22 #ifndef CIVETWEB_HEADER_INCLUDED
23 #define CIVETWEB_HEADER_INCLUDED
25 #ifndef CIVETWEB_VERSION
26 #define CIVETWEB_VERSION "1.6"
83 int (*
init_ssl)(
void *ssl_context,
void *user_data);
103 char *data,
size_t data_len);
121 const char * (*open_file)(
const struct mg_connection *,
122 const char *path,
size_t *data_len);
134 void (*
upload)(
struct mg_connection *,
const char *file_name);
170 const char **configuration_options);
178 void mg_stop(
struct mg_context *);
234 size_t mg_get_ports(
const struct mg_context *ctx,
size_t size,
int* ports,
int* ssl);
251 const char *password);
258 const struct mg_context *
mg_get_context(
const struct mg_connection *conn);
269 int mg_write(
struct mg_connection *,
const void *buf,
size_t len);
285 const char *data,
size_t data_len);
292 void mg_lock(
struct mg_connection* conn);
293 void mg_unlock(
struct mg_connection* conn);
307 #undef PRINTF_FORMAT_STRING
308 #if defined(_MSC_VER) && _MSC_VER >= 1400
310 #if defined(_MSC_VER) && _MSC_VER > 1400
311 #define PRINTF_FORMAT_STRING(s) _Printf_format_string_ s
313 #define PRINTF_FORMAT_STRING(s) __format_string s
316 #define PRINTF_FORMAT_STRING(s) s
320 #define PRINTF_ARGS(x, y) __attribute__((format(printf, x, y)))
322 #define PRINTF_ARGS(x, y)
333 void mg_send_file(struct mg_connection *conn, const
char *path);
341 int mg_read(struct mg_connection *,
void *buf,
size_t len);
371 int mg_get_var(const
char *data,
size_t data_len,
372 const
char *var_name,
char *dst,
size_t dst_len);
398 const
char *var_name,
char *dst,
size_t dst_len,
size_t occurrence);
414 char *buf,
size_t buf_len);
432 struct mg_connection *
mg_download(const
char *host,
int port,
int use_ssl,
433 char *error_buffer,
size_t error_buffer_size,
445 int mg_upload(struct mg_connection *conn, const
char *destination_dir);
469 int dst_len,
int is_form_url_encoded);
474 int mg_url_encode(const
char *src,
char *dst,
size_t dst_len);
482 char *
mg_md5(
char buf[33], ...);
492 void mg_cry(struct mg_connection *conn,
void(* upload)(struct mg_connection *, const char *file_name)
int mg_read(struct mg_connection *, void *buf, size_t len)
const char * mg_get_header(const struct mg_connection *, const char *name)
int mg_websocket_write(struct mg_connection *conn, int opcode, const char *data, size_t data_len)
int mg_get_var(const char *data, size_t data_len, const char *var_name, char *dst, size_t dst_len)
int(* mg_request_handler)(struct mg_connection *conn, void *cbdata)
void(* end_request)(const struct mg_connection *, int reply_status_code)
const char ** mg_get_valid_option_names(void)
int mg_printf(struct mg_connection *, PRINTF_FORMAT_STRING(const char *fmt),...) PRINTF_ARGS(2
#define PRINTF_ARGS(x, y)
int(* begin_request)(struct mg_connection *)
void mg_unlock(struct mg_connection *conn)
void * mg_get_user_data(const struct mg_context *ctx)
int(* init_ssl)(void *ssl_context, void *user_data)
int(* log_message)(const struct mg_connection *, const char *message)
void mg_cry(struct mg_connection *conn, PRINTF_FORMAT_STRING(const char *fmt),...) PRINTF_ARGS(2
int mg_url_encode(const char *src, char *dst, size_t dst_len)
int mg_start_thread(mg_thread_func_t f, void *p)
void(* connection_close)(struct mg_connection *)
struct mg_request_info::mg_header http_headers[64]
int mg_modify_passwords_file(const char *passwords_file_name, const char *domain, const char *user, const char *password)
int(* websocket_connect)(const struct mg_connection *)
void int mg_strncasecmp(const char *s1, const char *s2, size_t len)
struct mg_connection void mg_close_connection(struct mg_connection *conn)
#define PRINTF_FORMAT_STRING(s)
const char * request_method
const char * mg_version(void)
void(* init_lua)(struct mg_connection *, void *lua_context)
struct mg_connection * mg_download(const char *host, int port, int use_ssl, char *error_buffer, size_t error_buffer_size, PRINTF_FORMAT_STRING(const char *request_fmt),...) PRINTF_ARGS(6
int mg_write(struct mg_connection *, const void *buf, size_t len)
const char * mg_get_option(const struct mg_context *ctx, const char *name)
void(* websocket_ready)(struct mg_connection *)
int mg_url_decode(const char *src, int src_len, char *dst, int dst_len, int is_form_url_encoded)
const struct mg_context * mg_get_context(const struct mg_connection *conn)
size_t mg_get_ports(const struct mg_context *ctx, size_t size, int *ports, int *ssl)
const char * http_version
struct mg_request_info * mg_get_request_info(struct mg_connection *)
int(* http_error)(struct mg_connection *, int status)
void mg_stop(struct mg_context *)
int mg_get_var2(const char *data, size_t data_len, const char *var_name, char *dst, size_t dst_len, size_t occurrence)
int mg_get_cookie(const char *cookie, const char *var_name, char *buf, size_t buf_len)
void mg_lock(struct mg_connection *conn)
void mg_set_request_handler(struct mg_context *ctx, const char *uri, mg_request_handler handler, void *cbdata)
int mg_upload(struct mg_connection *conn, const char *destination_dir)
typedef void((*Func_t)())
const char * mg_get_builtin_mime_type(const char *file_name)
int void mg_send_file(struct mg_connection *conn, const char *path)
void *(* mg_thread_func_t)(void *)
char * mg_md5(char buf[33],...)
const char * query_string
int(* websocket_data)(struct mg_connection *, int bits, char *data, size_t data_len)
struct mg_context * mg_start(const struct mg_callbacks *callbacks, void *user_data, const char **configuration_options)