This file defines interface to communicate with network plug-ins. More...

Go to the source code of this file.
Data Structures | |
| struct | virtual_socket_t |
Defines | |
| #define | net_errno errno |
| #define | net_Connect(a, b, c, d, e) net_Connect(VLC_OBJECT(a), b, c, d, e) |
| #define | net_ListenTCP(a, b, c) |
| #define | net_ConnectTCP(a, b, c) net_ConnectTCP(VLC_OBJECT(a), b, c) |
| #define | net_Accept(a, b) net_Accept(VLC_OBJECT(a), b) |
| #define | net_ConnectDgram(a, b, c, d, e) net_ConnectDgram(VLC_OBJECT(a), b, c, d, e) |
| #define | net_OpenDgram(a, b, c, d, e, g) net_OpenDgram(VLC_OBJECT(a), b, c, d, e, g) |
| #define | net_Read(a, b, c, d, e, f) net_Read(VLC_OBJECT(a),b,c,d,e,f) |
| #define | net_Write(a, b, c, d, e) net_Write(VLC_OBJECT(a),b,c,d,e) |
| #define | net_Gets(a, b, c) net_Gets(VLC_OBJECT(a),b,c) |
| #define | net_Printf(o, fd, vs,...) net_Printf(VLC_OBJECT(o),fd,vs, __VA_ARGS__) |
| #define | net_vaPrintf(a, b, c, d, e) net_vaPrintf(VLC_OBJECT(a),b,c,d,e) |
| #define | net_Close(fd) (void)close (fd) |
| #define | EAI_BADFLAGS -1 |
| #define | EAI_NONAME -2 |
| #define | EAI_AGAIN -3 |
| #define | EAI_FAIL -4 |
| #define | EAI_NODATA -5 |
| #define | EAI_FAMILY -6 |
| #define | EAI_SOCKTYPE -7 |
| #define | EAI_SERVICE -8 |
| #define | EAI_ADDRFAMILY -9 |
| #define | EAI_MEMORY -10 |
| #define | EAI_OVERFLOW -11 |
| #define | EAI_SYSTEM -12 |
| #define | NI_MAXHOST 1025 |
| #define | NI_MAXSERV 32 |
| #define | NI_MAXNUMERICHOST 64 |
| #define | AI_NUMERICSERV 0 |
Functions | |
| int | vlc_socket (int, int, int, bool nonblock) VLC_USED |
| Creates a socket file descriptor. | |
| VLC_API int | vlc_accept (int, struct sockaddr *, socklen_t *, bool) VLC_USED |
| Accepts an inbound connection request on a listening socket. | |
| int | net_Socket (vlc_object_t *obj, int family, int socktype, int proto) |
| VLC_API int | net_Connect (vlc_object_t *p_this, const char *psz_host, int i_port, int socktype, int protocol) |
| VLC_API int * | net_Listen (vlc_object_t *p_this, const char *psz_host, int i_port, int socktype, int protocol) |
| static int | net_ConnectTCP (vlc_object_t *obj, const char *host, int port) |
| VLC_API int | net_AcceptSingle (vlc_object_t *obj, int lfd) |
| VLC_API int | net_Accept (vlc_object_t *, int *) |
| Accepts an new connection on a set of listening sockets. | |
| VLC_API int | net_ConnectDgram (vlc_object_t *p_this, const char *psz_host, int i_port, int hlim, int proto) |
| static int | net_ConnectUDP (vlc_object_t *obj, const char *host, int port, int hlim) |
| VLC_API int | net_OpenDgram (vlc_object_t *p_this, const char *psz_bind, int i_bind, const char *psz_server, int i_server, int proto) |
| static int | net_ListenUDP1 (vlc_object_t *obj, const char *host, int port) |
| VLC_API void | net_ListenClose (int *fd) |
| int | net_Subscribe (vlc_object_t *obj, int fd, const struct sockaddr *addr, socklen_t addrlen) |
| VLC_API int | net_SetCSCov (int fd, int sendcov, int recvcov) |
| net_SetCSCov: Sets the send and receive checksum coverage of a socket: | |
| VLC_API ssize_t | net_Read (vlc_object_t *p_this, int fd, const v_socket_t *, void *p_data, size_t i_data, bool b_retry) |
| VLC_API ssize_t | net_Write (vlc_object_t *p_this, int fd, const v_socket_t *, const void *p_data, size_t i_data) |
| VLC_API char * | net_Gets (vlc_object_t *p_this, int fd, const v_socket_t *) |
| Reads a line from a file descriptor. | |
| VLC_API ssize_t | net_Printf (vlc_object_t *p_this, int fd, const v_socket_t *, const char *psz_fmt,...) VLC_FORMAT(4 |
| VLC_API ssize_t | net_vaPrintf (vlc_object_t *p_this, int fd, const v_socket_t *, const char *psz_fmt, va_list args) |
| VLC_API int | vlc_getnameinfo (const struct sockaddr *, int, char *, int, int *, int) |
| VLC_API int | vlc_getaddrinfo (vlc_object_t *, const char *, int, const struct addrinfo *, struct addrinfo **) |
| Resolves a host name to a list of socket addresses (like getaddrinfo()). | |
| static bool | net_SockAddrIsMulticast (const struct sockaddr *addr, socklen_t len) |
| static int | net_GetSockAddress (int fd, char *address, int *port) |
| static int | net_GetPeerAddress (int fd, char *address, int *port) |
| static uint16_t | net_GetPort (const struct sockaddr *addr) |
| static void | net_SetPort (struct sockaddr *addr, uint16_t port) |
This file defines interface to communicate with network plug-ins.
| #define AI_NUMERICSERV 0 |
Referenced by vlc_getaddrinfo().
| #define EAI_ADDRFAMILY -9 |
| #define EAI_AGAIN -3 |
| #define EAI_BADFLAGS -1 |
Referenced by vlc_getaddrinfo().
| #define EAI_FAIL -4 |
| #define EAI_FAMILY -6 |
| #define EAI_MEMORY -10 |
| #define EAI_NODATA -5 |
| #define EAI_NONAME -2 |
| #define EAI_OVERFLOW -11 |
| #define EAI_SERVICE -8 |
| #define EAI_SOCKTYPE -7 |
| #define EAI_SYSTEM -12 |
| #define net_Accept | ( | a, | ||
| b | ||||
| ) | net_Accept(VLC_OBJECT(a), b) |
| #define net_Close | ( | fd | ) | (void)close (fd) |
| #define net_Connect | ( | a, | ||
| b, | ||||
| c, | ||||
| d, | ||||
| e | ||||
| ) | net_Connect(VLC_OBJECT(a), b, c, d, e) |
Referenced by net_ConnectTCP().
| #define net_ConnectDgram | ( | a, | ||
| b, | ||||
| c, | ||||
| d, | ||||
| e | ||||
| ) | net_ConnectDgram(VLC_OBJECT(a), b, c, d, e) |
Referenced by net_ConnectUDP(), and net_SetDSCP().
| #define net_ConnectTCP | ( | a, | ||
| b, | ||||
| c | ||||
| ) | net_ConnectTCP(VLC_OBJECT(a), b, c) |
| #define net_errno errno |
Referenced by net_Accept(), net_AcceptSingle(), net_Connect(), and net_Socket().
| #define net_Gets | ( | a, | ||
| b, | ||||
| c | ||||
| ) | net_Gets(VLC_OBJECT(a),b,c) |
| #define net_ListenTCP | ( | a, | ||
| b, | ||||
| c | ||||
| ) |
net_Listen(VLC_OBJECT(a), b, c, \ SOCK_STREAM, IPPROTO_TCP)
Referenced by httpd_HostCreate().
| #define net_OpenDgram | ( | a, | ||
| b, | ||||
| c, | ||||
| d, | ||||
| e, | ||||
| g | ||||
| ) | net_OpenDgram(VLC_OBJECT(a), b, c, d, e, g) |
Referenced by net_ListenUDP1().
| #define net_Printf | ( | o, | ||
| fd, | ||||
| vs, | ||||
| ... | ||||
| ) | net_Printf(VLC_OBJECT(o),fd,vs, __VA_ARGS__) |
| #define net_Read | ( | a, | ||
| b, | ||||
| c, | ||||
| d, | ||||
| e, | ||||
| f | ||||
| ) | net_Read(VLC_OBJECT(a),b,c,d,e,f) |
Referenced by net_Gets(), net_Listen(), SocksHandshakeTCP(), and SocksNegotiate().
| #define net_vaPrintf | ( | a, | ||
| b, | ||||
| c, | ||||
| d, | ||||
| e | ||||
| ) | net_vaPrintf(VLC_OBJECT(a),b,c,d,e) |
Referenced by net_Printf().
| #define net_Write | ( | a, | ||
| b, | ||||
| c, | ||||
| d, | ||||
| e | ||||
| ) | net_Write(VLC_OBJECT(a),b,c,d,e) |
Referenced by net_vaPrintf(), SocksHandshakeTCP(), and SocksNegotiate().
| #define NI_MAXHOST 1025 |
| #define NI_MAXNUMERICHOST 64 |
Referenced by net_GetPeerAddress(), and net_GetSockAddress().
| #define NI_MAXSERV 32 |
| VLC_API int net_Accept | ( | vlc_object_t * | p_this, | |
| int * | pi_fd | |||
| ) |
Accepts an new connection on a set of listening sockets.
If there are no pending connections, this function will wait.
| p_this | VLC object for logging and object kill signal | |
| pi_fd | listening socket set |
References pollfd::events, pollfd::fd, msg_Err, net_AcceptSingle(), net_errno, poll(), pollfd::revents, and vlc_object_waitpipe().
| VLC_API int net_AcceptSingle | ( | vlc_object_t * | obj, | |
| int | lfd | |||
| ) |
References pollfd::fd, msg_Dbg, msg_Err, net_errno, and vlc_accept().
Referenced by net_Accept().
| VLC_API int net_Connect | ( | vlc_object_t * | p_this, | |
| const char * | psz_host, | |||
| int | i_port, | |||
| int | socktype, | |||
| int | protocol | |||
| ) |
| VLC_API int net_ConnectDgram | ( | vlc_object_t * | p_this, | |
| const char * | psz_host, | |||
| int | i_port, | |||
| int | hlim, | |||
| int | proto | |||
| ) |
| static int net_ConnectTCP | ( | vlc_object_t * | obj, | |
| const char * | host, | |||
| int | port | |||
| ) | [inline, static] |
References net_Connect.
| static int net_ConnectUDP | ( | vlc_object_t * | obj, | |
| const char * | host, | |||
| int | port, | |||
| int | hlim | |||
| ) | [inline, static] |
References net_ConnectDgram.
Referenced by AddressCreate().
| static int net_GetPeerAddress | ( | int | fd, | |
| char * | address, | |||
| int * | port | |||
| ) | [inline, static] |
References NI_MAXNUMERICHOST, VLC_EGENERIC, and vlc_getnameinfo().
Referenced by httpd_ClientIP().
| static uint16_t net_GetPort | ( | const struct sockaddr * | addr | ) | [inline, static] |
| VLC_API char* net_Gets | ( | vlc_object_t * | p_this, | |
| int | fd, | |||
| const v_socket_t * | p_vs | |||
| ) |
Reads a line from a file descriptor.
This function is not thread-safe; the same file descriptor I/O cannot be read by another thread at the same time (although it can be written to).
References net_Read, and xrealloc().
| static int net_GetSockAddress | ( | int | fd, | |
| char * | address, | |||
| int * | port | |||
| ) | [inline, static] |
References NI_MAXNUMERICHOST, VLC_EGENERIC, and vlc_getnameinfo().
Referenced by httpd_ServerIP().
| VLC_API int* net_Listen | ( | vlc_object_t * | p_this, | |
| const char * | psz_host, | |||
| int | i_port, | |||
| int | socktype, | |||
| int | protocol | |||
| ) |
References freeaddrinfo(), gai_strerror(), msg_Dbg, msg_Err, net_Close, net_Read, net_SockAddrIsMulticast(), net_Socket(), net_Subscribe(), rootwrap_bind(), and vlc_getaddrinfo().
| VLC_API void net_ListenClose | ( | int * | fd | ) |
References net_Close.
Referenced by httpd_HostCreate(), and httpd_HostDelete().
| static int net_ListenUDP1 | ( | vlc_object_t * | obj, | |
| const char * | host, | |||
| int | port | |||
| ) | [inline, static] |
References net_OpenDgram.
| VLC_API int net_OpenDgram | ( | vlc_object_t * | p_this, | |
| const char * | psz_bind, | |||
| int | i_bind, | |||
| const char * | psz_server, | |||
| int | i_server, | |||
| int | proto | |||
| ) |
| VLC_API ssize_t net_Printf | ( | vlc_object_t * | p_this, | |
| int | fd, | |||
| const v_socket_t * | , | |||
| const char * | psz_fmt, | |||
| ... | ||||
| ) |
| VLC_API ssize_t net_Read | ( | vlc_object_t * | p_this, | |
| int | fd, | |||
| const v_socket_t * | , | |||
| void * | p_data, | |||
| size_t | i_data, | |||
| bool | b_retry | |||
| ) |
| VLC_API int net_SetCSCov | ( | int | fd, | |
| int | sendcov, | |||
| int | recvcov | |||
| ) |
net_SetCSCov: Sets the send and receive checksum coverage of a socket:
| fd | socket | |
| sendcov | payload coverage of sent packets (bytes), -1 for full | |
| recvcov | minimum payload coverage of received packets, -1 for full |
References SOL_DCCP, SOL_UDPLITE, VLC_EGENERIC, and VLC_UNUSED.
| static void net_SetPort | ( | struct sockaddr * | addr, | |
| uint16_t | port | |||
| ) | [inline, static] |
| static bool net_SockAddrIsMulticast | ( | const struct sockaddr * | addr, | |
| socklen_t | len | |||
| ) | [inline, static] |
Referenced by AddressToSDP(), net_Listen(), net_ListenSingle(), net_OpenDgram(), and net_SetupDgramSocket().
| int net_Socket | ( | vlc_object_t * | obj, | |
| int | family, | |||
| int | socktype, | |||
| int | proto | |||
| ) |
References pollfd::fd, IPPROTO_IPV6, msg_Err, net_errno, SOL_DCCP, var_InheritString, and vlc_socket().
Referenced by net_Connect(), net_ConnectDgram(), net_Listen(), net_ListenSingle(), and net_OpenDgram().
| int net_Subscribe | ( | vlc_object_t * | obj, | |
| int | fd, | |||
| const struct sockaddr * | addr, | |||
| socklen_t | addrlen | |||
| ) |
References msg_Err, SOL_IP, SOL_IPV6, and var_GetIfIndex().
Referenced by net_Listen(), net_ListenSingle(), and net_SourceSubscribe().
| VLC_API ssize_t net_vaPrintf | ( | vlc_object_t * | p_this, | |
| int | fd, | |||
| const v_socket_t * | , | |||
| const char * | psz_fmt, | |||
| va_list | args | |||
| ) |
References net_Write, and vasprintf().
| VLC_API ssize_t net_Write | ( | vlc_object_t * | p_this, | |
| int | fd, | |||
| const v_socket_t * | , | |||
| const void * | p_data, | |||
| size_t | i_data | |||
| ) |
| VLC_API int vlc_accept | ( | int | lfd, | |
| struct sockaddr * | addr, | |||
| socklen_t * | alen, | |||
| bool | nonblock | |||
| ) |
Accepts an inbound connection request on a listening socket.
The new file descriptor has the close-on-exec flag set.
| lfd | listening socket file descriptor | |
| addr | pointer to the peer address or NULL [OUT] | |
| alen | pointer to the length of the peer address or NULL [OUT] | |
| nonblock | whether to put the new socket in non-blocking mode |
Referenced by httpd_HostThread(), and net_AcceptSingle().
| VLC_API int vlc_getaddrinfo | ( | vlc_object_t * | p_this, | |
| const char * | node, | |||
| int | i_port, | |||
| const struct addrinfo * | p_hints, | |||
| struct addrinfo ** | res | |||
| ) |
Resolves a host name to a list of socket addresses (like getaddrinfo()).
| p_this | a VLC object | |
| node | host name to resolve (encoded as UTF-8), or NULL | |
| i_port | port number for the socket addresses | |
| p_hints | parameters (see getaddrinfo() manual page) | |
| res | pointer set to the resulting chained list. |
References AI_NUMERICSERV, EAI_BADFLAGS, getaddrinfo(), and msg_Err.
Referenced by net_Connect(), net_ConnectDgram(), net_Listen(), net_ListenSingle(), net_OpenDgram(), SocksHandshakeTCP(), and sout_AnnounceRegisterSDP().
| VLC_API int vlc_getnameinfo | ( | const struct sockaddr * | , | |
| int | , | |||
| char * | , | |||
| int | , | |||
| int * | , | |||
| int | ||||
| ) |
References getnameinfo().
Referenced by AddressToSDP(), net_GetPeerAddress(), net_GetSockAddress(), and SAP_Add().
| int vlc_socket | ( | int | pf, | |
| int | type, | |||
| int | proto, | |||
| bool | nonblock | |||
| ) |
Creates a socket file descriptor.
The new file descriptor has the close-on-exec flag set.
| pf | protocol family | |
| type | socket type | |
| proto | network protocol | |
| nonblock | true to create a non-blocking socket |
Referenced by net_Socket().
1.7.1