Data Structures | Defines | Typedefs | Functions

vlc_tls.h File Reference

This file defines Transport Layer Security API (TLS) in vlc. More...

Include dependency graph for vlc_tls.h:

Go to the source code of this file.

Data Structures

struct  vlc_tls
struct  vlc_tls_creds
 TLS (server-side) credentials. More...

Defines

#define tls_Send(a, b, c)   (((vlc_tls_t *)a)->sock.pf_send (a, b, c))
#define tls_Recv(a, b, c)   (((vlc_tls_t *)a)->sock.pf_recv (a, b, c))

Typedefs

typedef struct vlc_tls_sys vlc_tls_sys_t
typedef struct vlc_tls vlc_tls_t
typedef struct vlc_tls_creds_sys vlc_tls_creds_sys_t
typedef struct vlc_tls_creds vlc_tls_creds_t
 TLS (server-side) credentials.

Functions

VLC_API vlc_tls_tvlc_tls_ClientCreate (vlc_object_t *, int fd, const char *hostname)
 Allocates a client's TLS credentials and shakes hands through the network.
VLC_API void vlc_tls_ClientDelete (vlc_tls_t *)
 Releases data allocated with vlc_tls_ClientCreate().
vlc_tls_creds_tvlc_tls_ServerCreate (vlc_object_t *, const char *cert, const char *key)
 Allocates a whole server's TLS credentials.
void vlc_tls_ServerDelete (vlc_tls_creds_t *)
 Releases data allocated with vlc_tls_ServerCreate().
int vlc_tls_ServerAddCA (vlc_tls_creds_t *srv, const char *path)
 Adds one or more certificate authorities from a file.
int vlc_tls_ServerAddCRL (vlc_tls_creds_t *srv, const char *path)
 Adds one or more certificate revocation list from a file.
vlc_tls_tvlc_tls_ServerSessionCreate (vlc_tls_creds_t *, int fd)
int vlc_tls_ServerSessionHandshake (vlc_tls_t *)
void vlc_tls_ServerSessionDelete (vlc_tls_t *)

Detailed Description

This file defines Transport Layer Security API (TLS) in vlc.


Define Documentation

#define tls_Recv (   a,
  b,
  c 
)    (((vlc_tls_t *)a)->sock.pf_recv (a, b, c))

Referenced by httpd_NetRecv().

#define tls_Send (   a,
  b,
  c 
)    (((vlc_tls_t *)a)->sock.pf_send (a, b, c))

Referenced by httpd_NetSend().


Typedef Documentation

typedef struct vlc_tls_creds_sys vlc_tls_creds_sys_t

TLS (server-side) credentials.

typedef struct vlc_tls_sys vlc_tls_sys_t
typedef struct vlc_tls vlc_tls_t

Function Documentation

VLC_API vlc_tls_t* vlc_tls_ClientCreate ( vlc_object_t obj,
int  fd,
const char *  hostname 
)

Allocates a client's TLS credentials and shakes hands through the network.

This is a blocking network operation.

Parameters:
fd stream socket through which to establish the secure communication layer.
psz_hostname Server Name Indication to pass to the server, or NULL.
Returns:
NULL on error.

References vlc_tls::handshake, vlc_tls::module, msg_Dbg, msg_Err, tls_client_start(), tls_client_stop(), vlc_tls::u, unlikely, vlc_custom_create, vlc_module_load, vlc_module_unload(), and vlc_object_release.

VLC_API void vlc_tls_ClientDelete ( vlc_tls_t cl  ) 

Releases data allocated with vlc_tls_ClientCreate().

It is your job to close the underlying socket.

References vlc_tls::module, tls_client_stop(), vlc_tls::u, vlc_module_unload(), and vlc_object_release.

int vlc_tls_ServerAddCA ( vlc_tls_creds_t srv,
const char *  path 
)

Adds one or more certificate authorities from a file.

Returns:
-1 on error, 0 on success.

References vlc_tls_creds::add_CA.

Referenced by vlc_https_HostNew().

int vlc_tls_ServerAddCRL ( vlc_tls_creds_t srv,
const char *  path 
)

Adds one or more certificate revocation list from a file.

Returns:
-1 on error, 0 on success.

References vlc_tls_creds::add_CRL.

Referenced by vlc_https_HostNew().

vlc_tls_creds_t* vlc_tls_ServerCreate ( vlc_object_t obj,
const char *  cert_path,
const char *  key_path 
)

Allocates a whole server's TLS credentials.

Parameters:
cert_path required (Unicode) path to an x509 certificate, if NULL, anonymous key exchange will be used.
key_path (UTF-8) path to the PKCS private key for the certificate, if NULL; cert_path will be used.
Returns:
NULL on error.

References vlc_tls_creds::module, module_need, msg_Dbg, msg_Err, unlikely, var_Create, var_SetString, vlc_custom_create, vlc_object_release, and VLC_VAR_STRING.

Referenced by vlc_https_HostNew().

void vlc_tls_ServerDelete ( vlc_tls_creds_t srv  ) 

Releases data allocated with vlc_tls_ServerCreate().

Parameters:
srv TLS server object to be destroyed, or NULL

References vlc_tls_creds::module, module_unneed, and vlc_object_release.

Referenced by httpd_HostCreate(), httpd_HostDelete(), and vlc_https_HostNew().

vlc_tls_t* vlc_tls_ServerSessionCreate ( vlc_tls_creds_t ,
int  fd 
)

References vlc_tls_creds::open.

Referenced by httpd_HostThread().

void vlc_tls_ServerSessionDelete ( vlc_tls_t  ) 
int vlc_tls_ServerSessionHandshake ( vlc_tls_t  ) 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines