/*****************************************************************************
* tls.c
*****************************************************************************
- * Copyright (C) 2004 VideoLAN
+ * Copyright (C) 2004-2005 VideoLAN
* $Id: httpd.c 8263 2004-07-24 09:06:58Z courmisch $
*
* Authors: Remi Denis-Courmont <courmisch@via.ecp.fr>
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 * );
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 * );
};
* 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 * ) );
/*****************************************************************************
# 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 ))