vlc_tls.h

Go to the documentation of this file.
00001 /*****************************************************************************
00002  * tls.c: Transport Layer Security API
00003  *****************************************************************************
00004  * Copyright (C) 2004-2007 the VideoLAN team
00005  * $Id$
00006  *
00007  * Authors: Rémi Denis-Courmont <rem # videolan.org>
00008  *
00009  * This program is free software; you can redistribute it and/or modify
00010  * it under the terms of the GNU General Public License as published by
00011  * the Free Software Foundation; either version 2 of the License, or
00012  * (at your option) any later version.
00013  *
00014  * This program is distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  * GNU General Public License for more details.
00018  *
00019  * You should have received a copy of the GNU General Public License
00020  * along with this program; if not, write to the Free Software
00021  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
00022  *****************************************************************************/
00023 
00024 #ifndef VLC_TLS_H
00025 # define VLC_TLS_H
00026 
00027 /**
00028  * \file
00029  * This file defines Transport Layer Security API (TLS) in vlc
00030  */
00031 
00032 # include <vlc_network.h>
00033 
00034 typedef struct tls_server_sys_t tls_server_sys_t;
00035 
00036 struct tls_server_t
00037 {
00038     VLC_COMMON_MEMBERS
00039 
00040     module_t  *p_module;
00041     tls_server_sys_t *p_sys;
00042 
00043     int (*pf_add_CA) ( tls_server_t *, const char * );
00044     int (*pf_add_CRL) ( tls_server_t *, const char * );
00045 
00046     tls_session_t * (*pf_open)  ( tls_server_t * );
00047     void            (*pf_close) ( tls_server_t *, tls_session_t * );
00048 };
00049 
00050 typedef struct tls_session_sys_t tls_session_sys_t;
00051 
00052 struct tls_session_t
00053 {
00054     VLC_COMMON_MEMBERS
00055 
00056     module_t  *p_module;
00057     tls_session_sys_t *p_sys;
00058 
00059     struct virtual_socket_t sock;
00060     void (*pf_set_fd) ( tls_session_t *, int );
00061     int  (*pf_handshake) ( tls_session_t * );
00062 };
00063 
00064 
00065 tls_server_t *tls_ServerCreate (vlc_object_t *, const char *, const char *);
00066 void tls_ServerDelete (tls_server_t *);
00067 int tls_ServerAddCA (tls_server_t *srv, const char *path);
00068 int tls_ServerAddCRL (tls_server_t *srv, const char *path);
00069 
00070 tls_session_t *tls_ServerSessionPrepare (tls_server_t *);
00071 int tls_ServerSessionHandshake (tls_session_t *, int fd);
00072 int tls_SessionContinueHandshake (tls_session_t *);
00073 void tls_ServerSessionClose (tls_session_t *);
00074 
00075 VLC_EXPORT( tls_session_t *, tls_ClientCreate, ( vlc_object_t *, int, const char * ) );
00076 VLC_EXPORT( void, tls_ClientDelete, ( tls_session_t * ) );
00077 
00078 /* NOTE: It is assumed that a->sock.p_sys = a */
00079 # define tls_Send( a, b, c ) (((tls_session_t *)a)->sock.pf_send (a, b, c ))
00080 
00081 # define tls_Recv( a, b, c ) (((tls_session_t *)a)->sock.pf_recv (a, b, c ))
00082 
00083 #endif

Generated on Mon Nov 22 07:55:20 2010 for VLC by  doxygen 1.5.6