Tchatator413
TripEnArvor instant messaging protocol - JSON-based
|
Facade interface. More...
Go to the source code of this file.
Typedefs | |
typedef void(* | fn_on_action_t) (const action_t *action, void *ctx) |
An event handler for when the server has parsed an action. | |
typedef void(* | fn_on_response_t) (const response_t *response, void *ctx) |
An event handler for when the server has interpeted an action. | |
Functions | |
json_object * | tchatator413_interpret (json_object *input, cfg_t *cfg, db_t *db, server_t *server, fn_on_action_t on_action, fn_on_response_t on_response, void *on_ctx) |
Interpret a request. | |
int | tchatator413_run_interactive (cfg_t *cfg, db_t *db, server_t *server, int argc, char **argv) |
Run the server in interactive mode. | |
int | tchatator413_run_socket (cfg_t *cfg, db_t *db, server_t *server) |
Run the server in socket mode. | |
typedef void(* fn_on_action_t) (const action_t *action, void *ctx) |
An event handler for when the server has parsed an action.
Definition at line 16 of file tchatator413.h.
typedef void(* fn_on_response_t) (const response_t *response, void *ctx) |
An event handler for when the server has interpeted an action.
Definition at line 18 of file tchatator413.h.
json_object * tchatator413_interpret | ( | json_object * | input, |
cfg_t * | cfg, | ||
db_t * | db, | ||
server_t * | server, | ||
fn_on_action_t | on_action, | ||
fn_on_response_t | on_response, | ||
void * | on_ctx | ||
) |
Interpret a request.
input | The request JSON object. |
cfg | The configuration. |
db | The database. |
server | The server's state. |
on_action | Event handler to call when the action is parsed. Cab be NULL . |
on_response | Event handler to call when the action is interpreted. Cab be NULL . |
on_ctx | The contect to pass to the previous event handlers. |
int tchatator413_run_interactive | ( | cfg_t * | cfg, |
db_t * | db, | ||
server_t * | server, | ||
int | argc, | ||
char ** | argv | ||
) |
Run the server in interactive mode.
cfg | The configuration. |
db | The database. |
server | The server's state. |
argc | Argument count. |
argv | Argument vector. |