football
socket abstraction layer
Loading...
Searching...
No Matches
Macros | Functions | Variables
fb_transport_osx.c File Reference

Football transport implementations for Secure Transport (OS X). More...

#include <config.h>
#include <assert.h>
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include "fb_public.h"
#include "fb_transport.h"
#include "fb_service.h"
#include <CoreFoundation/CoreFoundation.h>
#include <Security/SecCertificate.h>
#include <Security/SecIdentity.h>
#include <Security/SecureTransport.h>

Macros

#define SSLHasClosed(status)   (((status) == errSSLClosedAbort || (status) == errSSLClosedGraceful || (status) == errSSLClosedNoNotify))
 

Functions

char * fb_base64_decode (const char *data, const char *end_data, int *length)
 Decode some base-64 encoded data.
 
char * load_pem_thing (const char *filename, const char *object_type, int *length)
 Extract a base 64 encoded, delimited data block from a PEM formatted file.
 
bool fb_securetransport_configure (const FB_TLS_CONFIG_FILENAMES *paths)
 
OSStatus fb_SSLWriteFunc (SSLConnectionRef connection, const void *data, size_t *dataLength)
 
bool fb_securetransport_init (FB_CONNECTION *connection)
 
ssize_t fb_securetransport_handshake (struct fb_connection_t *connection)
 Perform TLS handshaking on a new connection. Return incomplete, failure, or 0.
 
ssize_t fb_securetransport_buffering (struct fb_connection_t *connection)
 Query number of bytes in TLS buffers.
 
ssize_t fb_securetransport_read (struct fb_connection_t *connection, char *data, ssize_t byte_count)
 
ssize_t fb_securetransport_write (struct fb_connection_t *connection, const char *data, ssize_t byte_count)
 
void fb_securetransport_done (FB_CONNECTION *connection)
 
void fb_securetransport_cleanup ()
 

Variables

CFArrayRef cert_array
 
const FB_TRANSPORT_FUNCS fb_transport_encrypted
 

Detailed Description

Football transport implementations for Secure Transport (OS X).

Function Documentation

◆ fb_base64_decode()

char * fb_base64_decode ( const char *  data,
const char *  end_data,
int *  length 
)

Decode some base-64 encoded data.

Parameters
dataThe start of the data. Whitespace in data is ignored.
end_dataThe end of the data.
lengthThe length of the decoded binary data.
Returns
A pointer to malloc'ed data blocked, or nullptr on error.
Warning
The returned data block must be freed.

◆ load_pem_thing()

char * load_pem_thing ( const char *  filename,
const char *  object_type,
int *  length 
)

Extract a base 64 encoded, delimited data block from a PEM formatted file.

Parameters
filenameThe file.
object_typeThe type of block to extract.
lengthThe length of the resulting data block.
Returns
A pointer to the extracted data blocked, or nullptr on error.
Warning
The returned data block must be freed.

Variable Documentation

◆ fb_transport_encrypted

const FB_TRANSPORT_FUNCS fb_transport_encrypted
Initial value:
= {
.configure = fb_securetransport_configure,
.cleanup = fb_securetransport_cleanup,
.init = fb_securetransport_init,
.read = fb_securetransport_read,
.write = fb_securetransport_write,
.done = fb_securetransport_done
}
ssize_t fb_securetransport_buffering(struct fb_connection_t *connection)
Query number of bytes in TLS buffers.
Definition fb_transport_osx.c:277
ssize_t fb_securetransport_handshake(struct fb_connection_t *connection)
Perform TLS handshaking on a new connection. Return incomplete, failure, or 0.
Definition fb_transport_osx.c:261