xine-lib: xine-lib-1.2.12/src/input/tls/xine_tls.h Source File

xine-lib 1.2.12

xine_tls.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2000-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 * input plugin TLS helpers
22 */
23
24#ifndef XINE_INPUT_TLS_H
25#define XINE_INPUT_TLS_H
26
27/*
28 * xine_tls layer is a simple wrapper for _x_io_tcp_*() functions.
29 * _x_io_*() functions can be simply replaced with _x_tls_*() functions.
30 *
31 * Connection is unencrypted until _x_tls_handshake() is called.
32 * Unencrypted TCP connection can be used even if TLS support was not compiled in.
33 */
34
35#include <xine/xine_internal.h>
36
37 typedef struct xine_tls xine_tls_t;
38
39/*
40 * TCP connection
41 */
42
43int _x_tls_available(xine_t *xine);
44
45/* open/close by host and port. */
46 xine_tls_t *_x_tls_connect(xine_t *xine, xine_stream_t *stream, const char *host, int port);
47/* also close fd. */
48void _x_tls_close (xine_tls_t **tlsp);
49
50/* same thing on an existing user file handle.
51 * This is useful when doing _x_io_tcp_handshake_connect () and/or SOCKS4. */
52 xine_tls_t *_x_tls_init (xine_t *xine, xine_stream_t *stream, int fd);
53/* do NOT close fd. */
54void _x_tls_deinit (xine_tls_t **tlsp);
55
56ssize_t _x_tls_part_read(xine_tls_t *, void *data, size_t min, size_t max);
57ssize_t _x_tls_read(xine_tls_t *, void *data, size_t len);
58ssize_t _x_tls_write(xine_tls_t *, const void *data, size_t len);
59ssize_t _x_tls_read_line(xine_tls_t *, char *buf, size_t buf_size);
60
61/*
62 * TLS
63 */
64
72int _x_tls_handshake(xine_tls_t *, const char *host, int verify);
73
79void _x_tls_shutdown(xine_tls_t *);
80
81/*
82 * config helpers
83 */
84
85int _x_tls_get_verify_tls_cert(config_values_t *);
86
87#endif /* XINE_INPUT_TLS_H */
88
config_values_s
Definition: configfile.h:83
xine_s
Definition: xine_internal.h:80
xine_stream_s
Definition: xine_internal.h:123
xine_tls
Definition: xine_tls.c:41
xine_tls::stream
xine_stream_t * stream
Definition: xine_tls.c:43
xine_tls::fd
int fd
Definition: xine_tls.c:45
xine_tls::xine
xine_t * xine
Definition: xine_tls.c:42
xine_internal.h
_x_tls_part_read
ssize_t _x_tls_part_read(xine_tls_t *, void *data, size_t min, size_t max)
Definition: xine_tls.c:76
_x_tls_read
ssize_t _x_tls_read(xine_tls_t *, void *data, size_t len)
Definition: xine_tls.c:84
_x_tls_get_verify_tls_cert
int _x_tls_get_verify_tls_cert(config_values_t *)
Definition: xine_tls.c:225
_x_tls_shutdown
void _x_tls_shutdown(xine_tls_t *)
Definition: xine_tls.c:128
_x_tls_write
ssize_t _x_tls_write(xine_tls_t *, const void *data, size_t len)
Definition: xine_tls.c:68
_x_tls_connect
xine_tls_t * _x_tls_connect(xine_t *xine, xine_stream_t *stream, const char *host, int port)
Definition: xine_tls.c:180
_x_tls_deinit
void _x_tls_deinit(xine_tls_t **tlsp)
Definition: xine_tls.c:154
_x_tls_available
int _x_tls_available(xine_t *xine)
Definition: xine_tls.c:230
_x_tls_read_line
ssize_t _x_tls_read_line(xine_tls_t *, char *buf, size_t buf_size)
Definition: xine_tls.c:92
_x_tls_init
xine_tls_t * _x_tls_init(xine_t *xine, xine_stream_t *stream, int fd)
Definition: xine_tls.c:166
_x_tls_close
void _x_tls_close(xine_tls_t **tlsp)
Definition: xine_tls.c:139
_x_tls_handshake
int _x_tls_handshake(xine_tls_t *, const char *host, int verify)
Definition: xine_tls.c:198