Libav
tls.h
Go to the documentation of this file.
1 /*
2  * TLS/SSL Protocol
3  * Copyright (c) 2011 Martin Storsjo
4  *
5  * This file is part of Libav.
6  *
7  * Libav is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * Libav 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 GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with Libav; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
22 #ifndef AVFORMAT_TLS_H
23 #define AVFORMAT_TLS_H
24 
25 #include "config.h"
26 #include "url.h"
27 #include "libavutil/opt.h"
28 
29 #define CONFIG_TLS_PROTOCOL (CONFIG_TLS_GNUTLS_PROTOCOL | CONFIG_TLS_OPENSSL_PROTOCOL)
30 
31 typedef struct TLSShared {
32  char *ca_file;
33  int verify;
34  char *cert_file;
35  char *key_file;
36  int listen;
37 
38  char host[200];
40 
42 } TLSShared;
43 
44 #define TLS_OPTFL (AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_ENCODING_PARAM)
45 #define TLS_COMMON_OPTIONS(pstruct, options_field) \
46  {"ca_file", "Certificate Authority database file", offsetof(pstruct, options_field . ca_file), AV_OPT_TYPE_STRING, .flags = TLS_OPTFL }, \
47  {"tls_verify", "Verify the peer certificate", offsetof(pstruct, options_field . verify), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, .flags = TLS_OPTFL }, \
48  {"cert_file", "Certificate file", offsetof(pstruct, options_field . cert_file), AV_OPT_TYPE_STRING, .flags = TLS_OPTFL }, \
49  {"key_file", "Private key file", offsetof(pstruct, options_field . key_file), AV_OPT_TYPE_STRING, .flags = TLS_OPTFL }, \
50  {"listen", "Listen for incoming connections", offsetof(pstruct, options_field . listen), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, .flags = TLS_OPTFL }
51 
52 int ff_tls_open_underlying(TLSShared *c, URLContext *parent, const char *uri, AVDictionary **options);
53 
54 void ff_gnutls_init(void);
55 void ff_gnutls_deinit(void);
56 
57 void ff_openssl_init(void);
58 void ff_openssl_deinit(void);
59 
60 #endif /* AVFORMAT_TLS_H */
int verify
Definition: tls.h:33
int listen
Definition: tls.h:36
AVOptions.
char host[200]
Definition: tls.h:38
void ff_gnutls_init(void)
Definition: tls_gnutls.c:52
Definition: tls.h:31
const OptionDef options[]
Definition: avconv_opt.c:2447
void ff_openssl_init(void)
Definition: tls_openssl.c:69
char * cert_file
Definition: tls.h:34
char * ca_file
Definition: tls.h:32
Definition: url.h:38
void ff_gnutls_deinit(void)
Definition: tls_gnutls.c:63
URLContext * tcp
Definition: tls.h:41
int numerichost
Definition: tls.h:39
void ff_openssl_deinit(void)
Definition: tls_openssl.c:92
unbuffered private I/O API
int ff_tls_open_underlying(TLSShared *c, URLContext *parent, const char *uri, AVDictionary **options)
Definition: tls.c:32
char * key_file
Definition: tls.h:35