23 #ifndef CIVETWEB_HEADER_INCLUDED
24 #define CIVETWEB_HEADER_INCLUDED
26 #define CIVETWEB_VERSION "1.8"
30 #if defined(CIVETWEB_DLL_EXPORTS)
31 #define CIVETWEB_API __declspec(dllexport)
32 #elif defined(CIVETWEB_DLL_IMPORTS)
33 #define CIVETWEB_API __declspec(dllimport)
38 #define CIVETWEB_API __attribute__((visibility("default")))
72 #if defined(MG_LEGACY_INTERFACE)
117 int (*
log_message)(
const struct mg_connection *,
const char *message);
121 int (*
log_access)(
const struct mg_connection *,
const char *message);
130 int (*
init_ssl)(
void *ssl_context,
void *user_data);
132 #if defined(MG_LEGACY_INTERFACE)
138 int (*websocket_connect)(
const struct mg_connection *);
143 void (*websocket_ready)(
struct mg_connection *);
154 int (*websocket_data)(
struct mg_connection *,
178 const char *(*open_file)(
const struct mg_connection *,
188 #if defined(MG_LEGACY_INTERFACE)
194 void (*upload)(
struct mg_connection *,
const char *file_name);
256 const char **configuration_options);
414 #if defined(MG_LEGACY_INTERFACE)
420 CIVETWEB_API const char **mg_get_valid_option_names(
void);
472 mg_get_ports(
const struct mg_context *ctx,
size_t size,
int *ports,
int *ssl);
490 const char *password);
551 #if defined(MG_LEGACY_INTERFACE)
552 #define mg_lock mg_lock_connection
553 #define mg_unlock mg_unlock_connection
575 #undef PRINTF_FORMAT_STRING
576 #if defined(_MSC_VER) && _MSC_VER >= 1400
578 #if defined(_MSC_VER) && _MSC_VER > 1400
579 #define PRINTF_FORMAT_STRING(s) _Printf_format_string_ s
581 #define PRINTF_FORMAT_STRING(s) __format_string s
584 #define PRINTF_FORMAT_STRING(s) s
588 #define PRINTF_ARGS(x, y) __attribute__((format(printf, x, y)))
590 #define PRINTF_ARGS(x, y)
663 const
char *var_name,
693 const
char *var_name,
713 const
char *var_name,
738 size_t error_buffer_size,
747 #if defined(MG_LEGACY_INTERFACE)
753 const char *destination_dir);
780 const char *filename,
852 typedef void *(*mg_thread_func_t)(
void *);
880 int is_form_url_encoded);
907 ...) PRINTF_ARGS(2, 3);
938 size_t error_buffer_size,
962 size_t error_buffer_size);
977 size_t error_buffer_size);
int mg_get_var2(const char *data, size_t data_len, const char *name, char *dst, size_t dst_len, size_t occurrence)
int mg_get_response(struct mg_connection *conn, char *ebuf, size_t ebuf_len, int timeout)
int mg_url_decode(const char *src, int src_len, char *dst, int dst_len, int is_form_url_encoded)
void(* exit_context)(const struct mg_context *ctx)
size_t mg_get_ports(const struct mg_context *ctx, size_t size, int *ports, int *ssl)
int mg_modify_passwords_file(const char *fname, const char *domain, const char *user, const char *pass)
struct mg_option * mg_get_valid_options(void)
int mg_get_server_ports(const struct mg_context *ctx, int size, struct mg_server_ports *ports)
void mg_set_user_connection_data(struct mg_connection *conn, void *data)
int mg_start_thread(mg_thread_func_t func, void *param)
void(* end_request)(const struct mg_connection *, int reply_status_code)
#define PRINTF_ARGS(x, y)
void mg_unlock_context(struct mg_context *ctx)
int mg_read(struct mg_connection *conn, void *buf, size_t len)
const char * mg_version(void)
struct mg_request_info * mg_get_request_info(const struct mg_connection *conn)
void mg_stop(struct mg_context *ctx)
void mg_cry(const struct mg_connection *conn, const char *fmt,...)
int mg_get_cookie(const char *cookie_header, const char *var_name, char *dst, size_t dst_size)
struct mg_request_info::mg_header http_headers[64]
void mg_unlock_connection(struct mg_connection *conn)
void(* init_context)(const struct mg_context *ctx)
const char * default_value
int(* mg_authorization_handler)(struct mg_connection *conn, void *cbdata)
const char * mg_get_option(const struct mg_context *ctx, const char *name)
void mg_send_mime_file(struct mg_connection *conn, const char *path, const char *mime_type)
#define PRINTF_FORMAT_STRING(s)
int(* log_access)(const struct mg_connection *, const char *message)
const char * request_method
struct mg_connection * mg_connect_websocket_client(const char *host, int port, int use_ssl, char *error_buffer, size_t error_buffer_size, const char *path, const char *origin, mg_websocket_data_handler data_func, mg_websocket_close_handler close_func, void *user_data)
void mg_set_auth_handler(struct mg_context *ctx, const char *uri, mg_request_handler handler, void *cbdata)
void mg_set_request_handler(struct mg_context *ctx, const char *uri, mg_request_handler handler, void *cbdata)
int(* log_message)(const struct mg_connection *, const char *message)
struct mg_connection * mg_connect_client(const char *host, int port, int use_ssl, char *error_buffer, size_t error_buffer_size)
int(* http_error)(struct mg_connection *, int status)
long long mg_store_body(struct mg_connection *conn, const char *path)
void mg_send_file(struct mg_connection *conn, const char *path)
int mg_printf(struct mg_connection *conn, const char *fmt,...)
char * mg_md5(char buf[33],...)
int mg_url_encode(const char *src, char *dst, size_t dst_len)
unsigned mg_check_feature(unsigned feature)
void(* mg_websocket_close_handler)(const struct mg_connection *, void *)
const char * http_version
void mg_lock_connection(struct mg_connection *conn)
const char * mg_get_response_code_text(struct mg_connection *conn, int response_code)
CIVETWEB_API struct mg_connection * mg_connect_client_secure(const struct mg_client_options *client_options, char *error_buffer, size_t error_buffer_size)
struct mg_context * mg_start(const struct mg_callbacks *callbacks, void *user_data, const char **options)
int mg_write(struct mg_connection *conn, const void *buf, size_t len)
int(* mg_request_handler)(struct mg_connection *conn, void *cbdata)
int(* init_ssl)(void *ssl_context, void *user_data)
void mg_close_connection(struct mg_connection *conn)
int mg_strcasecmp(const char *s1, const char *s2)
struct mg_connection * mg_download(const char *host, int port, int use_ssl, char *ebuf, size_t ebuf_len, const char *fmt,...)
void(* init_thread)(const struct mg_context *ctx, int thread_type)
const char * mg_get_header(const struct mg_connection *conn, const char *name)
CIVETWEB_API int mg_websocket_write(struct mg_connection *conn, int opcode, const char *data, size_t data_len)
void * mg_get_user_data(const struct mg_context *ctx)
void(* connection_close)(const struct mg_connection *)
int(* begin_request)(struct mg_connection *)
int(* mg_websocket_connect_handler)(const struct mg_connection *, void *)
typedef void((*Func_t)())
void(* mg_websocket_ready_handler)(struct mg_connection *, void *)
const char * mg_get_builtin_mime_type(const char *path)
void * mg_get_user_connection_data(const struct mg_connection *conn)
void mg_lock_context(struct mg_context *ctx)
CIVETWEB_API int mg_handle_form_request(struct mg_connection *conn, struct mg_form_data_handler *fdh)
int(* mg_websocket_data_handler)(struct mg_connection *, int, char *, size_t, void *)
CIVETWEB_API int mg_websocket_client_write(struct mg_connection *conn, int opcode, const char *data, size_t data_len)
const char * query_string
void(* init_lua)(const struct mg_connection *, void *lua_context)
int mg_get_var(const char *data, size_t data_len, const char *name, char *dst, size_t dst_len)
void mg_set_websocket_handler(struct mg_context *ctx, const char *uri, mg_websocket_connect_handler connect_handler, mg_websocket_ready_handler ready_handler, mg_websocket_data_handler data_handler, mg_websocket_close_handler close_handler, void *cbdata)
struct mg_context * mg_get_context(const struct mg_connection *conn)
int mg_strncasecmp(const char *s1, const char *s2, size_t len)
void *(* mg_thread_func_t)(void *)