#include <stddef.h>
#include <stdio.h>
Classes | |
struct | mg_callbacks |
struct | mg_client_cert |
struct | mg_client_options |
struct | mg_form_data_handler |
struct | mg_header |
struct | mg_option |
struct | mg_request_info |
struct | mg_response_info |
struct | mg_server_ports |
struct | mg_websocket_subprotocols |
Macros | |
#define | CIVETWEB_API |
#define | CIVETWEB_VERSION "1.12" |
#define | CIVETWEB_VERSION_MAJOR (1) |
#define | CIVETWEB_VERSION_MINOR (12) |
#define | CIVETWEB_VERSION_PATCH (0) |
#define | MG_MAX_HEADERS (64) |
#define | PRINTF_ARGS(x, y) |
#define | PRINTF_FORMAT_STRING(s) s |
Typedefs | |
typedef int(* | mg_authorization_handler) (struct mg_connection *conn, void *cbdata) |
typedef int(* | mg_request_handler) (struct mg_connection *conn, void *cbdata) |
typedef void *(* | mg_thread_func_t) (void *) |
typedef void(* | mg_websocket_close_handler) (const struct mg_connection *, void *) |
typedef int(* | mg_websocket_connect_handler) (const struct mg_connection *, void *) |
typedef int(* | mg_websocket_data_handler) (struct mg_connection *, int, char *, size_t, void *) |
typedef void(* | mg_websocket_ready_handler) (struct mg_connection *, void *) |
Functions | |
CIVETWEB_API int | mg_check_digest_access_authentication (struct mg_connection *conn, const char *realm, const char *filename) |
CIVETWEB_API unsigned | mg_check_feature (unsigned feature) |
CIVETWEB_API struct mg_connection CIVETWEB_API void | mg_close_connection (struct mg_connection *conn) |
CIVETWEB_API struct mg_connection * | mg_connect_client (const char *host, int port, int use_ssl, char *error_buffer, size_t error_buffer_size) |
CIVETWEB_API struct mg_connection * | mg_connect_client_secure (const struct mg_client_options *client_options, char *error_buffer, size_t error_buffer_size) |
CIVETWEB_API 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) |
CIVETWEB_API void | mg_cry (const struct mg_connection *conn, PRINTF_FORMAT_STRING(const char *fmt),...) PRINTF_ARGS(2 |
CIVETWEB_API 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 |
CIVETWEB_API unsigned | mg_exit_library (void) |
CIVETWEB_API const char * | mg_get_builtin_mime_type (const char *file_name) |
CIVETWEB_API struct mg_context * | mg_get_context (const struct mg_connection *conn) |
CIVETWEB_API int | mg_get_context_info (const struct mg_context *ctx, char *buffer, int buflen) |
CIVETWEB_API int | mg_get_cookie (const char *cookie, const char *var_name, char *buf, size_t buf_len) |
CIVETWEB_API const char * | mg_get_header (const struct mg_connection *, const char *name) |
CIVETWEB_API const char * | mg_get_option (const struct mg_context *ctx, const char *name) |
CIVETWEB_API const struct mg_request_info * | mg_get_request_info (const struct mg_connection *) |
CIVETWEB_API int | mg_get_request_link (const struct mg_connection *conn, char *buf, size_t buflen) |
CIVETWEB_API int | mg_get_response (struct mg_connection *conn, char *ebuf, size_t ebuf_len, int timeout) |
CIVETWEB_API const char * | mg_get_response_code_text (const struct mg_connection *conn, int response_code) |
CIVETWEB_API const struct mg_response_info * | mg_get_response_info (const struct mg_connection *) |
CIVETWEB_API int | mg_get_server_ports (const struct mg_context *ctx, int size, struct mg_server_ports *ports) |
CIVETWEB_API int | mg_get_system_info (char *buffer, int buflen) |
CIVETWEB_API void * | mg_get_user_connection_data (const struct mg_connection *conn) |
CIVETWEB_API void * | mg_get_user_data (const struct mg_context *ctx) |
CIVETWEB_API const struct mg_option * | mg_get_valid_options (void) |
CIVETWEB_API int | mg_get_var (const char *data, size_t data_len, const char *var_name, char *dst, size_t dst_len) |
CIVETWEB_API int | mg_get_var2 (const char *data, size_t data_len, const char *var_name, char *dst, size_t dst_len, size_t occurrence) |
CIVETWEB_API int | mg_handle_form_request (struct mg_connection *conn, struct mg_form_data_handler *fdh) |
CIVETWEB_API unsigned | mg_init_library (unsigned features) |
CIVETWEB_API void | mg_lock_connection (struct mg_connection *conn) |
CIVETWEB_API void | mg_lock_context (struct mg_context *ctx) |
CIVETWEB_API char * | mg_md5 (char buf[33],...) |
CIVETWEB_API int | mg_modify_passwords_file (const char *passwords_file_name, const char *realm, const char *user, const char *password) |
CIVETWEB_API int | mg_printf (struct mg_connection *, PRINTF_FORMAT_STRING(const char *fmt),...) PRINTF_ARGS(2 |
CIVETWEB_API int | mg_read (struct mg_connection *, void *buf, size_t len) |
CIVETWEB_API int CIVETWEB_API int | mg_send_chunk (struct mg_connection *conn, const char *chunk, unsigned int chunk_len) |
CIVETWEB_API int | mg_send_digest_access_authentication_request (struct mg_connection *conn, const char *realm) |
CIVETWEB_API void | mg_send_file (struct mg_connection *conn, const char *path) |
CIVETWEB_API int | mg_send_file_body (struct mg_connection *conn, const char *path) |
CIVETWEB_API int | mg_send_http_error (struct mg_connection *conn, int status_code, PRINTF_FORMAT_STRING(const char *fmt),...) PRINTF_ARGS(3 |
CIVETWEB_API int CIVETWEB_API int | mg_send_http_ok (struct mg_connection *conn, const char *mime_type, long long content_length) |
CIVETWEB_API int | mg_send_http_redirect (struct mg_connection *conn, const char *target_url, int redirect_code) |
CIVETWEB_API void | mg_send_mime_file (struct mg_connection *conn, const char *path, const char *mime_type) |
CIVETWEB_API void | mg_send_mime_file2 (struct mg_connection *conn, const char *path, const char *mime_type, const char *additional_headers) |
CIVETWEB_API void | mg_set_auth_handler (struct mg_context *ctx, const char *uri, mg_authorization_handler handler, void *cbdata) |
CIVETWEB_API void | mg_set_request_handler (struct mg_context *ctx, const char *uri, mg_request_handler handler, void *cbdata) |
CIVETWEB_API void | mg_set_user_connection_data (struct mg_connection *conn, void *data) |
CIVETWEB_API 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) |
CIVETWEB_API void | mg_set_websocket_handler_with_subprotocols (struct mg_context *ctx, const char *uri, struct mg_websocket_subprotocols *subprotocols, 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) |
CIVETWEB_API struct mg_context * | mg_start (const struct mg_callbacks *callbacks, void *user_data, const char **configuration_options) |
CIVETWEB_API int | mg_start_thread (mg_thread_func_t f, void *p) |
CIVETWEB_API void | mg_stop (struct mg_context *) |
CIVETWEB_API long long | mg_store_body (struct mg_connection *conn, const char *path) |
CIVETWEB_API void CIVETWEB_API int | mg_strcasecmp (const char *s1, const char *s2) |
CIVETWEB_API int | mg_strncasecmp (const char *s1, const char *s2, size_t len) |
CIVETWEB_API void | mg_unlock_connection (struct mg_connection *conn) |
CIVETWEB_API void | mg_unlock_context (struct mg_context *ctx) |
CIVETWEB_API int | mg_url_decode (const char *src, int src_len, char *dst, int dst_len, int is_form_url_encoded) |
CIVETWEB_API int | mg_url_encode (const char *src, char *dst, size_t dst_len) |
CIVETWEB_API const char * | mg_version (void) |
CIVETWEB_API int | mg_websocket_client_write (struct mg_connection *conn, int opcode, const char *data, size_t data_len) |
CIVETWEB_API int | mg_websocket_write (struct mg_connection *conn, int opcode, const char *data, size_t data_len) |
CIVETWEB_API int | mg_write (struct mg_connection *, const void *buf, size_t len) |
#define CIVETWEB_API |
Definition at line 43 of file civetweb.h.
#define CIVETWEB_VERSION "1.12" |
Definition at line 26 of file civetweb.h.
#define CIVETWEB_VERSION_MAJOR (1) |
Definition at line 27 of file civetweb.h.
#define CIVETWEB_VERSION_MINOR (12) |
Definition at line 28 of file civetweb.h.
#define CIVETWEB_VERSION_PATCH (0) |
Definition at line 29 of file civetweb.h.
#define MG_MAX_HEADERS (64) |
Definition at line 136 of file civetweb.h.
Definition at line 861 of file civetweb.h.
#define PRINTF_FORMAT_STRING | ( | s | ) | s |
Definition at line 855 of file civetweb.h.
typedef int(* mg_authorization_handler) (struct mg_connection *conn, void *cbdata) |
Definition at line 569 of file civetweb.h.
typedef int(* mg_request_handler) (struct mg_connection *conn, void *cbdata) |
Definition at line 456 of file civetweb.h.
Definition at line 1273 of file civetweb.h.
Definition at line 518 of file civetweb.h.
typedef int(* mg_websocket_connect_handler) (const struct mg_connection *, void *) |
Definition at line 510 of file civetweb.h.
typedef int(* mg_websocket_data_handler) (struct mg_connection *, int, char *, size_t, void *) |
Definition at line 513 of file civetweb.h.
Definition at line 512 of file civetweb.h.
anonymous enum |
Definition at line 56 of file civetweb.h.
anonymous enum |
Definition at line 665 of file civetweb.h.
anonymous enum |
Enumerator | |
---|---|
MG_WEBSOCKET_OPCODE_CONTINUATION | |
MG_WEBSOCKET_OPCODE_TEXT | |
MG_WEBSOCKET_OPCODE_BINARY | |
MG_WEBSOCKET_OPCODE_CONNECTION_CLOSE | |
MG_WEBSOCKET_OPCODE_PING | |
MG_WEBSOCKET_OPCODE_PONG |
Definition at line 836 of file civetweb.h.
anonymous enum |
Enumerator | |
---|---|
MG_FORM_FIELD_STORAGE_SKIP | |
MG_FORM_FIELD_STORAGE_GET | |
MG_FORM_FIELD_STORAGE_STORE | |
MG_FORM_FIELD_STORAGE_ABORT |
Definition at line 1236 of file civetweb.h.
anonymous enum |
Enumerator | |
---|---|
MG_FORM_FIELD_HANDLE_GET | |
MG_FORM_FIELD_HANDLE_NEXT | |
MG_FORM_FIELD_HANDLE_ABORT |
Definition at line 1249 of file civetweb.h.
anonymous enum |
Enumerator | |
---|---|
TIMEOUT_INFINITE |
Definition at line 1402 of file civetweb.h.
anonymous enum |
Enumerator | |
---|---|
MG_TIMEOUT_INFINITE |
Definition at line 1403 of file civetweb.h.
CIVETWEB_API int mg_check_digest_access_authentication | ( | struct mg_connection * | conn, |
const char * | realm, | ||
const char * | filename | ||
) |
Definition at line 8431 of file civetweb.c.
CIVETWEB_API unsigned mg_check_feature | ( | unsigned | feature | ) |
Definition at line 18802 of file civetweb.c.
CIVETWEB_API struct mg_connection CIVETWEB_API void mg_close_connection | ( | struct mg_connection * | conn | ) |
Definition at line 16304 of file civetweb.c.
CIVETWEB_API struct mg_connection * mg_connect_client | ( | const char * | host, |
int | port, | ||
int | use_ssl, | ||
char * | error_buffer, | ||
size_t | error_buffer_size | ||
) |
Definition at line 16586 of file civetweb.c.
CIVETWEB_API struct mg_connection * mg_connect_client_secure | ( | const struct mg_client_options * | client_options, |
char * | error_buffer, | ||
size_t | error_buffer_size | ||
) |
Definition at line 16574 of file civetweb.c.
CIVETWEB_API 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 | ||
) |
Definition at line 17224 of file civetweb.c.
CIVETWEB_API void mg_cry | ( | const struct mg_connection * | conn, |
PRINTF_FORMAT_STRING(const char *fmt) | , | ||
... | |||
) |
CIVETWEB_API 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) | , | ||
... | |||
) |
CIVETWEB_API unsigned mg_exit_library | ( | void | ) |
Definition at line 19821 of file civetweb.c.
CIVETWEB_API const char * mg_get_builtin_mime_type | ( | const char * | file_name | ) |
Definition at line 7895 of file civetweb.c.
CIVETWEB_API struct mg_context * mg_get_context | ( | const struct mg_connection * | conn | ) |
Definition at line 3436 of file civetweb.c.
CIVETWEB_API int mg_get_context_info | ( | const struct mg_context * | ctx, |
char * | buffer, | ||
int | buflen | ||
) |
Definition at line 19704 of file civetweb.c.
CIVETWEB_API int mg_get_cookie | ( | const char * | cookie, |
const char * | var_name, | ||
char * | buf, | ||
size_t | buf_len | ||
) |
Definition at line 7093 of file civetweb.c.
CIVETWEB_API const char * mg_get_header | ( | const struct mg_connection * | conn, |
const char * | name | ||
) |
Definition at line 4016 of file civetweb.c.
CIVETWEB_API const char * mg_get_option | ( | const struct mg_context * | ctx, |
const char * | name | ||
) |
Definition at line 3421 of file civetweb.c.
CIVETWEB_API const struct mg_request_info * mg_get_request_info | ( | const struct mg_connection * | conn | ) |
Definition at line 3745 of file civetweb.c.
CIVETWEB_API int mg_get_request_link | ( | const struct mg_connection * | conn, |
char * | buf, | ||
size_t | buflen | ||
) |
Definition at line 3822 of file civetweb.c.
CIVETWEB_API int mg_get_response | ( | struct mg_connection * | conn, |
char * | ebuf, | ||
size_t | ebuf_len, | ||
int | timeout | ||
) |
Definition at line 17052 of file civetweb.c.
CIVETWEB_API const char * mg_get_response_code_text | ( | const struct mg_connection * | conn, |
int | response_code | ||
) |
Definition at line 4312 of file civetweb.c.
CIVETWEB_API const struct mg_response_info * mg_get_response_info | ( | const struct mg_connection * | conn | ) |
Definition at line 3782 of file civetweb.c.
CIVETWEB_API int mg_get_server_ports | ( | const struct mg_context * | ctx, |
int | size, | ||
struct mg_server_ports * | ports | ||
) |
Definition at line 3493 of file civetweb.c.
CIVETWEB_API int mg_get_system_info | ( | char * | buffer, |
int | buflen | ||
) |
Definition at line 19689 of file civetweb.c.
CIVETWEB_API void * mg_get_user_connection_data | ( | const struct mg_connection * | conn | ) |
Definition at line 3459 of file civetweb.c.
CIVETWEB_API void * mg_get_user_data | ( | const struct mg_context * | ctx | ) |
Definition at line 3443 of file civetweb.c.
CIVETWEB_API const struct mg_option * mg_get_valid_options | ( | void | ) |
Definition at line 3029 of file civetweb.c.
CIVETWEB_API int mg_get_var | ( | const char * | data, |
size_t | data_len, | ||
const char * | var_name, | ||
char * | dst, | ||
size_t | dst_len | ||
) |
Definition at line 7024 of file civetweb.c.
CIVETWEB_API int mg_get_var2 | ( | const char * | data, |
size_t | data_len, | ||
const char * | var_name, | ||
char * | dst, | ||
size_t | dst_len, | ||
size_t | occurrence | ||
) |
Definition at line 7035 of file civetweb.c.
CIVETWEB_API int mg_handle_form_request | ( | struct mg_connection * | conn, |
struct mg_form_data_handler * | fdh | ||
) |
Definition at line 179 of file handle_form.inl.
CIVETWEB_API unsigned mg_init_library | ( | unsigned | features | ) |
Definition at line 19745 of file civetweb.c.
CIVETWEB_API void mg_lock_connection | ( | struct mg_connection * | conn | ) |
Definition at line 12014 of file civetweb.c.
CIVETWEB_API void mg_lock_context | ( | struct mg_context * | ctx | ) |
Definition at line 12030 of file civetweb.c.
CIVETWEB_API char * mg_md5 | ( | char | buf[33], |
... | |||
) |
Definition at line 7967 of file civetweb.c.
CIVETWEB_API int mg_modify_passwords_file | ( | const char * | passwords_file_name, |
const char * | realm, | ||
const char * | user, | ||
const char * | password | ||
) |
Definition at line 8580 of file civetweb.c.
CIVETWEB_API int mg_printf | ( | struct mg_connection * | , |
PRINTF_FORMAT_STRING(const char *fmt) | , | ||
... | |||
) |
CIVETWEB_API int mg_read | ( | struct mg_connection * | conn, |
void * | buf, | ||
size_t | len | ||
) |
Definition at line 6655 of file civetweb.c.
CIVETWEB_API int CIVETWEB_API int mg_send_chunk | ( | struct mg_connection * | conn, |
const char * | chunk, | ||
unsigned int | chunk_len | ||
) |
Definition at line 6819 of file civetweb.c.
CIVETWEB_API int mg_send_digest_access_authentication_request | ( | struct mg_connection * | conn, |
const char * | realm | ||
) |
Definition at line 8546 of file civetweb.c.
CIVETWEB_API void mg_send_file | ( | struct mg_connection * | conn, |
const char * | path | ||
) |
Definition at line 9841 of file civetweb.c.
CIVETWEB_API int mg_send_file_body | ( | struct mg_connection * | conn, |
const char * | path | ||
) |
Definition at line 9776 of file civetweb.c.
CIVETWEB_API int mg_send_http_error | ( | struct mg_connection * | conn, |
int | status_code, | ||
PRINTF_FORMAT_STRING(const char *fmt) | , | ||
... | |||
) |
CIVETWEB_API int CIVETWEB_API int mg_send_http_ok | ( | struct mg_connection * | conn, |
const char * | mime_type, | ||
long long | content_length | ||
) |
Definition at line 4701 of file civetweb.c.
CIVETWEB_API int mg_send_http_redirect | ( | struct mg_connection * | conn, |
const char * | target_url, | ||
int | redirect_code | ||
) |
Definition at line 4739 of file civetweb.c.
CIVETWEB_API void mg_send_mime_file | ( | struct mg_connection * | conn, |
const char * | path, | ||
const char * | mime_type | ||
) |
Definition at line 9848 of file civetweb.c.
CIVETWEB_API void mg_send_mime_file2 | ( | struct mg_connection * | conn, |
const char * | path, | ||
const char * | mime_type, | ||
const char * | additional_headers | ||
) |
Definition at line 9857 of file civetweb.c.
CIVETWEB_API void mg_set_auth_handler | ( | struct mg_context * | ctx, |
const char * | uri, | ||
mg_authorization_handler | handler, | ||
void * | cbdata | ||
) |
Definition at line 13436 of file civetweb.c.
CIVETWEB_API void mg_set_request_handler | ( | struct mg_context * | ctx, |
const char * | uri, | ||
mg_request_handler | handler, | ||
void * | cbdata | ||
) |
Definition at line 13364 of file civetweb.c.
CIVETWEB_API void mg_set_user_connection_data | ( | struct mg_connection * | conn, |
void * | data | ||
) |
Definition at line 3450 of file civetweb.c.
CIVETWEB_API 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 | ||
) |
Definition at line 13386 of file civetweb.c.
CIVETWEB_API void mg_set_websocket_handler_with_subprotocols | ( | struct mg_context * | ctx, |
const char * | uri, | ||
struct mg_websocket_subprotocols * | subprotocols, | ||
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 | ||
) |
Definition at line 13406 of file civetweb.c.
CIVETWEB_API struct mg_context * mg_start | ( | const struct mg_callbacks * | callbacks, |
void * | user_data, | ||
const char ** | configuration_options | ||
) |
Definition at line 18342 of file civetweb.c.
CIVETWEB_API int mg_start_thread | ( | mg_thread_func_t | f, |
void * | p | ||
) |
Definition at line 5841 of file civetweb.c.
CIVETWEB_API void mg_stop | ( | struct mg_context * | ctx | ) |
Definition at line 18256 of file civetweb.c.
CIVETWEB_API long long mg_store_body | ( | struct mg_connection * | conn, |
const char * | path | ||
) |
Definition at line 9953 of file civetweb.c.
CIVETWEB_API void CIVETWEB_API int mg_strcasecmp | ( | const char * | s1, |
const char * | s2 | ||
) |
Definition at line 3282 of file civetweb.c.
CIVETWEB_API int mg_strncasecmp | ( | const char * | s1, |
const char * | s2, | ||
size_t | len | ||
) |
Definition at line 3267 of file civetweb.c.
CIVETWEB_API void mg_unlock_connection | ( | struct mg_connection * | conn | ) |
Definition at line 12022 of file civetweb.c.
CIVETWEB_API void mg_unlock_context | ( | struct mg_context * | ctx | ) |
Definition at line 12038 of file civetweb.c.
CIVETWEB_API int mg_url_decode | ( | const char * | src, |
int | src_len, | ||
char * | dst, | ||
int | dst_len, | ||
int | is_form_url_encoded | ||
) |
Definition at line 6993 of file civetweb.c.
CIVETWEB_API int mg_url_encode | ( | const char * | src, |
char * | dst, | ||
size_t | dst_len | ||
) |
Definition at line 8967 of file civetweb.c.
CIVETWEB_API const char * mg_version | ( | void | ) |
Definition at line 3738 of file civetweb.c.
CIVETWEB_API int mg_websocket_client_write | ( | struct mg_connection * | conn, |
int | opcode, | ||
const char * | data, | ||
size_t | data_len | ||
) |
CIVETWEB_API int mg_websocket_write | ( | struct mg_connection * | conn, |
int | opcode, | ||
const char * | data, | ||
size_t | data_len | ||
) |
CIVETWEB_API int mg_write | ( | struct mg_connection * | conn, |
const void * | buf, | ||
size_t | len | ||
) |
Definition at line 6755 of file civetweb.c.