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)
63#include <sys/socket.h>
64#include <netinet/in.h>
65#include <netinet/tcp.h>
68#define ff_neterrno() AVERROR(errno)
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
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
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,
274int ff_listen(
int fd,
const struct sockaddr *addr, socklen_t addrlen,
304 socklen_t addrlen,
int timeout,
309int ff_socket(
int domain,
int type,
int protocol,
void *logctx);
339 int (*
customize_fd)(
void *,
int,
int),
void *customize_ctx);
#define flags(name, subs,...)
const AVIOInterruptCB int_cb
int ff_connect_parallel(struct addrinfo *addrs, int timeout_ms_per_address, int parallel, URLContext *h, int *fd, int(*customize_fd)(void *, int, int), void *customize_ctx)
Connect to any of the given addrinfo addresses, with multiple attempts running in parallel.
int ff_is_multicast_address(struct sockaddr *addr)
int ff_socket_nonblock(int socket, int enable)
int ff_socket(int domain, int type, int protocol, void *logctx)
int ff_network_sleep_interruptible(int64_t timeout, AVIOInterruptCB *int_cb)
Waits for up to 'timeout' microseconds.
int ff_getaddrinfo(const char *node, const char *service, const struct addrinfo *hints, struct addrinfo **res)
int ff_listen(int fd, const struct sockaddr *addr, socklen_t addrlen, void *logctx)
Bind to a file descriptor to an address without accepting connections.
void ff_log_net_error(void *ctx, int level, const char *prefix)
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.
void ff_freeaddrinfo(struct addrinfo *res)
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_getnameinfo(const struct sockaddr *sa, int salen, char *host, int hostlen, char *serv, int servlen, int flags)
int ff_network_wait_fd(int fd, int write)
int ff_network_init(void)
Initialize the network subsystem.
int ff_udp_set_remote_addr(URLContext *h, const struct sockaddr *dest_addr, socklen_t dest_addr_len, int do_connect)
This function is identical to ff_udp_set_remote_url, except that it takes a sockaddr directly.
void ff_udp_get_last_recv_addr(URLContext *h, struct sockaddr_storage *addr, socklen_t *addr_len)
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_network_close(void)
int ff_http_match_no_proxy(const char *no_proxy, const char *hostname)
int ff_accept(int fd, int timeout, URLContext *h)
Poll for a single connection on the passed file descriptor.
const char * ff_gai_strerror(int ecode)
miscellaneous OS support macros and functions.
Callback for checking whether to abort blocking functions.
struct sockaddr * ai_addr
struct addrinfo * ai_next
static int customize_fd(void *ctx, int fd, int family)
static AVFormatContext * ctx
struct sockaddr_storage storage
unbuffered private I/O API