21 #ifndef AVFORMAT_NETWORK_H
22 #define AVFORMAT_NETWORK_H
28 #include "libavutil/error.h"
41 #ifndef EPROTONOSUPPORT
42 #define EPROTONOSUPPORT WSAEPROTONOSUPPORT
45 #define ETIMEDOUT WSAETIMEDOUT
48 #define ECONNREFUSED WSAECONNREFUSED
51 #define EINPROGRESS WSAEINPROGRESS
54 #define getsockopt(a, b, c, d, e) getsockopt(a, b, c, (char*) d, e)
55 #define setsockopt(a, b, c, d, e) setsockopt(a, b, c, (const char*) d, e)
59 #include <sys/types.h>
60 #include <sys/socket.h>
61 #include <netinet/in.h>
64 #define ff_neterrno() AVERROR(errno)
68 #include <arpa/inet.h>
98 int ff_inet_aton (
const char * str,
struct in_addr * add);
100 #if !HAVE_STRUCT_SOCKADDR_STORAGE
102 #if HAVE_STRUCT_SOCKADDR_SA_LEN
114 #if !HAVE_STRUCT_ADDRINFO
132 #define EAI_BADFLAGS 3
150 #define EAI_SERVICE 9
153 #define EAI_SOCKTYPE 10
161 #define AI_CANONNAME 2
164 #ifndef AI_NUMERICHOST
165 #define AI_NUMERICHOST 4
172 #ifndef NI_NUMERICHOST
173 #define NI_NUMERICHOST 2
180 #ifndef NI_NUMERICSERV
181 #define NI_NUMERICSERV 8
188 #if !HAVE_GETADDRINFO
193 char *host,
int hostlen,
194 char *serv,
int servlen,
int flags);
195 #define getaddrinfo ff_getaddrinfo
196 #define freeaddrinfo ff_freeaddrinfo
197 #define getnameinfo ff_getnameinfo
199 #if !HAVE_GETADDRINFO || HAVE_WINSOCK2_H
202 #define gai_strerror ff_gai_strerror
205 #ifndef INADDR_LOOPBACK
206 #define INADDR_LOOPBACK 0x7f000001
209 #ifndef INET_ADDRSTRLEN
210 #define INET_ADDRSTRLEN 16
213 #ifndef INET6_ADDRSTRLEN
214 #define INET6_ADDRSTRLEN INET_ADDRSTRLEN
218 #define IN_MULTICAST(a) ((((uint32_t)(a)) & 0xf0000000) == 0xe0000000)
220 #ifndef IN6_IS_ADDR_MULTICAST
221 #define IN6_IS_ADDR_MULTICAST(a) (((uint8_t *) (a))[0] == 0xff)
226 #define POLLING_TIME 100
241 socklen_t addrlen,
int timeout,
260 socklen_t addrlen,
int timeout,
void ff_network_close(void)
int ff_getnameinfo(const struct sockaddr *sa, int salen, char *host, int hostlen, char *serv, int servlen, int flags)
int ff_socket(int af, int type, int proto)
int ff_network_inited_globally
int ff_listen_bind(int fd, const struct sockaddr *addr, socklen_t addrlen, int timeout, URLContext *h)
Bind to a file descriptor and poll for a connection.
int ff_network_init(void)
miscellaneous OS support macros and functions.
int ff_listen_connect(int fd, const struct sockaddr *addr, socklen_t addrlen, int timeout, URLContext *h, int will_try_next)
Connect to a file descriptor and poll for result.
Callback for checking whether to abort blocking functions.
const AVIOInterruptCB int_cb
const char * ff_gai_strerror(int ecode)
int ff_is_multicast_address(struct sockaddr *addr)
int ff_network_wait_fd_timeout(int fd, int write, int64_t timeout, AVIOInterruptCB *int_cb)
This works similarly to ff_network_wait_fd, but waits up to 'timeout' microseconds Uses ff_network_wa...
void ff_freeaddrinfo(struct addrinfo *res)
int ff_inet_aton(const char *str, struct in_addr *add)
int ff_http_match_no_proxy(const char *no_proxy, const char *hostname)
int ff_socket_nonblock(int socket, int enable)
struct addrinfo * ai_next
int ff_getaddrinfo(const char *node, const char *service, const struct addrinfo *hints, struct addrinfo **res)
int ff_network_wait_fd(int fd, int write)
unbuffered private I/O API
struct sockaddr * ai_addr