Go to the documentation of this file.
21 #ifndef AVFORMAT_NETWORK_H
22 #define AVFORMAT_NETWORK_H
41 #ifndef EPROTONOSUPPORT
42 #define EPROTONOSUPPORT WSAEPROTONOSUPPORT
45 #define ETIMEDOUT WSAETIMEDOUT
48 #define ECONNREFUSED WSAECONNREFUSED
51 #define EINPROGRESS WSAEINPROGRESS
54 #define ENOTCONN WSAENOTCONN
57 #define getsockopt(a, b, c, d, e) getsockopt(a, b, c, (char*) d, e)
58 #define setsockopt(a, b, c, d, e) setsockopt(a, b, c, (const char*) d, e)
62 #include <sys/types.h>
63 #include <sys/socket.h>
64 #include <netinet/in.h>
65 #include <netinet/tcp.h>
68 #define ff_neterrno() AVERROR(errno)
72 #include <arpa/inet.h>
110 #if !HAVE_STRUCT_SOCKADDR_STORAGE
112 #if HAVE_STRUCT_SOCKADDR_SA_LEN
126 struct sockaddr_in
in;
127 #if HAVE_STRUCT_SOCKADDR_IN6
128 struct sockaddr_in6 in6;
133 #define MSG_NOSIGNAL 0
136 #if !HAVE_STRUCT_ADDRINFO
154 #define EAI_BADFLAGS 3
172 #define EAI_SERVICE 9
175 #define EAI_SOCKTYPE 10
183 #define AI_CANONNAME 2
186 #ifndef AI_NUMERICHOST
187 #define AI_NUMERICHOST 4
194 #ifndef NI_NUMERICHOST
195 #define NI_NUMERICHOST 2
202 #ifndef NI_NUMERICSERV
203 #define NI_NUMERICSERV 8
210 #if !HAVE_GETADDRINFO
215 char *host,
int hostlen,
216 char *serv,
int servlen,
int flags);
217 #define getaddrinfo ff_getaddrinfo
218 #define freeaddrinfo ff_freeaddrinfo
219 #define getnameinfo ff_getnameinfo
222 #if !HAVE_GETADDRINFO || HAVE_WINSOCK2_H
225 #define gai_strerror ff_gai_strerror
228 #ifndef INADDR_LOOPBACK
229 #define INADDR_LOOPBACK 0x7f000001
232 #ifndef INET_ADDRSTRLEN
233 #define INET_ADDRSTRLEN 16
236 #ifndef INET6_ADDRSTRLEN
237 #define INET6_ADDRSTRLEN INET_ADDRSTRLEN
241 #define IN_MULTICAST(a) ((((uint32_t)(a)) & 0xf0000000) == 0xe0000000)
243 #ifndef IN6_IS_ADDR_MULTICAST
244 #define IN6_IS_ADDR_MULTICAST(a) (((uint8_t *) (a))[0] == 0xff)
249 #define POLLING_TIME 100
264 socklen_t addrlen,
int timeout,
274 int ff_listen(
int fd,
const struct sockaddr *addr, socklen_t addrlen);
303 socklen_t addrlen,
int timeout,
338 void (*
customize_fd)(
void *,
int),
void *customize_ctx);
int ff_getaddrinfo(const char *node, const char *service, const struct addrinfo *hints, struct addrinfo **res)
int ff_network_sleep_interruptible(int64_t timeout, AVIOInterruptCB *int_cb)
Waits for up to 'timeout' microseconds.
int ff_http_match_no_proxy(const char *no_proxy, const char *hostname)
Callback for checking whether to abort blocking functions.
int ff_network_wait_fd(int fd, int write)
int ff_getnameinfo(const struct sockaddr *sa, int salen, char *host, int hostlen, char *serv, int servlen, int flags)
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...
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf type
int ff_connect_parallel(struct addrinfo *addrs, int timeout_ms_per_address, int parallel, URLContext *h, int *fd, void(*customize_fd)(void *, int), void *customize_ctx)
Connect to any of the given addrinfo addresses, with multiple attempts running in parallel.
void ff_freeaddrinfo(struct addrinfo *res)
void ff_network_close(void)
struct sockaddr_storage storage
const char * ff_gai_strerror(int ecode)
struct sockaddr * ai_addr
void ff_log_net_error(void *ctx, int level, const char *prefix)
int ff_socket_nonblock(int socket, int enable)
struct addrinfo * ai_next
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_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.
const AVIOInterruptCB int_cb
int ff_listen(int fd, const struct sockaddr *addr, socklen_t addrlen)
Bind to a file descriptor to an address without accepting connections.
int ff_accept(int fd, int timeout, URLContext *h)
Poll for a single connection on the passed file descriptor.
int ff_network_init(void)
#define flags(name, subs,...)
static void customize_fd(void *ctx, int fd)
int ff_socket(int domain, int type, int protocol)