FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
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_securetransport_protocol
 

Macro Definition Documentation

#define ioErr   -36

Definition at line 42 of file tls_securetransport.c.

Referenced by print_tls_error(), tls_read_cb(), and tls_write_cb().

#define CHECK_ERROR (   func,
  ... 
)
Value:
do { \
OSStatus status = func(__VA_ARGS__); \
if (status != noErr) { \
av_log(h, AV_LOG_ERROR, #func ": Error %i\n", (int)status); \
goto fail; \
} \
} while (0)
#define av_log(a,...)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:176
#define fail()
Definition: checkasm.h:109
int(* func)(AVBPrint *dst, const char *in, const char *arg)
Definition: jacosubdec.c:67
if(ret< 0)
Definition: vf_mcdeint.c:279
#define AVERROR_UNKNOWN
Unknown error, typically from an external library.
Definition: error.h:71

Definition at line 251 of file tls_securetransport.c.

Referenced by tls_open().

Function Documentation

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

Referenced by load_cert().

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().

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().

static int load_ca ( URLContext h)
static

Definition at line 129 of file tls_securetransport.c.

Referenced by tls_open().

static int load_cert ( URLContext h)
static

Definition at line 149 of file tls_securetransport.c.

Referenced by tls_open().

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

Definition at line 192 of file tls_securetransport.c.

Referenced by tls_open().

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

Definition at line 217 of file tls_securetransport.c.

Referenced by tls_open().

static int tls_close ( URLContext h)
static

Definition at line 237 of file tls_securetransport.c.

Referenced by tls_open().

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

Definition at line 260 of file tls_securetransport.c.

static int map_ssl_error ( OSStatus  status,
size_t  processed 
)
static

Definition at line 339 of file tls_securetransport.c.

Referenced by tls_read(), and tls_write().

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

Definition at line 352 of file tls_securetransport.c.

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

Definition at line 365 of file tls_securetransport.c.

static int tls_get_file_handle ( URLContext h)
static

Definition at line 378 of file tls_securetransport.c.

Variable Documentation

const AVOption options[]
static
Initial value:
= {
{ NULL }
}
#define NULL
Definition: coverity.c:32
#define TLS_COMMON_OPTIONS(pstruct, options_field)
Definition: tls.h:47

Definition at line 384 of file tls_securetransport.c.

const AVClass tls_class
static
Initial value:
= {
.class_name = "tls",
.item_name = av_default_item_name,
.option = options,
}
#define LIBAVUTIL_VERSION_INT
Definition: version.h:86
av_default_item_name
static const AVOption options[]

Definition at line 389 of file tls_securetransport.c.

const URLProtocol ff_tls_securetransport_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,
}
static const AVClass tls_class
static int tls_get_file_handle(URLContext *h)
#define URL_PROTOCOL_FLAG_NETWORK
Definition: url.h:34
static int tls_close(URLContext *h)
static int tls_open(URLContext *h, const char *uri, int flags, AVDictionary **options)
static int flags
Definition: log.c:57
static int tls_read(URLContext *h, uint8_t *buf, int size)
static int tls_write(URLContext *h, const uint8_t *buf, int size)

Definition at line 396 of file tls_securetransport.c.