FFmpeg
Data Structures | Macros | Functions | Variables
tls_securetransport.c File Reference
#include <errno.h>
#include "avformat.h"
#include "avio_internal.h"
#include "internal.h"
#include "network.h"
#include "os_support.h"
#include "url.h"
#include "tls.h"
#include "libavcodec/internal.h"
#include "libavutil/avstring.h"
#include "libavutil/opt.h"
#include "libavutil/parseutils.h"
#include <Security/Security.h>
#include <Security/SecureTransport.h>
#include <CoreFoundation/CoreFoundation.h>

Go to the source code of this file.

Data Structures

struct  TLSContext
 

Macros

#define ioErr   -36
 
#define CHECK_ERROR(func, ...)
 

Functions

SecIdentityRef SecIdentityCreate (CFAllocatorRef allocator, SecCertificateRef certificate, SecKeyRef privateKey)
 
static int print_tls_error (URLContext *h, int ret)
 
static int import_pem (URLContext *h, char *path, CFArrayRef *array)
 
static int load_ca (URLContext *h)
 
static int load_cert (URLContext *h)
 
static OSStatus tls_read_cb (SSLConnectionRef connection, void *data, size_t *dataLength)
 
static OSStatus tls_write_cb (SSLConnectionRef connection, const void *data, size_t *dataLength)
 
static int tls_close (URLContext *h)
 
static int tls_open (URLContext *h, const char *uri, int flags, AVDictionary **options)
 
static int map_ssl_error (OSStatus status, size_t processed)
 
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)
 

Variables

static const AVOption options []
 
static const AVClass tls_class
 
const URLProtocol ff_tls_protocol
 

Macro Definition Documentation

◆ ioErr

#define ioErr   -36

Definition at line 42 of file tls_securetransport.c.

◆ CHECK_ERROR

#define CHECK_ERROR (   func,
  ... 
)
Value:
do { \
OSStatus status = func(__VA_ARGS__); \
if (status != noErr) { \
ret = AVERROR_UNKNOWN; \
av_log(h, AV_LOG_ERROR, #func ": Error %i\n", (int)status); \
goto fail; \
} \
} while (0)

Definition at line 259 of file tls_securetransport.c.

Function Documentation

◆ SecIdentityCreate()

SecIdentityRef SecIdentityCreate ( CFAllocatorRef  allocator,
SecCertificateRef  certificate,
SecKeyRef  privateKey 
)

Referenced by load_cert().

◆ print_tls_error()

static int print_tls_error ( URLContext h,
int  ret 
)
static

Definition at line 52 of file tls_securetransport.c.

Referenced by tls_read(), and tls_write().

◆ import_pem()

static int import_pem ( URLContext h,
char *  path,
CFArrayRef *  array 
)
static

Definition at line 70 of file tls_securetransport.c.

Referenced by load_ca(), and load_cert().

◆ load_ca()

static int load_ca ( URLContext h)
static

Definition at line 133 of file tls_securetransport.c.

Referenced by tls_open().

◆ load_cert()

static int load_cert ( URLContext h)
static

Definition at line 153 of file tls_securetransport.c.

Referenced by tls_open().

◆ tls_read_cb()

static OSStatus tls_read_cb ( SSLConnectionRef  connection,
void *  data,
size_t *  dataLength 
)
static

Definition at line 196 of file tls_securetransport.c.

Referenced by tls_open().

◆ tls_write_cb()

static OSStatus tls_write_cb ( SSLConnectionRef  connection,
const void *  data,
size_t *  dataLength 
)
static

Definition at line 225 of file tls_securetransport.c.

Referenced by tls_open().

◆ tls_close()

static int tls_close ( URLContext h)
static

Definition at line 245 of file tls_securetransport.c.

Referenced by tls_open().

◆ tls_open()

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

Definition at line 268 of file tls_securetransport.c.

◆ map_ssl_error()

static int map_ssl_error ( OSStatus  status,
size_t  processed 
)
static

Definition at line 348 of file tls_securetransport.c.

Referenced by tls_read(), and tls_write().

◆ tls_read()

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

Definition at line 364 of file tls_securetransport.c.

◆ tls_write()

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

Definition at line 381 of file tls_securetransport.c.

◆ tls_get_file_handle()

static int tls_get_file_handle ( URLContext h)
static

Definition at line 394 of file tls_securetransport.c.

Variable Documentation

◆ options

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

Definition at line 400 of file tls_securetransport.c.

Referenced by tls_open().

◆ tls_class

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

Definition at line 405 of file tls_securetransport.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,
.priv_data_size = sizeof(TLSContext),
.priv_data_class = &tls_class,
}

Definition at line 412 of file tls_securetransport.c.

func
int(* func)(AVBPrint *dst, const char *in, const char *arg)
Definition: jacosubdec.c:67
TLSContext
Definition: tls_gnutls.c:48
status
they must not be accessed directly The fifo field contains the frames that are queued in the input for processing by the filter The status_in and status_out fields contains the queued status(EOF or error) of the link
URL_PROTOCOL_FLAG_NETWORK
#define URL_PROTOCOL_FLAG_NETWORK
Definition: url.h:34
tls_open
static int tls_open(URLContext *h, const char *uri, int flags, AVDictionary **options)
Definition: tls_securetransport.c:268
tls_write
static int tls_write(URLContext *h, const uint8_t *buf, int size)
Definition: tls_securetransport.c:381
AVERROR_UNKNOWN
#define AVERROR_UNKNOWN
Unknown error, typically from an external library.
Definition: error.h:71
TLS_COMMON_OPTIONS
#define TLS_COMMON_OPTIONS(pstruct, options_field)
Definition: tls.h:45
fail
#define fail()
Definition: checkasm.h:120
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:176
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:191
tls_get_file_handle
static int tls_get_file_handle(URLContext *h)
Definition: tls_securetransport.c:394
tls_read
static int tls_read(URLContext *h, uint8_t *buf, int size)
Definition: tls_securetransport.c:364
tls_class
static const AVClass tls_class
Definition: tls_securetransport.c:405
tls_close
static int tls_close(URLContext *h)
Definition: tls_securetransport.c:245
options
static const AVOption options[]
Definition: tls_securetransport.c:400
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:565
h
h
Definition: vp9dsp_template.c:2038