QVisu
Qt-based visualization for smart homes
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
vlc_tls.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * vlc_tls.h: Transport Layer Security API
3  *****************************************************************************
4  * Copyright (C) 2004-2011 RĂ©mi Denis-Courmont
5  * Copyright (C) 2005-2006 VLC authors and VideoLAN
6  *
7  * This program is free software; you can redistribute it and/or modify it
8  * under the terms of the GNU Lesser General Public License as published by
9  * the Free Software Foundation; either version 2.1 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public License
18  * along with this program; if not, write to the Free Software Foundation,
19  * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
20  *****************************************************************************/
21 
22 #ifndef VLC_TLS_H
23 # define VLC_TLS_H
24 
30 # include <vlc_network.h>
31 
32 typedef struct vlc_tls vlc_tls_t;
33 typedef struct vlc_tls_sys vlc_tls_sys_t;
34 typedef struct vlc_tls_creds vlc_tls_creds_t;
35 typedef struct vlc_tls_creds_sys vlc_tls_creds_sys_t;
36 
38 struct vlc_tls
39 {
40  VLC_COMMON_MEMBERS
41 
42  vlc_tls_sys_t *sys;
43 
44  struct virtual_socket_t sock;
45  int (*handshake) (vlc_tls_t *, const char *host, const char *service);
46 };
47 
48 VLC_API vlc_tls_t *vlc_tls_ClientSessionCreate (vlc_tls_creds_t *, int fd,
49  const char *host, const char *service);
50 vlc_tls_t *vlc_tls_SessionCreate (vlc_tls_creds_t *, int fd, const char *host);
51 int vlc_tls_SessionHandshake (vlc_tls_t *, const char *host, const char *serv);
52 VLC_API void vlc_tls_SessionDelete (vlc_tls_t *);
53 
54 /* NOTE: It is assumed that a->sock.p_sys = a */
55 # define tls_Send( a, b, c ) (((vlc_tls_t *)a)->sock.pf_send (a, b, c))
56 
57 # define tls_Recv( a, b, c ) (((vlc_tls_t *)a)->sock.pf_recv (a, b, c))
58 
59 
62 {
63  VLC_COMMON_MEMBERS
64 
65  module_t *module;
66  vlc_tls_creds_sys_t *sys;
67 
68  int (*add_CA) (vlc_tls_creds_t *, const char *path);
69  int (*add_CRL) (vlc_tls_creds_t *, const char *path);
70 
71  int (*open) (vlc_tls_creds_t *, vlc_tls_t *, int fd, const char *host);
72  void (*close) (vlc_tls_creds_t *, vlc_tls_t *);
73 };
74 
75 VLC_API vlc_tls_creds_t *vlc_tls_ClientCreate (vlc_object_t *);
76 vlc_tls_creds_t *vlc_tls_ServerCreate (vlc_object_t *,
77  const char *cert, const char *key);
78 VLC_API void vlc_tls_Delete (vlc_tls_creds_t *);
79 int vlc_tls_ServerAddCA (vlc_tls_creds_t *srv, const char *path);
80 int vlc_tls_ServerAddCRL (vlc_tls_creds_t *srv, const char *path);
81 
82 #endif
Definition: vlc_network.h:140
Definition: vlc_tls.h:38
Definition: vlc_tls.h:61
Definition: vlc_objects.h:42