libasyncd
|
Main core logic of the server implementation. More...
Go to the source code of this file.
Functions | |
enum ad_log_e | ad_log_level (enum ad_log_e log_level) |
Set debug output level. More... | |
ad_server_t * | ad_server_new (void) |
Create a server object. More... | |
int | ad_server_start (ad_server_t *server) |
Start server. More... | |
void | ad_server_stop (ad_server_t *server) |
Stop server. More... | |
void | ad_server_free (ad_server_t *server) |
Release server object and all the resources. More... | |
void | ad_server_global_free (void) |
Clean up all the global objects. More... | |
void | ad_server_set_option (ad_server_t *server, const char *key, const char *value) |
Set server option. More... | |
char * | ad_server_get_option (ad_server_t *server, const char *key) |
Retrieve server option. More... | |
int | ad_server_get_option_int (ad_server_t *server, const char *key) |
Retrieve server option in integer format. More... | |
SSL_CTX * | ad_server_ssl_ctx_create_simple (const char *cert_path, const char *pkey_path) |
Helper method for creating minimal OpenSSL SSL_CTX object. More... | |
void | ad_server_set_ssl_ctx (ad_server_t *server, SSL_CTX *sslctx) |
Attach OpenSSL SSL_CTX to the server. More... | |
SSL_CTX * | ad_server_get_ssl_ctx (ad_server_t *server) |
Get OpenSSL SSL_CTX object. More... | |
qhashtbl_t * | ad_server_get_stats (ad_server_t *server, const char *key) |
Return internal statistic counter map. More... | |
void | ad_server_register_hook (ad_server_t *server, ad_callback cb, void *userdata) |
Register user hook. More... | |
void | ad_server_register_hook_on_method (ad_server_t *server, const char *method, ad_callback cb, void *userdata) |
Register user hook on method name. More... | |
void * | ad_conn_set_userdata (ad_conn_t *conn, const void *userdata, ad_userdata_free_cb free_cb) |
Attach userdata into the connection. More... | |
void * | ad_conn_get_userdata (ad_conn_t *conn) |
Get userdata attached in the connection. More... | |
void * | ad_conn_set_extra (ad_conn_t *conn, const void *extra, ad_userdata_free_cb free_cb) |
Set extra userdata into the connection. More... | |
void * | ad_conn_get_extra (ad_conn_t *conn) |
Get extra userdata attached in this connection. More... | |
void | ad_conn_set_method (ad_conn_t *conn, char *method) |
Set method name on this connection. More... | |
int | ad_conn_get_socket (ad_conn_t *conn) |
Return socket file descriptor associated with a connection. More... | |
Variables | |
int | _ad_log_level = AD_LOG_WARN |
Main core logic of the server implementation.
Definition in file ad_server.c.
Set debug output level.
debug_level | debug output level. 0 to disable. |
Definition at line 126 of file ad_server.c.
ad_server_t* ad_server_new | ( | void | ) |
Create a server object.
Definition at line 135 of file ad_server.c.
int ad_server_start | ( | ad_server_t * | server | ) |
void ad_server_stop | ( | ad_server_t * | server | ) |
Stop server.
This call is be used to stop a server from different thread.
Definition at line 287 of file ad_server.c.
void ad_server_free | ( | ad_server_t * | server | ) |
Release server object and all the resources.
Definition at line 303 of file ad_server.c.
void ad_server_global_free | ( | void | ) |
Clean up all the global objects.
This will make memory-leak checkers happy. There are globally shared resources in libevent and openssl and it's usually not a problem since they don't grow but having these can confuse some debugging tools into thinking as memory leak. If you need to make sure that libasyncd has released all internal library-global data structures, call this.
Definition at line 352 of file ad_server.c.
void ad_server_set_option | ( | ad_server_t * | server, |
const char * | key, | ||
const char * | value | ||
) |
char* ad_server_get_option | ( | ad_server_t * | server, |
const char * | key | ||
) |
Retrieve server option.
Definition at line 377 of file ad_server.c.
int ad_server_get_option_int | ( | ad_server_t * | server, |
const char * | key | ||
) |
Retrieve server option in integer format.
Definition at line 384 of file ad_server.c.
SSL_CTX* ad_server_ssl_ctx_create_simple | ( | const char * | cert_path, |
const char * | pkey_path | ||
) |
Helper method for creating minimal OpenSSL SSL_CTX object.
cert_path | path to a PEM encoded certificate file |
pkey_path | path to a PEM encoded private key file |
Definition at line 404 of file ad_server.c.
void ad_server_set_ssl_ctx | ( | ad_server_t * | server, |
SSL_CTX * | sslctx | ||
) |
Attach OpenSSL SSL_CTX to the server.
server | a valid server instance |
sslctx | allocated and configured SSL_CTX object |
Definition at line 434 of file ad_server.c.
SSL_CTX* ad_server_get_ssl_ctx | ( | ad_server_t * | server | ) |
Get OpenSSL SSL_CTX object.
server | a valid server instance |
Definition at line 454 of file ad_server.c.
qhashtbl_t* ad_server_get_stats | ( | ad_server_t * | server, |
const char * | key | ||
) |
Return internal statistic counter map.
Definition at line 461 of file ad_server.c.
void ad_server_register_hook | ( | ad_server_t * | server, |
ad_callback | cb, | ||
void * | userdata | ||
) |
Register user hook.
Definition at line 468 of file ad_server.c.
void ad_server_register_hook_on_method | ( | ad_server_t * | server, |
const char * | method, | ||
ad_callback | cb, | ||
void * | userdata | ||
) |
Register user hook on method name.
Definition at line 475 of file ad_server.c.
void* ad_conn_set_userdata | ( | ad_conn_t * | conn, |
const void * | userdata, | ||
ad_userdata_free_cb | free_cb | ||
) |
Attach userdata into the connection.
Definition at line 490 of file ad_server.c.
void* ad_conn_get_userdata | ( | ad_conn_t * | conn | ) |
Get userdata attached in the connection.
Definition at line 499 of file ad_server.c.
void* ad_conn_set_extra | ( | ad_conn_t * | conn, |
const void * | extra, | ||
ad_userdata_free_cb | free_cb | ||
) |
Set extra userdata into the connection.
Definition at line 513 of file ad_server.c.
void* ad_conn_get_extra | ( | ad_conn_t * | conn | ) |
Get extra userdata attached in this connection.
Definition at line 520 of file ad_server.c.
void ad_conn_set_method | ( | ad_conn_t * | conn, |
char * | method | ||
) |
Set method name on this connection.
Once the method name is set, hooks registered by ad_server_register_hook_on_method() will be called if method name matches with the registered name.
Definition at line 532 of file ad_server.c.
int ad_conn_get_socket | ( | ad_conn_t * | conn | ) |
Return socket file descriptor associated with a connection.
Definition at line 543 of file ad_server.c.
int _ad_log_level = AD_LOG_WARN |
Definition at line 108 of file ad_server.c.