From ad5ed828a0cc9f0c299fffbe9f19f60c016227f3 Mon Sep 17 00:00:00 2001 From: Lammert Bies Date: Mon, 2 Jan 2017 03:15:57 +0100 Subject: [PATCH] Replaced httplib_callbacks with lh_clb_t --- include/libhttp.h | 6 +++--- src/httplib_create_client_context.c | 4 ++-- src/httplib_main.h | 2 +- src/httplib_start.c | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/libhttp.h b/include/libhttp.h index a3be102d..5a330f1b 100644 --- a/include/libhttp.h +++ b/include/libhttp.h @@ -191,7 +191,7 @@ struct client_cert { * https://github.com/lammertb/libhttp/blob/master/docs/UserManual.md */ -struct httplib_callbacks { +struct lh_clb_t { int (*begin_request)( const struct lh_ctx_t *ctx, struct lh_con_t *conn ); void (*end_request)( const struct lh_ctx_t *ctx, const struct lh_con_t *conn, int reply_status_code ); int (*log_message)( const struct lh_ctx_t *ctx, const struct lh_con_t *conn, const char *message ); @@ -620,7 +620,7 @@ LIBHTTP_API int httplib_closedir( DIR *dir ); LIBHTTP_API struct lh_con_t * httplib_connect_client( struct lh_ctx_t *ctx, const char *host, int port, int use_ssl ); LIBHTTP_API struct lh_con_t * httplib_connect_client_secure( struct lh_ctx_t *ctx, const struct httplib_client_options *client_options ); LIBHTTP_API struct lh_con_t * httplib_connect_websocket_client( struct lh_ctx_t *ctx, const char *host, int port, int use_ssl, const char *path, const char *origin, httplib_websocket_data_handler data_func, httplib_websocket_close_handler close_func, void *user_data ); -LIBHTTP_API struct lh_ctx_t * httplib_create_client_context( const struct httplib_callbacks *callbacks, const struct httplib_option_t *options ); +LIBHTTP_API struct lh_ctx_t * httplib_create_client_context( const struct lh_clb_t *callbacks, const struct httplib_option_t *options ); LIBHTTP_API void httplib_cry( enum debug_level_t debug_level, const struct lh_ctx_t *ctx, const struct lh_con_t *conn, PRINTF_FORMAT_STRING(const char *fmt), ...) PRINTF_ARGS(4, 5); LIBHTTP_API void httplib_destroy_client_context( struct lh_ctx_t *ctx ); LIBHTTP_API struct lh_con_t * httplib_download( struct lh_ctx_t *ctx, const char *host, int port, int use_ssl, PRINTF_FORMAT_STRING(const char *request_fmt), ...) PRINTF_ARGS(5, 6); @@ -674,7 +674,7 @@ LIBHTTP_API enum debug_level_t httplib_set_debug_level( struct lh_ctx_t *ctx, en LIBHTTP_API void httplib_set_request_handler( struct lh_ctx_t *ctx, const char *uri, httplib_request_handler handler, void *cbdata ); LIBHTTP_API void httplib_set_user_connection_data( struct lh_con_t *conn, void *data ); LIBHTTP_API void httplib_set_websocket_handler( struct lh_ctx_t *ctx, const char *uri, httplib_websocket_connect_handler connect_handler, httplib_websocket_ready_handler ready_handler, httplib_websocket_data_handler data_handler, httplib_websocket_close_handler close_handler, void *cbdata ); -LIBHTTP_API struct lh_ctx_t * httplib_start(const struct httplib_callbacks *callbacks, void *user_data, const struct httplib_option_t *options ); +LIBHTTP_API struct lh_ctx_t * httplib_start( const struct lh_clb_t *callbacks, void *user_data, const struct httplib_option_t *options ); LIBHTTP_API void httplib_stop( struct lh_ctx_t *ctx ); LIBHTTP_API int64_t httplib_store_body( const struct lh_ctx_t *ctx, struct lh_con_t *conn, const char *path ); LIBHTTP_API int httplib_strcasecmp( const char *s1, const char *s2 ); diff --git a/src/httplib_create_client_context.c b/src/httplib_create_client_context.c index fee1ebbf..a03fb9da 100644 --- a/src/httplib_create_client_context.c +++ b/src/httplib_create_client_context.c @@ -23,7 +23,7 @@ #include "httplib_main.h" /* - * struct lh_ctx_t *httplib_create_client_context( const struct httplib_callbacks *callbacks, const struct httplib_option_t *options ); + * struct lh_ctx_t *httplib_create_client_context( const struct lh_clb_t *callbacks, const struct httplib_option_t *options ); * * The function httplib_create_client_context() creates a context to be used * for one simultaneous client connection. It is not possible to use one client @@ -31,7 +31,7 @@ * contains SSL context information which is specific for one connection. */ -struct lh_ctx_t *httplib_create_client_context( const struct httplib_callbacks *callbacks, const struct httplib_option_t *options ) { +struct lh_ctx_t *httplib_create_client_context( const struct lh_clb_t *callbacks, const struct httplib_option_t *options ) { struct lh_ctx_t *ctx; void (*exit_callback)(const struct lh_ctx_t *ctx); diff --git a/src/httplib_main.h b/src/httplib_main.h index 4c657f7c..06056063 100644 --- a/src/httplib_main.h +++ b/src/httplib_main.h @@ -525,7 +525,7 @@ struct lh_ctx_t { volatile enum ctx_status_t status; /* Should we stop event loop */ SSL_CTX *ssl_ctx; /* SSL context */ - struct httplib_callbacks callbacks; /* User-defined callback function */ + struct lh_clb_t callbacks; /* User-defined callback function */ void *user_data; /* User-defined data */ enum ctx_type_t ctx_type; /* CTX_TYPE_SERVER or CTX_TYPE_CLIENT */ diff --git a/src/httplib_start.c b/src/httplib_start.c index a5bbc6da..2eff7f90 100644 --- a/src/httplib_start.c +++ b/src/httplib_start.c @@ -32,14 +32,14 @@ #include "httplib_utils.h" /* - * struct lh_ctx_t *httplib_start( const struct httplib_callbacks *callbacks, void *user_data, const struct httplib_t *options ); + * struct lh_ctx_t *httplib_start( const struct lh_clb_t *callbacks, void *user_data, const struct httplib_t *options ); * * The function httplib_start() functions as the main entry point for the LibHTTP * server. The function starts all threads and when finished returns the * context to the running server for future reference. */ -struct lh_ctx_t *httplib_start( const struct httplib_callbacks *callbacks, void *user_data, const struct httplib_option_t *options ) { +struct lh_ctx_t *httplib_start( const struct lh_clb_t *callbacks, void *user_data, const struct httplib_option_t *options ) { struct lh_ctx_t *ctx; int i;