X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=include%2Fvlc_tls.h;h=0472959e40c56489b5272231eecde69ac5d38ffc;hb=8e6998b0526723216efa024c9d86397dcd96dbb7;hp=2982f9553317f1533e15b546ca45230ee193cdda;hpb=1c672a3d5cead318809db9b030f928e9fc4a8c72;p=vlc diff --git a/include/vlc_tls.h b/include/vlc_tls.h index 2982f95533..0472959e40 100644 --- a/include/vlc_tls.h +++ b/include/vlc_tls.h @@ -1,10 +1,10 @@ /***************************************************************************** - * tls.c + * tls.c: TLS wrapper ***************************************************************************** - * Copyright (C) 2004 VideoLAN - * $Id: httpd.c 8263 2004-07-24 09:06:58Z courmisch $ + * Copyright (C) 2004-2005 the VideoLAN team + * $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. *****************************************************************************/ +#if !defined( __LIBVLC__ ) + #error You are not libvlc or one of its plugins. You cannot include this file +#endif + #ifndef _VLC_TLS_H # define _VLC_TLS_H -# include "network.h" +# include struct tls_t { @@ -34,32 +38,33 @@ struct tls_t module_t *p_module; void *p_sys; - tls_server_t * (*pf_server_create) ( tls_t *, const char *, const char * ); - tls_session_t * (*pf_client_create) ( tls_t *, const char * ); + tls_server_t * (*pf_server_create) ( tls_t *, const char *, + const char * ); + tls_session_t * (*pf_client_create) ( tls_t * ); }; struct tls_server_t { - tls_t *p_tls; + VLC_COMMON_MEMBERS + void *p_sys; void (*pf_delete) ( tls_server_t * ); - + int (*pf_add_CA) ( tls_server_t *, const char * ); int (*pf_add_CRL) ( tls_server_t *, const char * ); - + tls_session_t * (*pf_session_prepare) ( tls_server_t * ); }; struct tls_session_t { - tls_t *p_tls; - tls_server_t *p_server; + VLC_COMMON_MEMBERS void *p_sys; struct virtual_socket_t sock; - int (*pf_handshake) ( tls_session_t *, int ); + int (*pf_handshake) ( tls_session_t *, int, const char * ); int (*pf_handshake2) ( tls_session_t * ); void (*pf_close) ( tls_session_t * ); }; @@ -71,7 +76,6 @@ struct tls_session_t * Allocates a whole server's TLS credentials. * Returns NULL on error. *****************************************************************************/ -# define __tls_ServerCreate( a, b, c ) (((tls_t *)a)->pf_server_create (a, b, c)) VLC_EXPORT( tls_server_t *, tls_ServerCreate, ( vlc_object_t *, const char *, const char * ) ); /***************************************************************************** @@ -92,20 +96,20 @@ VLC_EXPORT( tls_server_t *, tls_ServerCreate, ( vlc_object_t *, const char *, co # define tls_ServerAddCRL( a, b ) (((tls_server_t *)a)->pf_add_CRL (a, b)) -# define __tls_ServerDelete( a ) (((tls_server_t *)a)->pf_delete ( a )) VLC_EXPORT( void, tls_ServerDelete, ( tls_server_t * ) ); # define tls_ServerSessionPrepare( a ) (((tls_server_t *)a)->pf_session_prepare (a)) +# define tls_ServerSessionHandshake( a, b ) (((tls_session_t *)a)->pf_handshake (a, b, NULL)) +# define tls_ServerSessionClose( a ) (((tls_session_t *)a)->pf_close (a)) -# define __tls_ClientCreate( a, b ) (((tls_t *)a)->pf_client_create (a, b )) -VLC_EXPORT( tls_session_t *, tls_ClientCreate, ( vlc_object_t *, const char *, int ) ); +VLC_EXPORT( tls_session_t *, tls_ClientCreate, ( vlc_object_t *, int, const char * ) ); VLC_EXPORT( void, tls_ClientDelete, ( tls_session_t * ) ); -# define tls_SessionHandshake( a, b ) (((tls_session_t *)a)->pf_handshake (a, b)) +# define tls_ClientSessionHandshake( a, b, c ) (((tls_session_t *)a)->pf_handshake (a, b, c)) + # define tls_SessionContinueHandshake( a ) (((tls_session_t *)a)->pf_handshake2 (a)) -# define tls_SessionClose( a ) (((tls_session_t *)a)->pf_close (a)) /* NOTE: It is assumed that a->sock.p_sys = a */ # define tls_Send( a, b, c ) (((tls_session_t *)a)->sock.pf_send (a, b, c ))