|
messenger_via_http_server
1.0
|
#include "mongoose.h"#include <stdarg.h>#include <stdio.h>#include <string.h>#include <limits.h>#include <stddef.h>#include <sys/time.h>#include <assert.h>#include <stdlib.h>
Структуры данных | |
| struct | ctl_msg |
| union | char64long16 |
| struct | mg_tun_frame |
| struct | mg_tun_ssl_opts |
| struct | mg_tun_client |
| struct | mg_http_proto_data_file |
| struct | mg_http_proto_data_chuncked |
| struct | mg_http_endpoint |
| struct | mg_http_multipart_stream |
| struct | mg_reverse_proxy_data |
| struct | mg_http_proto_data |
| struct | ws_mask_ctx |
| struct | mg_dns_header |
| struct | mg_resolve_async_request |
Определения типов | |
| typedef int | cs_dirent_dummy |
Перечисления | |
| enum | cs_log_level { LL_NONE = -1, LL_ERROR = 0, LL_WARN = 1, LL_INFO = 2, LL_DEBUG = 3, LL_VERBOSE_DEBUG = 4, _LL_MIN = -2, _LL_MAX = 5 } |
| enum | mg_http_proto_data_type { DATA_NONE, DATA_FILE, DATA_PUT } |
| enum | mg_http_multipart_stream_state { MPS_BEGIN, MPS_WAITING_FOR_BOUNDARY, MPS_WAITING_FOR_CHUNK, MPS_GOT_CHUNK, MPS_GOT_BOUNDARY, MPS_FINALIZE, MPS_FINISHED } |
Функции | |
| MG_INTERNAL struct mg_connection * | mg_do_connect (struct mg_connection *nc, int proto, union socket_address *sa) |
| MG_INTERNAL int | mg_parse_address (const char *str, union socket_address *sa, int *proto, char *host, size_t host_len) |
| MG_INTERNAL void | mg_call (struct mg_connection *nc, mg_event_handler_t ev_handler, int ev, void *ev_data) |
| void | mg_forward (struct mg_connection *from, struct mg_connection *to) |
| MG_INTERNAL void | mg_add_conn (struct mg_mgr *mgr, struct mg_connection *c) |
| MG_INTERNAL void | mg_remove_conn (struct mg_connection *c) |
| MG_INTERNAL struct mg_connection * | mg_create_connection (struct mg_mgr *mgr, mg_event_handler_t callback, struct mg_add_sock_opts opts) |
| MG_INTERNAL int | parse_mqtt (struct mbuf *io, struct mg_mqtt_message *mm) |
| MG_INTERNAL size_t | mg_handle_chunked (struct mg_connection *nc, struct http_message *hm, char *buf, size_t blen) |
| MG_INTERNAL int | mg_http_common_url_parse (const char *url, const char *schema, const char *schema_tls, int *use_ssl, char **user, char **pass, char **addr, int *port_i, const char **path) |
| MG_INTERNAL void | mg_ws_handler (struct mg_connection *nc, int ev, void *ev_data) |
| MG_INTERNAL void | mg_ws_handshake (struct mg_connection *nc, const struct mg_str *key) |
| MG_INTERNAL int | mg_get_errno (void) |
| MG_INTERNAL void | mg_close_conn (struct mg_connection *conn) |
| void | cs_log_set_level (enum cs_log_level level) |
| static void | cs_base64_emit_code (struct cs_base64_ctx *ctx, int v) |
| static void | cs_base64_emit_chunk (struct cs_base64_ctx *ctx) |
| void | cs_base64_init (struct cs_base64_ctx *ctx, cs_base64_putc_t b64_putc, void *user_data) |
| void | cs_base64_update (struct cs_base64_ctx *ctx, const char *str, size_t len) |
| void | cs_base64_finish (struct cs_base64_ctx *ctx) |
| void | cs_base64_encode (const unsigned char *src, int src_len, char *dst) |
| static unsigned char | from_b64 (unsigned char ch) |
| int | cs_base64_decode (const unsigned char *s, int len, char *dst, int *dec_len) |
| double | cs_time (void) |
| static void | byteReverse (unsigned char *buf, unsigned longs) |
| void | MD5_Init (MD5_CTX *ctx) |
| static void | MD5Transform (uint32_t buf[4], uint32_t const in[16]) |
| void | MD5_Update (MD5_CTX *ctx, const unsigned char *buf, size_t len) |
| void | MD5_Final (unsigned char digest[16], MD5_CTX *ctx) |
| char * | cs_md5 (char buf[33],...) |
| void | mbuf_init (struct mbuf *mbuf, size_t initial_size) WEAK |
| void | mbuf_free (struct mbuf *mbuf) WEAK |
| void | mbuf_resize (struct mbuf *a, size_t new_size) WEAK |
| void | mbuf_trim (struct mbuf *mbuf) WEAK |
| size_t | mbuf_insert (struct mbuf *a, size_t off, const void *buf, size_t) WEAK |
| size_t | mbuf_append (struct mbuf *a, const void *buf, size_t len) WEAK |
| void | mbuf_remove (struct mbuf *mb, size_t n) WEAK |
| int | mg_ncasecmp (const char *s1, const char *s2, size_t len) WEAK |
| struct mg_str | mg_mk_str (const char *s) WEAK |
| struct mg_str | mg_mk_str_n (const char *s, size_t len) WEAK |
| int | mg_vcmp (const struct mg_str *str1, const char *str2) WEAK |
| int | mg_vcasecmp (const struct mg_str *str1, const char *str2) WEAK |
| struct mg_str | mg_strdup (const struct mg_str s) WEAK |
| int | mg_strcmp (const struct mg_str str1, const struct mg_str str2) WEAK |
| int | mg_strncmp (const struct mg_str, const struct mg_str, size_t n) WEAK |
| static uint32_t | blk0 (union char64long16 *block, int i) |
| void | cs_sha1_transform (uint32_t state[5], const unsigned char buffer[64]) |
| void | cs_sha1_init (cs_sha1_ctx *context) |
| void | cs_sha1_update (cs_sha1_ctx *context, const unsigned char *data, uint32_t len) |
| void | cs_sha1_final (unsigned char digest[20], cs_sha1_ctx *context) |
| void | cs_hmac_sha1 (const unsigned char *key, size_t keylen, const unsigned char *data, size_t datalen, unsigned char out[20]) |
| size_t | c_strnlen (const char *s, size_t maxlen) WEAK |
| static int | c_itoa (char *buf, size_t buf_size, int64_t num, int base, int flags, int field_width) |
| int | c_vsnprintf (char *buf, size_t buf_size, const char *fmt, va_list ap) WEAK |
| int | c_snprintf (char *buf, size_t buf_size, const char *fmt,...) WEAK |
| const char * | c_strnstr (const char *s, const char *find, size_t slen) WEAK |
| void | cs_to_hex (char *to, const unsigned char *p, size_t len) WEAK |
| static int | fourbit (int ch) |
| void | cs_from_hex (char *to, const char *p, size_t len) WEAK |
| static int | str_util_lowercase (const char *s) |
| int | mg_casecmp (const char *s1, const char *s2) WEAK |
| int | mg_asprintf (char **buf, size_t size, const char *fmt,...) WEAK |
| int | mg_avprintf (char **buf, size_t size, const char *fmt, va_list ap) WEAK |
| struct mg_connection * | mg_tun_bind_opt (struct mg_mgr *mgr, const char *dispatcher, mg_event_handler_t handler, struct mg_bind_opts opts) |
| int | mg_tun_parse_frame (void *data, size_t len, struct mg_tun_frame *frame) |
| void | mg_tun_send_frame (struct mg_connection *ws, uint32_t stream_id, uint8_t type, uint8_t flags, struct mg_str msg) |
| void | mg_tun_destroy_client (struct mg_tun_client *client) |
| void | mg_if_timer (struct mg_connection *c, double now) |
| void | mg_if_poll (struct mg_connection *nc, time_t now) |
| static void | mg_destroy_conn (struct mg_connection *conn, int destroy_if) |
| void | mg_mgr_init (struct mg_mgr *m, void *user_data) |
| void | mg_mgr_init_opt (struct mg_mgr *m, void *user_data, struct mg_mgr_init_opts opts) |
| void | mg_mgr_free (struct mg_mgr *m) |
| time_t | mg_mgr_poll (struct mg_mgr *m, int timeout_ms) |
| int | mg_vprintf (struct mg_connection *nc, const char *fmt, va_list ap) |
| int | mg_printf (struct mg_connection *conn, const char *fmt,...) |
| MG_INTERNAL struct mg_connection * | mg_create_connection_base (struct mg_mgr *mgr, mg_event_handler_t callback, struct mg_add_sock_opts opts) |
| struct mg_connection * | mg_if_accept_new_conn (struct mg_connection *lc) |
| void | mg_if_accept_tcp_cb (struct mg_connection *nc, union socket_address *sa, size_t sa_len) |
| void | mg_send (struct mg_connection *nc, const void *buf, int len) |
| void | mg_if_sent_cb (struct mg_connection *nc, int num_sent) |
| MG_INTERNAL void | mg_recv_common (struct mg_connection *nc, void *buf, int len, int own) |
| void | mg_if_recv_tcp_cb (struct mg_connection *nc, void *buf, int len, int own) |
| void | mg_if_recv_udp_cb (struct mg_connection *nc, void *buf, int len, union socket_address *sa, size_t sa_len) |
| void | mg_if_connect_cb (struct mg_connection *nc, int err) |
| static void | resolve_cb (struct mg_dns_message *msg, void *data, enum mg_resolve_err e) |
| struct mg_connection * | mg_connect (struct mg_mgr *mgr, const char *address, mg_event_handler_t callback) |
| struct mg_connection * | mg_connect_opt (struct mg_mgr *mgr, const char *address, mg_event_handler_t callback, struct mg_connect_opts opts) |
| struct mg_connection * | mg_bind (struct mg_mgr *srv, const char *address, mg_event_handler_t event_handler) |
| struct mg_connection * | mg_bind_opt (struct mg_mgr *mgr, const char *address, mg_event_handler_t callback, struct mg_bind_opts opts) |
| struct mg_connection * | mg_next (struct mg_mgr *s, struct mg_connection *conn) |
| static int | isbyte (int n) |
| static int | parse_net (const char *spec, uint32_t *net, uint32_t *mask) |
| int | mg_check_ip_acl (const char *acl, uint32_t remote_ip) |
| double | mg_set_timer (struct mg_connection *c, double timestamp) |
| void | mg_sock_set (struct mg_connection *nc, sock_t sock) |
| void | mg_if_get_conn_addr (struct mg_connection *nc, int remote, union socket_address *sa) |
| struct mg_connection * | mg_add_sock_opt (struct mg_mgr *s, sock_t sock, mg_event_handler_t callback, struct mg_add_sock_opts opts) |
| struct mg_connection * | mg_add_sock (struct mg_mgr *s, sock_t sock, mg_event_handler_t callback) |
| double | mg_time (void) |
| struct mg_connection * | mg_tun_if_find_conn (struct mg_tun_client *client, uint32_t stream_id) |
| struct mg_iface * | mg_if_create_iface (struct mg_iface_vtable *vtable, struct mg_mgr *mgr) |
| struct mg_iface * | mg_find_iface (struct mg_mgr *mgr, struct mg_iface_vtable *vtable, struct mg_iface *from) |
| static sock_t | mg_open_listening_socket (union socket_address *sa, int type, int proto) |
| void | mg_set_non_blocking_mode (sock_t sock) |
| static int | mg_is_error (int n) |
| void | mg_socket_if_connect_tcp (struct mg_connection *nc, const union socket_address *sa) |
| void | mg_socket_if_connect_udp (struct mg_connection *nc) |
| int | mg_socket_if_listen_tcp (struct mg_connection *nc, union socket_address *sa) |
| int | mg_socket_if_listen_udp (struct mg_connection *nc, union socket_address *sa) |
| void | mg_socket_if_tcp_send (struct mg_connection *nc, const void *buf, size_t len) |
| void | mg_socket_if_udp_send (struct mg_connection *nc, const void *buf, size_t len) |
| void | mg_socket_if_recved (struct mg_connection *nc, size_t len) |
| int | mg_socket_if_create_conn (struct mg_connection *nc) |
| void | mg_socket_if_destroy_conn (struct mg_connection *nc) |
| static int | mg_accept_conn (struct mg_connection *lc) |
| static void | mg_write_to_socket (struct mg_connection *nc) |
| MG_INTERNAL size_t | recv_avail_size (struct mg_connection *conn, size_t max) |
| static void | mg_handle_tcp_read (struct mg_connection *conn) |
| static int | mg_recvfrom (struct mg_connection *nc, union socket_address *sa, socklen_t *sa_len, char **buf) |
| static void | mg_handle_udp_read (struct mg_connection *nc) |
| void | mg_mgr_handle_conn (struct mg_connection *nc, int fd_flags, double now) |
| void | mg_socket_if_sock_set (struct mg_connection *nc, sock_t sock) |
| void | mg_socket_if_init (struct mg_iface *iface) |
| void | mg_socket_if_free (struct mg_iface *iface) |
| void | mg_socket_if_add_conn (struct mg_connection *nc) |
| void | mg_socket_if_remove_conn (struct mg_connection *nc) |
| void | mg_add_to_set (sock_t sock, fd_set *set, sock_t *max_fd) |
| time_t | mg_socket_if_poll (struct mg_iface *iface, int timeout_ms) |
| static void | mg_sock_get_addr (sock_t sock, int remote, union socket_address *sa) |
| void | mg_sock_to_str (sock_t sock, char *buf, size_t len, int flags) |
| void | mg_socket_if_get_conn_addr (struct mg_connection *nc, int remote, union socket_address *sa) |
| void | mg_tun_if_connect_tcp (struct mg_connection *nc, const union socket_address *sa) |
| void | mg_tun_if_connect_udp (struct mg_connection *nc) |
| int | mg_tun_if_listen_tcp (struct mg_connection *nc, union socket_address *sa) |
| int | mg_tun_if_listen_udp (struct mg_connection *nc, union socket_address *sa) |
| void | mg_tun_if_tcp_send (struct mg_connection *nc, const void *buf, size_t len) |
| void | mg_tun_if_udp_send (struct mg_connection *nc, const void *buf, size_t len) |
| void | mg_tun_if_recved (struct mg_connection *nc, size_t len) |
| int | mg_tun_if_create_conn (struct mg_connection *nc) |
| void | mg_tun_if_destroy_conn (struct mg_connection *nc) |
| void | mg_tun_if_sock_set (struct mg_connection *nc, sock_t sock) |
| void | mg_tun_if_init (struct mg_iface *iface) |
| void | mg_tun_if_free (struct mg_iface *iface) |
| void | mg_tun_if_add_conn (struct mg_connection *nc) |
| void | mg_tun_if_remove_conn (struct mg_connection *nc) |
| time_t | mg_tun_if_poll (struct mg_iface *iface, int timeout_ms) |
| void | mg_tun_if_get_conn_addr (struct mg_connection *nc, int remote, union socket_address *sa) |
| static void | parse_uri_component (const char **p, const char *end, char sep, struct mg_str *res) |
| int | mg_parse_uri (struct mg_str uri, struct mg_str *scheme, struct mg_str *user_info, struct mg_str *host, unsigned int *port, struct mg_str *path, struct mg_str *query, struct mg_str *fragment) |
| int | mg_normalize_uri_path (const struct mg_str *in, struct mg_str *out) |
| static void | mg_http_conn_destructor (void *proto_data) |
| struct mg_connection * | mg_connect_http_base (struct mg_mgr *mgr, mg_event_handler_t ev_handler, struct mg_connect_opts opts, const char *schema, const char *schema_ssl, const char *url, const char **path, char **user, char **pass, char **addr) |
| static struct mg_http_proto_data * | mg_http_get_proto_data (struct mg_connection *c) |
| static void | mg_http_free_proto_data_endpoints (struct mg_http_endpoint **ep) |
| static void | mg_http_free_reverse_proxy_data (struct mg_reverse_proxy_data *rpd) |
| static int | mg_http_get_request_len (const char *s, int buf_len) |
| static const char * | mg_http_parse_headers (const char *s, const char *end, int len, struct http_message *req) |
| int | mg_parse_http (const char *s, int n, struct http_message *hm, int is_req) |
| struct mg_str * | mg_get_http_header (struct http_message *hm, const char *name) |
| static size_t | mg_http_parse_chunk (char *buf, size_t len, char **chunk_data, size_t *chunk_len) |
| static mg_event_handler_t | mg_http_get_endpoint_handler (struct mg_connection *nc, struct mg_str *uri_path) |
| static void | mg_http_call_endpoint_handler (struct mg_connection *nc, int ev, struct http_message *hm) |
| void | mg_http_handler (struct mg_connection *nc, int ev, void *ev_data) |
| static size_t | mg_get_line_len (const char *buf, size_t buf_len) |
| void | mg_set_protocol_http_websocket (struct mg_connection *nc) |
| const char * | mg_status_message (int status_code) |
| void | mg_send_response_line_s (struct mg_connection *nc, int status_code, const struct mg_str extra_headers) |
| void | mg_send_response_line (struct mg_connection *nc, int status_code, const char *extra_headers) |
| void | mg_http_send_redirect (struct mg_connection *nc, int status_code, const struct mg_str location, const struct mg_str extra_headers) |
| void | mg_send_head (struct mg_connection *c, int status_code, int64_t content_length, const char *extra_headers) |
| void | mg_http_send_error (struct mg_connection *nc, int code, const char *reason) |
| int | mg_url_decode (const char *src, int src_len, char *dst, int dst_len, int is_form_url_encoded) |
| int | mg_get_http_var (const struct mg_str *buf, const char *name, char *dst, size_t dst_len) |
| void | mg_send_http_chunk (struct mg_connection *nc, const char *buf, size_t len) |
| void | mg_printf_http_chunk (struct mg_connection *nc, const char *fmt,...) |
| void | mg_printf_html_escape (struct mg_connection *nc, const char *fmt,...) |
| int | mg_http_parse_header (struct mg_str *hdr, const char *var_name, char *buf, size_t buf_size) |
| int | mg_get_http_basic_auth (struct http_message *hm, char *user, size_t user_len, char *pass, size_t pass_len) |
| int | mg_parse_http_basic_auth (struct mg_str *hdr, char *user, size_t user_len, char *pass, size_t pass_len) |
| struct mg_connection * | mg_connect_http_opt (struct mg_mgr *mgr, mg_event_handler_t ev_handler, struct mg_connect_opts opts, const char *url, const char *extra_headers, const char *post_data) |
| struct mg_connection * | mg_connect_http (struct mg_mgr *mgr, mg_event_handler_t ev_handler, const char *url, const char *extra_headers, const char *post_data) |
| size_t | mg_parse_multipart (const char *buf, size_t buf_len, char *var_name, size_t var_name_len, char *file_name, size_t file_name_len, const char **data, size_t *data_len) |
| void | mg_register_http_endpoint (struct mg_connection *nc, const char *uri_path, mg_event_handler_t handler) |
| static int | mg_is_ws_fragment (unsigned char flags) |
| static int | mg_is_ws_first_fragment (unsigned char flags) |
| static void | mg_handle_incoming_websocket_frame (struct mg_connection *nc, struct websocket_message *wsm) |
| static int | mg_deliver_websocket_data (struct mg_connection *nc) |
| static uint32_t | mg_ws_random_mask (void) |
| static void | mg_send_ws_header (struct mg_connection *nc, int op, size_t len, struct ws_mask_ctx *ctx) |
| static void | mg_ws_mask_frame (struct mbuf *mbuf, struct ws_mask_ctx *ctx) |
| void | mg_send_websocket_frame (struct mg_connection *nc, int op, const void *data, size_t len) |
| void | mg_send_websocket_framev (struct mg_connection *nc, int op, const struct mg_str *strv, int strvcnt) |
| void | mg_printf_websocket_frame (struct mg_connection *nc, int op, const char *fmt,...) |
| static void | mg_hash_sha1_v (size_t num_msgs, const uint8_t *msgs[], const size_t *msg_lens, uint8_t *digest) |
| void | mg_send_websocket_handshake2 (struct mg_connection *nc, const char *path, const char *host, const char *protocol, const char *extra_headers) |
| void | mg_send_websocket_handshake3 (struct mg_connection *nc, const char *path, const char *host, const char *protocol, const char *extra_headers, const char *user, const char *pass) |
| void | mg_send_websocket_handshake (struct mg_connection *nc, const char *path, const char *extra_headers) |
| struct mg_connection * | mg_connect_ws_opt (struct mg_mgr *mgr, mg_event_handler_t ev_handler, struct mg_connect_opts opts, const char *url, const char *protocol, const char *extra_headers) |
| struct mg_connection * | mg_connect_ws (struct mg_mgr *mgr, mg_event_handler_t ev_handler, const char *url, const char *protocol, const char *extra_headers) |
| const char * | mg_skip (const char *s, const char *end, const char *delims, struct mg_str *v) |
| static int | lowercase (const char *s) |
| void | mg_base64_encode (const unsigned char *src, int src_len, char *dst) |
| int | mg_base64_decode (const unsigned char *s, int len, char *dst) |
| void | mg_set_close_on_exec (sock_t sock) |
| void | mg_sock_addr_to_str (const union socket_address *sa, char *buf, size_t len, int flags) |
| void | mg_conn_addr_to_str (struct mg_connection *nc, char *buf, size_t len, int flags) |
| int | mg_is_big_endian (void) |
| const char * | mg_next_comma_list_entry (const char *list, struct mg_str *val, struct mg_str *eq_val) |
| int | mg_match_prefix_n (const struct mg_str pattern, const struct mg_str str) |
| int | mg_match_prefix (const char *pattern, int pattern_len, const char *str) |
| void | mg_mbuf_append_base64_putc (char ch, void *user_data) |
| void | mg_mbuf_append_base64 (struct mbuf *mbuf, const void *data, size_t len) |
| void | mg_basic_auth_header (const char *user, const char *pass, struct mbuf *buf) |
| static uint16_t | getu16 (const char *p) |
| static const char * | scanto (const char *p, struct mg_str *s) |
| static void | mqtt_handler (struct mg_connection *nc, int ev, void *ev_data) |
| static void | mg_mqtt_proto_data_destructor (void *proto_data) |
| void | mg_set_protocol_mqtt (struct mg_connection *nc) |
| void | mg_send_mqtt_handshake (struct mg_connection *nc, const char *client_id) |
| void | mg_send_mqtt_handshake_opt (struct mg_connection *nc, const char *client_id, struct mg_send_mqtt_handshake_opts opts) |
| static void | mg_mqtt_prepend_header (struct mg_connection *nc, uint8_t cmd, uint8_t flags, size_t len) |
| void | mg_mqtt_publish (struct mg_connection *nc, const char *topic, uint16_t message_id, int flags, const void *data, size_t len) |
| void | mg_mqtt_subscribe (struct mg_connection *nc, const struct mg_mqtt_topic_expression *topics, size_t topics_len, uint16_t message_id) |
| int | mg_mqtt_next_subscribe_topic (struct mg_mqtt_message *msg, struct mg_str *topic, uint8_t *qos, int pos) |
| void | mg_mqtt_unsubscribe (struct mg_connection *nc, char **topics, size_t topics_len, uint16_t message_id) |
| void | mg_mqtt_connack (struct mg_connection *nc, uint8_t return_code) |
| static void | mg_send_mqtt_short_command (struct mg_connection *nc, uint8_t cmd, uint16_t message_id) |
| void | mg_mqtt_puback (struct mg_connection *nc, uint16_t message_id) |
| void | mg_mqtt_pubrec (struct mg_connection *nc, uint16_t message_id) |
| void | mg_mqtt_pubrel (struct mg_connection *nc, uint16_t message_id) |
| void | mg_mqtt_pubcomp (struct mg_connection *nc, uint16_t message_id) |
| void | mg_mqtt_suback (struct mg_connection *nc, uint8_t *qoss, size_t qoss_len, uint16_t message_id) |
| void | mg_mqtt_unsuback (struct mg_connection *nc, uint16_t message_id) |
| void | mg_mqtt_ping (struct mg_connection *nc) |
| void | mg_mqtt_pong (struct mg_connection *nc) |
| void | mg_mqtt_disconnect (struct mg_connection *nc) |
| struct mg_dns_resource_record * | mg_dns_next_record (struct mg_dns_message *msg, int query, struct mg_dns_resource_record *prev) |
| int | mg_dns_parse_record_data (struct mg_dns_message *msg, struct mg_dns_resource_record *rr, void *data, size_t data_len) |
| int | mg_dns_insert_header (struct mbuf *io, size_t pos, struct mg_dns_message *msg) |
| int | mg_dns_copy_questions (struct mbuf *io, struct mg_dns_message *msg) |
| int | mg_dns_encode_name (struct mbuf *io, const char *name, size_t len) |
| int | mg_dns_encode_record (struct mbuf *io, struct mg_dns_resource_record *rr, const char *name, size_t nlen, const void *rdata, size_t rlen) |
| void | mg_send_dns_query (struct mg_connection *nc, const char *name, int query_type) |
| static unsigned char * | mg_parse_dns_resource_record (unsigned char *data, unsigned char *end, struct mg_dns_resource_record *rr, int reply) |
| int | mg_parse_dns (const char *buf, int len, struct mg_dns_message *msg) |
| size_t | mg_dns_uncompress_name (struct mg_dns_message *msg, struct mg_str *name, char *dst, int dst_len) |
| static void | dns_handler (struct mg_connection *nc, int ev, void *ev_data) |
| void | mg_set_protocol_dns (struct mg_connection *nc) |
| static int | mg_get_ip_address_of_nameserver (char *name, size_t name_len) |
| int | mg_resolve_from_hosts_file (const char *name, union socket_address *usa) |
| static void | mg_resolve_async_eh (struct mg_connection *nc, int ev, void *data) |
| int | mg_resolve_async (struct mg_mgr *mgr, const char *name, int query, mg_resolve_callback_t cb, void *data) |
| int | mg_resolve_async_opt (struct mg_mgr *mgr, const char *name, int query, mg_resolve_callback_t cb, void *data, struct mg_resolve_async_opts opts) |
| static void | mg_tun_reconnect (struct mg_tun_client *client, int timeout) |
| static void | mg_tun_init_client (struct mg_tun_client *client, struct mg_mgr *mgr, struct mg_iface *iface, const char *dispatcher, struct mg_tun_ssl_opts ssl) |
| void | mg_tun_log_frame (struct mg_tun_frame *frame) |
| static void | mg_tun_close_all (struct mg_tun_client *client) |
| static void | mg_tun_client_handler (struct mg_connection *nc, int ev, void *ev_data) |
| static void | mg_tun_do_reconnect (struct mg_tun_client *client) |
| void | mg_tun_reconnect_ev_handler (struct mg_connection *nc, int ev, void *ev_data) |
| static struct mg_tun_client * | mg_tun_create_client (struct mg_mgr *mgr, const char *dispatcher, struct mg_tun_ssl_opts ssl) |
| static struct mg_connection * | mg_tun_do_bind (struct mg_tun_client *client, mg_event_handler_t handler, struct mg_bind_opts opts) |
Переменные | |
| void *(* | test_malloc )(size_t size) |
| void *(* | test_calloc )(size_t count, size_t size) |
| enum cs_log_level cs_log_level | WEAK |
| struct mg_iface_vtable | mg_socket_iface_vtable = MG_SOCKET_IFACE_VTABLE |
| struct mg_iface_vtable | mg_tun_iface_vtable = MG_TUN_IFACE_VTABLE |
| struct mg_iface_vtable | mg_default_iface_vtable = MG_SOCKET_IFACE_VTABLE |
| struct mg_iface_vtable * | mg_ifaces [] |
| int | mg_num_ifaces = (int) (sizeof(mg_ifaces) / sizeof(mg_ifaces[0])) |
| static const char * | mg_version_header = "Mongoose/" MG_VERSION |
| static int | mg_dns_tid = 0xa0 |
| static const char * | mg_default_dns_server = "udp://" MG_DEFAULT_NAMESERVER ":53" |
| MG_INTERNAL char | mg_dns_server [256] |
| struct mg_iface_vtable | mg_simplelink_iface_vtable |
| struct mg_iface_vtable | mg_pic32_iface_vtable |
| #define _MG_ALLOWED_CONNECT_FLAGS_MASK |
| #define _MG_CALLBACK_MODIFIABLE_FLAGS_MASK |
| #define _MG_F_FD_CAN_READ 1 |
| #define _MG_F_FD_CAN_WRITE 1 << 1 |
| #define _MG_F_FD_ERROR 1 << 2 |
| #define BASE64_ENCODE_BODY |
| #define BASE64_FLUSH | ( | ) |
| #define BASE64_OUT | ( | ch | ) |
| #define blk | ( | i | ) |
| #define C_DISABLE_BUILTIN_SNPRINTF 0 |
| #define C_SNPRINTF_APPEND_CHAR | ( | ch | ) |
| #define C_SNPRINTF_FLAG_ZERO 1 |
| #define CS_COMMON_CS_DBG_H_ |
| #define CS_COMMON_CS_DIRENT_H_ |
| #define CS_COMMON_CS_ENDIAN_H_ |
| #define CS_COMMON_PLATFORMS_LWIP_MG_NET_IF_LWIP_H_ |
| #define CS_COMMON_PLATFORMS_PIC32_NET_IF_H_ |
| #define CS_COMMON_PLATFORMS_SIMPLELINK_SL_FS_SLFS_H_ |
| #define CS_COMMON_PLATFORMS_SIMPLELINK_SL_NET_IF_H_ |
| #define CS_ENABLE_DEBUG 0 |
| #define CS_LOG_ENABLE_TS_DIFF 0 |
| #define CS_MONGOOSE_SRC_INTERNAL_H_ |
| #define CS_MONGOOSE_SRC_NET_IF_SOCKET_H_ |
| #define CS_MONGOOSE_SRC_NET_IF_TUN_H_ |
| #define CS_MONGOOSE_SRC_TUN_H_ |
| #define DBG | ( | x | ) |
| #define F1 | ( | x, | |
| y, | |||
| z | |||
| ) | (z ^ (x & (y ^ z))) |
| #define F2 | ( | x, | |
| y, | |||
| z | |||
| ) | F1(z, x, y) |
| #define F3 | ( | x, | |
| y, | |||
| z | |||
| ) | (x ^ y ^ z) |
| #define F4 | ( | x, | |
| y, | |||
| z | |||
| ) | (y ^ (x | ~z)) |
| #define HEXTOI | ( | x | ) | (isdigit(x) ? x - '0' : x - 'W') |
| #define intptr_t long |
| #define LOG | ( | l, | |
| x | |||
| ) |
| #define MAX | ( | a, | |
| b | |||
| ) | ((a) > (b) ? (a) : (b)) |
| #define MBUF_FREE MG_FREE |
| #define MBUF_REALLOC MG_REALLOC |
| #define MD5STEP | ( | f, | |
| w, | |||
| x, | |||
| y, | |||
| z, | |||
| data, | |||
| s | |||
| ) | (w += f(x, y, z) + data, w = w << s | w >> (32 - s), w += x) |
| #define MG_CALLOC calloc |
| #define MG_COPY_COMMON_CONNECTION_OPTIONS | ( | dst, | |
| src | |||
| ) | memcpy(dst, src, sizeof(*dst)); |
| #define MG_CTL_MSG_MESSAGE_SIZE 8192 |
| #define MG_DEFAULT_NAMESERVER "8.8.8.8" |
| #define MG_ENABLE_NET_IF_LWIP_LOW_LEVEL MG_NET_IF == MG_NET_IF_LWIP_LOW_LEVEL |
| #define MG_ENABLE_NET_IF_PIC32 MG_NET_IF == MG_NET_IF_PIC32 |
| #define MG_ENABLE_NET_IF_SIMPLELINK MG_NET_IF == MG_NET_IF_SIMPLELINK |
| #define MG_ENABLE_NET_IF_SOCKET MG_NET_IF == MG_NET_IF_SOCKET |
| #define MG_FREE free |
| #define MG_INTERNAL static |
| #define MG_MALLOC malloc |
| #define MG_MAX_HOST_LEN 200 |
| #define MG_REALLOC realloc |
| #define MG_SET_PTRPTR | ( | _ptr, | |
| _v | |||
| ) |
| #define MG_SOCKET_IFACE_VTABLE |
| #define MG_TCP_RECV_BUFFER_SIZE 1024 |
| #define MG_TCP_RECV_BUFFER_SIZE 1024 |
| #define MG_TUN_DATA_FRAME 0x0 |
| #define MG_TUN_F_END_STREAM 0x1 |
| #define MG_TUN_IFACE_VTABLE |
| #define MG_TUN_PROTO_NAME "mg_tun" |
| #define MG_TUN_RECONNECT_INTERVAL 1 |
| #define MG_UDP_RECV_BUFFER_SIZE 1500 |
| #define MG_UDP_RECV_BUFFER_SIZE 1500 |
| #define MG_WEBSOCKET_PING_INTERVAL_SECONDS 5 |
| #define MG_WS_NO_HOST_HEADER_MAGIC ((char *) 0x1) |
| #define MIN | ( | a, | |
| b | |||
| ) | ((a) < (b) ? (a) : (b)) |
| #define NUM_DIGITS ('9' - '0' + 1) |
| #define NUM_LETTERS (NUM_UPPERCASES * 2) |
| #define NUM_UPPERCASES ('Z' - 'A' + 1) |
| #define R0 | ( | v, | |
| w, | |||
| x, | |||
| y, | |||
| z, | |||
| i | |||
| ) |
| #define R1 | ( | v, | |
| w, | |||
| x, | |||
| y, | |||
| z, | |||
| i | |||
| ) |
| #define R2 | ( | v, | |
| w, | |||
| x, | |||
| y, | |||
| z, | |||
| i | |||
| ) |
| #define R3 | ( | v, | |
| w, | |||
| x, | |||
| y, | |||
| z, | |||
| i | |||
| ) |
| #define R4 | ( | v, | |
| w, | |||
| x, | |||
| y, | |||
| z, | |||
| i | |||
| ) |
| #define rol | ( | value, | |
| bits | |||
| ) | (((value) << (bits)) | ((value) >> (32 - (bits)))) |
| #define SHA1HANDSOFF |
| typedef int cs_dirent_dummy |
| enum cs_log_level |
|
static |
|
static |

|
static |


| int c_snprintf | ( | char * | buf, |
| size_t | buf_size, | ||
| const char * | fmt, | ||
| ... | |||
| ) |


| size_t c_strnlen | ( | const char * | s, |
| size_t | maxlen | ||
| ) |

| const char * c_strnstr | ( | const char * | s, |
| const char * | find, | ||
| size_t | slen | ||
| ) |


| int c_vsnprintf | ( | char * | buf, |
| size_t | buf_size, | ||
| const char * | fmt, | ||
| va_list | ap | ||
| ) |


| int cs_base64_decode | ( | const unsigned char * | s, |
| int | len, | ||
| char * | dst, | ||
| int * | dec_len | ||
| ) |


|
static |


|
static |

| void cs_base64_encode | ( | const unsigned char * | src, |
| int | src_len, | ||
| char * | dst | ||
| ) |


| void cs_base64_finish | ( | struct cs_base64_ctx * | ctx | ) |


| void cs_base64_init | ( | struct cs_base64_ctx * | ctx, |
| cs_base64_putc_t | b64_putc, | ||
| void * | user_data | ||
| ) |

| void cs_base64_update | ( | struct cs_base64_ctx * | ctx, |
| const char * | str, | ||
| size_t | len | ||
| ) |


| void cs_from_hex | ( | char * | to, |
| const char * | p, | ||
| size_t | len | ||
| ) |


| void cs_hmac_sha1 | ( | const unsigned char * | key, |
| size_t | keylen, | ||
| const unsigned char * | data, | ||
| size_t | datalen, | ||
| unsigned char | out[20] | ||
| ) |

| void cs_log_set_level | ( | enum cs_log_level | level | ) |

| char* cs_md5 | ( | char | buf[33], |
| ... | |||
| ) |


| void cs_sha1_final | ( | unsigned char | digest[20], |
| cs_sha1_ctx * | context | ||
| ) |


| void cs_sha1_init | ( | cs_sha1_ctx * | context | ) |

| void cs_sha1_transform | ( | uint32_t | state[5], |
| const unsigned char | buffer[64] | ||
| ) |

| void cs_sha1_update | ( | cs_sha1_ctx * | context, |
| const unsigned char * | data, | ||
| uint32_t | len | ||
| ) |


| double cs_time | ( | void | ) |

| void cs_to_hex | ( | char * | to, |
| const unsigned char * | p, | ||
| size_t | len | ||
| ) |

|
static |


|
static |


|
static |

|
static |

|
static |

|
static |

| size_t mbuf_append | ( | struct mbuf * | a, |
| const void * | buf, | ||
| size_t | len | ||
| ) |


| void mbuf_free | ( | struct mbuf * | mbuf | ) |


| void mbuf_init | ( | struct mbuf * | mbuf, |
| size_t | initial_size | ||
| ) |


| size_t mbuf_insert | ( | struct mbuf * | a, |
| size_t | off, | ||
| const void * | buf, | ||
| size_t | len | ||
| ) |


| void mbuf_remove | ( | struct mbuf * | mb, |
| size_t | n | ||
| ) |


| void mbuf_resize | ( | struct mbuf * | a, |
| size_t | new_size | ||
| ) |


| void mbuf_trim | ( | struct mbuf * | mbuf | ) |


| void MD5_Final | ( | unsigned char | digest[16], |
| MD5_CTX * | ctx | ||
| ) |


| void MD5_Init | ( | MD5_CTX * | ctx | ) |

| void MD5_Update | ( | MD5_CTX * | ctx, |
| const unsigned char * | buf, | ||
| size_t | len | ||
| ) |


|
static |

|
static |


| MG_INTERNAL void mg_add_conn | ( | struct mg_mgr * | mgr, |
| struct mg_connection * | c | ||
| ) |

| struct mg_connection* mg_add_sock | ( | struct mg_mgr * | s, |
| sock_t | sock, | ||
| mg_event_handler_t | callback | ||
| ) |


| struct mg_connection* mg_add_sock_opt | ( | struct mg_mgr * | s, |
| sock_t | sock, | ||
| mg_event_handler_t | callback, | ||
| struct mg_add_sock_opts | opts | ||
| ) |


| void mg_add_to_set | ( | sock_t | sock, |
| fd_set * | set, | ||
| sock_t * | max_fd | ||
| ) |

| int mg_asprintf | ( | char ** | buf, |
| size_t | size, | ||
| const char * | fmt, | ||
| ... | |||
| ) |


| int mg_avprintf | ( | char ** | buf, |
| size_t | size, | ||
| const char * | fmt, | ||
| va_list | ap | ||
| ) |

| int mg_base64_decode | ( | const unsigned char * | s, |
| int | len, | ||
| char * | dst | ||
| ) |

| void mg_base64_encode | ( | const unsigned char * | src, |
| int | src_len, | ||
| char * | dst | ||
| ) |


| void mg_basic_auth_header | ( | const char * | user, |
| const char * | pass, | ||
| struct mbuf * | buf | ||
| ) |


| struct mg_connection* mg_bind | ( | struct mg_mgr * | srv, |
| const char * | address, | ||
| mg_event_handler_t | event_handler | ||
| ) |


| struct mg_connection* mg_bind_opt | ( | struct mg_mgr * | mgr, |
| const char * | address, | ||
| mg_event_handler_t | callback, | ||
| struct mg_bind_opts | opts | ||
| ) |


| MG_INTERNAL void mg_call | ( | struct mg_connection * | nc, |
| mg_event_handler_t | ev_handler, | ||
| int | ev, | ||
| void * | ev_data | ||
| ) |


| int mg_casecmp | ( | const char * | s1, |
| const char * | s2 | ||
| ) |


| int mg_check_ip_acl | ( | const char * | acl, |
| uint32_t | remote_ip | ||
| ) |


| void mg_close_conn | ( | struct mg_connection * | conn | ) |


| void mg_conn_addr_to_str | ( | struct mg_connection * | nc, |
| char * | buf, | ||
| size_t | len, | ||
| int | flags | ||
| ) |


| struct mg_connection* mg_connect | ( | struct mg_mgr * | mgr, |
| const char * | address, | ||
| mg_event_handler_t | callback | ||
| ) |


| struct mg_connection* mg_connect_http | ( | struct mg_mgr * | mgr, |
| mg_event_handler_t | ev_handler, | ||
| const char * | url, | ||
| const char * | extra_headers, | ||
| const char * | post_data | ||
| ) |

| struct mg_connection * mg_connect_http_base | ( | struct mg_mgr * | mgr, |
| mg_event_handler_t | ev_handler, | ||
| struct mg_connect_opts | opts, | ||
| const char * | schema, | ||
| const char * | schema_ssl, | ||
| const char * | url, | ||
| const char ** | path, | ||
| char ** | user, | ||
| char ** | pass, | ||
| char ** | addr | ||
| ) |


| struct mg_connection* mg_connect_http_opt | ( | struct mg_mgr * | mgr, |
| mg_event_handler_t | ev_handler, | ||
| struct mg_connect_opts | opts, | ||
| const char * | url, | ||
| const char * | extra_headers, | ||
| const char * | post_data | ||
| ) |


| struct mg_connection* mg_connect_opt | ( | struct mg_mgr * | mgr, |
| const char * | address, | ||
| mg_event_handler_t | callback, | ||
| struct mg_connect_opts | opts | ||
| ) |


| struct mg_connection* mg_connect_ws | ( | struct mg_mgr * | mgr, |
| mg_event_handler_t | ev_handler, | ||
| const char * | url, | ||
| const char * | protocol, | ||
| const char * | extra_headers | ||
| ) |

| struct mg_connection* mg_connect_ws_opt | ( | struct mg_mgr * | mgr, |
| mg_event_handler_t | ev_handler, | ||
| struct mg_connect_opts | opts, | ||
| const char * | url, | ||
| const char * | protocol, | ||
| const char * | extra_headers | ||
| ) |


| MG_INTERNAL struct mg_connection * mg_create_connection | ( | struct mg_mgr * | mgr, |
| mg_event_handler_t | callback, | ||
| struct mg_add_sock_opts | opts | ||
| ) |


| MG_INTERNAL struct mg_connection* mg_create_connection_base | ( | struct mg_mgr * | mgr, |
| mg_event_handler_t | callback, | ||
| struct mg_add_sock_opts | opts | ||
| ) |


|
static |


|
static |


| int mg_dns_copy_questions | ( | struct mbuf * | io, |
| struct mg_dns_message * | msg | ||
| ) |


| int mg_dns_encode_name | ( | struct mbuf * | io, |
| const char * | name, | ||
| size_t | len | ||
| ) |


| int mg_dns_encode_record | ( | struct mbuf * | io, |
| struct mg_dns_resource_record * | rr, | ||
| const char * | name, | ||
| size_t | nlen, | ||
| const void * | rdata, | ||
| size_t | rlen | ||
| ) |


| int mg_dns_insert_header | ( | struct mbuf * | io, |
| size_t | pos, | ||
| struct mg_dns_message * | msg | ||
| ) |


| struct mg_dns_resource_record* mg_dns_next_record | ( | struct mg_dns_message * | msg, |
| int | query, | ||
| struct mg_dns_resource_record * | prev | ||
| ) |
| int mg_dns_parse_record_data | ( | struct mg_dns_message * | msg, |
| struct mg_dns_resource_record * | rr, | ||
| void * | data, | ||
| size_t | data_len | ||
| ) |


| size_t mg_dns_uncompress_name | ( | struct mg_dns_message * | msg, |
| struct mg_str * | name, | ||
| char * | dst, | ||
| int | dst_len | ||
| ) |

| MG_INTERNAL struct mg_connection * mg_do_connect | ( | struct mg_connection * | nc, |
| int | proto, | ||
| union socket_address * | sa | ||
| ) |


| struct mg_iface* mg_find_iface | ( | struct mg_mgr * | mgr, |
| struct mg_iface_vtable * | vtable, | ||
| struct mg_iface * | from | ||
| ) |


| void mg_forward | ( | struct mg_connection * | from, |
| struct mg_connection * | to | ||
| ) |


| DO_NOT_WARN_UNUSED MG_INTERNAL int mg_get_errno | ( | void | ) |

| int mg_get_http_basic_auth | ( | struct http_message * | hm, |
| char * | user, | ||
| size_t | user_len, | ||
| char * | pass, | ||
| size_t | pass_len | ||
| ) |


| struct mg_str* mg_get_http_header | ( | struct http_message * | hm, |
| const char * | name | ||
| ) |


| int mg_get_http_var | ( | const struct mg_str * | buf, |
| const char * | name, | ||
| char * | dst, | ||
| size_t | dst_len | ||
| ) |


|
static |

|
static |


| MG_INTERNAL size_t mg_handle_chunked | ( | struct mg_connection * | nc, |
| struct http_message * | hm, | ||
| char * | buf, | ||
| size_t | blen | ||
| ) |


|
static |


|
static |


|
static |


|
static |


|
static |


| MG_INTERNAL int mg_http_common_url_parse | ( | const char * | url, |
| const char * | schema, | ||
| const char * | schema_tls, | ||
| int * | use_ssl, | ||
| char ** | user, | ||
| char ** | pass, | ||
| char ** | addr, | ||
| int * | port_i, | ||
| const char ** | path | ||
| ) |

|
static |


|
static |

|
static |


|
static |


|
static |


|
static |

| void mg_http_handler | ( | struct mg_connection * | nc, |
| int | ev, | ||
| void * | ev_data | ||
| ) |


|
static |

| int mg_http_parse_header | ( | struct mg_str * | hdr, |
| const char * | var_name, | ||
| char * | buf, | ||
| size_t | buf_size | ||
| ) |

|
static |


| void mg_http_send_error | ( | struct mg_connection * | nc, |
| int | code, | ||
| const char * | reason | ||
| ) |


| void mg_http_send_redirect | ( | struct mg_connection * | nc, |
| int | status_code, | ||
| const struct mg_str | location, | ||
| const struct mg_str | extra_headers | ||
| ) |

| struct mg_connection* mg_if_accept_new_conn | ( | struct mg_connection * | lc | ) |


| void mg_if_accept_tcp_cb | ( | struct mg_connection * | nc, |
| union socket_address * | sa, | ||
| size_t | sa_len | ||
| ) |


| void mg_if_connect_cb | ( | struct mg_connection * | nc, |
| int | err | ||
| ) |


| struct mg_iface* mg_if_create_iface | ( | struct mg_iface_vtable * | vtable, |
| struct mg_mgr * | mgr | ||
| ) |

| void mg_if_get_conn_addr | ( | struct mg_connection * | nc, |
| int | remote, | ||
| union socket_address * | sa | ||
| ) |

| void mg_if_poll | ( | struct mg_connection * | nc, |
| time_t | now | ||
| ) |


| void mg_if_recv_tcp_cb | ( | struct mg_connection * | nc, |
| void * | buf, | ||
| int | len, | ||
| int | own | ||
| ) |


| void mg_if_recv_udp_cb | ( | struct mg_connection * | nc, |
| void * | buf, | ||
| int | len, | ||
| union socket_address * | sa, | ||
| size_t | sa_len | ||
| ) |


| void mg_if_sent_cb | ( | struct mg_connection * | nc, |
| int | num_sent | ||
| ) |


| void mg_if_timer | ( | struct mg_connection * | c, |
| double | now | ||
| ) |


| int mg_is_big_endian | ( | void | ) |
|
static |


|
static |

|
static |

| int mg_match_prefix | ( | const char * | pattern, |
| int | pattern_len, | ||
| const char * | str | ||
| ) |




| void mg_mbuf_append_base64 | ( | struct mbuf * | mbuf, |
| const void * | data, | ||
| size_t | len | ||
| ) |

| void mg_mbuf_append_base64_putc | ( | char | ch, |
| void * | user_data | ||
| ) |


| void mg_mgr_free | ( | struct mg_mgr * | m | ) |


| void mg_mgr_handle_conn | ( | struct mg_connection * | nc, |
| int | fd_flags, | ||
| double | now | ||
| ) |


| void mg_mgr_init | ( | struct mg_mgr * | m, |
| void * | user_data | ||
| ) |


| void mg_mgr_init_opt | ( | struct mg_mgr * | m, |
| void * | user_data, | ||
| struct mg_mgr_init_opts | opts | ||
| ) |


| time_t mg_mgr_poll | ( | struct mg_mgr * | m, |
| int | timeout_ms | ||
| ) |

| struct mg_str mg_mk_str | ( | const char * | s | ) |

| struct mg_str mg_mk_str_n | ( | const char * | s, |
| size_t | len | ||
| ) |

| void mg_mqtt_connack | ( | struct mg_connection * | nc, |
| uint8_t | return_code | ||
| ) |


| void mg_mqtt_disconnect | ( | struct mg_connection * | nc | ) |

| int mg_mqtt_next_subscribe_topic | ( | struct mg_mqtt_message * | msg, |
| struct mg_str * | topic, | ||
| uint8_t * | qos, | ||
| int | pos | ||
| ) |

| void mg_mqtt_ping | ( | struct mg_connection * | nc | ) |

| void mg_mqtt_pong | ( | struct mg_connection * | nc | ) |

|
static |


|
static |

| void mg_mqtt_puback | ( | struct mg_connection * | nc, |
| uint16_t | message_id | ||
| ) |

| void mg_mqtt_pubcomp | ( | struct mg_connection * | nc, |
| uint16_t | message_id | ||
| ) |

| void mg_mqtt_publish | ( | struct mg_connection * | nc, |
| const char * | topic, | ||
| uint16_t | message_id, | ||
| int | flags, | ||
| const void * | data, | ||
| size_t | len | ||
| ) |


| void mg_mqtt_pubrec | ( | struct mg_connection * | nc, |
| uint16_t | message_id | ||
| ) |

| void mg_mqtt_pubrel | ( | struct mg_connection * | nc, |
| uint16_t | message_id | ||
| ) |

| void mg_mqtt_suback | ( | struct mg_connection * | nc, |
| uint8_t * | qoss, | ||
| size_t | qoss_len, | ||
| uint16_t | message_id | ||
| ) |


| void mg_mqtt_subscribe | ( | struct mg_connection * | nc, |
| const struct mg_mqtt_topic_expression * | topics, | ||
| size_t | topics_len, | ||
| uint16_t | message_id | ||
| ) |

| void mg_mqtt_unsuback | ( | struct mg_connection * | nc, |
| uint16_t | message_id | ||
| ) |

| void mg_mqtt_unsubscribe | ( | struct mg_connection * | nc, |
| char ** | topics, | ||
| size_t | topics_len, | ||
| uint16_t | message_id | ||
| ) |

| int mg_ncasecmp | ( | const char * | s1, |
| const char * | s2, | ||
| size_t | len | ||
| ) |


| struct mg_connection* mg_next | ( | struct mg_mgr * | s, |
| struct mg_connection * | conn | ||
| ) |

| const char* mg_next_comma_list_entry | ( | const char * | list, |
| struct mg_str * | val, | ||
| struct mg_str * | eq_val | ||
| ) |



|
static |


| MG_INTERNAL int mg_parse_address | ( | const char * | str, |
| union socket_address * | sa, | ||
| int * | proto, | ||
| char * | host, | ||
| size_t | host_len | ||
| ) |


| int mg_parse_dns | ( | const char * | buf, |
| int | len, | ||
| struct mg_dns_message * | msg | ||
| ) |


|
static |

| int mg_parse_http | ( | const char * | s, |
| int | n, | ||
| struct http_message * | hm, | ||
| int | is_req | ||
| ) |


| int mg_parse_http_basic_auth | ( | struct mg_str * | hdr, |
| char * | user, | ||
| size_t | user_len, | ||
| char * | pass, | ||
| size_t | pass_len | ||
| ) |


| size_t mg_parse_multipart | ( | const char * | buf, |
| size_t | buf_len, | ||
| char * | var_name, | ||
| size_t | var_name_len, | ||
| char * | file_name, | ||
| size_t | file_name_len, | ||
| const char ** | data, | ||
| size_t * | data_len | ||
| ) |

| int mg_parse_uri | ( | struct mg_str | uri, |
| struct mg_str * | scheme, | ||
| struct mg_str * | user_info, | ||
| struct mg_str * | host, | ||
| unsigned int * | port, | ||
| struct mg_str * | path, | ||
| struct mg_str * | query, | ||
| struct mg_str * | fragment | ||
| ) |

| int mg_printf | ( | struct mg_connection * | conn, |
| const char * | fmt, | ||
| ... | |||
| ) |


| void mg_printf_html_escape | ( | struct mg_connection * | nc, |
| const char * | fmt, | ||
| ... | |||
| ) |

| void mg_printf_http_chunk | ( | struct mg_connection * | nc, |
| const char * | fmt, | ||
| ... | |||
| ) |


| void mg_printf_websocket_frame | ( | struct mg_connection * | nc, |
| int | op, | ||
| const char * | fmt, | ||
| ... | |||
| ) |

| MG_INTERNAL void mg_recv_common | ( | struct mg_connection * | nc, |
| void * | buf, | ||
| int | len, | ||
| int | own | ||
| ) |


|
static |


| void mg_register_http_endpoint | ( | struct mg_connection * | nc, |
| const char * | uri_path, | ||
| mg_event_handler_t | handler | ||
| ) |

| MG_INTERNAL void mg_remove_conn | ( | struct mg_connection * | c | ) |

| int mg_resolve_async | ( | struct mg_mgr * | mgr, |
| const char * | name, | ||
| int | query, | ||
| mg_resolve_callback_t | cb, | ||
| void * | data | ||
| ) |

|
static |


| int mg_resolve_async_opt | ( | struct mg_mgr * | mgr, |
| const char * | name, | ||
| int | query, | ||
| mg_resolve_callback_t | cb, | ||
| void * | data, | ||
| struct mg_resolve_async_opts | opts | ||
| ) |


| int mg_resolve_from_hosts_file | ( | const char * | name, |
| union socket_address * | usa | ||
| ) |

| void mg_send | ( | struct mg_connection * | nc, |
| const void * | buf, | ||
| int | len | ||
| ) |


| void mg_send_dns_query | ( | struct mg_connection * | nc, |
| const char * | name, | ||
| int | query_type | ||
| ) |


| void mg_send_head | ( | struct mg_connection * | c, |
| int | status_code, | ||
| int64_t | content_length, | ||
| const char * | extra_headers | ||
| ) |


| void mg_send_http_chunk | ( | struct mg_connection * | nc, |
| const char * | buf, | ||
| size_t | len | ||
| ) |


| void mg_send_mqtt_handshake | ( | struct mg_connection * | nc, |
| const char * | client_id | ||
| ) |

| void mg_send_mqtt_handshake_opt | ( | struct mg_connection * | nc, |
| const char * | client_id, | ||
| struct mg_send_mqtt_handshake_opts | opts | ||
| ) |


|
static |


| void mg_send_response_line | ( | struct mg_connection * | nc, |
| int | status_code, | ||
| const char * | extra_headers | ||
| ) |


| void mg_send_response_line_s | ( | struct mg_connection * | nc, |
| int | status_code, | ||
| const struct mg_str | extra_headers | ||
| ) |


| void mg_send_websocket_frame | ( | struct mg_connection * | nc, |
| int | op, | ||
| const void * | data, | ||
| size_t | len | ||
| ) |


| void mg_send_websocket_framev | ( | struct mg_connection * | nc, |
| int | op, | ||
| const struct mg_str * | strv, | ||
| int | strvcnt | ||
| ) |


| void mg_send_websocket_handshake | ( | struct mg_connection * | nc, |
| const char * | path, | ||
| const char * | extra_headers | ||
| ) |

| void mg_send_websocket_handshake2 | ( | struct mg_connection * | nc, |
| const char * | path, | ||
| const char * | host, | ||
| const char * | protocol, | ||
| const char * | extra_headers | ||
| ) |


| void mg_send_websocket_handshake3 | ( | struct mg_connection * | nc, |
| const char * | path, | ||
| const char * | host, | ||
| const char * | protocol, | ||
| const char * | extra_headers, | ||
| const char * | user, | ||
| const char * | pass | ||
| ) |


|
static |


| void mg_set_close_on_exec | ( | sock_t | sock | ) |

| void mg_set_non_blocking_mode | ( | sock_t | sock | ) |

| void mg_set_protocol_dns | ( | struct mg_connection * | nc | ) |

| void mg_set_protocol_http_websocket | ( | struct mg_connection * | nc | ) |


| void mg_set_protocol_mqtt | ( | struct mg_connection * | nc | ) |


| double mg_set_timer | ( | struct mg_connection * | c, |
| double | timestamp | ||
| ) |

| const char* mg_skip | ( | const char * | s, |
| const char * | end, | ||
| const char * | delims, | ||
| struct mg_str * | v | ||
| ) |

| void mg_sock_addr_to_str | ( | const union socket_address * | sa, |
| char * | buf, | ||
| size_t | len, | ||
| int | flags | ||
| ) |

|
static |

| void mg_sock_set | ( | struct mg_connection * | nc, |
| sock_t | sock | ||
| ) |

| void mg_sock_to_str | ( | sock_t | sock, |
| char * | buf, | ||
| size_t | len, | ||
| int | flags | ||
| ) |


| void mg_socket_if_add_conn | ( | struct mg_connection * | nc | ) |
| void mg_socket_if_connect_tcp | ( | struct mg_connection * | nc, |
| const union socket_address * | sa | ||
| ) |

| void mg_socket_if_connect_udp | ( | struct mg_connection * | nc | ) |

| int mg_socket_if_create_conn | ( | struct mg_connection * | nc | ) |
| void mg_socket_if_destroy_conn | ( | struct mg_connection * | nc | ) |
| void mg_socket_if_free | ( | struct mg_iface * | iface | ) |
| void mg_socket_if_get_conn_addr | ( | struct mg_connection * | nc, |
| int | remote, | ||
| union socket_address * | sa | ||
| ) |

| void mg_socket_if_init | ( | struct mg_iface * | iface | ) |

| int mg_socket_if_listen_tcp | ( | struct mg_connection * | nc, |
| union socket_address * | sa | ||
| ) |

| int mg_socket_if_listen_udp | ( | struct mg_connection * | nc, |
| union socket_address * | sa | ||
| ) |

| time_t mg_socket_if_poll | ( | struct mg_iface * | iface, |
| int | timeout_ms | ||
| ) |

| void mg_socket_if_recved | ( | struct mg_connection * | nc, |
| size_t | len | ||
| ) |
| void mg_socket_if_remove_conn | ( | struct mg_connection * | nc | ) |
| void mg_socket_if_sock_set | ( | struct mg_connection * | nc, |
| sock_t | sock | ||
| ) |

| void mg_socket_if_tcp_send | ( | struct mg_connection * | nc, |
| const void * | buf, | ||
| size_t | len | ||
| ) |

| void mg_socket_if_udp_send | ( | struct mg_connection * | nc, |
| const void * | buf, | ||
| size_t | len | ||
| ) |

| const char* mg_status_message | ( | int | status_code | ) |





| double mg_time | ( | void | ) |


| struct mg_connection * mg_tun_bind_opt | ( | struct mg_mgr * | mgr, |
| const char * | dispatcher, | ||
| mg_event_handler_t | handler, | ||
| struct mg_bind_opts | opts | ||
| ) |


|
static |


|
static |

|
static |


| void mg_tun_destroy_client | ( | struct mg_tun_client * | client | ) |

|
static |


|
static |


| void mg_tun_if_add_conn | ( | struct mg_connection * | nc | ) |
| void mg_tun_if_connect_tcp | ( | struct mg_connection * | nc, |
| const union socket_address * | sa | ||
| ) |
| void mg_tun_if_connect_udp | ( | struct mg_connection * | nc | ) |
| int mg_tun_if_create_conn | ( | struct mg_connection * | nc | ) |
| void mg_tun_if_destroy_conn | ( | struct mg_connection * | nc | ) |

| struct mg_connection * mg_tun_if_find_conn | ( | struct mg_tun_client * | client, |
| uint32_t | stream_id | ||
| ) |


| void mg_tun_if_free | ( | struct mg_iface * | iface | ) |
| void mg_tun_if_get_conn_addr | ( | struct mg_connection * | nc, |
| int | remote, | ||
| union socket_address * | sa | ||
| ) |
| void mg_tun_if_init | ( | struct mg_iface * | iface | ) |
| int mg_tun_if_listen_tcp | ( | struct mg_connection * | nc, |
| union socket_address * | sa | ||
| ) |
| int mg_tun_if_listen_udp | ( | struct mg_connection * | nc, |
| union socket_address * | sa | ||
| ) |
| time_t mg_tun_if_poll | ( | struct mg_iface * | iface, |
| int | timeout_ms | ||
| ) |

| void mg_tun_if_recved | ( | struct mg_connection * | nc, |
| size_t | len | ||
| ) |
| void mg_tun_if_remove_conn | ( | struct mg_connection * | nc | ) |
| void mg_tun_if_sock_set | ( | struct mg_connection * | nc, |
| sock_t | sock | ||
| ) |
| void mg_tun_if_tcp_send | ( | struct mg_connection * | nc, |
| const void * | buf, | ||
| size_t | len | ||
| ) |

| void mg_tun_if_udp_send | ( | struct mg_connection * | nc, |
| const void * | buf, | ||
| size_t | len | ||
| ) |
|
static |

| void mg_tun_log_frame | ( | struct mg_tun_frame * | frame | ) |

| int mg_tun_parse_frame | ( | void * | data, |
| size_t | len, | ||
| struct mg_tun_frame * | frame | ||
| ) |

|
static |


| void mg_tun_reconnect_ev_handler | ( | struct mg_connection * | nc, |
| int | ev, | ||
| void * | ev_data | ||
| ) |


| void mg_tun_send_frame | ( | struct mg_connection * | ws, |
| uint32_t | stream_id, | ||
| uint8_t | type, | ||
| uint8_t | flags, | ||
| struct mg_str | msg | ||
| ) |


| int mg_url_decode | ( | const char * | src, |
| int | src_len, | ||
| char * | dst, | ||
| int | dst_len, | ||
| int | is_form_url_encoded | ||
| ) |

| int mg_vcasecmp | ( | const struct mg_str * | str1, |
| const char * | str2 | ||
| ) |


| int mg_vcmp | ( | const struct mg_str * | str1, |
| const char * | str2 | ||
| ) |


| int mg_vprintf | ( | struct mg_connection * | nc, |
| const char * | fmt, | ||
| va_list | ap | ||
| ) |


|
static |


| MG_INTERNAL void mg_ws_handler | ( | struct mg_connection * | nc, |
| int | ev, | ||
| void * | ev_data | ||
| ) |


| MG_INTERNAL void mg_ws_handshake | ( | struct mg_connection * | nc, |
| const struct mg_str * | key | ||
| ) |


|
static |

|
static |

|
static |


| MG_INTERNAL int parse_mqtt | ( | struct mbuf * | io, |
| struct mg_mqtt_message * | mm | ||
| ) |


|
static |


|
static |

| MG_INTERNAL size_t recv_avail_size | ( | struct mg_connection * | conn, |
| size_t | max | ||
| ) |

|
static |


|
static |


|
static |


|
static |
| struct mg_iface_vtable mg_default_iface_vtable = MG_SOCKET_IFACE_VTABLE |
| MG_INTERNAL char mg_dns_server[256] |
|
static |
| struct mg_iface_vtable* mg_ifaces[] |
| struct mg_iface_vtable mg_pic32_iface_vtable |
| struct mg_iface_vtable mg_simplelink_iface_vtable |
| struct mg_iface_vtable mg_socket_iface_vtable = MG_SOCKET_IFACE_VTABLE |
| struct mg_iface_vtable mg_tun_iface_vtable = MG_TUN_IFACE_VTABLE |
|
static |
| void*(* test_calloc) (size_t count, size_t size) |
| void*(* test_malloc) (size_t size) |
| enum cs_log_level cs_log_level WEAK |
1.8.13