Teonet library
0.4.7
|
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <time.h>
#include <signal.h>
#include <assert.h>
#include <ctype.h>
#include <limits.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <dirent.h>
#include <netdb.h>
#include <pthread.h>
#include <unistd.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <sys/select.h>
#include <errno.h>
#include <inttypes.h>
Go to the source code of this file.
Data Structures | |
struct | mbuf |
struct | cs_sha1_ctx |
struct | MD5Context |
struct | cs_base64_ctx |
struct | json_token |
union | socket_address |
struct | mg_str |
struct | mg_mgr |
struct | mg_connection |
struct | mg_add_sock_opts |
struct | mg_bind_opts |
struct | mg_connect_opts |
struct | http_message |
struct | websocket_message |
struct | mg_serve_http_opts |
struct | mg_rpc_request |
struct | mg_rpc_reply |
struct | mg_rpc_error |
struct | mg_mqtt_message |
struct | mg_mqtt_topic_expression |
struct | mg_send_mqtt_handshake_opts |
struct | mg_dns_resource_record |
struct | mg_dns_message |
struct | mg_resolve_async_opts |
Macros | |
#define | MG_VERSION "6.0" |
#define | OSDEP_HEADER_INCLUDED |
#define | _MBCS /* Use multibyte encoding on Windows */ |
#define | _INTEGRAL_MAX_BITS 64 /* Enable _stati64() on Windows */ |
#define | _CRT_SECURE_NO_WARNINGS /* Disable deprecation warning in VS2005+ */ |
#define | _XOPEN_SOURCE 600 /* For flockfile() on Linux */ |
#define | __STDC_FORMAT_MACROS /* <inttypes.h> wants this for C++ */ |
#define | __STDC_LIMIT_MACROS /* C++ wants that for INT64_MAX */ |
#define | _LARGEFILE_SOURCE /* Enable fseeko() and ftello() functions */ |
#define | _FILE_OFFSET_BITS 64 /* Enable 64-bit file offsets */ |
#define | LITTLE_ENDIAN 0x41424344 |
#define | BIG_ENDIAN 0x44434241 |
#define | PDP_ENDIAN 0x42414443 |
#define | BYTE_ORDER LITTLE_ENDIAN |
#define | va_copy(x, y) (x) = (y) |
#define | closesocket(x) close(x) |
#define | __cdecl |
#define | INVALID_SOCKET (-1) |
#define | INT64_FMT PRId64 |
#define | SIZE_T_FMT "zu" |
#define | to64(x) strtoll(x, NULL, 10) |
#define | DIRSEP '/' |
#define | ARRAY_SIZE(array) (sizeof(array) / sizeof(array[0])) |
#define | _CS_DBG_H_ |
#define | LOG(l, x) |
#define | DBG(x) |
#define | MBUF_H_INCLUDED |
#define | MBUF_SIZE_MULTIPLIER 1.5 |
#define | MG_SHA1_HEADER_INCLUDED |
#define | MD5_HEADER_DEFINED |
#define | BASE64_H_INCLUDED |
#define | STR_UTIL_H |
#define | _MG_PROVIDE_STRNLEN |
#define | FROZEN_HEADER_INCLUDED |
#define | JSON_STRING_INVALID -1 |
#define | JSON_STRING_INCOMPLETE -2 |
#define | JSON_TOKEN_ARRAY_TOO_SMALL -3 |
#define | MG_NET_HEADER_INCLUDED |
#define | MG_RECV_FUNC(s, b, l, f) recv(s, b, l, f) |
#define | MG_SEND_FUNC(s, b, l, f) send(s, b, l, f) |
#define | MG_STR(str_literal) { str_literal, sizeof(str_literal) - 1 } |
#define | MG_EV_POLL 0 /* Sent to each connection on each mg_mgr_poll() call */ |
#define | MG_EV_ACCEPT 1 /* New connection accepted. union socket_address * */ |
#define | MG_EV_CONNECT 2 /* connect() succeeded or failed. int * */ |
#define | MG_EV_RECV 3 /* Data has benn received. int *num_bytes */ |
#define | MG_EV_SEND 4 /* Data has been written to a socket. int *num_bytes */ |
#define | MG_EV_CLOSE 5 /* Connection is closed. NULL */ |
#define | MG_F_LISTENING (1 << 0) /* This connection is listening */ |
#define | MG_F_UDP (1 << 1) /* This connection is UDP */ |
#define | MG_F_RESOLVING (1 << 2) /* Waiting for async resolver */ |
#define | MG_F_CONNECTING (1 << 3) /* connect() call in progress */ |
#define | MG_F_SSL_HANDSHAKE_DONE (1 << 4) /* SSL specific */ |
#define | MG_F_WANT_READ (1 << 5) /* SSL specific */ |
#define | MG_F_WANT_WRITE (1 << 6) /* SSL specific */ |
#define | MG_F_IS_WEBSOCKET (1 << 7) /* Websocket specific */ |
#define | MG_F_SEND_AND_CLOSE (1 << 10) /* Push remaining data and close */ |
#define | MG_F_CLOSE_IMMEDIATELY (1 << 11) /* Disconnect */ |
#define | MG_F_WEBSOCKET_NO_DEFRAG (1 << 12) /* Websocket specific */ |
#define | MG_F_DELETE_CHUNK (1 << 13) /* HTTP specific */ |
#define | MG_F_USER_1 (1 << 20) /* Flags left for application */ |
#define | MG_F_USER_2 (1 << 21) |
#define | MG_F_USER_3 (1 << 22) |
#define | MG_F_USER_4 (1 << 23) |
#define | MG_F_USER_5 (1 << 24) |
#define | MG_F_USER_6 (1 << 25) |
#define | MG_NET_IF_HEADER_INCLUDED |
#define | MG_UTIL_HEADER_DEFINED |
#define | MAX_PATH_SIZE 500 |
#define | MG_SOCK_STRINGIFY_IP 1 |
#define | MG_SOCK_STRINGIFY_PORT 2 |
#define | MG_SOCK_STRINGIFY_REMOTE 4 |
#define | MG_HTTP_HEADER_DEFINED |
#define | MG_MAX_HTTP_HEADERS 40 |
#define | MG_MAX_HTTP_REQUEST_SIZE 8192 |
#define | MG_MAX_PATH 1024 |
#define | MG_MAX_HTTP_SEND_IOBUF 4096 |
#define | MG_WEBSOCKET_PING_INTERVAL_SECONDS 5 |
#define | MG_CGI_ENVIRONMENT_SIZE 8192 |
#define | MG_MAX_CGI_ENVIR_VARS 64 |
#define | MG_ENV_EXPORT_TO_CGI "MONGOOSE_CGI" |
#define | MG_EV_HTTP_REQUEST 100 /* struct http_message * */ |
#define | MG_EV_HTTP_REPLY 101 /* struct http_message * */ |
#define | MG_EV_HTTP_CHUNK 102 /* struct http_message * */ |
#define | MG_EV_SSI_CALL 105 /* char * */ |
#define | MG_EV_WEBSOCKET_HANDSHAKE_REQUEST 111 /* NULL */ |
#define | MG_EV_WEBSOCKET_HANDSHAKE_DONE 112 /* NULL */ |
#define | MG_EV_WEBSOCKET_FRAME 113 /* struct websocket_message * */ |
#define | MG_EV_WEBSOCKET_CONTROL_FRAME 114 /* struct websocket_message * */ |
#define | WEBSOCKET_OP_CONTINUE 0 |
#define | WEBSOCKET_OP_TEXT 1 |
#define | WEBSOCKET_OP_BINARY 2 |
#define | WEBSOCKET_OP_CLOSE 8 |
#define | WEBSOCKET_OP_PING 9 |
#define | WEBSOCKET_OP_PONG 10 |
#define | WEBSOCKET_DONT_FIN 0x100 |
#define | MG_JSON_RPC_HEADER_DEFINED |
#define | JSON_RPC_PARSE_ERROR (-32700) |
#define | JSON_RPC_INVALID_REQUEST_ERROR (-32600) |
#define | JSON_RPC_METHOD_NOT_FOUND_ERROR (-32601) |
#define | JSON_RPC_INVALID_PARAMS_ERROR (-32602) |
#define | JSON_RPC_INTERNAL_ERROR (-32603) |
#define | JSON_RPC_SERVER_ERROR (-32000) |
#define | MG_MQTT_HEADER_INCLUDED |
#define | MG_MQTT_CMD_CONNECT 1 |
#define | MG_MQTT_CMD_CONNACK 2 |
#define | MG_MQTT_CMD_PUBLISH 3 |
#define | MG_MQTT_CMD_PUBACK 4 |
#define | MG_MQTT_CMD_PUBREC 5 |
#define | MG_MQTT_CMD_PUBREL 6 |
#define | MG_MQTT_CMD_PUBCOMP 7 |
#define | MG_MQTT_CMD_SUBSCRIBE 8 |
#define | MG_MQTT_CMD_SUBACK 9 |
#define | MG_MQTT_CMD_UNSUBSCRIBE 10 |
#define | MG_MQTT_CMD_UNSUBACK 11 |
#define | MG_MQTT_CMD_PINGREQ 12 |
#define | MG_MQTT_CMD_PINGRESP 13 |
#define | MG_MQTT_CMD_DISCONNECT 14 |
#define | MG_MQTT_EVENT_BASE 200 |
#define | MG_EV_MQTT_CONNECT (MG_MQTT_EVENT_BASE + MG_MQTT_CMD_CONNECT) |
#define | MG_EV_MQTT_CONNACK (MG_MQTT_EVENT_BASE + MG_MQTT_CMD_CONNACK) |
#define | MG_EV_MQTT_PUBLISH (MG_MQTT_EVENT_BASE + MG_MQTT_CMD_PUBLISH) |
#define | MG_EV_MQTT_PUBACK (MG_MQTT_EVENT_BASE + MG_MQTT_CMD_PUBACK) |
#define | MG_EV_MQTT_PUBREC (MG_MQTT_EVENT_BASE + MG_MQTT_CMD_PUBREC) |
#define | MG_EV_MQTT_PUBREL (MG_MQTT_EVENT_BASE + MG_MQTT_CMD_PUBREL) |
#define | MG_EV_MQTT_PUBCOMP (MG_MQTT_EVENT_BASE + MG_MQTT_CMD_PUBCOMP) |
#define | MG_EV_MQTT_SUBSCRIBE (MG_MQTT_EVENT_BASE + MG_MQTT_CMD_SUBSCRIBE) |
#define | MG_EV_MQTT_SUBACK (MG_MQTT_EVENT_BASE + MG_MQTT_CMD_SUBACK) |
#define | MG_EV_MQTT_UNSUBSCRIBE (MG_MQTT_EVENT_BASE + MG_MQTT_CMD_UNSUBSCRIBE) |
#define | MG_EV_MQTT_UNSUBACK (MG_MQTT_EVENT_BASE + MG_MQTT_CMD_UNSUBACK) |
#define | MG_EV_MQTT_PINGREQ (MG_MQTT_EVENT_BASE + MG_MQTT_CMD_PINGREQ) |
#define | MG_EV_MQTT_PINGRESP (MG_MQTT_EVENT_BASE + MG_MQTT_CMD_PINGRESP) |
#define | MG_EV_MQTT_DISCONNECT (MG_MQTT_EVENT_BASE + MG_MQTT_CMD_DISCONNECT) |
#define | MG_MQTT_RETAIN 0x1 |
#define | MG_MQTT_DUP 0x4 |
#define | MG_MQTT_QOS(qos) ((qos) << 1) |
#define | MG_MQTT_GET_QOS(flags) (((flags) &0x6) >> 1) |
#define | MG_MQTT_SET_QOS(flags, qos) (flags) = ((flags) & ~0x6) | ((qos) << 1) |
#define | MG_MQTT_CLEAN_SESSION 0x02 |
#define | MG_MQTT_HAS_WILL 0x04 |
#define | MG_MQTT_WILL_RETAIN 0x20 |
#define | MG_MQTT_HAS_PASSWORD 0x40 |
#define | MG_MQTT_HAS_USER_NAME 0x80 |
#define | MG_MQTT_GET_WILL_QOS(flags) (((flags) &0x18) >> 3) |
#define | MG_MQTT_SET_WILL_QOS(flags, qos) (flags) = ((flags) & ~0x18) | ((qos) << 3) |
#define | MG_EV_MQTT_CONNACK_ACCEPTED 0 |
#define | MG_EV_MQTT_CONNACK_UNACCEPTABLE_VERSION 1 |
#define | MG_EV_MQTT_CONNACK_IDENTIFIER_REJECTED 2 |
#define | MG_EV_MQTT_CONNACK_SERVER_UNAVAILABLE 3 |
#define | MG_EV_MQTT_CONNACK_BAD_AUTH 4 |
#define | MG_EV_MQTT_CONNACK_NOT_AUTHORIZED 5 |
#define | MG_MQTT_BROKER_HEADER_INCLUDED |
#define | MG_DNS_HEADER_DEFINED |
#define | MG_DNS_A_RECORD 0x01 /* Lookup IP address */ |
#define | MG_DNS_CNAME_RECORD 0x05 /* Lookup CNAME */ |
#define | MG_DNS_AAAA_RECORD 0x1c /* Lookup IPv6 address */ |
#define | MG_DNS_MX_RECORD 0x0f /* Lookup mail server for domain */ |
#define | MG_MAX_DNS_QUESTIONS 32 |
#define | MG_MAX_DNS_ANSWERS 32 |
#define | MG_DNS_MESSAGE 100 /* High-level DNS message event */ |
#define | MG_DNS_SERVER_HEADER_DEFINED |
#define | MG_RESOLV_HEADER_DEFINED |
#define | MG_COAP_HEADER_INCLUDED |
Typedefs | |
typedef int | sock_t |
typedef struct stat | cs_stat_t |
typedef struct MD5Context | MD5_CTX |
typedef void(* | cs_base64_putc_t )(char, void *) |
typedef void * | SSL |
typedef void * | SSL_CTX |
typedef void(* | mg_event_handler_t )(struct mg_connection *, int ev, void *) |
typedef int(* | mg_rpc_handler_t )(char *buf, int len, struct mg_rpc_request *) |
typedef void(* | mg_resolve_callback_t )(struct mg_dns_message *, void *) |
Enumerations | |
enum | cs_log_level { LL_NONE = -1, LL_ERROR = 0, LL_WARN = 1, LL_INFO = 2, LL_DEBUG = 3, _LL_MIN = -2, _LL_MAX = 4 } |
enum | json_type { JSON_TYPE_EOF = 0, JSON_TYPE_STRING = 1, JSON_TYPE_NUMBER = 2, JSON_TYPE_OBJECT = 3, JSON_TYPE_TRUE = 4, JSON_TYPE_FALSE = 5, JSON_TYPE_NULL = 6, JSON_TYPE_ARRAY = 7 } |
enum | mg_dns_resource_record_kind { MG_DNS_INVALID_RECORD = 0, MG_DNS_QUESTION, MG_DNS_ANSWER } |
Functions | |
void | cs_log_set_level (enum cs_log_level level) |
void | cs_log_printf (const char *fmt,...) |
void | mbuf_init (struct mbuf *, size_t initial_capacity) |
void | mbuf_free (struct mbuf *) |
size_t | mbuf_append (struct mbuf *, const void *data, size_t data_size) |
size_t | mbuf_insert (struct mbuf *, size_t, const void *, size_t) |
void | mbuf_remove (struct mbuf *, size_t data_size) |
void | mbuf_resize (struct mbuf *, size_t new_size) |
void | mbuf_trim (struct mbuf *) |
void | cs_sha1_init (cs_sha1_ctx *) |
void | cs_sha1_update (cs_sha1_ctx *, const unsigned char *data, uint32_t len) |
void | cs_sha1_final (unsigned char digest[20], cs_sha1_ctx *) |
void | cs_hmac_sha1 (const unsigned char *key, size_t key_len, const unsigned char *text, size_t text_len, unsigned char out[20]) |
void | MD5_Init (MD5_CTX *c) |
void | MD5_Update (MD5_CTX *c, const unsigned char *data, size_t len) |
void | MD5_Final (unsigned char *md, MD5_CTX *c) |
char * | cs_md5 (char buf[33],...) |
void | cs_to_hex (char *to, const unsigned char *p, size_t len) |
void | cs_base64_init (struct cs_base64_ctx *ctx, cs_base64_putc_t 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) |
void | cs_fprint_base64 (FILE *f, const unsigned char *src, int src_len) |
int | cs_base64_decode (const unsigned char *s, int len, char *dst) |
int | c_snprintf (char *buf, size_t buf_size, const char *format,...) |
int | c_vsnprintf (char *buf, size_t buf_size, const char *format, va_list ap) |
size_t | strnlen (const char *s, size_t maxlen) |
int | parse_json (const char *json_string, int json_string_length, struct json_token *tokens_array, int size_of_tokens_array) |
struct json_token * | parse_json2 (const char *json_string, int string_length) |
struct json_token * | find_json_token (struct json_token *toks, const char *path) |
int | json_emit_long (char *buf, int buf_len, long value) |
int | json_emit_double (char *buf, int buf_len, double value) |
int | json_emit_quoted_str (char *buf, int buf_len, const char *str, int len) |
int | json_emit_unquoted_str (char *buf, int buf_len, const char *str, int len) |
int | json_emit (char *buf, int buf_len, const char *fmt,...) |
int | json_emit_va (char *buf, int buf_len, const char *fmt, va_list) |
void | mg_mgr_init (struct mg_mgr *mgr, void *user_data) |
void | mg_mgr_free (struct mg_mgr *) |
time_t | mg_mgr_poll (struct mg_mgr *, int milli) |
void | mg_broadcast (struct mg_mgr *, mg_event_handler_t func, void *, size_t) |
struct mg_connection * | mg_next (struct mg_mgr *, struct mg_connection *) |
struct mg_connection * | mg_add_sock (struct mg_mgr *, sock_t, mg_event_handler_t) |
struct mg_connection * | mg_add_sock_opt (struct mg_mgr *, sock_t, mg_event_handler_t, struct mg_add_sock_opts) |
struct mg_connection * | mg_bind (struct mg_mgr *, const char *, mg_event_handler_t) |
struct mg_connection * | mg_bind_opt (struct mg_mgr *, const char *, mg_event_handler_t, struct mg_bind_opts) |
struct mg_connection * | mg_connect (struct mg_mgr *, const char *, mg_event_handler_t) |
struct mg_connection * | mg_connect_opt (struct mg_mgr *, const char *, mg_event_handler_t, struct mg_connect_opts) |
const char * | mg_set_ssl (struct mg_connection *nc, const char *cert, const char *ca_cert) |
void | mg_send (struct mg_connection *, const void *buf, int len) |
int | mg_printf (struct mg_connection *, const char *fmt,...) |
int | mg_vprintf (struct mg_connection *, const char *fmt, va_list ap) |
int | mg_socketpair (sock_t[2], int sock_type) |
int | mg_resolve (const char *domain_name, char *ip_addr_buf, size_t buf_len) |
int | mg_check_ip_acl (const char *acl, uint32_t remote_ip) |
void | mg_enable_multithreading (struct mg_connection *nc) |
void | mg_if_connect_tcp (struct mg_connection *nc, const union socket_address *sa) |
void | mg_if_connect_udp (struct mg_connection *nc) |
void | mg_if_connect_cb (struct mg_connection *nc, int err) |
int | mg_if_listen_tcp (struct mg_connection *nc, union socket_address *sa) |
struct mg_connection * | mg_if_accept_tcp_cb (struct mg_connection *lc, union socket_address *sa, size_t sa_len) |
int | mg_if_listen_udp (struct mg_connection *nc, union socket_address *sa) |
void | mg_if_tcp_send (struct mg_connection *nc, const void *buf, size_t len) |
void | mg_if_udp_send (struct mg_connection *nc, const void *buf, size_t len) |
void | mg_if_sent_cb (struct mg_connection *nc, int num_sent) |
void | mg_if_recv_tcp_cb (struct mg_connection *nc, void *buf, int len) |
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_recved (struct mg_connection *nc, size_t len) |
void | mg_if_poll (struct mg_connection *nc, time_t now) |
void | mg_if_destroy_conn (struct mg_connection *nc) |
void | mg_close_conn (struct mg_connection *nc) |
const char * | mg_skip (const char *s, const char *end_string, const char *delimiters, struct mg_str *v) |
int | mg_ncasecmp (const char *s1, const char *s2, size_t len) |
int | mg_casecmp (const char *s1, const char *s2) |
int | mg_vcmp (const struct mg_str *str2, const char *str1) |
int | mg_vcasecmp (const struct mg_str *str2, const char *str1) |
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) |
int | mg_stat (const char *path, cs_stat_t *st) |
FILE * | mg_fopen (const char *path, const char *mode) |
int | mg_open (const char *path, int flag, int mode) |
void | mg_set_close_on_exec (sock_t) |
void | mg_sock_to_str (sock_t sock, char *buf, size_t len, int flags) |
void | mg_sock_addr_to_str (const union socket_address *sa, char *buf, size_t len, int flags) |
int | mg_hexdump (const void *buf, int len, char *dst, int dst_len) |
void | mg_hexdump_connection (struct mg_connection *nc, const char *path, int num_bytes, int ev) |
int | mg_avprintf (char **buf, size_t size, const char *fmt, va_list ap) |
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 (const char *pattern, int pattern_len, const char *str) |
void | mg_set_protocol_http_websocket (struct mg_connection *nc) |
void | mg_send_websocket_handshake (struct mg_connection *nc, const char *uri, const char *extra_headers) |
void | mg_send_websocket_frame (struct mg_connection *nc, int op_and_flags, const void *data, size_t data_len) |
void | mg_send_websocket_framev (struct mg_connection *nc, int op_and_flags, const struct mg_str *strings, int num_strings) |
void | mg_printf_websocket_frame (struct mg_connection *nc, int op_and_flags, const char *fmt,...) |
void | mg_send_http_chunk (struct mg_connection *nc, const char *buf, size_t len) |
void | mg_printf_http_chunk (struct mg_connection *, const char *,...) |
void | mg_send_response_line (struct mg_connection *c, int status_code, const char *extra_headers) |
void | mg_send_head (struct mg_connection *n, int status_code, int64_t content_length, const char *extra_headers) |
void | mg_printf_html_escape (struct mg_connection *, const char *,...) |
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) |
int | mg_http_parse_header (struct mg_str *hdr, const char *var_name, char *buf, size_t buf_size) |
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 **chunk, size_t *chunk_len) |
int | mg_get_http_var (const struct mg_str *, const char *, char *dst, size_t) |
int | mg_http_create_digest_auth_header (char *buf, size_t buf_len, const char *method, const char *uri, const char *auth_domain, const char *user, const char *passwd) |
struct mg_connection * | mg_connect_http (struct mg_mgr *, mg_event_handler_t event_handler, const char *url, const char *extra_headers, const char *post_data) |
void | mg_serve_http (struct mg_connection *, struct http_message *, struct mg_serve_http_opts) |
int | mg_rpc_parse_reply (const char *buf, int len, struct json_token *toks, int max_toks, struct mg_rpc_reply *, struct mg_rpc_error *) |
int | mg_rpc_create_request (char *buf, int len, const char *method, const char *id, const char *params_fmt,...) |
int | mg_rpc_create_reply (char *buf, int len, const struct mg_rpc_request *req, const char *result_fmt,...) |
int | mg_rpc_create_error (char *buf, int len, struct mg_rpc_request *req, int code, const char *message, const char *fmt,...) |
int | mg_rpc_create_std_error (char *, int, struct mg_rpc_request *, int code) |
int | mg_rpc_dispatch (const char *buf, int, char *dst, int dst_len, const char **methods, mg_rpc_handler_t *handlers) |
void | mg_set_protocol_mqtt (struct mg_connection *) |
void | mg_send_mqtt_handshake (struct mg_connection *nc, const char *client_id) |
void | mg_send_mqtt_handshake_opt (struct mg_connection *, const char *client_id, struct mg_send_mqtt_handshake_opts) |
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) |
void | mg_mqtt_unsubscribe (struct mg_connection *nc, char **topics, size_t topics_len, uint16_t message_id) |
void | mg_mqtt_disconnect (struct mg_connection *nc) |
void | mg_mqtt_connack (struct mg_connection *, uint8_t) |
void | mg_mqtt_puback (struct mg_connection *, uint16_t) |
void | mg_mqtt_pubrec (struct mg_connection *, uint16_t) |
void | mg_mqtt_pubrel (struct mg_connection *, uint16_t) |
void | mg_mqtt_pubcomp (struct mg_connection *, uint16_t) |
void | mg_mqtt_suback (struct mg_connection *, uint8_t *, size_t, uint16_t) |
void | mg_mqtt_unsuback (struct mg_connection *, uint16_t) |
void | mg_mqtt_ping (struct mg_connection *) |
void | mg_mqtt_pong (struct mg_connection *) |
int | mg_mqtt_next_subscribe_topic (struct mg_mqtt_message *, struct mg_str *, uint8_t *, int) |
struct mg_dns_resource_record * | mg_dns_next_record (struct mg_dns_message *, int, struct mg_dns_resource_record *) |
int | mg_dns_parse_record_data (struct mg_dns_message *, struct mg_dns_resource_record *, void *, size_t) |
void | mg_send_dns_query (struct mg_connection *, const char *, int) |
int | mg_dns_insert_header (struct mbuf *, size_t, struct mg_dns_message *) |
int | mg_dns_copy_body (struct mbuf *, struct mg_dns_message *) |
int | mg_dns_encode_record (struct mbuf *, struct mg_dns_resource_record *, const char *, size_t, const void *, size_t) |
int | mg_parse_dns (const char *, int, struct mg_dns_message *) |
size_t | mg_dns_uncompress_name (struct mg_dns_message *, struct mg_str *, char *, int) |
void | mg_set_protocol_dns (struct mg_connection *) |
int | mg_resolve_async (struct mg_mgr *, const char *, int, mg_resolve_callback_t, void *data) |
int | mg_resolve_async_opt (struct mg_mgr *, const char *, int, mg_resolve_callback_t, void *data, struct mg_resolve_async_opts opts) |
int | mg_resolve_from_hosts_file (const char *host, union socket_address *usa) |
Variables | |
enum cs_log_level | s_cs_log_level |
#define __cdecl |
#define __STDC_FORMAT_MACROS /* <inttypes.h> wants this for C++ */ |
#define __STDC_LIMIT_MACROS /* C++ wants that for INT64_MAX */ |
#define _CRT_SECURE_NO_WARNINGS /* Disable deprecation warning in VS2005+ */ |
#define _CS_DBG_H_ |
#define _FILE_OFFSET_BITS 64 /* Enable 64-bit file offsets */ |
#define _INTEGRAL_MAX_BITS 64 /* Enable _stati64() on Windows */ |
#define _LARGEFILE_SOURCE /* Enable fseeko() and ftello() functions */ |
#define _MBCS /* Use multibyte encoding on Windows */ |
#define _MG_PROVIDE_STRNLEN |
#define _XOPEN_SOURCE 600 /* For flockfile() on Linux */ |
#define ARRAY_SIZE | ( | array | ) | (sizeof(array) / sizeof(array[0])) |
Referenced by mg_fopen(), mg_open(), mg_parse_dns(), and mg_stat().
#define BASE64_H_INCLUDED |
#define BIG_ENDIAN 0x44434241 |
#define BYTE_ORDER LITTLE_ENDIAN |
#define closesocket | ( | x | ) | close(x) |
Referenced by mg_if_destroy_conn(), mg_mgr_free(), and mg_socketpair().
#define DBG | ( | x | ) |
Referenced by http_handler(), mg_add_conn(), mg_bind_opt(), mg_call(), mg_close_conn(), mg_connect_http(), mg_do_connect(), mg_ev_mgr_init(), mg_if_accept_tcp_cb(), mg_if_connect_cb(), mg_if_connect_tcp(), mg_if_recv_udp_cb(), mg_if_udp_send(), mg_is_error(), mg_mgr_free(), mg_mgr_handle_conn(), mg_mgr_init(), mg_mgr_poll(), mg_resolve_async_opt(), mg_send_dns_query(), mg_send_http_file(), and mg_stat().
#define DIRSEP '/' |
#define FROZEN_HEADER_INCLUDED |
#define INT64_FMT PRId64 |
Referenced by mg_send_head().
#define INVALID_SOCKET (-1) |
#define JSON_RPC_INTERNAL_ERROR (-32603) |
#define JSON_RPC_INVALID_PARAMS_ERROR (-32602) |
Referenced by mg_rpc_create_std_error().
#define JSON_RPC_INVALID_REQUEST_ERROR (-32600) |
Referenced by mg_rpc_create_std_error(), and mg_rpc_dispatch().
#define JSON_RPC_METHOD_NOT_FOUND_ERROR (-32601) |
Referenced by mg_rpc_create_std_error(), and mg_rpc_dispatch().
#define JSON_RPC_PARSE_ERROR (-32700) |
Referenced by mg_rpc_create_std_error(), and mg_rpc_dispatch().
#define JSON_RPC_SERVER_ERROR (-32000) |
Referenced by mg_rpc_create_std_error(), and mg_rpc_dispatch().
#define JSON_STRING_INCOMPLETE -2 |
#define JSON_STRING_INVALID -1 |
Referenced by mg_rpc_dispatch().
#define JSON_TOKEN_ARRAY_TOO_SMALL -3 |
#define LITTLE_ENDIAN 0x41424344 |
#define LOG | ( | l, | |
x | |||
) |
#define MAX_PATH_SIZE 500 |
Referenced by mg_fopen(), mg_open(), and mg_stat().
#define MBUF_H_INCLUDED |
#define MBUF_SIZE_MULTIPLIER 1.5 |
Referenced by mbuf_insert().
#define MD5_HEADER_DEFINED |
#define MG_CGI_ENVIRONMENT_SIZE 8192 |
#define MG_COAP_HEADER_INCLUDED |
#define MG_DNS_A_RECORD 0x01 /* Lookup IP address */ |
Referenced by mg_connect_opt(), and mg_dns_parse_record_data().
#define MG_DNS_AAAA_RECORD 0x1c /* Lookup IPv6 address */ |
Referenced by mg_dns_parse_record_data().
#define MG_DNS_CNAME_RECORD 0x05 /* Lookup CNAME */ |
Referenced by mg_dns_encode_record(), and mg_dns_parse_record_data().
#define MG_DNS_HEADER_DEFINED |
#define MG_DNS_MESSAGE 100 /* High-level DNS message event */ |
#define MG_DNS_MX_RECORD 0x0f /* Lookup mail server for domain */ |
#define MG_DNS_SERVER_HEADER_DEFINED |
#define MG_ENV_EXPORT_TO_CGI "MONGOOSE_CGI" |
#define MG_EV_ACCEPT 1 /* New connection accepted. union socket_address * */ |
Referenced by mg_hexdump_connection(), mg_if_accept_tcp_cb(), and mg_if_recv_udp_cb().
#define MG_EV_CLOSE 5 /* Connection is closed. NULL */ |
Referenced by http_handler(), and mg_close_conn().
#define MG_EV_CONNECT 2 /* connect() succeeded or failed. int * */ |
Referenced by mg_hexdump_connection(), and mg_if_connect_cb().
#define MG_EV_HTTP_CHUNK 102 /* struct http_message * */ |
Referenced by mg_handle_chunked().
#define MG_EV_HTTP_REPLY 101 /* struct http_message * */ |
Referenced by http_handler().
#define MG_EV_HTTP_REQUEST 100 /* struct http_message * */ |
Referenced by http_handler().
#define MG_EV_MQTT_CONNACK (MG_MQTT_EVENT_BASE + MG_MQTT_CMD_CONNACK) |
#define MG_EV_MQTT_CONNACK_ACCEPTED 0 |
#define MG_EV_MQTT_CONNACK_BAD_AUTH 4 |
#define MG_EV_MQTT_CONNACK_IDENTIFIER_REJECTED 2 |
#define MG_EV_MQTT_CONNACK_NOT_AUTHORIZED 5 |
#define MG_EV_MQTT_CONNACK_SERVER_UNAVAILABLE 3 |
#define MG_EV_MQTT_CONNACK_UNACCEPTABLE_VERSION 1 |
#define MG_EV_MQTT_CONNECT (MG_MQTT_EVENT_BASE + MG_MQTT_CMD_CONNECT) |
#define MG_EV_MQTT_DISCONNECT (MG_MQTT_EVENT_BASE + MG_MQTT_CMD_DISCONNECT) |
#define MG_EV_MQTT_PINGREQ (MG_MQTT_EVENT_BASE + MG_MQTT_CMD_PINGREQ) |
#define MG_EV_MQTT_PINGRESP (MG_MQTT_EVENT_BASE + MG_MQTT_CMD_PINGRESP) |
#define MG_EV_MQTT_PUBACK (MG_MQTT_EVENT_BASE + MG_MQTT_CMD_PUBACK) |
#define MG_EV_MQTT_PUBCOMP (MG_MQTT_EVENT_BASE + MG_MQTT_CMD_PUBCOMP) |
#define MG_EV_MQTT_PUBLISH (MG_MQTT_EVENT_BASE + MG_MQTT_CMD_PUBLISH) |
#define MG_EV_MQTT_PUBREC (MG_MQTT_EVENT_BASE + MG_MQTT_CMD_PUBREC) |
#define MG_EV_MQTT_PUBREL (MG_MQTT_EVENT_BASE + MG_MQTT_CMD_PUBREL) |
#define MG_EV_MQTT_SUBACK (MG_MQTT_EVENT_BASE + MG_MQTT_CMD_SUBACK) |
#define MG_EV_MQTT_SUBSCRIBE (MG_MQTT_EVENT_BASE + MG_MQTT_CMD_SUBSCRIBE) |
#define MG_EV_MQTT_UNSUBACK (MG_MQTT_EVENT_BASE + MG_MQTT_CMD_UNSUBACK) |
#define MG_EV_MQTT_UNSUBSCRIBE (MG_MQTT_EVENT_BASE + MG_MQTT_CMD_UNSUBSCRIBE) |
#define MG_EV_POLL 0 /* Sent to each connection on each mg_mgr_poll() call */ |
Referenced by mg_call(), and mg_if_poll().
#define MG_EV_RECV 3 /* Data has benn received. int *num_bytes */ |
Referenced by http_handler(), mg_call(), and mg_hexdump_connection().
#define MG_EV_SEND 4 /* Data has been written to a socket. int *num_bytes */ |
Referenced by mg_call(), mg_hexdump_connection(), mg_if_sent_cb(), and mg_send().
#define MG_EV_SSI_CALL 105 /* char * */ |
#define MG_EV_WEBSOCKET_CONTROL_FRAME 114 /* struct websocket_message * */ |
#define MG_EV_WEBSOCKET_FRAME 113 /* struct websocket_message * */ |
#define MG_EV_WEBSOCKET_HANDSHAKE_DONE 112 /* NULL */ |
Referenced by http_handler().
#define MG_EV_WEBSOCKET_HANDSHAKE_REQUEST 111 /* NULL */ |
Referenced by http_handler().
#define MG_F_CLOSE_IMMEDIATELY (1 << 11) /* Disconnect */ |
Referenced by http_handler(), mg_handle_chunked(), mg_if_connect_cb(), mg_if_sent_cb(), mg_mgr_handle_conn(), mg_mgr_poll(), and mg_send_http_file().
#define MG_F_CONNECTING (1 << 3) /* connect() call in progress */ |
Referenced by mg_close_conn(), mg_do_connect(), mg_if_connect_cb(), mg_mgr_handle_conn(), and mg_mgr_poll().
#define MG_F_DELETE_CHUNK (1 << 13) /* HTTP specific */ |
Referenced by mg_handle_chunked().
#define MG_F_IS_WEBSOCKET (1 << 7) /* Websocket specific */ |
Referenced by http_handler().
#define MG_F_LISTENING (1 << 0) /* This connection is listening */ |
Referenced by mg_bind_opt(), mg_if_recv_udp_cb(), and mg_mgr_handle_conn().
#define MG_F_RESOLVING (1 << 2) /* Waiting for async resolver */ |
#define MG_F_SEND_AND_CLOSE (1 << 10) /* Push remaining data and close */ |
Referenced by http_handler(), mg_mgr_poll(), mg_send_websocket_frame(), mg_send_websocket_framev(), and mg_serve_http().
#define MG_F_SSL_HANDSHAKE_DONE (1 << 4) /* SSL specific */ |
#define MG_F_UDP (1 << 1) /* This connection is UDP */ |
Referenced by mg_bind_opt(), mg_connect_opt(), mg_if_destroy_conn(), mg_if_recv_udp_cb(), mg_mgr_handle_conn(), mg_mgr_poll(), mg_send(), and mg_send_dns_query().
#define MG_F_USER_1 (1 << 20) /* Flags left for application */ |
#define MG_F_USER_2 (1 << 21) |
#define MG_F_USER_3 (1 << 22) |
#define MG_F_USER_4 (1 << 23) |
#define MG_F_USER_5 (1 << 24) |
#define MG_F_USER_6 (1 << 25) |
#define MG_F_WANT_READ (1 << 5) /* SSL specific */ |
Referenced by mg_mgr_poll().
#define MG_F_WANT_WRITE (1 << 6) /* SSL specific */ |
Referenced by mg_mgr_poll().
#define MG_F_WEBSOCKET_NO_DEFRAG (1 << 12) /* Websocket specific */ |
#define MG_HTTP_HEADER_DEFINED |
#define MG_JSON_RPC_HEADER_DEFINED |
#define MG_MAX_CGI_ENVIR_VARS 64 |
#define MG_MAX_DNS_ANSWERS 32 |
#define MG_MAX_DNS_QUESTIONS 32 |
#define MG_MAX_HTTP_HEADERS 40 |
#define MG_MAX_HTTP_REQUEST_SIZE 8192 |
Referenced by http_handler().
#define MG_MAX_HTTP_SEND_IOBUF 4096 |
#define MG_MAX_PATH 1024 |
Referenced by mg_serve_http().
#define MG_MQTT_BROKER_HEADER_INCLUDED |
#define MG_MQTT_CLEAN_SESSION 0x02 |
#define MG_MQTT_CMD_CONNACK 2 |
Referenced by mg_mqtt_connack().
#define MG_MQTT_CMD_CONNECT 1 |
Referenced by mg_send_mqtt_handshake_opt().
#define MG_MQTT_CMD_DISCONNECT 14 |
Referenced by mg_mqtt_disconnect().
#define MG_MQTT_CMD_PINGREQ 12 |
Referenced by mg_mqtt_ping().
#define MG_MQTT_CMD_PINGRESP 13 |
Referenced by mg_mqtt_pong().
#define MG_MQTT_CMD_PUBACK 4 |
Referenced by mg_mqtt_puback().
#define MG_MQTT_CMD_PUBCOMP 7 |
Referenced by mg_mqtt_pubcomp().
#define MG_MQTT_CMD_PUBLISH 3 |
Referenced by mg_mqtt_publish().
#define MG_MQTT_CMD_PUBREC 5 |
Referenced by mg_mqtt_pubrec().
#define MG_MQTT_CMD_PUBREL 6 |
Referenced by mg_mqtt_pubrel().
#define MG_MQTT_CMD_SUBACK 9 |
Referenced by mg_mqtt_suback().
#define MG_MQTT_CMD_SUBSCRIBE 8 |
Referenced by mg_mqtt_subscribe().
#define MG_MQTT_CMD_UNSUBACK 11 |
Referenced by mg_mqtt_unsuback().
#define MG_MQTT_CMD_UNSUBSCRIBE 10 |
Referenced by mg_mqtt_unsubscribe().
#define MG_MQTT_DUP 0x4 |
#define MG_MQTT_EVENT_BASE 200 |
#define MG_MQTT_GET_QOS | ( | flags | ) | (((flags) &0x6) >> 1) |
Referenced by mg_mqtt_publish().
#define MG_MQTT_GET_WILL_QOS | ( | flags | ) | (((flags) &0x18) >> 3) |
#define MG_MQTT_HAS_PASSWORD 0x40 |
#define MG_MQTT_HAS_USER_NAME 0x80 |
#define MG_MQTT_HAS_WILL 0x04 |
#define MG_MQTT_HEADER_INCLUDED |
#define MG_MQTT_QOS | ( | qos | ) | ((qos) << 1) |
Referenced by mg_mqtt_suback(), mg_mqtt_subscribe(), and mg_mqtt_unsubscribe().
#define MG_MQTT_RETAIN 0x1 |
#define MG_MQTT_SET_QOS | ( | flags, | |
qos | |||
) | (flags) = ((flags) & ~0x6) | ((qos) << 1) |
#define MG_MQTT_SET_WILL_QOS | ( | flags, | |
qos | |||
) | (flags) = ((flags) & ~0x18) | ((qos) << 3) |
#define MG_MQTT_WILL_RETAIN 0x20 |
#define MG_NET_HEADER_INCLUDED |
#define MG_NET_IF_HEADER_INCLUDED |
#define MG_RECV_FUNC | ( | s, | |
b, | |||
l, | |||
f | |||
) | recv(s, b, l, f) |
Referenced by mg_broadcast().
#define MG_RESOLV_HEADER_DEFINED |
#define MG_SEND_FUNC | ( | s, | |
b, | |||
l, | |||
f | |||
) | send(s, b, l, f) |
Referenced by mg_broadcast().
#define MG_SHA1_HEADER_INCLUDED |
#define MG_SOCK_STRINGIFY_IP 1 |
Referenced by mg_sock_addr_to_str().
#define MG_SOCK_STRINGIFY_PORT 2 |
Referenced by mg_sock_addr_to_str().
#define MG_SOCK_STRINGIFY_REMOTE 4 |
Referenced by mg_sock_to_str().
#define MG_STR | ( | str_literal | ) | { str_literal, sizeof(str_literal) - 1 } |
#define MG_UTIL_HEADER_DEFINED |
#define MG_VERSION "6.0" |
#define MG_WEBSOCKET_PING_INTERVAL_SECONDS 5 |
#define OSDEP_HEADER_INCLUDED |
#define PDP_ENDIAN 0x42414443 |
#define SIZE_T_FMT "zu" |
Referenced by mg_connect_http().
#define STR_UTIL_H |
#define to64 | ( | x | ) | strtoll(x, NULL, 10) |
#define va_copy | ( | x, | |
y | |||
) | (x) = (y) |
Referenced by ksnet_vformatMessage(), and mg_avprintf().
#define WEBSOCKET_DONT_FIN 0x100 |
#define WEBSOCKET_OP_BINARY 2 |
#define WEBSOCKET_OP_CLOSE 8 |
Referenced by mg_send_websocket_frame(), and mg_send_websocket_framev().
#define WEBSOCKET_OP_CONTINUE 0 |
#define WEBSOCKET_OP_PING 9 |
#define WEBSOCKET_OP_PONG 10 |
#define WEBSOCKET_OP_TEXT 1 |
Referenced by event_cb().
typedef void(* cs_base64_putc_t)(char, void *) |
typedef struct stat cs_stat_t |
typedef struct MD5Context MD5_CTX |
typedef void(* mg_event_handler_t)(struct mg_connection *, int ev, void *) |
typedef void(* mg_resolve_callback_t)(struct mg_dns_message *, void *) |
typedef int(* mg_rpc_handler_t)(char *buf, int len, struct mg_rpc_request *) |
typedef int sock_t |
typedef void* SSL |
typedef void* SSL_CTX |
enum cs_log_level |
enum json_type |
int c_snprintf | ( | char * | buf, |
size_t | buf_size, | ||
const char * | format, | ||
... | |||
) |
References c_vsnprintf(), and result.
int c_vsnprintf | ( | char * | buf, |
size_t | buf_size, | ||
const char * | format, | ||
va_list | ap | ||
) |
References C_SNPRINTF_APPEND_CHAR, C_SNPRINTF_FLAG_ZERO, and strnlen().
Referenced by c_snprintf().
int cs_base64_decode | ( | const unsigned char * | s, |
int | len, | ||
char * | dst | ||
) |
Referenced by mg_base64_decode().
void cs_base64_encode | ( | const unsigned char * | src, |
int | src_len, | ||
char * | dst | ||
) |
References BASE64_ENCODE_BODY.
Referenced by mg_base64_encode().
void cs_base64_finish | ( | struct cs_base64_ctx * | ctx | ) |
void cs_base64_init | ( | struct cs_base64_ctx * | ctx, |
cs_base64_putc_t | putc, | ||
void * | user_data | ||
) |
void cs_base64_update | ( | struct cs_base64_ctx * | ctx, |
const char * | str, | ||
size_t | len | ||
) |
References cs_base64_ctx::chunk, and cs_base64_ctx::chunk_size.
void cs_fprint_base64 | ( | FILE * | f, |
const unsigned char * | src, | ||
int | src_len | ||
) |
References BASE64_ENCODE_BODY.
void cs_hmac_sha1 | ( | const unsigned char * | key, |
size_t | key_len, | ||
const unsigned char * | text, | ||
size_t | text_len, | ||
unsigned char | out[20] | ||
) |
References cs_sha1_final(), cs_sha1_init(), and cs_sha1_update().
void cs_log_printf | ( | const char * | fmt, |
... | |||
) |
void cs_log_set_level | ( | enum cs_log_level | level | ) |
char* cs_md5 | ( | char | buf[33], |
... | |||
) |
References cs_to_hex(), MD5_Final(), MD5_Init(), and MD5_Update().
Referenced by mg_http_create_digest_auth_header().
void cs_sha1_final | ( | unsigned char | digest[20], |
cs_sha1_ctx * | |||
) |
References cs_sha1_ctx::count, cs_sha1_update(), and cs_sha1_ctx::state.
Referenced by cs_hmac_sha1().
void cs_sha1_init | ( | cs_sha1_ctx * | ) |
References cs_sha1_ctx::count, and cs_sha1_ctx::state.
Referenced by cs_hmac_sha1().
void cs_sha1_update | ( | cs_sha1_ctx * | , |
const unsigned char * | data, | ||
uint32_t | len | ||
) |
References cs_sha1_ctx::buffer, cs_sha1_ctx::count, cs_sha1_transform(), and cs_sha1_ctx::state.
Referenced by cs_hmac_sha1(), and cs_sha1_final().
void cs_to_hex | ( | char * | to, |
const unsigned char * | p, | ||
size_t | len | ||
) |
Referenced by cs_md5().
struct json_token* find_json_token | ( | struct json_token * | toks, |
const char * | path | ||
) |
References JSON_TYPE_ARRAY, JSON_TYPE_OBJECT, JSON_TYPE_STRING, json_token::num_desc, and json_token::type.
Referenced by mg_rpc_dispatch(), and mg_rpc_parse_reply().
int json_emit | ( | char * | buf, |
int | buf_len, | ||
const char * | fmt, | ||
... | |||
) |
References json_emit_va(), and json_token::len.
Referenced by mg_rpc_create_error(), mg_rpc_create_reply(), and mg_rpc_create_request().
int json_emit_double | ( | char * | buf, |
int | buf_len, | ||
double | value | ||
) |
Referenced by json_emit_va().
int json_emit_long | ( | char * | buf, |
int | buf_len, | ||
long | value | ||
) |
int json_emit_quoted_str | ( | char * | buf, |
int | buf_len, | ||
const char * | str, | ||
int | len | ||
) |
References EMIT, and json_token::len.
Referenced by json_emit_va(), and mg_rpc_create_reply().
int json_emit_unquoted_str | ( | char * | buf, |
int | buf_len, | ||
const char * | str, | ||
int | len | ||
) |
References json_token::len.
Referenced by json_emit_va(), and mg_rpc_create_reply().
int json_emit_va | ( | char * | buf, |
int | buf_len, | ||
const char * | fmt, | ||
va_list | |||
) |
References json_emit_double(), json_emit_long(), json_emit_quoted_str(), json_emit_unquoted_str(), and json_token::len.
Referenced by json_emit(), mg_rpc_create_error(), mg_rpc_create_reply(), and mg_rpc_create_request().
size_t mbuf_append | ( | struct mbuf * | , |
const void * | data, | ||
size_t | data_size | ||
) |
References mbuf::len, and mbuf_insert().
Referenced by mg_dns_copy_body(), mg_dns_encode_record(), mg_if_tcp_send(), and mg_if_udp_send().
void mbuf_free | ( | struct mbuf * | ) |
References mbuf::buf, MBUF_FREE, and mbuf_init().
Referenced by mg_send_dns_query().
void mbuf_init | ( | struct mbuf * | , |
size_t | initial_capacity | ||
) |
References mbuf::buf, mbuf::len, mbuf_resize(), and mbuf::size.
Referenced by mbuf_free(), and mg_send_dns_query().
size_t mbuf_insert | ( | struct mbuf * | , |
size_t | , | ||
const void * | , | ||
size_t | |||
) |
References mbuf::buf, mbuf::len, json_token::len, MBUF_REALLOC, MBUF_SIZE_MULTIPLIER, and mbuf::size.
Referenced by mbuf_append(), mg_dns_insert_header(), and mg_send_dns_query().
void mbuf_remove | ( | struct mbuf * | , |
size_t | data_size | ||
) |
References mbuf::buf, and mbuf::len.
Referenced by http_handler(), and mg_forward().
void mbuf_resize | ( | struct mbuf * | , |
size_t | new_size | ||
) |
References mbuf::buf, mbuf::len, MBUF_REALLOC, and mbuf::size.
Referenced by mbuf_init(), and mbuf_trim().
void mbuf_trim | ( | struct mbuf * | ) |
References mbuf::len, and mbuf_resize().
void MD5_Final | ( | unsigned char * | md, |
MD5_CTX * | c | ||
) |
void MD5_Init | ( | MD5_CTX * | c | ) |
References MD5Context::bits, and MD5Context::buf.
Referenced by cs_md5().
void MD5_Update | ( | MD5_CTX * | c, |
const unsigned char * | data, | ||
size_t | len | ||
) |
References MD5Context::bits, MD5Context::buf, if(), and MD5Context::in.
Referenced by cs_md5().
struct mg_connection* mg_add_sock | ( | struct mg_mgr * | , |
sock_t | , | ||
mg_event_handler_t | |||
) |
References mg_add_sock_opt().
struct mg_connection* mg_add_sock_opt | ( | struct mg_mgr * | , |
sock_t | , | ||
mg_event_handler_t | , | ||
struct mg_add_sock_opts | |||
) |
References mg_add_conn(), mg_create_connection(), mg_connection::mgr, and nc.
Referenced by mg_add_sock().
int mg_avprintf | ( | char ** | buf, |
size_t | size, | ||
const char * | fmt, | ||
va_list | ap | ||
) |
References mg_str::len, MG_FREE, MG_MALLOC, and va_copy.
Referenced by mg_printf_html_escape(), mg_printf_http_chunk(), mg_printf_websocket_frame(), and mg_vprintf().
int mg_base64_decode | ( | const unsigned char * | s, |
int | len, | ||
char * | dst | ||
) |
References cs_base64_decode().
void mg_base64_encode | ( | const unsigned char * | src, |
int | src_len, | ||
char * | dst | ||
) |
References cs_base64_encode().
Referenced by mg_send_websocket_handshake().
struct mg_connection* mg_bind | ( | struct mg_mgr * | , |
const char * | , | ||
mg_event_handler_t | |||
) |
References mg_bind_opt().
struct mg_connection* mg_bind_opt | ( | struct mg_mgr * | , |
const char * | , | ||
mg_event_handler_t | , | ||
struct mg_bind_opts | |||
) |
References DBG, mg_bind_opts::error_string, mg_connection::flags, mg_add_conn(), MG_COPY_COMMON_CONNECTION_OPTIONS, mg_create_connection(), MG_F_LISTENING, MG_F_UDP, mg_if_listen_tcp(), mg_if_listen_udp(), MG_MAX_HOST_LEN, mg_parse_address(), MG_SET_PTRPTR, mg_connection::mgr, nc, and mg_connection::sa.
Referenced by mg_bind().
void mg_broadcast | ( | struct mg_mgr * | , |
mg_event_handler_t | func, | ||
void * | , | ||
size_t | |||
) |
References mg_mgr::ctl, INVALID_SOCKET, MG_RECV_FUNC, and MG_SEND_FUNC.
int mg_casecmp | ( | const char * | s1, |
const char * | s2 | ||
) |
References mg_ncasecmp().
int mg_check_ip_acl | ( | const char * | acl, |
uint32_t | remote_ip | ||
) |
References mg_next_comma_list_entry(), and mg_str::p.
Referenced by mg_send_http_file().
void mg_close_conn | ( | struct mg_connection * | nc | ) |
References DBG, mg_connection::flags, mg_call(), MG_EV_CLOSE, MG_F_CONNECTING, and mg_remove_conn().
Referenced by mg_mgr_free(), and mg_mgr_poll().
struct mg_connection* mg_connect | ( | struct mg_mgr * | , |
const char * | , | ||
mg_event_handler_t | |||
) |
References mg_connect_opt().
Referenced by mg_connect_http(), and mg_resolve_async_opt().
struct mg_connection* mg_connect_http | ( | struct mg_mgr * | , |
mg_event_handler_t | event_handler, | ||
const char * | url, | ||
const char * | extra_headers, | ||
const char * | post_data | ||
) |
References DBG, mg_connect(), MG_FREE, mg_printf(), MG_REALLOC, mg_set_protocol_http_websocket(), mg_set_ssl(), nc, and SIZE_T_FMT.
struct mg_connection* mg_connect_opt | ( | struct mg_mgr * | , |
const char * | , | ||
mg_event_handler_t | , | ||
struct mg_connect_opts | |||
) |
References _MG_ALLOWED_CONNECT_FLAGS_MASK, mg_connect_opts::error_string, mg_connection::flags, mg_connect_opts::flags, MG_COPY_COMMON_CONNECTION_OPTIONS, mg_create_connection(), MG_DNS_A_RECORD, mg_do_connect(), MG_F_UDP, MG_MAX_HOST_LEN, mg_parse_address(), mg_resolve_async(), MG_SET_PTRPTR, mg_connection::mgr, nc, mg_connection::sa, mg_connection::user_data, and mg_connect_opts::user_data.
Referenced by mg_connect().
int mg_dns_copy_body | ( | struct mbuf * | , |
struct mg_dns_message * | |||
) |
References mg_str::len, mbuf_append(), mg_str::p, and mg_dns_message::pkt.
int mg_dns_encode_record | ( | struct mbuf * | , |
struct mg_dns_resource_record * | , | ||
const char * | , | ||
size_t | , | ||
const void * | , | ||
size_t | |||
) |
int mg_dns_insert_header | ( | struct mbuf * | , |
size_t | , | ||
struct mg_dns_message * | |||
) |
References mg_dns_message::flags, mbuf_insert(), mg_dns_message::num_answers, mg_dns_message::num_questions, and mg_dns_message::transaction_id.
Referenced by mg_send_dns_query().
struct mg_dns_resource_record* mg_dns_next_record | ( | struct mg_dns_message * | , |
int | , | ||
struct mg_dns_resource_record * | |||
) |
References mg_dns_message::answers, mg_dns_message::num_answers, and mg_dns_resource_record::rtype.
int mg_dns_parse_record_data | ( | struct mg_dns_message * | , |
struct mg_dns_resource_record * | , | ||
void * | , | ||
size_t | |||
) |
size_t mg_dns_uncompress_name | ( | struct mg_dns_message * | , |
struct mg_str * | , | ||
char * | , | ||
int | |||
) |
References mg_str::len, mg_str::p, and mg_dns_message::pkt.
Referenced by mg_dns_parse_record_data().
void mg_enable_multithreading | ( | struct mg_connection * | nc | ) |
FILE* mg_fopen | ( | const char * | path, |
const char * | mode | ||
) |
References ARRAY_SIZE, and MAX_PATH_SIZE.
struct mg_str* mg_get_http_header | ( | struct http_message * | hm, |
const char * | name | ||
) |
References http_message::header_names, http_message::header_values, mg_str::len, mg_ncasecmp(), and mg_str::p.
Referenced by http_handler(), mg_is_not_modified(), and mg_serve_http().
int mg_get_http_var | ( | const struct mg_str * | , |
const char * | , | ||
char * | dst, | ||
size_t | |||
) |
References mg_str::len, mg_ncasecmp(), and mg_str::p.
int mg_hexdump | ( | const void * | buf, |
int | len, | ||
char * | dst, | ||
int | dst_len | ||
) |
References mg_str::len.
Referenced by mg_hexdump_connection().
void mg_hexdump_connection | ( | struct mg_connection * | nc, |
const char * | path, | ||
int | num_bytes, | ||
int | ev | ||
) |
int mg_http_create_digest_auth_header | ( | char * | buf, |
size_t | buf_len, | ||
const char * | method, | ||
const char * | uri, | ||
const char * | auth_domain, | ||
const char * | user, | ||
const char * | passwd | ||
) |
References cs_md5().
int mg_http_parse_header | ( | struct mg_str * | hdr, |
const char * | var_name, | ||
char * | buf, | ||
size_t | buf_size | ||
) |
References mg_str::len, and mg_str::p.
Referenced by mg_parse_multipart().
struct mg_connection* mg_if_accept_tcp_cb | ( | struct mg_connection * | lc, |
union socket_address * | sa, | ||
size_t | sa_len | ||
) |
References DBG, mg_connection::flags, mg_connection::handler, mg_connection::listener, mg_add_conn(), mg_call(), mg_create_connection(), MG_EV_ACCEPT, mg_connection::mgr, nc, mg_connection::proto_data, mg_connection::proto_handler, mg_connection::recv_mbuf_limit, mg_connection::sa, mg_connection::sock, mg_connection::ssl, mg_connection::ssl_ctx, and mg_connection::user_data.
void mg_if_connect_cb | ( | struct mg_connection * | nc, |
int | err | ||
) |
References DBG, mg_connection::flags, mg_call(), MG_EV_CONNECT, MG_F_CLOSE_IMMEDIATELY, MG_F_CONNECTING, mg_connection::sock, and mg_connection::ssl.
Referenced by mg_mgr_handle_conn().
void mg_if_connect_tcp | ( | struct mg_connection * | nc, |
const union socket_address * | sa | ||
) |
References DBG, mg_connection::err, INVALID_SOCKET, mg_is_error(), mg_set_non_blocking_mode(), socket_address::sa, socket_address::sin, and mg_connection::sock.
Referenced by mg_do_connect().
void mg_if_connect_udp | ( | struct mg_connection * | nc | ) |
References mg_connection::err, INVALID_SOCKET, and mg_connection::sock.
Referenced by mg_do_connect().
void mg_if_destroy_conn | ( | struct mg_connection * | nc | ) |
int mg_if_listen_tcp | ( | struct mg_connection * | nc, |
union socket_address * | sa | ||
) |
Referenced by mg_bind_opt().
int mg_if_listen_udp | ( | struct mg_connection * | nc, |
union socket_address * | sa | ||
) |
Referenced by mg_bind_opt().
void mg_if_poll | ( | struct mg_connection * | nc, |
time_t | now | ||
) |
References mg_call(), and MG_EV_POLL.
Referenced by mg_mgr_handle_conn().
void mg_if_recv_tcp_cb | ( | struct mg_connection * | nc, |
void * | buf, | ||
int | len | ||
) |
References mg_if_recved().
void mg_if_recv_udp_cb | ( | struct mg_connection * | nc, |
void * | buf, | ||
int | len, | ||
union socket_address * | sa, | ||
size_t | sa_len | ||
) |
References DBG, mg_connection::flags, mg_connection::handler, mg_connection::listener, mg_add_conn(), mg_call(), mg_create_connection(), MG_EV_ACCEPT, MG_F_LISTENING, MG_F_UDP, MG_FREE, mg_if_recved(), mg_next(), mg_connection::mgr, nc, mg_connection::proto_data, mg_connection::proto_handler, mg_connection::recv_mbuf_limit, socket_address::sa, mg_connection::sa, mg_connection::sock, and mg_connection::user_data.
void mg_if_recved | ( | struct mg_connection * | nc, |
size_t | len | ||
) |
Referenced by mg_if_recv_tcp_cb(), and mg_if_recv_udp_cb().
void mg_if_sent_cb | ( | struct mg_connection * | nc, |
int | num_sent | ||
) |
References mg_connection::flags, mg_call(), MG_EV_SEND, and MG_F_CLOSE_IMMEDIATELY.
void mg_if_tcp_send | ( | struct mg_connection * | nc, |
const void * | buf, | ||
size_t | len | ||
) |
References mbuf_append(), and mg_connection::send_mbuf.
Referenced by mg_send().
void mg_if_udp_send | ( | struct mg_connection * | nc, |
const void * | buf, | ||
size_t | len | ||
) |
References DBG, mbuf::len, mbuf_append(), and mg_connection::send_mbuf.
Referenced by mg_send().
int mg_is_big_endian | ( | void | ) |
int mg_match_prefix | ( | const char * | pattern, |
int | pattern_len, | ||
const char * | str | ||
) |
References mbuf::len, and mg_match_prefix().
Referenced by mg_match_prefix(), and mg_send_http_file().
void mg_mgr_free | ( | struct mg_mgr * | ) |
References mg_mgr::active_connections, closesocket, mg_mgr::ctl, DBG, INVALID_SOCKET, mg_close_conn(), mg_ev_mgr_free(), mg_mgr_poll(), and mg_connection::next.
void mg_mgr_init | ( | struct mg_mgr * | mgr, |
void * | user_data | ||
) |
References mg_mgr::ctl, data, DBG, INVALID_SOCKET, mg_ev_mgr_init(), and mg_mgr::user_data.
time_t mg_mgr_poll | ( | struct mg_mgr * | , |
int | milli | ||
) |
References _MG_F_FD_CAN_READ, _MG_F_FD_CAN_WRITE, _MG_F_FD_ERROR, mg_mgr::active_connections, mg_mgr::ctl, DBG, mg_connection::flags, INVALID_SOCKET, mbuf::len, mg_connection::listener, mg_add_to_set(), mg_close_conn(), MG_F_CLOSE_IMMEDIATELY, MG_F_CONNECTING, MG_F_SEND_AND_CLOSE, MG_F_UDP, MG_F_WANT_READ, MG_F_WANT_WRITE, mg_mgr_handle_conn(), nc, mg_connection::next, mg_connection::recv_mbuf, mg_connection::recv_mbuf_limit, mg_connection::send_mbuf, and mg_connection::sock.
Referenced by mg_mgr_free().
void mg_mqtt_connack | ( | struct mg_connection * | , |
uint8_t | |||
) |
References MG_MQTT_CMD_CONNACK, and mg_send().
void mg_mqtt_disconnect | ( | struct mg_connection * | nc | ) |
References MG_MQTT_CMD_DISCONNECT.
int mg_mqtt_next_subscribe_topic | ( | struct mg_mqtt_message * | , |
struct mg_str * | , | ||
uint8_t * | , | ||
int | |||
) |
References if(), mg_str::len, mg_str::p, and mg_mqtt_message::payload.
void mg_mqtt_ping | ( | struct mg_connection * | ) |
References MG_MQTT_CMD_PINGREQ.
void mg_mqtt_pong | ( | struct mg_connection * | ) |
References MG_MQTT_CMD_PINGRESP.
void mg_mqtt_puback | ( | struct mg_connection * | , |
uint16_t | |||
) |
References MG_MQTT_CMD_PUBACK.
void mg_mqtt_pubcomp | ( | struct mg_connection * | , |
uint16_t | |||
) |
References MG_MQTT_CMD_PUBCOMP.
void mg_mqtt_publish | ( | struct mg_connection * | nc, |
const char * | topic, | ||
uint16_t | message_id, | ||
int | flags, | ||
const void * | data, | ||
size_t | len | ||
) |
References mbuf::len, MG_MQTT_CMD_PUBLISH, MG_MQTT_GET_QOS, mg_send(), and mg_connection::send_mbuf.
void mg_mqtt_pubrec | ( | struct mg_connection * | , |
uint16_t | |||
) |
References MG_MQTT_CMD_PUBREC.
void mg_mqtt_pubrel | ( | struct mg_connection * | , |
uint16_t | |||
) |
References MG_MQTT_CMD_PUBREL.
void mg_mqtt_suback | ( | struct mg_connection * | , |
uint8_t * | , | ||
size_t | , | ||
uint16_t | |||
) |
References MG_MQTT_CMD_SUBACK, MG_MQTT_QOS, and mg_send().
void mg_mqtt_subscribe | ( | struct mg_connection * | nc, |
const struct mg_mqtt_topic_expression * | topics, | ||
size_t | topics_len, | ||
uint16_t | message_id | ||
) |
References mbuf::len, MG_MQTT_CMD_SUBSCRIBE, MG_MQTT_QOS, mg_send(), and mg_connection::send_mbuf.
void mg_mqtt_unsuback | ( | struct mg_connection * | , |
uint16_t | |||
) |
References MG_MQTT_CMD_UNSUBACK.
void mg_mqtt_unsubscribe | ( | struct mg_connection * | nc, |
char ** | topics, | ||
size_t | topics_len, | ||
uint16_t | message_id | ||
) |
References mbuf::len, MG_MQTT_CMD_UNSUBSCRIBE, MG_MQTT_QOS, mg_send(), and mg_connection::send_mbuf.
int mg_ncasecmp | ( | const char * | s1, |
const char * | s2, | ||
size_t | len | ||
) |
Referenced by mg_casecmp(), mg_get_http_header(), mg_get_http_var(), mg_parse_multipart(), and mg_vcasecmp().
struct mg_connection* mg_next | ( | struct mg_mgr * | , |
struct mg_connection * | |||
) |
References mg_mgr::active_connections, and mg_connection::next.
Referenced by mg_if_recv_udp_cb().
const char* mg_next_comma_list_entry | ( | const char * | list, |
struct mg_str * | val, | ||
struct mg_str * | eq_val | ||
) |
References mg_str::len, and mg_str::p.
Referenced by find_index_file(), and mg_check_ip_acl().
int mg_open | ( | const char * | path, |
int | flag, | ||
int | mode | ||
) |
References ARRAY_SIZE, and MAX_PATH_SIZE.
int mg_parse_dns | ( | const char * | , |
int | , | ||
struct mg_dns_message * | |||
) |
int mg_parse_http | ( | const char * | s, |
int | n, | ||
struct http_message * | hm, | ||
int | is_req | ||
) |
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 ** | chunk, | ||
size_t * | chunk_len | ||
) |
References mg_str::len, mg_http_parse_header(), mg_ncasecmp(), and mg_str::p.
int mg_printf | ( | struct mg_connection * | , |
const char * | fmt, | ||
... | |||
) |
References mg_vprintf().
Referenced by mg_connect_http(), mg_send_head(), mg_send_http_file(), mg_send_response_line(), and mg_send_websocket_handshake().
void mg_printf_html_escape | ( | struct mg_connection * | , |
const char * | , | ||
... | |||
) |
References mg_str::len, mg_avprintf(), MG_FREE, and mg_send().
void mg_printf_http_chunk | ( | struct mg_connection * | , |
const char * | , | ||
... | |||
) |
References mg_str::len, mg_avprintf(), MG_FREE, and mg_send_http_chunk().
void mg_printf_websocket_frame | ( | struct mg_connection * | nc, |
int | op_and_flags, | ||
const char * | fmt, | ||
... | |||
) |
References mg_avprintf(), MG_FREE, and mg_send_websocket_frame().
int mg_resolve | ( | const char * | domain_name, |
char * | ip_addr_buf, | ||
size_t | buf_len | ||
) |
int mg_resolve_async | ( | struct mg_mgr * | , |
const char * | , | ||
int | , | ||
mg_resolve_callback_t | , | ||
void * | data | ||
) |
References mg_resolve_async_opt().
Referenced by mg_connect_opt().
int mg_resolve_async_opt | ( | struct mg_mgr * | , |
const char * | , | ||
int | , | ||
mg_resolve_callback_t | , | ||
void * | data, | ||
struct mg_resolve_async_opts | opts | ||
) |
References data, DBG, free(), mg_resolve_async_opts::max_retries, MG_CALLOC, mg_connect(), mg_dns_server, mg_resolve_async_opts::nameserver_url, mg_resolve_async_opts::timeout, and mg_connection::user_data.
Referenced by mg_resolve_async().
int mg_resolve_from_hosts_file | ( | const char * | host, |
union socket_address * | usa | ||
) |
References socket_address::sin.
Referenced by mg_parse_address().
int mg_rpc_create_error | ( | char * | buf, |
int | len, | ||
struct mg_rpc_request * | req, | ||
int | code, | ||
const char * | message, | ||
const char * | fmt, | ||
... | |||
) |
References mg_rpc_request::id, json_emit(), json_emit_va(), json_token::len, and json_token::ptr.
Referenced by mg_rpc_create_std_error().
int mg_rpc_create_reply | ( | char * | buf, |
int | len, | ||
const struct mg_rpc_request * | req, | ||
const char * | result_fmt, | ||
... | |||
) |
int mg_rpc_create_request | ( | char * | buf, |
int | len, | ||
const char * | method, | ||
const char * | id, | ||
const char * | params_fmt, | ||
... | |||
) |
References json_emit(), and json_emit_va().
int mg_rpc_create_std_error | ( | char * | , |
int | , | ||
struct mg_rpc_request * | , | ||
int | code | ||
) |
int mg_rpc_dispatch | ( | const char * | buf, |
int | , | ||
char * | dst, | ||
int | dst_len, | ||
const char ** | methods, | ||
mg_rpc_handler_t * | handlers | ||
) |
References find_json_token(), mg_rpc_request::id, JSON_RPC_INVALID_REQUEST_ERROR, JSON_RPC_METHOD_NOT_FOUND_ERROR, JSON_RPC_PARSE_ERROR, JSON_RPC_SERVER_ERROR, JSON_STRING_INVALID, json_token::len, mg_rpc_request::message, mg_rpc_request::method, mg_rpc_create_std_error(), mg_rpc_request::params, parse_json(), and json_token::ptr.
int mg_rpc_parse_reply | ( | const char * | buf, |
int | len, | ||
struct json_token * | toks, | ||
int | max_toks, | ||
struct mg_rpc_reply * | , | ||
struct mg_rpc_error * | |||
) |
void mg_send | ( | struct mg_connection * | , |
const void * | buf, | ||
int | len | ||
) |
References mg_connection::flags, mg_mgr::hexdump_file, mg_connection::last_io_time, MG_EV_SEND, MG_F_UDP, mg_hexdump_connection(), mg_if_tcp_send(), mg_if_udp_send(), and mg_connection::mgr.
Referenced by mg_forward(), mg_mqtt_connack(), mg_mqtt_publish(), mg_mqtt_suback(), mg_mqtt_subscribe(), mg_mqtt_unsubscribe(), mg_printf_html_escape(), mg_send_dns_query(), mg_send_head(), mg_send_http_chunk(), mg_send_mqtt_handshake_opt(), mg_send_websocket_frame(), mg_send_websocket_framev(), and mg_vprintf().
void mg_send_dns_query | ( | struct mg_connection * | , |
const char * | , | ||
int | |||
) |
References mbuf::buf, DBG, mg_connection::flags, mg_dns_message::flags, mg_dns_resource_record::kind, mbuf::len, mbuf_free(), mbuf_init(), mbuf_insert(), MG_CALLOC, mg_dns_encode_record(), mg_dns_insert_header(), MG_DNS_QUESTION, MG_F_UDP, MG_FREE, mg_send(), mg_dns_message::num_questions, mg_dns_message::questions, mg_dns_resource_record::rclass, mg_dns_resource_record::rtype, and mg_dns_message::transaction_id.
void mg_send_head | ( | struct mg_connection * | n, |
int | status_code, | ||
int64_t | content_length, | ||
const char * | extra_headers | ||
) |
References INT64_FMT, mg_printf(), mg_send(), and mg_send_response_line().
void mg_send_http_chunk | ( | struct mg_connection * | nc, |
const char * | buf, | ||
size_t | len | ||
) |
References mg_send().
Referenced by mg_printf_http_chunk().
void mg_send_mqtt_handshake | ( | struct mg_connection * | nc, |
const char * | client_id | ||
) |
References mg_send_mqtt_handshake_opt().
void mg_send_mqtt_handshake_opt | ( | struct mg_connection * | , |
const char * | client_id, | ||
struct mg_send_mqtt_handshake_opts | |||
) |
References mg_send_mqtt_handshake_opts::flags, mg_send_mqtt_handshake_opts::keep_alive, MG_MQTT_CMD_CONNECT, and mg_send().
Referenced by mg_send_mqtt_handshake().
void mg_send_response_line | ( | struct mg_connection * | c, |
int | status_code, | ||
const char * | extra_headers | ||
) |
References mg_printf().
Referenced by mg_send_head().
void mg_send_websocket_frame | ( | struct mg_connection * | nc, |
int | op_and_flags, | ||
const void * | data, | ||
size_t | data_len | ||
) |
References mg_connection::flags, MG_F_SEND_AND_CLOSE, mg_send(), mg_connection::send_mbuf, and WEBSOCKET_OP_CLOSE.
Referenced by event_cb(), and mg_printf_websocket_frame().
void mg_send_websocket_framev | ( | struct mg_connection * | nc, |
int | op_and_flags, | ||
const struct mg_str * | strings, | ||
int | num_strings | ||
) |
References mg_connection::flags, mg_str::len, MG_F_SEND_AND_CLOSE, mg_send(), mg_connection::send_mbuf, and WEBSOCKET_OP_CLOSE.
void mg_send_websocket_handshake | ( | struct mg_connection * | nc, |
const char * | uri, | ||
const char * | extra_headers | ||
) |
References mg_base64_encode(), and mg_printf().
void mg_serve_http | ( | struct mg_connection * | , |
struct http_message * | , | ||
struct mg_serve_http_opts | |||
) |
References mg_serve_http_opts::cgi_file_pattern, mg_serve_http_opts::document_root, mg_serve_http_opts::enable_directory_listing, mg_connection::flags, mg_serve_http_opts::index_files, MG_F_SEND_AND_CLOSE, mg_get_http_header(), MG_MAX_PATH, mg_send_http_file(), mg_vcmp(), mg_serve_http_opts::per_directory_auth_file, http_message::proto, and mg_serve_http_opts::ssi_pattern.
void mg_set_close_on_exec | ( | sock_t | ) |
Referenced by mg_socketpair().
void mg_set_protocol_dns | ( | struct mg_connection * | ) |
References mg_connection::proto_handler.
void mg_set_protocol_http_websocket | ( | struct mg_connection * | nc | ) |
References http_handler(), and mg_connection::proto_handler.
Referenced by mg_connect_http().
void mg_set_protocol_mqtt | ( | struct mg_connection * | ) |
References mg_connection::proto_handler.
const char* mg_set_ssl | ( | struct mg_connection * | nc, |
const char * | cert, | ||
const char * | ca_cert | ||
) |
Referenced by mg_connect_http().
const char* mg_skip | ( | const char * | s, |
const char * | end_string, | ||
const char * | delimiters, | ||
struct mg_str * | v | ||
) |
References mg_str::len, and mg_str::p.
Referenced by mg_parse_http().
void mg_sock_addr_to_str | ( | const union socket_address * | sa, |
char * | buf, | ||
size_t | len, | ||
int | flags | ||
) |
References if(), mg_str::len, MG_SOCK_STRINGIFY_IP, MG_SOCK_STRINGIFY_PORT, socket_address::sa, socket_address::sin, and socket_address::sin6.
Referenced by mg_sock_to_str().
void mg_sock_to_str | ( | sock_t | sock, |
char * | buf, | ||
size_t | len, | ||
int | flags | ||
) |
References mg_sock_addr_to_str(), MG_SOCK_STRINGIFY_REMOTE, and socket_address::sa.
Referenced by mg_hexdump_connection().
int mg_socketpair | ( | sock_t | [2], |
int | sock_type | ||
) |
References closesocket, INVALID_SOCKET, mg_set_close_on_exec(), socket_address::sa, and socket_address::sin.
Referenced by mg_ev_mgr_init().
int mg_stat | ( | const char * | path, |
cs_stat_t * | st | ||
) |
References ARRAY_SIZE, DBG, and MAX_PATH_SIZE.
Referenced by find_index_file(), and mg_send_http_file().
int mg_vcasecmp | ( | const struct mg_str * | str2, |
const char * | str1 | ||
) |
References mg_str::len, mg_ncasecmp(), and mg_str::p.
Referenced by http_handler(), mg_is_not_modified(), and mg_parse_http().
int mg_vcmp | ( | const struct mg_str * | str2, |
const char * | str1 | ||
) |
References mg_str::len, and mg_str::p.
Referenced by mg_send_http_file(), and mg_serve_http().
int mg_vprintf | ( | struct mg_connection * | , |
const char * | fmt, | ||
va_list | ap | ||
) |
References mg_avprintf(), MG_FREE, mg_send(), and MG_VPRINTF_BUFFER_SIZE.
Referenced by mg_printf().
int parse_json | ( | const char * | json_string, |
int | json_string_length, | ||
struct json_token * | tokens_array, | ||
int | size_of_tokens_array | ||
) |
References TRY.
Referenced by mg_rpc_dispatch(), and mg_rpc_parse_reply().
struct json_token* parse_json2 | ( | const char * | json_string, |
int | string_length | ||
) |
References FROZEN_FREE.
size_t strnlen | ( | const char * | s, |
size_t | maxlen | ||
) |
Referenced by c_vsnprintf().
enum cs_log_level s_cs_log_level |