FFmpeg
Data Structures | Macros | Functions | Variables
tls_openssl.c File Reference
#include "network.h"
#include "os_support.h"
#include "url.h"
#include "tls.h"
#include "libavutil/opt.h"
#include <openssl/bio.h>
#include <openssl/ssl.h>
#include <openssl/err.h>
#include "libavutil/thread.h"

Go to the source code of this file.

Data Structures

struct  TLSContext
 

Macros

#define GET_BIO_DATA(x)   (x)->ptr
 

Functions

int ff_openssl_init (void)
 
void ff_openssl_deinit (void)
 
static int print_tls_error (URLContext *h, int ret)
 
static int tls_close (URLContext *h)
 
static int url_bio_create (BIO *b)
 
static int url_bio_destroy (BIO *b)
 
static int url_bio_bread (BIO *b, char *buf, int len)
 
static int url_bio_bwrite (BIO *b, const char *buf, int len)
 
static long url_bio_ctrl (BIO *b, int cmd, long num, void *ptr)
 
static int url_bio_bputs (BIO *b, const char *str)
 
static int tls_open (URLContext *h, const char *uri, int flags, AVDictionary **options)
 
static int tls_read (URLContext *h, uint8_t *buf, int size)
 
static int tls_write (URLContext *h, const uint8_t *buf, int size)
 
static int tls_get_file_handle (URLContext *h)
 
static int tls_get_short_seek (URLContext *h)
 

Variables

static AVMutex openssl_mutex = AV_MUTEX_INITIALIZER
 
static int openssl_init
 
static BIO_METHOD url_bio_method
 
static const AVOption options []
 
static const AVClass tls_class
 
const URLProtocol ff_tls_protocol
 

Macro Definition Documentation

◆ GET_BIO_DATA

#define GET_BIO_DATA (   x)    (x)->ptr

Definition at line 190 of file tls_openssl.c.

Function Documentation

◆ ff_openssl_init()

int ff_openssl_init ( void  )

Definition at line 75 of file tls_openssl.c.

Referenced by ff_tls_init(), and tls_open().

◆ ff_openssl_deinit()

void ff_openssl_deinit ( void  )

Definition at line 105 of file tls_openssl.c.

Referenced by ff_tls_deinit(), and tls_close().

◆ print_tls_error()

static int print_tls_error ( URLContext h,
int  ret 
)
static

Definition at line 124 of file tls_openssl.c.

Referenced by tls_open(), tls_read(), and tls_write().

◆ tls_close()

static int tls_close ( URLContext h)
static

Definition at line 148 of file tls_openssl.c.

Referenced by tls_open().

◆ url_bio_create()

static int url_bio_create ( BIO *  b)
static

Definition at line 168 of file tls_openssl.c.

Referenced by tls_open().

◆ url_bio_destroy()

static int url_bio_destroy ( BIO *  b)
static

Definition at line 182 of file tls_openssl.c.

Referenced by tls_open().

◆ url_bio_bread()

static int url_bio_bread ( BIO *  b,
char *  buf,
int  len 
)
static

Definition at line 193 of file tls_openssl.c.

Referenced by tls_open().

◆ url_bio_bwrite()

static int url_bio_bwrite ( BIO *  b,
const char *  buf,
int  len 
)
static

Definition at line 209 of file tls_openssl.c.

Referenced by tls_open(), and url_bio_bputs().

◆ url_bio_ctrl()

static long url_bio_ctrl ( BIO *  b,
int  cmd,
long  num,
void *  ptr 
)
static

Definition at line 225 of file tls_openssl.c.

Referenced by tls_open().

◆ url_bio_bputs()

static int url_bio_bputs ( BIO *  b,
const char *  str 
)
static

Definition at line 234 of file tls_openssl.c.

Referenced by tls_open().

◆ tls_open()

static int tls_open ( URLContext h,
const char *  uri,
int  flags,
AVDictionary **  options 
)
static

Definition at line 253 of file tls_openssl.c.

◆ tls_read()

static int tls_read ( URLContext h,
uint8_t *  buf,
int  size 
)
static

Definition at line 338 of file tls_openssl.c.

◆ tls_write()

static int tls_write ( URLContext h,
const uint8_t *  buf,
int  size 
)
static

Definition at line 353 of file tls_openssl.c.

◆ tls_get_file_handle()

static int tls_get_file_handle ( URLContext h)
static

Definition at line 368 of file tls_openssl.c.

◆ tls_get_short_seek()

static int tls_get_short_seek ( URLContext h)
static

Definition at line 374 of file tls_openssl.c.

Variable Documentation

◆ openssl_mutex

AVMutex openssl_mutex = AV_MUTEX_INITIALIZER
static

Definition at line 51 of file tls_openssl.c.

Referenced by ff_openssl_deinit(), and ff_openssl_init().

◆ openssl_init

int openssl_init
static

Definition at line 53 of file tls_openssl.c.

Referenced by ff_openssl_deinit(), and ff_openssl_init().

◆ url_bio_method

BIO_METHOD url_bio_method
static
Initial value:
= {
.type = BIO_TYPE_SOURCE_SINK,
.name = "urlprotocol bio",
.bwrite = url_bio_bwrite,
.bread = url_bio_bread,
.bputs = url_bio_bputs,
.bgets = NULL,
.ctrl = url_bio_ctrl,
.create = url_bio_create,
.destroy = url_bio_destroy,
}

Definition at line 240 of file tls_openssl.c.

Referenced by tls_open().

◆ options

const AVOption options[]
static
Initial value:
= {
{ NULL }
}

Definition at line 380 of file tls_openssl.c.

◆ tls_class

const AVClass tls_class
static
Initial value:
= {
.class_name = "tls",
.item_name = av_default_item_name,
.option = options,
}

Definition at line 385 of file tls_openssl.c.

◆ ff_tls_protocol

const URLProtocol ff_tls_protocol
Initial value:
= {
.name = "tls",
.url_open2 = tls_open,
.url_read = tls_read,
.url_write = tls_write,
.url_close = tls_close,
.url_get_file_handle = tls_get_file_handle,
.url_get_short_seek = tls_get_short_seek,
.priv_data_size = sizeof(TLSContext),
.priv_data_class = &tls_class,
}

Definition at line 392 of file tls_openssl.c.

TLSContext
Definition: tls_gnutls.c:44
URL_PROTOCOL_FLAG_NETWORK
#define URL_PROTOCOL_FLAG_NETWORK
Definition: url.h:33
TLS_COMMON_OPTIONS
#define TLS_COMMON_OPTIONS(pstruct, options_field)
Definition: tls.h:46
tls_class
static const AVClass tls_class
Definition: tls_openssl.c:385
url_bio_create
static int url_bio_create(BIO *b)
Definition: tls_openssl.c:168
tls_write
static int tls_write(URLContext *h, const uint8_t *buf, int size)
Definition: tls_openssl.c:353
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
NULL
#define NULL
Definition: coverity.c:32
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:237
url_bio_ctrl
static long url_bio_ctrl(BIO *b, int cmd, long num, void *ptr)
Definition: tls_openssl.c:225
url_bio_destroy
static int url_bio_destroy(BIO *b)
Definition: tls_openssl.c:182
url_bio_bwrite
static int url_bio_bwrite(BIO *b, const char *buf, int len)
Definition: tls_openssl.c:209
tls_open
static int tls_open(URLContext *h, const char *uri, int flags, AVDictionary **options)
Definition: tls_openssl.c:253
url_bio_bread
static int url_bio_bread(BIO *b, char *buf, int len)
Definition: tls_openssl.c:193
options
static const AVOption options[]
Definition: tls_openssl.c:380
tls_get_file_handle
static int tls_get_file_handle(URLContext *h)
Definition: tls_openssl.c:368
tls_get_short_seek
static int tls_get_short_seek(URLContext *h)
Definition: tls_openssl.c:374
tls_read
static int tls_read(URLContext *h, uint8_t *buf, int size)
Definition: tls_openssl.c:338
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:482
tls_close
static int tls_close(URLContext *h)
Definition: tls_openssl.c:148
url_bio_bputs
static int url_bio_bputs(BIO *b, const char *str)
Definition: tls_openssl.c:234