Tchatator413
TripEnArvor instant messaging protocol - JSON-based
|
Tchatator413 dynamic server state - Interface. More...
Go to the source code of this file.
Data Structures | |
struct | user_stats_t |
Typedefs | |
typedef struct server | server_t |
Opaque type handle representing a server instance. | |
Functions | |
server_t * | server_create (api_key_t admin_api_key, char const *admin_password) |
Creates a new server instance. | |
void | server_destroy (server_t *server) |
Destroys the specified server instance. | |
token_t | server_login (server_t *server, serial_t user_id) |
Creates a new session, logging in an user. | |
bool | server_is_admin_api_key (server_t *server, api_key_t api_key) |
Checks if an API key is the admin API key. | |
bool | server_check_admin_password (server_t *server, char const *password) |
Check a password against the admin password. | |
bool | server_logout (server_t *server, token_t token) |
Deletes a session, logging out an user. | |
serial_t | server_verify_token (server_t *server, token_t token) |
Verifies a token, returning its owning user ID. | |
typedef struct server server_t |
bool server_check_admin_password | ( | server_t * | server, |
char const * | password | ||
) |
Check a password against the admin password.
server | The server. |
password | The password to check. |
true
if the provided password matches the admin password. false
otherwise. Creates a new server instance.
admin_api_key | The admin API key. |
admin_password | The admin password. |
void server_destroy | ( | server_t * | server | ) |
Destroys the specified server instance.
server | The server instance to destroy. |
Checks if an API key is the admin API key.
server | The server. |
api_key | The API key to check. |
true
if api_key
is the admin API key. false
otherwise. Creates a new session, logging in an user.
server | The server. |
user_id | The ID of the user to login. |
0
if the the session could not be created. This happens if the same user tries logs in twice in the same second. Deletes a session, logging out an user.
server | The server. |
token | The session token to invalidate. |
true
on successful log out. false
if the token is invalid.