9 #ifndef __football__transport__
10 #define __football__transport__
19 #if defined(HAVE_LIBGNUTLS)
21 #include <gnutls/gnutls.h>
22 typedef gnutls_session_t FB_TLS_CONTEXT;
24 #elif defined(HAVE_LIBMBEDTLS)
26 #pragma GCC diagnostic push
27 #pragma GCC diagnostic ignored "-Wdocumentation"
28 #include <mbedtls/ssl.h>
29 #pragma GCC diagnostic pop
31 typedef struct fb_tls_context_t {
32 mbedtls_ssl_context context;
34 unsigned char buffered_char;
37 #elif defined(HAVE_LIBTLS)
39 typedef struct fb_tls_context_t {
45 #elif defined(HAVE_LIBSSL)
47 #include <openssl/ssl.h>
49 typedef SSL *FB_TLS_CONTEXT;
51 #elif defined(HAVE_SECURETRANSPORT)
53 #include <Security/SecureTransport.h>
55 typedef SSLContextRef FB_TLS_CONTEXT;
Football public declarations.
const FB_TRANSPORT_FUNCS fb_transport_unencrypted
Transport virtual method table for unenrypted connections.
Definition: fb_transport.c:104
const ssize_t FB_TRANSPORT_INCOMPLETE
An action was incomplete, but can be retried in the future.
Definition: fb_transport.c:35
struct fb_transport_funcs_t FB_TRANSPORT_FUNCS
const FB_TRANSPORT_FUNCS fb_transport_read_file
Transport virtual method table for reading from files.
Definition: fb_transport.c:159
const ssize_t FB_TRANSPORT_FAILURE
An action failed permanently; the connection has failed and should be closed.
Definition: fb_transport.c:38
const ssize_t FB_TRANSPORT_CLOSED
Connection closed normally. Returned by read transport function only.
Definition: fb_transport.c:32
struct fb_config_files_t FB_TLS_CONFIG_FILENAMES
Structure with various I/O functions.
const FB_TRANSPORT_FUNCS fb_transport_encrypted
Definition: fb_transport_gnutls.c:174
Structure with various I/O functions.
Definition: fb_transport.h:68
char * x509_revokation_name
Definition: fb_transport.h:71
char * public_key_name
Definition: fb_transport.h:69
char * x509_certificate_name
Definition: fb_transport.h:70
Connection state information.
Definition: fb_service.h:199
Definition: fb_transport.h:74
void(* done)(FB_CONNECTION *connection)
Clean up a closing connection.
Definition: fb_transport.h:91
void(* cleanup)()
One-time teardown before exit. Not called per-connection.
Definition: fb_transport.h:78
bool(* init)(FB_CONNECTION *connection)
Initialize a new connection. Return true on success, 0 on failure.
Definition: fb_transport.h:81
ssize_t(* write)(struct fb_connection_t *connection, const char *data, ssize_t byte_count)
Write data to a connection. Return incomplete, failure, or bytes written (0 is not an error).
Definition: fb_transport.h:89
ssize_t(* buffering)(struct fb_connection_t *connection)
Query number of bytes in TLS buffers.
Definition: fb_transport.h:85
bool(* configure)(const FB_TLS_CONFIG_FILENAMES *files)
One-time initialization on startup. Not called per-connection.
Definition: fb_transport.h:76
ssize_t(* handshake)(struct fb_connection_t *connection)
Perform TLS handshaking on a new connection. Return incomplete, failure, or 0.
Definition: fb_transport.h:83
ssize_t(* read)(struct fb_connection_t *connection, char *data, ssize_t byte_count)
Read data from a connection. Return transport constant or bytes read.
Definition: fb_transport.h:87