FFmpeg
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 FFmpeg.
6  *
7  * FFmpeg 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  * FFmpeg 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 FFmpeg; 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 "libavutil/opt.h"
26 
27 #include "url.h"
28 
29 typedef struct TLSShared {
30  char *ca_file;
31  int verify;
32  char *cert_file;
33  char *key_file;
34  int listen;
35 
36  char *host;
37  char *http_proxy;
38 
39  char underlying_host[200];
41 
43 } TLSShared;
44 
45 #define TLS_OPTFL (AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_ENCODING_PARAM)
46 #define TLS_COMMON_OPTIONS(pstruct, options_field) \
47  {"ca_file", "Certificate Authority database file", offsetof(pstruct, options_field . ca_file), AV_OPT_TYPE_STRING, .flags = TLS_OPTFL }, \
48  {"cafile", "Certificate Authority database file", offsetof(pstruct, options_field . ca_file), AV_OPT_TYPE_STRING, .flags = TLS_OPTFL }, \
49  {"tls_verify", "Verify the peer certificate", offsetof(pstruct, options_field . verify), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, .flags = TLS_OPTFL }, \
50  {"cert_file", "Certificate file", offsetof(pstruct, options_field . cert_file), AV_OPT_TYPE_STRING, .flags = TLS_OPTFL }, \
51  {"key_file", "Private key file", offsetof(pstruct, options_field . key_file), AV_OPT_TYPE_STRING, .flags = TLS_OPTFL }, \
52  {"listen", "Listen for incoming connections", offsetof(pstruct, options_field . listen), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, .flags = TLS_OPTFL }, \
53  {"verifyhost", "Verify against a specific hostname", offsetof(pstruct, options_field . host), AV_OPT_TYPE_STRING, .flags = TLS_OPTFL }, \
54  {"http_proxy", "Set proxy to tunnel through", offsetof(pstruct, options_field . http_proxy), AV_OPT_TYPE_STRING, .flags = TLS_OPTFL }
55 
56 int ff_tls_open_underlying(TLSShared *c, URLContext *parent, const char *uri, AVDictionary **options);
57 
58 void ff_gnutls_init(void);
59 void ff_gnutls_deinit(void);
60 
61 int ff_openssl_init(void);
62 void ff_openssl_deinit(void);
63 
64 #endif /* AVFORMAT_TLS_H */
opt.h
ff_gnutls_init
void ff_gnutls_init(void)
Definition: tls_gnutls.c:57
AVDictionary
Definition: dict.c:34
TLSShared::verify
int verify
Definition: tls.h:31
TLSShared::listen
int listen
Definition: tls.h:34
ff_gnutls_deinit
void ff_gnutls_deinit(void)
Definition: tls_gnutls.c:68
ff_openssl_deinit
void ff_openssl_deinit(void)
Definition: tls_openssl.c:106
ff_openssl_init
int ff_openssl_init(void)
Definition: tls_openssl.c:69
TLSShared::underlying_host
char underlying_host[200]
Definition: tls.h:39
c
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
Definition: undefined.txt:32
TLSShared::host
char * host
Definition: tls.h:36
options
const OptionDef options[]
TLSShared::http_proxy
char * http_proxy
Definition: tls.h:37
URLContext
Definition: url.h:37
url.h
TLSShared::cert_file
char * cert_file
Definition: tls.h:32
TLSShared::ca_file
char * ca_file
Definition: tls.h:30
TLSShared::key_file
char * key_file
Definition: tls.h:33
TLSShared
Definition: tls.h:29
TLSShared::numerichost
int numerichost
Definition: tls.h:40
TLSShared::tcp
URLContext * tcp
Definition: tls.h:42
ff_tls_open_underlying
int ff_tls_open_underlying(TLSShared *c, URLContext *parent, const char *uri, AVDictionary **options)
Definition: tls.c:68