X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fnetwork%2Ftls.c;h=c74be68bdb81ad82cb53b71ef0eb18b295f5fcf6;hb=6ee1e193fd896ab9a4729fde14f009d9ce629815;hp=95c44cf8c7a49449f252ac294ba902eb08d44625;hpb=3793ee13a2146356d38ed9e2069a6bdf056f0923;p=vlc diff --git a/src/network/tls.c b/src/network/tls.c index 95c44cf8c7..c74be68bdb 100644 --- a/src/network/tls.c +++ b/src/network/tls.c @@ -1,10 +1,10 @@ /***************************************************************************** * tls.c ***************************************************************************** - * Copyright (C) 2004-2005 the VideoLAN team + * Copyright © 2004-2007 Rémi Denis-Courmont * $Id$ * - * Authors: Remi Denis-Courmont + * Authors: Rémi Denis-Courmont * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,13 +18,17 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/ -#include +/** + * @file + * libvlc interface to the Transport Layer Security (TLS) plugins. + */ + #include -#include "vlc_tls.h" +#include static tls_t * tls_Init( vlc_object_t *p_this ) @@ -56,7 +60,7 @@ tls_Init( vlc_object_t *p_this ) return NULL; } - vlc_object_attach( p_tls, p_this->p_vlc ); + vlc_object_attach( p_tls, p_this->p_libvlc ); vlc_object_yield( p_tls ); msg_Dbg( p_tls, "TLS/SSL provider initialized" ); } @@ -75,7 +79,7 @@ tls_Deinit( tls_t *p_tls ) vlc_mutex_lock( lockval.p_address ); vlc_object_release( p_tls ); - + i = p_tls->i_refcount; if( i == 0 ) vlc_object_detach( p_tls ); @@ -90,12 +94,15 @@ tls_Deinit( tls_t *p_tls ) } } -/***************************************************************************** - * tls_ServerCreate: - ***************************************************************************** +/** * Allocates a whole server's TLS credentials. - * Returns NULL on error. - *****************************************************************************/ + * + * @param psz_cert required (Unicode) path to an x509 certificate. + * @param psz_key required (Unicode) path to the PKCS private key for + * the certificate. + * + * @return NULL on error. + */ tls_server_t * tls_ServerCreate( vlc_object_t *p_this, const char *psz_cert, const char *psz_key ) @@ -124,11 +131,9 @@ tls_ServerCreate( vlc_object_t *p_this, const char *psz_cert, } -/***************************************************************************** - * tls_ServerDelete: - ***************************************************************************** +/** * Releases data allocated with tls_ServerCreate. - *****************************************************************************/ + */ void tls_ServerDelete( tls_server_t *p_server ) { @@ -140,12 +145,16 @@ tls_ServerDelete( tls_server_t *p_server ) } -/***************************************************************************** - * tls_ClientCreate: - ***************************************************************************** +/** * Allocates a client's TLS credentials and shakes hands through the network. - * Returns NULL on error. This is a blocking network operation. - *****************************************************************************/ + * This is a blocking network operation. + * + * @param fd stream socket through which to establish the secure communication + * layer. + * @param psz_hostname Server Name Indication to pass to the server, or NULL. + * + * @return NULL on error. + **/ tls_session_t * tls_ClientCreate( vlc_object_t *p_this, int fd, const char *psz_hostname ) { @@ -155,7 +164,7 @@ tls_ClientCreate( vlc_object_t *p_this, int fd, const char *psz_hostname ) p_tls = tls_Init( p_this ); if( p_tls == NULL ) return NULL; - + p_session = p_tls->pf_client_create( p_tls ); if( p_session != NULL ) { @@ -181,11 +190,10 @@ tls_ClientCreate( vlc_object_t *p_this, int fd, const char *psz_hostname ) } -/***************************************************************************** - * tls_ClientDelete: - ***************************************************************************** +/** * Releases data allocated with tls_ClientCreate. - *****************************************************************************/ + * It is your job to close the underlying socket. + */ void tls_ClientDelete( tls_session_t *p_session ) {