VLC  3.0.15
Data Structures | Macros | Typedefs | Functions
tls.c File Reference
Include dependency graph for tls.c:

Data Structures

struct  vlc_tls_socket
 

Macros

#define SOL_TCP   IPPROTO_TCP
 

Typedefs

typedef struct vlc_tls_socket vlc_tls_socket_t
 

Functions

static int tls_server_load (void *func, va_list ap)
 
static int tls_client_load (void *func, va_list ap)
 
static void tls_unload (void *func, va_list ap)
 
vlc_tls_creds_tvlc_tls_ServerCreate (vlc_object_t *obj, const char *cert_path, const char *key_path)
 Allocates server TLS credentials. More...
 
vlc_tls_creds_tvlc_tls_ClientCreate (vlc_object_t *obj)
 Allocates TLS credentials for a client. More...
 
void vlc_tls_Delete (vlc_tls_creds_t *crd)
 Releases TLS credentials. More...
 
static vlc_tls_tvlc_tls_SessionCreate (vlc_tls_creds_t *crd, vlc_tls_t *sock, const char *host, const char *const *alpn)
 
void vlc_tls_SessionDelete (vlc_tls_t *session)
 Destroys a TLS session down. More...
 
static void cleanup_tls (void *data)
 
vlc_tls_tvlc_tls_ClientSessionCreate (vlc_tls_creds_t *crd, vlc_tls_t *sock, const char *host, const char *service, const char *const *alpn, char **alp)
 Initiates a client TLS session. More...
 
vlc_tls_tvlc_tls_ServerSessionCreate (vlc_tls_creds_t *crd, vlc_tls_t *sock, const char *const *alpn)
 Creates a TLS server session. More...
 
ssize_t vlc_tls_Read (vlc_tls_t *session, void *buf, size_t len, bool waitall)
 Receives data through a socket. More...
 
ssize_t vlc_tls_Write (vlc_tls_t *session, const void *buf, size_t len)
 Sends data through a socket. More...
 
char * vlc_tls_GetLine (vlc_tls_t *session)
 Receives a text line through a socket. More...
 
static int vlc_tls_SocketGetFD (vlc_tls_t *tls)
 
static ssize_t vlc_tls_SocketRead (vlc_tls_t *tls, struct iovec *iov, unsigned count)
 
static ssize_t vlc_tls_SocketWrite (vlc_tls_t *tls, const struct iovec *iov, unsigned count)
 
static int vlc_tls_SocketShutdown (vlc_tls_t *tls, bool duplex)
 
static void vlc_tls_SocketClose (vlc_tls_t *tls)
 
static vlc_tls_tvlc_tls_SocketAlloc (int fd, const struct sockaddr *restrict peer, socklen_t peerlen)
 
vlc_tls_tvlc_tls_SocketOpen (int fd)
 Creates a transport-layer stream from a socket. More...
 
int vlc_tls_SocketPair (int family, int protocol, vlc_tls_t *pair[2])
 Creates a connected pair of transport-layer sockets. More...
 
static vlc_tls_tvlc_tls_SocketAddrInfo (const struct addrinfo *restrict info)
 Allocates an unconnected transport layer socket. More...
 
static int vlc_tls_WaitConnect (vlc_tls_t *tls)
 Waits for pending transport layer socket connection. More...
 
static ssize_t vlc_tls_Connect (vlc_tls_t *tls)
 Connects a transport layer socket. More...
 
static ssize_t vlc_tls_ConnectWrite (vlc_tls_t *tls, const struct iovec *iov, unsigned count)
 
vlc_tls_tvlc_tls_SocketOpenAddrInfo (const struct addrinfo *restrict info, bool defer_connect)
 
vlc_tls_tvlc_tls_SocketOpenTCP (vlc_object_t *obj, const char *name, unsigned port)
 Creates a transport-layer TCP stream from a name and port. More...
 
vlc_tls_tvlc_tls_SocketOpenTLS (vlc_tls_creds_t *creds, const char *name, unsigned port, const char *service, const char *const *alpn, char **alp)
 Initiates a TLS session over TCP. More...
 

Detailed Description

Transport Layer Socket abstraction.

This file implements the Transport Layer Socket (vlc_tls) abstraction.

Macro Definition Documentation

◆ SOL_TCP

#define SOL_TCP   IPPROTO_TCP

Typedef Documentation

◆ vlc_tls_socket_t

Function Documentation

◆ cleanup_tls()

static void cleanup_tls ( void *  data)
static

◆ tls_client_load()

static int tls_client_load ( void *  func,
va_list  ap 
)
static

Referenced by vlc_tls_ClientCreate().

◆ tls_server_load()

static int tls_server_load ( void *  func,
va_list  ap 
)
static

Referenced by vlc_tls_ServerCreate().

◆ tls_unload()

static void tls_unload ( void *  func,
va_list  ap 
)
static

Referenced by vlc_tls_Delete().

◆ vlc_tls_Connect()

static ssize_t vlc_tls_Connect ( vlc_tls_t tls)
static

◆ vlc_tls_ConnectWrite()

static ssize_t vlc_tls_ConnectWrite ( vlc_tls_t tls,
const struct iovec *  iov,
unsigned  count 
)
static

◆ vlc_tls_SessionCreate()

static vlc_tls_t* vlc_tls_SessionCreate ( vlc_tls_creds_t crd,
vlc_tls_t sock,
const char *  host,
const char *const *  alpn 
)
static

◆ vlc_tls_SocketAddrInfo()

static vlc_tls_t* vlc_tls_SocketAddrInfo ( const struct addrinfo *restrict  info)
static

Allocates an unconnected transport layer socket.

References net_Close, SOL_TCP, unlikely, vlc_socket(), and vlc_tls_SocketAlloc().

Referenced by vlc_tls_SocketOpenAddrInfo().

◆ vlc_tls_SocketAlloc()

static vlc_tls_t* vlc_tls_SocketAlloc ( int  fd,
const struct sockaddr *restrict  peer,
socklen_t  peerlen 
)
static

◆ vlc_tls_SocketClose()

static void vlc_tls_SocketClose ( vlc_tls_t tls)
static

References net_Close, and vlc_tls_SocketGetFD().

Referenced by vlc_tls_SocketAlloc().

◆ vlc_tls_SocketGetFD()

static int vlc_tls_SocketGetFD ( vlc_tls_t tls)
static

◆ vlc_tls_SocketOpenAddrInfo()

vlc_tls_t* vlc_tls_SocketOpenAddrInfo ( const struct addrinfo *restrict  info,
bool  defer_connect 
)

◆ vlc_tls_SocketRead()

static ssize_t vlc_tls_SocketRead ( vlc_tls_t tls,
struct iovec *  iov,
unsigned  count 
)
static

References count, recvmsg(), and vlc_tls_SocketGetFD().

Referenced by vlc_tls_SocketAlloc().

◆ vlc_tls_SocketShutdown()

static int vlc_tls_SocketShutdown ( vlc_tls_t tls,
bool  duplex 
)
static

References vlc_tls_SocketGetFD().

Referenced by vlc_tls_SocketAlloc().

◆ vlc_tls_SocketWrite()

static ssize_t vlc_tls_SocketWrite ( vlc_tls_t tls,
const struct iovec *  iov,
unsigned  count 
)
static

◆ vlc_tls_WaitConnect()

static int vlc_tls_WaitConnect ( vlc_tls_t tls)
static

Waits for pending transport layer socket connection.

References pollfd::events, pollfd::fd, POLLOUT, vlc_killed(), vlc_poll_i11e(), and vlc_tls_GetFD().

Referenced by vlc_tls_Connect(), and vlc_tls_ConnectWrite().