AISL Instance Type and Functions

/* @file aisl/types.h */

typedef struct aisl_instance * AislInstance;

Pointer of this type represents library engine instance. One instance can run several independent HTTP servers on different network sockets.

Functions


Function aisl_new

A constructor of AislInstance type.

AislInstance
aisl_new(const struct aisl_cfg *cfg);

Arguments

Return value

Pointer to an AislInstance or NULL if out of memory.


Function aisl_free

A destructor of AislInstance object.

void
aisl_free(AislInstance instance);

Arguments

Return value

Returns no value.


Function aisl_run_cycle

Performs an engine work cycle including all queued read and write sockets operations, accepts new clients and triggers engine events. Should be called periodically in a main loop of the application.

AislStatus
aisl_run_cycle(AislInstance instance);

Arguments

Return value

Return value handling should be soft. It is completely safe to continue program execution even if error value was returned.

To preserve CPU time it is recommended to add a delay between aisl_run_cycle calls, at least if anything but AISL_SUCCESS has been returned. You may want to use aisl_sleep for this.


Function aisl_sleep

This function runs select system call inside on all opened sockets for read or write depending on a stream state for user defined timeout.

AislStatus
aisl_sleep(AislInstance instance, uint32_t usec);

Arguments

Return value