trafilo 0.1.0
Streaming event-handler framework in C
Loading...
Searching...
No Matches
trafilo.c File Reference

Data Structures

struct  trafilo_t

Macros

#define QUEUE_CAPACITY   4096
#define MAX_LINE   2048

Functions

static int validate_config (const trafilo_config_t *config)
 Validate the trafilo_config_t state.
trafilo_t * trafilo_create (const trafilo_config_t *config)
 Create a framework instance.
int trafilo_run (trafilo_t *trafilo)
 Run the framework. Blocks until trafilo_shutdown() is called.
void trafilo_shutdown (trafilo_t *trafilo)
 Signal the framework to shut down.
void trafilo_destroy (trafilo_t *trafilo)
 Free all resources.
int trafilo_emit (trafilo_t *trafilo, const char *raw_line, size_t len)
 Push a raw line into the framework's queue, bypassing the socket.

Macro Definition Documentation

◆ MAX_LINE

#define MAX_LINE   2048

◆ QUEUE_CAPACITY

#define QUEUE_CAPACITY   4096

Function Documentation

◆ trafilo_create()

trafilo_t * trafilo_create ( const trafilo_config_t * config)

Create a framework instance.

Parameters
configPointer to the configuration struct.
Returns
New trafilo_t* on success, NULL on invalid config or alloc failure.

◆ trafilo_destroy()

void trafilo_destroy ( trafilo_t * t)

Free all resources.

Parameters
tThe framework instance.

◆ trafilo_emit()

int trafilo_emit ( trafilo_t * t,
const char * raw,
size_t len )

Push a raw line into the framework's queue, bypassing the socket.

Parameters
tThe framework instance.
rawRaw line data.
lenLength of the raw line.
Returns
0 on success, -1 if queue full or framework shutting down.

◆ trafilo_run()

int trafilo_run ( trafilo_t * trafilo)

Run the framework. Blocks until trafilo_shutdown() is called.

Parameters
trafiloThe framework instance.
Returns
0 on clean shutdown, non-zero on error.

◆ trafilo_shutdown()

void trafilo_shutdown ( trafilo_t * trafilo)

Signal the framework to shut down.

Parameters
trafiloThe framework instance.

◆ validate_config()

int validate_config ( const trafilo_config_t * config)
static

Validate the trafilo_config_t state.

Parameters
configThe configuration state
Returns
0 on valid state, -1 on error