|
#define | net_errno errno |
|
#define | net_Close(fd) ((void)vlc_close(fd)) |
|
#define | MSG_NOSIGNAL 0 |
|
#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) net_Read(VLC_OBJECT(a),b,c,d) |
|
#define | net_Write(a, b, c, d) net_Write(VLC_OBJECT(a),b,c,d) |
|
#define | net_Gets(a, b) net_Gets(VLC_OBJECT(a),b) |
|
#define | net_Printf(o, fd, ...) net_Printf(VLC_OBJECT(o),fd, __VA_ARGS__) |
|
#define | net_vaPrintf(a, b, c, d) net_vaPrintf(VLC_OBJECT(a),b,c,d) |
|
|
int | vlc_socket (int pf, int type, int proto, bool nonblock) |
| Creates a socket file descriptor. More...
|
|
int | vlc_socketpair (int pf, int type, int proto, int fds[2], bool nonblock) |
| Creates a pair of socket file descriptors. More...
|
|
int | vlc_accept (int lfd, struct sockaddr *addr, socklen_t *alen, bool nonblock) |
| Accepts an inbound connection request on a listening socket. More...
|
|
int | net_Socket (vlc_object_t *obj, int family, int socktype, int proto) |
|
int | net_Connect (vlc_object_t *p_this, const char *psz_host, int i_port, int socktype, int protocol) |
|
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) |
|
int | net_AcceptSingle (vlc_object_t *obj, int lfd) |
|
int | net_Accept (vlc_object_t *, int *) |
| Accepts an new connection on a set of listening sockets. More...
|
|
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) |
|
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) |
|
void | net_ListenClose (int *fd) |
|
int | net_Subscribe (vlc_object_t *obj, int fd, const struct sockaddr *addr, socklen_t addrlen) |
|
int | net_SetCSCov (int fd, int sendcov, int recvcov) |
| net_SetCSCov: Sets the send and receive checksum coverage of a socket: More...
|
|
ssize_t | net_Read (vlc_object_t *p_this, int fd, void *p_data, size_t i_data) |
|
ssize_t | net_Write (vlc_object_t *p_this, int fd, const void *p_data, size_t i_data) |
| Writes data to a socket. More...
|
|
char * | net_Gets (vlc_object_t *p_this, int fd) |
| Reads a line from a file descriptor. More...
|
|
ssize_t | net_Printf (vlc_object_t *p_this, int fd, const char *psz_fmt,...) |
|
ssize_t | net_vaPrintf (vlc_object_t *p_this, int fd, const char *psz_fmt, va_list args) |
|
int | vlc_close (int) |
| Closes a file descriptor. More...
|
|
Accepts an new connection on a set of listening sockets.
If there are no pending connections, this function will wait.
- Note
- If the thread needs to handle events other than incoming connections, you need to use poll() and net_AcceptSingle() instead.
- Parameters
-
p_this | VLC object for logging and object kill signal |
pi_fd | listening socket set |
- Returns
- -1 on error (may be transient error due to network issues), a new socket descriptor on success.
References pollfd::events, pollfd::fd, msg_Err, net_AcceptSingle(), net_errno, poll(), POLLIN, pollfd::revents, and vlc_strerror_c().
int vlc_accept |
( |
int |
lfd, |
|
|
struct sockaddr * |
addr, |
|
|
socklen_t * |
alen, |
|
|
bool |
nonblock |
|
) |
| |
Accepts an inbound connection request on a listening socket.
This function creates a connected socket from a listening socket, much like the standard accept() function. However, the new file descriptor has the close-on-exec flag set atomically. See also vlc_socket().
- Parameters
-
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 |
- Returns
- a new file descriptor or -1 on error
References vlc_socket_setup().
Referenced by vlc_accept_i11e().
Closes a file descriptor.
This closes a file descriptor. If this is a last file descriptor for the underlying open file, the file is closed too; the exact semantics depend on the type of file.
- Note
- The file descriptor is always closed when the function returns, even if the function returns an error. The sole exception is if the file descriptor was not currently valid, and thus cannot be closed (errno will then be set to EBADF).
- Parameters
-
- Returns
- Normally, zero is returned. If an I/O error is detected before or while closing, the function may return -1. Such an error is unrecoverable since the descriptor is closed.
A nul return value does not necessarily imply that all pending I/O succeeded, since I/O might still occur asynchronously afterwards.
References unlikely.
Referenced by block_FilePath(), config_SaveConfigFile(), vlc_fopen(), vlc_getProxyUrl(), vlc_poll_i11e_cleanup(), vlc_poll_i11e_inner(), and vlc_rand_init().
int vlc_socket |
( |
int |
pf, |
|
|
int |
type, |
|
|
int |
proto, |
|
|
bool |
nonblock |
|
) |
| |
Creates a socket file descriptor.
This function creates a socket, similar to the standard socket() function. However, the new file descriptor has the close-on-exec flag set atomically, so as to avoid leaking the descriptor to child processes.
The non-blocking flag can also optionally be set.
- Parameters
-
pf | protocol family |
type | socket type |
proto | network protocol |
nonblock | true to create a non-blocking socket |
- Returns
- a new file descriptor or -1 on error
References vlc_socket_setup().
Referenced by vlc_tls_SocketAddrInfo().
int vlc_socketpair |
( |
int |
pf, |
|
|
int |
type, |
|
|
int |
proto, |
|
|
int |
fds[2], |
|
|
bool |
nonblock |
|
) |
| |
Creates a pair of socket file descriptors.
This function creates a pair of sockets that are mutually connected, much like the standard socketpair() function. However, the new file descriptors have the close-on-exec flag set atomically. See also vlc_socket().
- Parameters
-
pf | protocol family |
type | socket type |
proto | network protocol |
nonblock | true to create non-blocking sockets |
- Return values
-
References vlc_socket_setup().
Referenced by vlc_pipe(), and vlc_tls_SocketPair().