xine-lib 1.2.11
xine_tls_plugin.h
Go to the documentation of this file.
1 /*
2 * Copyright (C) 2019 the xine project
3 * Copyright (C) 2018 Petri Hintukainen <phintuka@users.sourceforge.net>
4 *
5 * This file is part of xine, a free video player.
6 *
7 * xine is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * xine 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 General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
20 *
21 * xine TLS provider plugin interface
22 */
23
24#ifndef _XINE_TLS_PLUGIN_H_
25#define _XINE_TLS_PLUGIN_H_
26
27#include <sys/types.h>
28
29#include <xine/xine_module.h>
30
31#define TLS_PLUGIN_TYPE "tls_v1"
32
33typedef struct {
36 int fd;
38
40
43
44 int (*handshake)(tls_plugin_t *, const char *host, int verify);
46
47 ssize_t (*read)(tls_plugin_t *, void *buf, size_t len);
48 ssize_t (*write)(tls_plugin_t *, const void *buf, size_t len);
49 ssize_t (*part_read)(tls_plugin_t *, void *buf, size_t min, size_t max);
50};
51
52/*
53 * config helpers
54 */
55
56#include <xine/configfile.h>
57
58#define TLS_VERIFY_CERT_KEY "media.network.verify_tls_certificate"
59
60static inline void tls_register_config_keys(config_values_t *config)
61{
62 config->register_bool(config,
64 1, _("Verify server TLS certificate"),
65 _("If enabled, server TLS certificate is always checked. "
66 "If check fails, connections to server are not allowed."),
67 10, NULL, NULL);
68}
69
70static inline int tls_get_verify_tls_cert(config_values_t *config)
71{
72 cfg_entry_t *entry;
73
74 entry = config->lookup_entry(config, TLS_VERIFY_CERT_KEY);
75 if (entry) {
76 return entry->num_value;
77 }
78 return 1;
79}
80
81#endif /* _XINE_TLS_PLUGIN_H_ */
Definition: configfile.h:46
int num_value
Definition: configfile.h:64
Definition: configfile.h:83
int(* register_bool)(config_values_t *self, const char *key, int def_value, const char *description, const char *help, int exp_level, xine_config_cb_t changed_cb, void *cb_data)
Definition: configfile.h:154
cfg_entry_t *(* lookup_entry)(config_values_t *self, const char *key)
lookup config entries
Definition: configfile.h:182
Definition: xine_tls_plugin.h:33
xine_t * xine
Definition: xine_tls_plugin.h:34
xine_stream_t * stream
Definition: xine_tls_plugin.h:35
int fd
Definition: xine_tls_plugin.h:36
Definition: xine_tls_plugin.h:41
int(* handshake)(tls_plugin_t *, const char *host, int verify)
Definition: xine_tls_plugin.h:44
void(* shutdown)(tls_plugin_t *)
Definition: xine_tls_plugin.h:45
ssize_t(* write)(tls_plugin_t *, const void *buf, size_t len)
Definition: xine_tls_plugin.h:48
ssize_t(* part_read)(tls_plugin_t *, void *buf, size_t min, size_t max)
Definition: xine_tls_plugin.h:49
xine_module_t module
Definition: xine_tls_plugin.h:42
ssize_t(* read)(tls_plugin_t *, void *buf, size_t len)
Definition: xine_tls_plugin.h:47
Definition: xine_module.h:62
Definition: xine_internal.h:80
Definition: xine_internal.h:123
#define _(String)
Definition: vcdplayer.h:39
NULL
Definition: xine_plugin.c:78
static void tls_register_config_keys(config_values_t *config)
Definition: xine_tls_plugin.h:60
#define TLS_VERIFY_CERT_KEY
Definition: xine_tls_plugin.h:58
static int tls_get_verify_tls_cert(config_values_t *config)
Definition: xine_tls_plugin.h:70