|
football
socket abstraction layer
|
Football public declarations. More...
#include <config.h>#include <stdarg.h>#include <stdbool.h>#include <sys/types.h>#include <netinet/in.h>Go to the source code of this file.
Data Structures | |
| struct | fb_event_t |
| Events are returned in this structure. More... | |
| struct | fb_service_options_t |
| Service options are passed to a new service, defining its behavior. More... | |
Typedefs | |
| typedef enum fb_event_type_t | FB_EVENTTYPE |
| Event types returned from the socket manager. | |
| typedef struct fb_event_t | FB_EVENT |
| Events are returned in this structure. | |
| typedef enum fb_service_greeting_mode_t | FB_GREETING_MODE |
| Greeting mode allows a service to require, accept, or not use greetings to trigger a line session via the HTTP or TLS port. | |
| typedef enum fb_internationalizaton_mode_t | FB_I18N_MODE |
| Internationalization mode– how to mangle filenames for language-specific files. | |
| typedef struct fb_service_options_t | FB_SERVICE_OPTIONS |
| Service options are passed to a new service, defining its behavior. | |
| typedef struct fb_service_t | FB_SERVICE |
| typedef struct fb_connection_t | FB_CONNECTION |
| typedef struct fb_iterator_t | FB_ITERATOR |
| typedef void(* | FB_LOGGING_FUNCTION) (const char *file, int line, const char *func, int level, const char *format,...) |
Enumerations | |
| enum | fb_event_type_t { FB_EVENT_CONNECT = 1 , FB_EVENT_INPUT , FB_EVENT_CLOSE , FB_EVENT_STOPPED , FB_EVENT_ITERATOR , FB_EVENT_ITERATOR_CLOSE , FB_EVENT_WRITABLE , FB_EVENT_READABLE , FB_EVENT_FAULTING , FB_EVENT_TIMEOUT , FB_EVENT_INTERRUPT } |
| Event types returned from the socket manager. More... | |
| enum | fb_service_greeting_mode_t { FB_GREETING_OFF , FB_GREETING_ALLOW , FB_GREETING_FALLBACK , FB_GREETING_REQUIRE } |
| Greeting mode allows a service to require, accept, or not use greetings to trigger a line session via the HTTP or TLS port. More... | |
| enum | fb_internationalizaton_mode_t { FB_INTERNATIONALIZATION_NONE , FB_INTERNATIONALIZATION_EXTENSION , FB_INTERNATIONALIZATION_DIRECTORY } |
| Internationalization mode– how to mangle filenames for language-specific files. More... | |
Functions | |
| void | fb_set_logging (int logtype, FB_LOGGING_FUNCTION func) |
| Set logging level. | |
| bool | fb_expandcalloc (void **data, size_t *count, size_t newcount, size_t itemsize) |
| calloc() with ability to expand the allocated data. | |
| FB_EVENT * | fb_wait (void) |
| Poll indefinitely. | |
| FB_EVENT * | fb_poll (void) |
| Quick poll with no waiting. | |
| FB_EVENT * | fb_poll_until (time_t untilwhen) |
| Poll with a timeout at a specific time. | |
| FB_EVENT * | fb_poll_with_timeout (double timeout) |
| Poll with a duration. | |
| void | fb_interrupt (void) |
| Return an FB_EVENT_INTERRUPTED on current or next poll. | |
| FB_SERVICE * | fb_create_service (const FB_SERVICE_OPTIONS *options) |
| Create a new service and initialize its listeners. | |
| bool | fb_transfer (FB_CONNECTION *connection, FB_SERVICE *service) |
| Transfer a connection to a new service. | |
| bool | fb_services_are_open (void) |
| Indicate whether there are any services open. | |
| void | fb_close_service (FB_SERVICE *service) |
| Initiate closure of a service. | |
| bool | fb_init_tls_support (const char *path) |
| void | fb_cleanup_tls_support (void) |
| FB_EVENT * | fb_accept_file (FB_SERVICE *service, char *filename) |
| Make a connection that reads from a file. | |
| FB_EVENT * | fb_loopback_socket (FB_SERVICE *service) |
| Make a connection with a pipe. | |
| void | fb_close_connection (FB_CONNECTION *connection) |
| Initiate connection closure. | |
| ssize_t | fb_fprint (void *thing, const char *bytes, ssize_t length) |
| Adds an unformatted message to the output queue. | |
| ssize_t | fb_fprintf (void *thing, const char *format,...) |
| Add messages to output queues in various forms and styles. | |
| ssize_t | fb_vfprintf (void *thing, const char *format, va_list parameters) |
| ssize_t | fb_bfprintf (void *thing, const char *format,...) |
| ssize_t | fb_bvfprintf (void *thing, const char *format, va_list parameters) |
| ssize_t | fb_cbfprintf (void *thing, bool(*callback)(FB_CONNECTION *), const char *format,...) |
| ssize_t | fb_cbvfprintf (void *thing, bool(*callback)(FB_CONNECTION *), const char *format, va_list parameters) |
| FB_ITERATOR * | fb_new_iterator (FB_SERVICE *service) |
| Create a new iterator. | |
| FB_EVENT * | fb_iterate_next (struct fb_iterator_t *it) |
| Get the next iteration. | |
| void | fb_destroy_iterator (FB_ITERATOR *it) |
| Destroy an iterator and release its resources. | |
| void | fb_accept_input (FB_CONNECTION *connection, bool input) |
| Public interface to enable/disable reading on a connection. | |
Variables | |
| FB_LOGGING_FUNCTION | fb_log |
Football public declarations.
| typedef enum fb_event_type_t FB_EVENTTYPE |
Event types returned from the socket manager.
For FB_EVENT_CONNECT on HTTP or TLS ports, the event occurs when the session greets or begins a websocket session. Connections may silently exist in the socket manager before that.
| typedef enum fb_service_greeting_mode_t FB_GREETING_MODE |
Greeting mode allows a service to require, accept, or not use greetings to trigger a line session via the HTTP or TLS port.
Greetings reduce port pollution, and encrypted line sessions are only supported via greeting.
| enum fb_event_type_t |
Event types returned from the socket manager.
For FB_EVENT_CONNECT on HTTP or TLS ports, the event occurs when the session greets or begins a websocket session. Connections may silently exist in the socket manager before that.
Greeting mode allows a service to require, accept, or not use greetings to trigger a line session via the HTTP or TLS port.
Greetings reduce port pollution, and encrypted line sessions are only supported via greeting.
|
extern |
Make a connection that reads from a file.
| service | the service to register the connection with |
| filename | the file to read from |
|
extern |
Public interface to enable/disable reading on a connection.
| connection | - the connection to adjust. |
| input | true to enable reading, false to disable. |
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
Initiate connection closure.
If the socket is in an open state, change its state and enable writes. The next write attempt will generate a close event. If the connection is already on its way out, leave it alone.
| connection | the connection to close |
|
extern |
Initiate closure of a service.
|
extern |
Create a new service and initialize its listeners.
Subsequent changes made to the options do not effect behavior.
| options | Options for the new service's behavior. |
|
extern |
Destroy an iterator and release its resources.
| it | The iterator |
|
extern |
calloc() with ability to expand the allocated data.
Does nothing if the actual capacity meets or exceeds the requested capacity. When expansion occurs, the added elements are zeroed out.
| data | the allocation to expand. May be *NULL for initial allocation. |
| capacity | the capacity of the allocation, which may be adjusted by this call. |
| newcapacity | the desired capacity of the allocation. |
| itemsize | the size of data items in the allocation. |
|
extern |
Adds an unformatted message to the output queue.
| thing | the destined service, connection or event. |
| bytes | the bytes to transmit. |
| length | number of bytes in the message. |
|
extern |
Add messages to output queues in various forms and styles.
All forms take an opaque type and determine if it's a connection or service, so you can write code once and deal with both single and broadcast messages.
true.| thing | the destined service, connection or event. |
| format | a printf format string, with values to follow. |
|
extern |
Get the next iteration.
| it | The iterator |
|
extern |
Make a connection with a pipe.
| service | the service to register the connection with |
|
extern |
Create a new iterator.
Create and initialize a new iterator for a service.
|
extern |
Quick poll with no waiting.
|
extern |
Poll with a timeout at a specific time.
| untilwhen | Time at which timeout should occur. |
|
extern |
Poll with a duration.
| timeout | in seconds. |
|
extern |
Indicate whether there are any services open.
|
extern |
Set logging level.
Set which messages will be collected by the internal logging function, or provide an alternate logging function. When using a private logging function, logtype is not used.
| logtype | a bitmask indicating which data to log. |
| func | a logging function that replaces the default one. |
|
extern |
Transfer a connection to a new service.
| connection | The connection to transfer. |
| service | The service to reassign it to. |
|
extern |
|
extern |
Poll indefinitely.