Football utility functions.
More...
#include <config.h>
#include <stdio.h>
#include <errno.h>
#include <ctype.h>
#include <stdbool.h>
#include <assert.h>
#include <stdlib.h>
#include <stdarg.h>
#include <memory.h>
#include <time.h>
#include <arpa/inet.h>
#include "fb_public.h"
#include "fb_service.h"
|
| void | fb_set_logging (int logtype, FB_LOGGING_FUNCTION func) |
| | Set logging level. More...
|
| |
| void | fb_log_impl (const char *file, int line, const char *func, int level, const char *format,...) |
| |
| const char * | fb_connection_info (FB_CONNECTION *connection) |
| |
| bool | fb_expandcalloc (void **data, size_t *capacity, size_t newcapacity, size_t itemsize) |
| | calloc() with ability to expand the allocated data. More...
|
| |
| void | fb_destroy_argv (char **argv) |
| |
| int | fb_create_argv (const char *commandline, char ***result) |
| |
| static char | hexvalue (char ch) |
| |
| int | fb_create_argv_from_query_string (const char *query_string, char ***result_names, char ***result_values) |
| |
Football utility functions.
- Football socket abstraction layer
- Author
- Perette Barella
- Date
- 2014-03-26
- Copyright
- Copyright 2012-2020 Devious Fish. All rights reserved.
◆ fb_connection_info()
Return a a connection's opposing end as a string.
- Parameters
-
| connection | the connection to get the string of. |
- Returns
- a string with the info, or a stand-in value.
◆ fb_create_argv()
| int fb_create_argv |
( |
const char * |
commandline, |
|
|
char *** |
result |
|
) |
| |
Create an argv-style array. A command line with nothing on it results in 0 and a pointer to an array with one null.
- Parameters
-
| commandline | The command to split up. This original string remains unaltered. |
| result | The place to put the argv array. |
- Returns
- The number of populated terms in the argv array. On error, returns a negative number and a null pointer.
◆ fb_create_argv_from_query_string()
| int fb_create_argv_from_query_string |
( |
const char * |
query_string, |
|
|
char *** |
result_names, |
|
|
char *** |
result_values |
|
) |
| |
Create arrays of parameter names and values from an HTTP query parameter string. An empty query string results in 0 and pointers arrays with one null.
- Parameters
-
| query_string | The command to split up. This original string remains unaltered. |
| result_names | The place to put the parameter name array reference. |
| result_values | The place to put the parameter value array reference. |
- Returns
- The number of populated terms in the parameter array. On error, returns a negative number and a null pointer.
◆ fb_destroy_argv()
| void fb_destroy_argv |
( |
char ** |
argv | ) |
|
Free up resources used by an argv array.
- Parameters
-
| argv | The array to release. |
◆ fb_expandcalloc()
| bool fb_expandcalloc |
( |
void ** |
data, |
|
|
size_t * |
capacity, |
|
|
size_t |
newcapacity, |
|
|
size_t |
itemsize |
|
) |
| |
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.
- Parameters
-
| 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. |
- Returns
- true on success, false on failure (existing allocation remains valid).
◆ fb_log_impl()
| void fb_log_impl |
( |
const char * |
file, |
|
|
int |
line, |
|
|
const char * |
func, |
|
|
int |
level, |
|
|
const char * |
format, |
|
|
|
... |
|
) |
| |
Default logging implementation: Log stuff to stderr. The file, line, and func parameters are removed for release builds (when NDEBUG is set.) An application can provide an alternative function using the second parameter to fb_set_logging.
- See also
- fb_set_logging
-
FB_WHERE
- Parameters
-
| file | the filename from which the message originates. |
| line | the line number at which the message originates. |
| func | the function from which the message originates. |
| level | a bitmask indicating the type of the message (0=error, always logged) |
| format | a printf-style format string, with parameters to follow. |
◆ fb_set_logging()
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.
- Parameters
-
| logtype | a bitmask indicating which data to log. |
| func | a logging function that replaces the default one. |
◆ hexvalue()
| static char hexvalue |
( |
char |
ch | ) |
|
|
static |
◆ fb_log
◆ logmode