1 /*****************************************************************************
3 *****************************************************************************
4 * Copyright (C) 2004 VideoLAN
5 * $Id: httpd.c 8263 2004-07-24 09:06:58Z courmisch $
7 * Authors: Remi Denis-Courmont <courmisch@via.ecp.fr>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
22 *****************************************************************************/
32 * - client side stuff,
33 * - server-side client cert validation,
34 * - client-side server cert validation (?).
37 /*****************************************************************************
39 *****************************************************************************
40 * Allocates a whole server's TLS credentials.
41 * Returns NULL on error.
42 *****************************************************************************/
44 tls_ServerCreate( vlc_object_t *p_this, const char *psz_cert,
48 tls_server_t *p_server;
51 p_tls = vlc_object_create( p_this, VLC_OBJECT_TLS );
52 vlc_object_attach( p_tls, p_this );
54 p_tls->p_module = module_Need( p_tls, "tls", 0, 0 );
55 if( p_tls->p_module != NULL )
60 p_server = __tls_ServerCreate( p_tls, psz_cert, psz_key );
61 if( p_server != NULL )
63 msg_Dbg( p_this, "TLS/SSL provider initialized" );
67 msg_Err( p_this, "TLS/SSL provider error" );
68 module_Unneed( p_tls, p_tls->p_module );
71 msg_Err( p_this, "TLS/SSL provider not found" );
73 vlc_object_detach( p_tls );
74 vlc_object_destroy( p_tls );
79 /*****************************************************************************
81 *****************************************************************************
82 * Releases data allocated with tls_ServerCreate
83 *****************************************************************************/
85 tls_ServerDelete( tls_server_t *p_server )
87 tls_t *p_tls = p_server->p_tls;
89 __tls_ServerDelete( p_server );
91 module_Unneed( p_tls, p_tls->p_module );
92 vlc_object_detach( p_tls );
93 vlc_object_destroy( p_tls );