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 "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)
 

Variables

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

Macro Definition Documentation

#define ioErr   -36

Definition at line 41 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)
if()
Definition: avfilter.c:975
#define av_log(a,...)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:176
ret
Definition: avfilter.c:974
int(* func)(AVBPrint *dst, const char *in, const char *arg)
Definition: jacosubdec.c:67
#define AVERROR_UNKNOWN
Unknown error, typically from an external library.
Definition: error.h:71

Definition at line 249 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 51 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 69 of file tls_securetransport.c.

Referenced by load_ca(), and load_cert().

static int load_ca ( URLContext h)
static

Definition at line 127 of file tls_securetransport.c.

Referenced by tls_open().

static int load_cert ( URLContext h)
static

Definition at line 147 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 190 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 215 of file tls_securetransport.c.

Referenced by tls_open().

static int tls_close ( URLContext h)
static

Definition at line 235 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 258 of file tls_securetransport.c.

static int map_ssl_error ( OSStatus  status,
size_t  processed 
)
static

Definition at line 337 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 350 of file tls_securetransport.c.

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

Definition at line 362 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 374 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:62
av_default_item_name
static const AVOption options[]

Definition at line 379 of file tls_securetransport.c.

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,
.priv_data_size = sizeof(TLSContext),
.priv_data_class = &tls_class,
}
static const AVClass tls_class
#define URL_PROTOCOL_FLAG_NETWORK
Definition: url.h:35
static int tls_close(URLContext *h)
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 flags
Definition: cpu.c:47
static int tls_write(URLContext *h, const uint8_t *buf, int size)

Definition at line 386 of file tls_securetransport.c.