1cabdff1aSopenharmony_ci/*
2cabdff1aSopenharmony_ci * TLS/SSL Protocol
3cabdff1aSopenharmony_ci * Copyright (c) 2011 Martin Storsjo
4cabdff1aSopenharmony_ci *
5cabdff1aSopenharmony_ci * This file is part of FFmpeg.
6cabdff1aSopenharmony_ci *
7cabdff1aSopenharmony_ci * FFmpeg is free software; you can redistribute it and/or
8cabdff1aSopenharmony_ci * modify it under the terms of the GNU Lesser General Public
9cabdff1aSopenharmony_ci * License as published by the Free Software Foundation; either
10cabdff1aSopenharmony_ci * version 2.1 of the License, or (at your option) any later version.
11cabdff1aSopenharmony_ci *
12cabdff1aSopenharmony_ci * FFmpeg is distributed in the hope that it will be useful,
13cabdff1aSopenharmony_ci * but WITHOUT ANY WARRANTY; without even the implied warranty of
14cabdff1aSopenharmony_ci * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15cabdff1aSopenharmony_ci * Lesser General Public License for more details.
16cabdff1aSopenharmony_ci *
17cabdff1aSopenharmony_ci * You should have received a copy of the GNU Lesser General Public
18cabdff1aSopenharmony_ci * License along with FFmpeg; if not, write to the Free Software
19cabdff1aSopenharmony_ci * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20cabdff1aSopenharmony_ci */
21cabdff1aSopenharmony_ci
22cabdff1aSopenharmony_ci#ifndef AVFORMAT_TLS_H
23cabdff1aSopenharmony_ci#define AVFORMAT_TLS_H
24cabdff1aSopenharmony_ci
25cabdff1aSopenharmony_ci#include "libavutil/opt.h"
26cabdff1aSopenharmony_ci
27cabdff1aSopenharmony_ci#include "url.h"
28cabdff1aSopenharmony_ci
29cabdff1aSopenharmony_citypedef struct TLSShared {
30cabdff1aSopenharmony_ci    char *ca_file;
31cabdff1aSopenharmony_ci    int verify;
32cabdff1aSopenharmony_ci    char *cert_file;
33cabdff1aSopenharmony_ci    char *key_file;
34cabdff1aSopenharmony_ci    int listen;
35cabdff1aSopenharmony_ci
36cabdff1aSopenharmony_ci    char *host;
37cabdff1aSopenharmony_ci    char *http_proxy;
38cabdff1aSopenharmony_ci
39cabdff1aSopenharmony_ci    char underlying_host[200];
40cabdff1aSopenharmony_ci    int numerichost;
41cabdff1aSopenharmony_ci
42cabdff1aSopenharmony_ci    URLContext *tcp;
43cabdff1aSopenharmony_ci} TLSShared;
44cabdff1aSopenharmony_ci
45cabdff1aSopenharmony_ci#define TLS_OPTFL (AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_ENCODING_PARAM)
46cabdff1aSopenharmony_ci#define TLS_COMMON_OPTIONS(pstruct, options_field) \
47cabdff1aSopenharmony_ci    {"ca_file",    "Certificate Authority database file", offsetof(pstruct, options_field . ca_file),   AV_OPT_TYPE_STRING, .flags = TLS_OPTFL }, \
48cabdff1aSopenharmony_ci    {"cafile",     "Certificate Authority database file", offsetof(pstruct, options_field . ca_file),   AV_OPT_TYPE_STRING, .flags = TLS_OPTFL }, \
49cabdff1aSopenharmony_ci    {"tls_verify", "Verify the peer certificate",         offsetof(pstruct, options_field . verify),    AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, .flags = TLS_OPTFL }, \
50cabdff1aSopenharmony_ci    {"cert_file",  "Certificate file",                    offsetof(pstruct, options_field . cert_file), AV_OPT_TYPE_STRING, .flags = TLS_OPTFL }, \
51cabdff1aSopenharmony_ci    {"key_file",   "Private key file",                    offsetof(pstruct, options_field . key_file),  AV_OPT_TYPE_STRING, .flags = TLS_OPTFL }, \
52cabdff1aSopenharmony_ci    {"listen",     "Listen for incoming connections",     offsetof(pstruct, options_field . listen),    AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, .flags = TLS_OPTFL }, \
53cabdff1aSopenharmony_ci    {"verifyhost", "Verify against a specific hostname",  offsetof(pstruct, options_field . host),      AV_OPT_TYPE_STRING, .flags = TLS_OPTFL }, \
54cabdff1aSopenharmony_ci    {"http_proxy", "Set proxy to tunnel through",         offsetof(pstruct, options_field . http_proxy), AV_OPT_TYPE_STRING, .flags = TLS_OPTFL }
55cabdff1aSopenharmony_ci
56cabdff1aSopenharmony_ciint ff_tls_open_underlying(TLSShared *c, URLContext *parent, const char *uri, AVDictionary **options);
57cabdff1aSopenharmony_ci
58cabdff1aSopenharmony_civoid ff_gnutls_init(void);
59cabdff1aSopenharmony_civoid ff_gnutls_deinit(void);
60cabdff1aSopenharmony_ci
61cabdff1aSopenharmony_ciint ff_openssl_init(void);
62cabdff1aSopenharmony_civoid ff_openssl_deinit(void);
63cabdff1aSopenharmony_ci
64cabdff1aSopenharmony_ci#endif /* AVFORMAT_TLS_H */
65