Libav
Data Structures | Macros | Functions | Variables
network.h File Reference
#include <errno.h>
#include <stdint.h>
#include "config.h"
#include "libavutil/error.h"
#include "os_support.h"
#include "url.h"
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>

Go to the source code of this file.

Data Structures

struct  sockaddr_storage
 
struct  addrinfo
 

Macros

#define ff_neterrno()   AVERROR(errno)
 
#define EAI_AGAIN   2
 
#define EAI_BADFLAGS   3
 
#define EAI_FAIL   4
 
#define EAI_FAMILY   5
 
#define EAI_MEMORY   6
 
#define EAI_NODATA   7
 
#define EAI_NONAME   8
 
#define EAI_SERVICE   9
 
#define EAI_SOCKTYPE   10
 
#define AI_PASSIVE   1
 
#define AI_CANONNAME   2
 
#define AI_NUMERICHOST   4
 
#define NI_NOFQDN   1
 
#define NI_NUMERICHOST   2
 
#define NI_NAMERQD   4
 
#define NI_NUMERICSERV   8
 
#define NI_DGRAM   16
 
#define getaddrinfo   ff_getaddrinfo
 
#define freeaddrinfo   ff_freeaddrinfo
 
#define getnameinfo   ff_getnameinfo
 
#define gai_strerror   ff_gai_strerror
 
#define INADDR_LOOPBACK   0x7f000001
 
#define INET_ADDRSTRLEN   16
 
#define INET6_ADDRSTRLEN   INET_ADDRSTRLEN
 
#define IN_MULTICAST(a)   ((((uint32_t)(a)) & 0xf0000000) == 0xe0000000)
 
#define IN6_IS_ADDR_MULTICAST(a)   (((uint8_t *) (a))[0] == 0xff)
 
#define POLLING_TIME   100
 

Functions

int ff_socket_nonblock (int socket, int enable)
 
int ff_network_init (void)
 
void ff_network_close (void)
 
void ff_tls_init (void)
 
void ff_tls_deinit (void)
 
int ff_network_wait_fd (int fd, int write)
 
int ff_inet_aton (const char *str, struct in_addr *add)
 
int ff_getaddrinfo (const char *node, const char *service, const struct addrinfo *hints, struct addrinfo **res)
 
void ff_freeaddrinfo (struct addrinfo *res)
 
int ff_getnameinfo (const struct sockaddr *sa, int salen, char *host, int hostlen, char *serv, int servlen, int flags)
 
const char * ff_gai_strerror (int ecode)
 
int ff_is_multicast_address (struct sockaddr *addr)
 
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. More...
 
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. More...
 
int ff_http_match_no_proxy (const char *no_proxy, const char *hostname)
 
int ff_socket (int domain, int type, int protocol)
 

Variables

int ff_network_inited_globally
 

Macro Definition Documentation

§ ff_neterrno

#define ff_neterrno ( )    AVERROR(errno)

§ EAI_AGAIN

#define EAI_AGAIN   2

Definition at line 116 of file network.h.

§ EAI_BADFLAGS

#define EAI_BADFLAGS   3

Definition at line 119 of file network.h.

§ EAI_FAIL

#define EAI_FAIL   4

Definition at line 122 of file network.h.

§ EAI_FAMILY

#define EAI_FAMILY   5

Definition at line 125 of file network.h.

§ EAI_MEMORY

#define EAI_MEMORY   6

Definition at line 128 of file network.h.

§ EAI_NODATA

#define EAI_NODATA   7

Definition at line 131 of file network.h.

§ EAI_NONAME

#define EAI_NONAME   8

Definition at line 134 of file network.h.

§ EAI_SERVICE

#define EAI_SERVICE   9

Definition at line 137 of file network.h.

§ EAI_SOCKTYPE

#define EAI_SOCKTYPE   10

Definition at line 140 of file network.h.

§ AI_PASSIVE

#define AI_PASSIVE   1

Definition at line 144 of file network.h.

Referenced by tcp_open(), and udp_socket_create().

§ AI_CANONNAME

#define AI_CANONNAME   2

Definition at line 148 of file network.h.

§ AI_NUMERICHOST

#define AI_NUMERICHOST   4

Definition at line 152 of file network.h.

Referenced by ff_url_join(), get_sockaddr(), and tls_open().

§ NI_NOFQDN

#define NI_NOFQDN   1

Definition at line 156 of file network.h.

§ NI_NUMERICHOST

#define NI_NUMERICHOST   2

Definition at line 160 of file network.h.

Referenced by ff_rtsp_open_transport_ctx().

§ NI_NAMERQD

#define NI_NAMERQD   4

Definition at line 164 of file network.h.

§ NI_NUMERICSERV

#define NI_NUMERICSERV   8

Definition at line 168 of file network.h.

Referenced by udp_port().

§ NI_DGRAM

#define NI_DGRAM   16

Definition at line 172 of file network.h.

§ getaddrinfo

#define getaddrinfo   ff_getaddrinfo

§ freeaddrinfo

#define freeaddrinfo   ff_freeaddrinfo

§ getnameinfo

#define getnameinfo   ff_getnameinfo

Definition at line 184 of file network.h.

Referenced by ff_rtsp_open_transport_ctx(), and udp_port().

§ gai_strerror

#define gai_strerror   ff_gai_strerror

Definition at line 190 of file network.h.

Referenced by rtp_resolve_host(), sctp_open(), tcp_open(), udp_port(), and udp_resolve_host().

§ INADDR_LOOPBACK

#define INADDR_LOOPBACK   0x7f000001

Definition at line 194 of file network.h.

§ INET_ADDRSTRLEN

#define INET_ADDRSTRLEN   16

Definition at line 198 of file network.h.

§ INET6_ADDRSTRLEN

#define INET6_ADDRSTRLEN   INET_ADDRSTRLEN

Definition at line 202 of file network.h.

§ IN_MULTICAST

#define IN_MULTICAST (   a)    ((((uint32_t)(a)) & 0xf0000000) == 0xe0000000)

Definition at line 206 of file network.h.

Referenced by ff_is_multicast_address().

§ IN6_IS_ADDR_MULTICAST

#define IN6_IS_ADDR_MULTICAST (   a)    (((uint8_t *) (a))[0] == 0xff)

Definition at line 209 of file network.h.

Referenced by ff_is_multicast_address().

§ POLLING_TIME

#define POLLING_TIME   100

Definition at line 214 of file network.h.

Referenced by ff_poll_interrupt().

Function Documentation

§ ff_socket_nonblock()

int ff_socket_nonblock ( int  socket,
int  enable 
)

§ ff_network_init()

int ff_network_init ( void  )

§ ff_network_close()

void ff_network_close ( void  )

§ ff_tls_init()

void ff_tls_init ( void  )

Definition at line 66 of file network.c.

Referenced by avformat_network_init(), and tls_open().

§ ff_tls_deinit()

void ff_tls_deinit ( void  )

Definition at line 98 of file network.c.

Referenced by avformat_network_deinit(), tls_close(), and tls_open().

§ ff_network_wait_fd()

int ff_network_wait_fd ( int  fd,
int  write 
)

Definition at line 141 of file network.c.

Referenced by rtp_write(), tcp_read(), tcp_write(), udp_read(), udp_write(), unix_read(), and unix_write().

§ ff_inet_aton()

int ff_inet_aton ( const char *  str,
struct in_addr *  add 
)

§ ff_getaddrinfo()

int ff_getaddrinfo ( const char *  node,
const char *  service,
const struct addrinfo hints,
struct addrinfo **  res 
)

§ ff_freeaddrinfo()

void ff_freeaddrinfo ( struct addrinfo res)

§ ff_getnameinfo()

int ff_getnameinfo ( const struct sockaddr *  sa,
int  salen,
char *  host,
int  hostlen,
char *  serv,
int  servlen,
int  flags 
)

§ ff_gai_strerror()

const char* ff_gai_strerror ( int  ecode)

§ ff_is_multicast_address()

int ff_is_multicast_address ( struct sockaddr *  addr)

Definition at line 179 of file network.c.

Referenced by ff_udp_set_remote_url().

§ ff_listen_bind()

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.

Parameters
fdFirst argument of bind().
addrSecond argument of bind().
addrlenThird argument of bind().
timeoutPolling timeout in milliseconds.
hURLContext providing interrupt check callback and logging context.
Returns
A non-blocking file descriptor on success or an AVERROR on failure.

Definition at line 232 of file network.c.

Referenced by tcp_open(), and unix_open().

§ ff_listen_connect()

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.

Parameters
fdFirst argument of connect(), will be set as non-blocking.
addrSecond argument of connect().
addrlenThird argument of connect().
timeoutPolling timeout in milliseconds.
hURLContext providing interrupt check callback and logging context.
will_try_nextWhether the caller will try to connect to another address for the same host name, affecting the form of logged errors.
Returns
0 on success, AVERROR on failure.

Definition at line 261 of file network.c.

Referenced by tcp_open(), and unix_open().

§ ff_http_match_no_proxy()

int ff_http_match_no_proxy ( const char *  no_proxy,
const char *  hostname 
)

Definition at line 329 of file network.c.

Referenced by http_open_cnx_internal(), test(), and tls_open().

§ ff_socket()

int ff_socket ( int  domain,
int  type,
int  protocol 
)

Definition at line 214 of file network.c.

Referenced by sctp_open(), tcp_open(), udp_socket_create(), and unix_open().

Variable Documentation

§ ff_network_inited_globally

int ff_network_inited_globally

Definition at line 121 of file network.c.

Referenced by avformat_network_init().