2 #include "avrsupport.h"
23 #define MG_VERSION "6.0"
27 #include <mg_locals.h>
30 #if defined(MG_ENABLE_DEBUG) && !defined(CS_ENABLE_DEBUG)
31 #define CS_ENABLE_DEBUG
38 #ifndef OSDEP_HEADER_INCLUDED
39 #define OSDEP_HEADER_INCLUDED
41 #if !defined(MG_DISABLE_FILESYSTEM) && defined(AVR_NOFS)
42 #define MG_DISABLE_FILESYSTEM
48 #define _INTEGRAL_MAX_BITS 64
49 #ifndef _CRT_SECURE_NO_WARNINGS
50 #define _CRT_SECURE_NO_WARNINGS
52 #undef WIN32_LEAN_AND_MEAN
54 #define _XOPEN_SOURCE 600
55 #define __STDC_FORMAT_MACROS
56 #define __STDC_LIMIT_MACROS
57 #ifndef _LARGEFILE_SOURCE
58 #define _LARGEFILE_SOURCE
60 #define _FILE_OFFSET_BITS 64
62 #if !(defined(AVR_LIBC) || defined(PICOTCP))
63 #include <sys/types.h>
71 #define LITTLE_ENDIAN 0x41424344
72 #define BIG_ENDIAN 0x44434241
73 #define PDP_ENDIAN 0x42414443
76 #define BYTE_ORDER LITTLE_ENDIAN
92 #pragma warning(disable : 4127)
93 #pragma warning(disable : 4204)
97 #define time(x) PICO_TIME()
99 #define SOMAXCONN (16)
101 #ifdef _POSIX_VERSION
117 #define va_copy __va_copy
119 #define va_copy(x, y) (x) = (y)
124 #define random() rand()
126 #pragma comment(lib, "ws2_32.lib")
131 #define EINPROGRESS WSAEINPROGRESS
134 #define EWOULDBLOCK WSAEWOULDBLOCK
138 #define STR(x) STRX(x)
139 #define __func__ __FILE__ ":" STR(__LINE__)
141 #define snprintf _snprintf
142 #define fileno _fileno
143 #define vsnprintf _vsnprintf
144 #define sleep(x) Sleep((x) *1000)
145 #define to64(x) _atoi64(x)
146 #define popen(x, y) _popen((x), (y))
147 #define pclose(x) _pclose(x)
148 #if defined(_MSC_VER) && _MSC_VER >= 1400
149 #define fseeko(x, y, z) _fseeki64((x), (y), (z))
151 #define fseeko(x, y, z) fseek((x), (y), (z))
153 #define random() rand()
154 typedef int socklen_t;
155 typedef signed char int8_t;
156 typedef unsigned char uint8_t;
158 typedef unsigned int uint32_t;
159 typedef short int16_t;
160 typedef unsigned short uint16_t;
161 typedef __int64 int64_t;
162 typedef unsigned __int64 uint64_t;
164 typedef uint32_t in_addr_t;
166 #define UINT16_MAX 65535
169 #define UINT32_MAX 4294967295
174 #define INT64_FMT "I64d"
175 #define SIZE_T_FMT "Iu"
182 #define S_ISDIR(x) ((x) &_S_IFDIR)
188 char d_name[MAX_PATH];
193 WIN32_FIND_DATAW
info;
197 DIR *opendir(
const char *name);
198 int closedir(DIR *dir);
199 struct dirent *readdir(DIR *dir);
201 #elif defined(MG_CC3200)
205 #include <cc3200_libc.h>
206 #include <cc3200_socket.h>
208 #elif defined(MG_LWIP)
210 #include <lwip/sockets.h>
211 #include <lwip/netdb.h>
212 #include <lwip/dns.h>
214 #if defined(MG_ESP8266) && defined(RTOS_SDK)
215 #include <esp_libc.h>
216 #define random() os_random()
223 #elif !defined(NO_LIBC) && !defined(NO_BSD_SOCKETS)
230 #include <arpa/inet.h>
231 #include <netinet/in.h>
232 #include <sys/socket.h>
233 #include <sys/select.h>
236 #ifndef LWIP_PROVIDE_ERRNO
241 #include <inttypes.h>
246 #define closesocket(x) close(x)
252 #define INVALID_SOCKET (-1)
253 #define INT64_FMT PRId64
254 #if defined(ESP8266) || defined(MG_ESP8266) || defined(MG_CC3200)
255 #define SIZE_T_FMT "u"
257 #define SIZE_T_FMT "zu"
259 #define to64(x) strtoll(x, NULL, 10)
266 int64_t strtoll(
const char *str,
char **endptr,
int base);
271 #define ARRAY_SIZE(array) (sizeof(array) / sizeof(array[0]))
297 if (s_cs_log_level >= l) { \
298 fprintf(stderr, "%-20s ", __func__); \
303 if (s_cs_log_level >= LL_DEBUG) { \
304 fprintf(stderr, "%-20s ", __func__); \
310 #define cs_log_set_level(l)
332 #ifndef MBUF_H_INCLUDED
333 #define MBUF_H_INCLUDED
335 #if defined(__cplusplus)
341 #ifndef MBUF_SIZE_MULTIPLIER
342 #define MBUF_SIZE_MULTIPLIER 1.5
391 #if defined(__cplusplus)
401 #if !defined(MG_SHA1_HEADER_INCLUDED) && !defined(DISABLE_SHA1)
402 #define MG_SHA1_HEADER_INCLUDED
412 unsigned char buffer[64];
418 void cs_hmac_sha1(
const unsigned char *key,
size_t key_len,
419 const unsigned char *text,
size_t text_len,
420 unsigned char out[20]);
430 #ifndef MD5_HEADER_DEFINED
431 #define MD5_HEADER_DEFINED
441 unsigned char in[64];
455 char *
cs_md5(
char buf[33], ...);
462 void cs_to_hex(
char *to,
const unsigned char *p,
size_t len);
474 #if !defined(BASE64_H_INCLUDED) && !defined(DISABLE_BASE64)
475 #define BASE64_H_INCLUDED
521 int c_snprintf(
char *buf,
size_t buf_size,
const char *format, ...);
522 int c_vsnprintf(
char *buf,
size_t buf_size,
const char *format, va_list ap);
524 #if (!(defined(_XOPEN_SOURCE) && _XOPEN_SOURCE >= 700) && \
525 !(defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200809L) && \
526 !(defined(__DARWIN_C_LEVEL) && __DARWIN_C_LEVEL >= 200809L) && \
527 !defined(RTOS_SDK)) || \
529 #define _MG_PROVIDE_STRNLEN
530 size_t strnlen(
const char *s,
size_t maxlen);
556 #ifndef FROZEN_HEADER_INCLUDED
557 #define FROZEN_HEADER_INCLUDED
584 #define JSON_STRING_INVALID -1
585 #define JSON_STRING_INCOMPLETE -2
586 #define JSON_TOKEN_ARRAY_TOO_SMALL -3
588 int parse_json(
const char *json_string,
int json_string_length,
589 struct json_token *tokens_array,
int size_of_tokens_array);
597 int json_emit(
char *buf,
int buf_len,
const char *fmt, ...);
598 int json_emit_va(
char *buf,
int buf_len,
const char *fmt, va_list);
632 #ifndef MG_NET_HEADER_INCLUDED
633 #define MG_NET_HEADER_INCLUDED
635 #ifdef MG_ENABLE_JAVASCRIPT
636 #define EXCLUDE_COMMON
643 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
645 #include <openssl/ssl.h>
651 #ifdef MG_USE_READ_WRITE
652 #define MG_RECV_FUNC(s, b, l, f) read(s, b, l)
653 #define MG_SEND_FUNC(s, b, l, f) write(s, b, l)
655 #define MG_RECV_FUNC(s, b, l, f) recv(s, b, l, f)
656 #define MG_SEND_FUNC(s, b, l, f) send(s, b, l, f)
666 #ifdef MG_ENABLE_IPV6
667 struct sockaddr_in6
sin6;
679 #define MG_STR(str_literal) \
680 { str_literal, sizeof(str_literal) - 1 }
691 #define MG_EV_ACCEPT 1
692 #define MG_EV_CONNECT 2
695 #define MG_EV_CLOSE 5
706 #ifdef MG_ENABLE_JAVASCRIPT
738 #define MG_F_LISTENING (1 << 0)
739 #define MG_F_UDP (1 << 1)
740 #define MG_F_RESOLVING (1 << 2)
741 #define MG_F_CONNECTING (1 << 3)
742 #define MG_F_SSL_HANDSHAKE_DONE (1 << 4)
743 #define MG_F_WANT_READ (1 << 5)
744 #define MG_F_WANT_WRITE (1 << 6)
745 #define MG_F_IS_WEBSOCKET (1 << 7)
748 #define MG_F_SEND_AND_CLOSE (1 << 10)
749 #define MG_F_CLOSE_IMMEDIATELY (1 << 11)
750 #define MG_F_WEBSOCKET_NO_DEFRAG (1 << 12)
751 #define MG_F_DELETE_CHUNK (1 << 13)
753 #define MG_F_USER_1 (1 << 20)
754 #define MG_F_USER_2 (1 << 21)
755 #define MG_F_USER_3 (1 << 22)
756 #define MG_F_USER_4 (1 << 23)
757 #define MG_F_USER_5 (1 << 24)
758 #define MG_F_USER_6 (1 << 25)
788 #ifndef MG_DISABLE_SOCKETPAIR
967 const char *ca_cert);
979 #if defined(__GNUC__)
980 __attribute__((format(printf, 2, 3)))
1011 #ifndef MG_DISABLE_SYNC_RESOLVER
1012 int mg_resolve(
const char *domain_name,
char *ip_addr_buf,
size_t buf_len);
1046 #ifdef MG_ENABLE_JAVASCRIPT
1053 enum v7_err mg_enable_javascript(
struct mg_mgr *m,
struct v7 *v7,
1054 const char *init_js_file_name);
1062 #ifndef MG_NET_IF_HEADER_INCLUDED
1063 #define MG_NET_IF_HEADER_INCLUDED
1129 #ifndef MG_UTIL_HEADER_DEFINED
1130 #define MG_UTIL_HEADER_DEFINED
1139 #ifndef MAX_PATH_SIZE
1140 #define MAX_PATH_SIZE 500
1152 const char *
mg_skip(
const char *s,
const char *end_string,
1153 const char *delimiters,
struct mg_str *v);
1158 int mg_ncasecmp(
const char *s1,
const char *s2,
size_t len);
1163 int mg_casecmp(
const char *s1,
const char *s2);
1195 #ifndef MG_DISABLE_FILESYSTEM
1212 FILE *
mg_fopen(
const char *path,
const char *mode);
1221 int mg_open(
const char *path,
int flag,
int mode);
1225 #define MG_ENABLE_THREADS
1228 #ifdef MG_ENABLE_THREADS
1235 void *mg_start_thread(
void *(*thread_func)(
void *),
void *thread_func_param);
1240 #define MG_SOCK_STRINGIFY_IP 1
1241 #define MG_SOCK_STRINGIFY_PORT 2
1242 #define MG_SOCK_STRINGIFY_REMOTE 4
1274 int mg_hexdump(
const void *buf,
int len,
char *dst,
int dst_len);
1284 int num_bytes,
int ev);
1300 int mg_avprintf(
char **buf,
size_t size,
const char *fmt, va_list ap);
1327 int mg_match_prefix(
const char *pattern,
int pattern_len,
const char *str);
1342 #ifndef MG_HTTP_HEADER_DEFINED
1343 #define MG_HTTP_HEADER_DEFINED
1350 #ifndef MG_MAX_HTTP_HEADERS
1351 #define MG_MAX_HTTP_HEADERS 40
1354 #ifndef MG_MAX_HTTP_REQUEST_SIZE
1355 #define MG_MAX_HTTP_REQUEST_SIZE 8192
1360 #define MG_MAX_PATH PATH_MAX
1362 #define MG_MAX_PATH 1024
1366 #ifndef MG_MAX_HTTP_SEND_IOBUF
1367 #define MG_MAX_HTTP_SEND_IOBUF 4096
1370 #ifndef MG_WEBSOCKET_PING_INTERVAL_SECONDS
1371 #define MG_WEBSOCKET_PING_INTERVAL_SECONDS 5
1374 #ifndef MG_CGI_ENVIRONMENT_SIZE
1375 #define MG_CGI_ENVIRONMENT_SIZE 8192
1378 #ifndef MG_MAX_CGI_ENVIR_VARS
1379 #define MG_MAX_CGI_ENVIR_VARS 64
1382 #ifndef MG_ENV_EXPORT_TO_CGI
1383 #define MG_ENV_EXPORT_TO_CGI "MONGOOSE_CGI"
1424 #define MG_EV_HTTP_REQUEST 100
1425 #define MG_EV_HTTP_REPLY 101
1426 #define MG_EV_HTTP_CHUNK 102
1427 #define MG_EV_SSI_CALL 105
1429 #define MG_EV_WEBSOCKET_HANDSHAKE_REQUEST 111
1430 #define MG_EV_WEBSOCKET_HANDSHAKE_DONE 112
1431 #define MG_EV_WEBSOCKET_FRAME 113
1432 #define MG_EV_WEBSOCKET_CONTROL_FRAME 114
1473 const char *extra_headers);
1494 const void *
data,
size_t data_len);
1502 const struct mg_str *strings,
int num_strings);
1511 const char *fmt, ...);
1553 const char *extra_headers);
1569 int64_t content_length,
const char *extra_headers);
1577 #define WEBSOCKET_OP_CONTINUE 0
1578 #define WEBSOCKET_OP_TEXT 1
1579 #define WEBSOCKET_OP_BINARY 2
1580 #define WEBSOCKET_OP_CLOSE 8
1581 #define WEBSOCKET_OP_PING 9
1582 #define WEBSOCKET_OP_PONG 10
1596 #define WEBSOCKET_DONT_FIN 0x100
1670 size_t var_name_len,
char *file_name,
1671 size_t file_name_len,
const char **chunk,
1686 const char *method,
const char *uri,
1687 const char *auth_domain,
const char *user,
1688 const char *passwd);
1711 const char *extra_headers,
1712 const char *post_data);
1844 #ifndef MG_JSON_RPC_HEADER_DEFINED
1845 #define MG_JSON_RPC_HEADER_DEFINED
1903 const char *
id,
const char *params_fmt, ...);
1914 const char *result_fmt, ...);
1925 int code,
const char *message,
const char *fmt, ...);
1928 #define JSON_RPC_PARSE_ERROR (-32700)
1929 #define JSON_RPC_INVALID_REQUEST_ERROR (-32600)
1930 #define JSON_RPC_METHOD_NOT_FOUND_ERROR (-32601)
1931 #define JSON_RPC_INVALID_PARAMS_ERROR (-32602)
1932 #define JSON_RPC_INTERNAL_ERROR (-32603)
1933 #define JSON_RPC_SERVER_ERROR (-32000)
1993 #ifndef MG_MQTT_HEADER_INCLUDED
1994 #define MG_MQTT_HEADER_INCLUDED
2021 #define MG_MQTT_CMD_CONNECT 1
2022 #define MG_MQTT_CMD_CONNACK 2
2023 #define MG_MQTT_CMD_PUBLISH 3
2024 #define MG_MQTT_CMD_PUBACK 4
2025 #define MG_MQTT_CMD_PUBREC 5
2026 #define MG_MQTT_CMD_PUBREL 6
2027 #define MG_MQTT_CMD_PUBCOMP 7
2028 #define MG_MQTT_CMD_SUBSCRIBE 8
2029 #define MG_MQTT_CMD_SUBACK 9
2030 #define MG_MQTT_CMD_UNSUBSCRIBE 10
2031 #define MG_MQTT_CMD_UNSUBACK 11
2032 #define MG_MQTT_CMD_PINGREQ 12
2033 #define MG_MQTT_CMD_PINGRESP 13
2034 #define MG_MQTT_CMD_DISCONNECT 14
2037 #define MG_MQTT_EVENT_BASE 200
2038 #define MG_EV_MQTT_CONNECT (MG_MQTT_EVENT_BASE + MG_MQTT_CMD_CONNECT)
2039 #define MG_EV_MQTT_CONNACK (MG_MQTT_EVENT_BASE + MG_MQTT_CMD_CONNACK)
2040 #define MG_EV_MQTT_PUBLISH (MG_MQTT_EVENT_BASE + MG_MQTT_CMD_PUBLISH)
2041 #define MG_EV_MQTT_PUBACK (MG_MQTT_EVENT_BASE + MG_MQTT_CMD_PUBACK)
2042 #define MG_EV_MQTT_PUBREC (MG_MQTT_EVENT_BASE + MG_MQTT_CMD_PUBREC)
2043 #define MG_EV_MQTT_PUBREL (MG_MQTT_EVENT_BASE + MG_MQTT_CMD_PUBREL)
2044 #define MG_EV_MQTT_PUBCOMP (MG_MQTT_EVENT_BASE + MG_MQTT_CMD_PUBCOMP)
2045 #define MG_EV_MQTT_SUBSCRIBE (MG_MQTT_EVENT_BASE + MG_MQTT_CMD_SUBSCRIBE)
2046 #define MG_EV_MQTT_SUBACK (MG_MQTT_EVENT_BASE + MG_MQTT_CMD_SUBACK)
2047 #define MG_EV_MQTT_UNSUBSCRIBE (MG_MQTT_EVENT_BASE + MG_MQTT_CMD_UNSUBSCRIBE)
2048 #define MG_EV_MQTT_UNSUBACK (MG_MQTT_EVENT_BASE + MG_MQTT_CMD_UNSUBACK)
2049 #define MG_EV_MQTT_PINGREQ (MG_MQTT_EVENT_BASE + MG_MQTT_CMD_PINGREQ)
2050 #define MG_EV_MQTT_PINGRESP (MG_MQTT_EVENT_BASE + MG_MQTT_CMD_PINGRESP)
2051 #define MG_EV_MQTT_DISCONNECT (MG_MQTT_EVENT_BASE + MG_MQTT_CMD_DISCONNECT)
2054 #define MG_MQTT_RETAIN 0x1
2055 #define MG_MQTT_DUP 0x4
2056 #define MG_MQTT_QOS(qos) ((qos) << 1)
2057 #define MG_MQTT_GET_QOS(flags) (((flags) &0x6) >> 1)
2058 #define MG_MQTT_SET_QOS(flags, qos) (flags) = ((flags) & ~0x6) | ((qos) << 1)
2061 #define MG_MQTT_CLEAN_SESSION 0x02
2062 #define MG_MQTT_HAS_WILL 0x04
2063 #define MG_MQTT_WILL_RETAIN 0x20
2064 #define MG_MQTT_HAS_PASSWORD 0x40
2065 #define MG_MQTT_HAS_USER_NAME 0x80
2066 #define MG_MQTT_GET_WILL_QOS(flags) (((flags) &0x18) >> 3)
2067 #define MG_MQTT_SET_WILL_QOS(flags, qos) \
2068 (flags) = ((flags) & ~0x18) | ((qos) << 3)
2071 #define MG_EV_MQTT_CONNACK_ACCEPTED 0
2072 #define MG_EV_MQTT_CONNACK_UNACCEPTABLE_VERSION 1
2073 #define MG_EV_MQTT_CONNACK_IDENTIFIER_REJECTED 2
2074 #define MG_EV_MQTT_CONNACK_SERVER_UNAVAILABLE 3
2075 #define MG_EV_MQTT_CONNACK_BAD_AUTH 4
2076 #define MG_EV_MQTT_CONNACK_NOT_AUTHORIZED 5
2106 uint16_t message_id,
int flags,
const void *
data,
2112 size_t topics_len, uint16_t message_id);
2116 size_t topics_len, uint16_t message_id);
2187 #ifndef MG_MQTT_BROKER_HEADER_INCLUDED
2188 #define MG_MQTT_BROKER_HEADER_INCLUDED
2190 #ifdef MG_ENABLE_MQTT_BROKER
2197 #define MG_MQTT_MAX_SESSION_SUBSCRIPTIONS 512;
2199 struct mg_mqtt_broker;
2202 struct mg_mqtt_session {
2203 struct mg_mqtt_broker *brk;
2204 struct mg_mqtt_session *next, *prev;
2206 size_t num_subscriptions;
2212 struct mg_mqtt_broker {
2213 struct mg_mqtt_session *sessions;
2218 void mg_mqtt_broker_init(
struct mg_mqtt_broker *,
void *);
2256 struct mg_mqtt_session *mg_mqtt_next(
struct mg_mqtt_broker *,
2257 struct mg_mqtt_session *);
2274 #ifndef MG_DNS_HEADER_DEFINED
2275 #define MG_DNS_HEADER_DEFINED
2282 #define MG_DNS_A_RECORD 0x01
2283 #define MG_DNS_CNAME_RECORD 0x05
2284 #define MG_DNS_AAAA_RECORD 0x1c
2285 #define MG_DNS_MX_RECORD 0x0f
2287 #define MG_MAX_DNS_QUESTIONS 32
2288 #define MG_MAX_DNS_ANSWERS 32
2290 #define MG_DNS_MESSAGE 100
2375 const char *,
size_t,
const void *,
size_t);
2425 #ifndef MG_DNS_SERVER_HEADER_DEFINED
2426 #define MG_DNS_SERVER_HEADER_DEFINED
2428 #ifdef MG_ENABLE_DNS_SERVER
2435 #define MG_DNS_SERVER_DEFAULT_TTL 3600
2437 struct mg_dns_reply {
2472 struct mg_dns_reply mg_dns_create_reply(struct mbuf *,
struct mg_dns_message *);
2483 const char *,
int,
int,
const void *,
size_t);
2497 void mg_dns_send_reply(
struct mg_connection *,
struct mg_dns_reply *);
2514 #ifndef MG_RESOLV_HEADER_DEFINED
2515 #define MG_RESOLV_HEADER_DEFINED
2602 #ifndef MG_COAP_HEADER_INCLUDED
2603 #define MG_COAP_HEADER_INCLUDED
2605 #ifdef MG_ENABLE_COAP
2607 #define MG_COAP_MSG_TYPE_FIELD 0x2
2608 #define MG_COAP_CODE_CLASS_FIELD 0x4
2609 #define MG_COAP_CODE_DETAIL_FIELD 0x8
2610 #define MG_COAP_MSG_ID_FIELD 0x10
2611 #define MG_COAP_TOKEN_FIELD 0x20
2612 #define MG_COAP_OPTIOMG_FIELD 0x40
2613 #define MG_COAP_PAYLOAD_FIELD 0x80
2615 #define MG_COAP_ERROR 0x10000
2616 #define MG_COAP_FORMAT_ERROR (MG_COAP_ERROR | 0x20000)
2617 #define MG_COAP_IGNORE (MG_COAP_ERROR | 0x40000)
2618 #define MG_COAP_NOT_ENOUGH_DATA (MG_COAP_ERROR | 0x80000)
2619 #define MG_COAP_NETWORK_ERROR (MG_COAP_ERROR | 0x100000)
2621 #define MG_COAP_MSG_CON 0
2622 #define MG_COAP_MSG_NOC 1
2623 #define MG_COAP_MSG_ACK 2
2624 #define MG_COAP_MSG_RST 3
2625 #define MG_COAP_MSG_MAX 3
2627 #define MG_COAP_CODECLASS_REQUEST 0
2628 #define MG_COAP_CODECLASS_RESP_OK 2
2629 #define MG_COAP_CODECLASS_CLIENT_ERR 4
2630 #define MG_COAP_CODECLASS_SRV_ERR 5
2632 #define MG_COAP_EVENT_BASE 300
2633 #define MG_EV_COAP_CON (MG_COAP_EVENT_BASE + MG_COAP_MSG_CON)
2634 #define MG_EV_COAP_NOC (MG_COAP_EVENT_BASE + MG_COAP_MSG_NOC)
2635 #define MG_EV_COAP_ACK (MG_COAP_EVENT_BASE + MG_COAP_MSG_ACK)
2636 #define MG_EV_COAP_RST (MG_COAP_EVENT_BASE + MG_COAP_MSG_RST)
2643 struct mg_coap_option {
2644 struct mg_coap_option *next;
2650 struct mg_coap_message {
2654 uint8_t code_detail;
2657 struct mg_coap_option *options;
2659 struct mg_coap_option *optiomg_tail;
2673 struct mg_coap_option *mg_coap_add_option(
struct mg_coap_message *cm,
2674 uint32_t number,
char *value,
2681 void mg_coap_free_options(
struct mg_coap_message *cm);
2695 struct mg_coap_message *cm);
2719 uint32_t mg_coap_parse(
struct mbuf *io,
struct mg_coap_message *cm);
2726 uint32_t mg_coap_compose(
struct mg_coap_message *cm,
struct mbuf *io);
int mg_resolve(const char *domain_name, char *ip_addr_buf, size_t buf_len)
Definition: mongoose.c:2043
struct mg_str header_values[MG_MAX_HTTP_HEADERS]
Definition: mongoose.h:1411
void mg_mqtt_pubcomp(struct mg_connection *, uint16_t)
Definition: mongoose.c:7060
int mg_parse_dns(const char *, int, struct mg_dns_message *)
Definition: mongoose.c:7511
Definition: mongoose.h:2309
const char * cgi_file_pattern
Definition: mongoose.h:1788
Definition: mongoose.h:2299
struct json_token * message
Definition: mongoose.h:1868
Definition: mongoose.h:1852
Definition: mongoose.h:1417
struct json_token * result
Definition: mongoose.h:1863
void mg_set_protocol_http_websocket(struct mg_connection *nc)
Definition: mongoose.c:4458
int accept_literal
Definition: mongoose.h:2529
unsigned char in[64]
Definition: mongoose.h:441
int mg_vprintf(struct mg_connection *, const char *fmt, va_list ap)
Definition: mongoose.c:1988
void mg_send_dns_query(struct mg_connection *, const char *, int)
Definition: mongoose.c:7424
void mg_if_connect_cb(struct mg_connection *nc, int err)
Definition: mongoose.c:2497
union socket_address sa
Definition: mongoose.h:721
mg_event_handler_t handler
Definition: mongoose.h:730
const char * custom_mime_types
Definition: mongoose.h:1797
struct json_token * parse_json2(const char *json_string, int string_length)
Definition: mongoose.c:759
void mg_if_poll(struct mg_connection *nc, time_t now)
Definition: mongoose.c:1891
void cs_sha1_init(cs_sha1_ctx *)
Definition: mongoose.c:1451
int json_emit_quoted_str(char *buf, int buf_len, const char *str, int len)
Definition: mongoose.c:830
void mg_send_websocket_handshake(struct mg_connection *nc, const char *uri, const char *extra_headers)
Definition: mongoose.c:4464
void mbuf_free(struct mbuf *)
Definition: mongoose.c:1216
void mg_broadcast(struct mg_mgr *, mg_event_handler_t func, void *, size_t)
Definition: mongoose.c:2659
mg_event_handler_t proto_handler
Definition: mongoose.h:728
int sock_t
Definition: mongoose.h:260
unsigned char flags
Definition: mongoose.h:2012
Definition: mongoose.h:281
Definition: mongoose.h:2011
#define MG_MAX_DNS_QUESTIONS
Definition: mongoose.h:2287
void mg_if_udp_send(struct mg_connection *nc, const void *buf, size_t len)
Definition: mongoose.c:2820
const char * topic
Definition: mongoose.h:2007
Definition: mongoose.h:1860
json_type
Definition: mongoose.h:565
void cs_base64_finish(struct cs_base64_ctx *ctx)
Definition: mongoose.c:188
Definition: mongoose.h:2295
size_t mbuf_insert(struct mbuf *, size_t, const void *, size_t)
Definition: mongoose.c:1241
struct mg_connection * mg_bind_opt(struct mg_mgr *, const char *, mg_event_handler_t, struct mg_bind_opts)
Definition: mongoose.c:2614
Definition: mongoose.h:1718
struct json_token * error_data
Definition: mongoose.h:1872
void mg_mqtt_unsubscribe(struct mg_connection *nc, char **topics, size_t topics_len, uint16_t message_id)
Definition: mongoose.c:7011
struct json_token * method
Definition: mongoose.h:1855
void mg_enable_multithreading(struct mg_connection *nc)
int only_literal
Definition: mongoose.h:2530
void MD5_Init(MD5_CTX *c)
Definition: mongoose.c:992
void mbuf_init(struct mbuf *, size_t initial_capacity)
Definition: mongoose.c:1210
void cs_base64_update(struct cs_base64_ctx *ctx, const char *str, size_t len)
Definition: mongoose.c:176
int mg_mqtt_next_subscribe_topic(struct mg_mqtt_message *, struct mg_str *, uint8_t *, int)
Definition: mongoose.c:6998
struct mbuf send_mbuf
Definition: mongoose.h:724
void * priv_1
Definition: mongoose.h:732
const char data[]
Make it with: gcc -o post-callback post-callback.c -lcurl.
Definition: post-callback.c:23
void mg_send_mqtt_handshake_opt(struct mg_connection *, const char *client_id, struct mg_send_mqtt_handshake_opts)
Definition: mongoose.c:6906
struct MD5Context MD5_CTX
int mg_hexdump(const void *buf, int len, char *dst, int dst_len)
Definition: mongoose.c:6460
int c_snprintf(char *buf, size_t buf_size, const char *format,...)
Definition: mongoose.c:1740
struct mg_str message
Definition: mongoose.h:1388
char * topic
Definition: mongoose.h:2003
struct mg_str query_string
Definition: mongoose.h:1407
void mg_if_recv_udp_cb(struct mg_connection *nc, void *buf, int len, union socket_address *sa, size_t sa_len)
Definition: mongoose.c:2433
struct sockaddr sa
Definition: mongoose.h:664
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 *)
Definition: mongoose.c:6767
Definition: mongoose.h:485
void * SSL
Definition: mongoose.h:647
Definition: mongoose.h:825
const char * password
Definition: mongoose.h:2017
struct mg_str name
Definition: mongoose.h:2300
const char * ip_acl
Definition: mongoose.h:1759
void(* mg_event_handler_t)(struct mg_connection *, int ev, void *)
Definition: mongoose.h:687
const char ** error_string
Definition: mongoose.h:828
SSL_CTX * ssl_ctx
Definition: mongoose.h:726
const char * per_directory_auth_file
Definition: mongoose.h:1737
const char * document_root
Definition: mongoose.h:1720
struct json_token * id
Definition: mongoose.h:1854
const char * hexdump_file
Definition: mongoose.h:702
void MD5_Final(unsigned char *md, MD5_CTX *c)
void * user_data
Definition: mongoose.h:490
int mg_if_listen_tcp(struct mg_connection *nc, union socket_address *sa)
Definition: mongoose.c:2802
uint8_t connack_ret_code
Definition: mongoose.h:2001
void mg_mqtt_ping(struct mg_connection *)
Definition: mongoose.c:7079
void mg_serve_http(struct mg_connection *, struct http_message *, struct mg_serve_http_opts)
Definition: mongoose.c:6130
enum mg_dns_resource_record_kind kind
Definition: mongoose.h:2304
struct mg_connection * prev
Definition: mongoose.h:715
struct json_token * error_message
Definition: mongoose.h:1871
int rclass
Definition: mongoose.h:2302
int mg_match_prefix(const char *pattern, int pattern_len, const char *str)
Definition: mongoose.c:6594
void mg_send_head(struct mg_connection *n, int status_code, int64_t content_length, const char *extra_headers)
Definition: mongoose.c:4504
void mg_if_destroy_conn(struct mg_connection *nc)
Definition: mongoose.c:2830
Definition: mongoose.h:854
void mg_close_conn(struct mg_connection *nc)
Definition: mongoose.c:1902
Definition: mongoose.h:568
void mg_mqtt_pong(struct mg_connection *)
Definition: mongoose.c:7083
int num_answers
Definition: mongoose.h:2314
void mg_send_mqtt_handshake(struct mg_connection *nc, const char *client_id)
Definition: mongoose.c:6901
void(* cs_base64_putc_t)(char, void *)
Definition: mongoose.h:483
int mg_avprintf(char **buf, size_t size, const char *fmt, va_list ap)
Definition: mongoose.c:6482
Definition: mongoose.h:409
Definition: mongoose.h:280
Definition: mongoose.h:571
uint32_t buf[4]
Definition: mongoose.h:439
void mg_if_tcp_send(struct mg_connection *nc, const void *buf, size_t len)
Definition: mongoose.c:2816
Definition: mongoose.h:674
struct mg_dns_resource_record answers[MG_MAX_DNS_ANSWERS]
Definition: mongoose.h:2316
struct mg_connection * mg_add_sock_opt(struct mg_mgr *, sock_t, mg_event_handler_t, struct mg_add_sock_opts)
Definition: mongoose.c:3140
void * priv_2
Definition: mongoose.h:733
int mg_parse_http(const char *s, int n, struct http_message *hm, int is_req)
Definition: mongoose.c:3788
Definition: mongoose.h:1867
struct mg_connection * mg_connect_opt(struct mg_mgr *, const char *, mg_event_handler_t, struct mg_connect_opts)
Definition: mongoose.c:2560
size_t len
Definition: mongoose.h:348
const char * access_log_file
Definition: mongoose.h:1726
enum json_type type
Definition: mongoose.h:580
int c_vsnprintf(char *buf, size_t buf_size, const char *format, va_list ap)
Definition: mongoose.c:1617
void * user_data
Definition: mongoose.h:889
int json_emit_unquoted_str(char *buf, int buf_len, const char *str, int len)
Definition: mongoose.c:858
const char * enable_directory_listing
Definition: mongoose.h:1753
Definition: mongoose.h:283
struct mg_connection * next
Definition: mongoose.h:715
int mg_http_parse_header(struct mg_str *hdr, const char *var_name, char *buf, size_t buf_size)
Definition: mongoose.c:4958
int(* mg_rpc_handler_t)(char *buf, int len, struct mg_rpc_request *)
Definition: mongoose.h:1951
struct mg_connection * mg_if_accept_tcp_cb(struct mg_connection *lc, union socket_address *sa, size_t sa_len)
Definition: mongoose.c:2316
int mg_stat(const char *path, cs_stat_t *st)
Definition: mongoose.c:6341
void mg_mqtt_suback(struct mg_connection *, uint8_t *, size_t, uint16_t)
Definition: mongoose.c:7064
int mg_socketpair(sock_t[2], int sock_type)
Definition: mongoose.c:3424
struct json_token * message
Definition: mongoose.h:1861
int cs_base64_decode(const unsigned char *s, int len, char *dst)
Definition: mongoose.c:296
const char * user_name
Definition: mongoose.h:2016
const char * p
Definition: mongoose.h:675
Definition: mongoose.h:2293
void mg_printf_websocket_frame(struct mg_connection *nc, int op_and_flags, const char *fmt,...)
Definition: mongoose.c:4080
size_t mg_dns_uncompress_name(struct mg_dns_message *, struct mg_str *, char *, int)
Definition: mongoose.c:7540
sock_t ctl[2]
Definition: mongoose.h:703
void * user_data
Definition: mongoose.h:855
struct sockaddr_in sin
Definition: mongoose.h:665
int num_desc
Definition: mongoose.h:579
struct mg_connection * mg_bind(struct mg_mgr *, const char *, mg_event_handler_t)
Definition: mongoose.c:2607
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)
Definition: mongoose.c:6245
Definition: mongoose.h:285
void cs_base64_encode(const unsigned char *src, int src_len, char *dst)
Definition: mongoose.c:234
struct mg_connection * mg_add_sock(struct mg_mgr *, sock_t, mg_event_handler_t)
Definition: mongoose.c:3133
struct json_token * params
Definition: mongoose.h:1856
int err
Definition: test38.c:26
const char * dav_auth_file
Definition: mongoose.h:1782
struct mg_str rdata
Definition: mongoose.h:2305
void mg_send_response_line(struct mg_connection *c, int status_code, const char *extra_headers)
Definition: mongoose.c:4484
void * proto_data
Definition: mongoose.h:729
time_t last_io_time
Definition: mongoose.h:727
void mg_mqtt_connack(struct mg_connection *, uint8_t)
Definition: mongoose.c:7029
int json_emit_va(char *buf, int buf_len, const char *fmt, va_list)
Definition: mongoose.c:869
Definition: mongoose.h:282
void mbuf_trim(struct mbuf *)
Definition: mongoose.c:1237
void cs_hmac_sha1(const unsigned char *key, size_t key_len, const unsigned char *text, size_t text_len, unsigned char out[20])
Definition: mongoose.c:1504
int num_questions
Definition: mongoose.h:2313
unsigned long flags
Definition: mongoose.h:736
struct json_token * message
Definition: mongoose.h:1853
struct mg_str payload
Definition: mongoose.h:1999
unsigned char chunk[3]
Definition: mongoose.h:488
struct mg_str proto
Definition: mongoose.h:1393
struct mg_connection * mg_connect(struct mg_mgr *, const char *, mg_event_handler_t)
Definition: mongoose.c:2553
mg_dns_resource_record_kind
Definition: mongoose.h:2292
void mg_set_protocol_dns(struct mg_connection *)
Definition: mongoose.c:7620
void MD5_Update(MD5_CTX *c, const unsigned char *data, size_t len)
Definition: mongoose.c:1084
struct mg_str method
Definition: mongoose.h:1391
Definition: mongoose.h:663
struct mg_connection * listener
Definition: mongoose.h:716
Definition: mongoose.h:700
size_t mbuf_append(struct mbuf *, const void *data, size_t data_size)
Definition: mongoose.c:1273
void * user_data
Definition: mongoose.h:731
int rtype
Definition: mongoose.h:2301
void mg_printf_html_escape(struct mg_connection *, const char *,...)
Definition: mongoose.c:4931
int ttl
Definition: mongoose.h:2303
void mg_if_sent_cb(struct mg_connection *nc, int num_sent)
Definition: mongoose.c:2395
int json_emit(char *buf, int buf_len, const char *fmt,...)
Definition: mongoose.c:929
int mg_casecmp(const char *s1, const char *s2)
Definition: mongoose.c:6318
int cmd
Definition: mongoose.h:1998
int mg_dns_encode_record(struct mbuf *, struct mg_dns_resource_record *, const char *, size_t, const void *, size_t)
Definition: mongoose.c:7379
unsigned int flags
Definition: mongoose.h:856
const char * cgi_interpreter
Definition: mongoose.h:1791
int mg_resolve_from_hosts_file(const char *host, union socket_address *usa)
Definition: mongoose.c:7807
void * SSL_CTX
Definition: mongoose.h:648
uint16_t transaction_id
Definition: mongoose.h:2312
struct mg_str uri
Definition: mongoose.h:1392
Definition: mongoose.h:1387
void mg_base64_encode(const unsigned char *src, int src_len, char *dst)
Definition: mongoose.c:6374
unsigned int flags
Definition: mongoose.h:890
Definition: mongoose.h:888
int mg_ncasecmp(const char *s1, const char *s2, size_t len)
Definition: mongoose.c:6308
int result
Definition: grammar-filter.c:79
time_t mg_mgr_poll(struct mg_mgr *, int milli)
Definition: mongoose.c:3338
struct mg_dns_resource_record * mg_dns_next_record(struct mg_dns_message *, int, struct mg_dns_resource_record *)
Definition: mongoose.c:7289
char * cs_md5(char buf[33],...)
Definition: mongoose.c:1165
Definition: mongoose.h:569
void cs_log_set_level(enum cs_log_level level)
Definition: mongoose.c:341
unsigned char flags
Definition: mongoose.h:1420
struct stat cs_stat_t
Definition: mongoose.h:261
void mg_mqtt_pubrel(struct mg_connection *, uint16_t)
Definition: mongoose.c:7056
void cs_sha1_final(unsigned char digest[20], cs_sha1_ctx *)
Definition: mongoose.c:1480
void mg_mqtt_subscribe(struct mg_connection *nc, const struct mg_mqtt_topic_expression *topics, size_t topics_len, uint16_t message_id)
Definition: mongoose.c:6978
size_t strnlen(const char *s, size_t maxlen)
Definition: mongoose.c:1555
int mg_if_listen_udp(struct mg_connection *nc, union socket_address *sa)
Definition: mongoose.c:2809
int max_retries
Definition: mongoose.h:2527
int parse_json(const char *json_string, int json_string_length, struct json_token *tokens_array, int size_of_tokens_array)
Definition: mongoose.c:745
struct mg_dns_resource_record questions[MG_MAX_DNS_QUESTIONS]
Definition: mongoose.h:2315
int mg_base64_decode(const unsigned char *s, int len, char *dst)
Definition: mongoose.c:6378
void mg_mqtt_pubrec(struct mg_connection *, uint16_t)
Definition: mongoose.c:7052
int mg_rpc_create_request(char *buf, int len, const char *method, const char *id, const char *params_fmt,...)
Definition: mongoose.c:6666
void mg_send_websocket_frame(struct mg_connection *nc, int op_and_flags, const void *data, size_t data_len)
Definition: mongoose.c:4045
#define MG_MAX_DNS_ANSWERS
Definition: mongoose.h:2288
void mg_mqtt_unsuback(struct mg_connection *, uint16_t)
Definition: mongoose.c:7075
void mg_mqtt_puback(struct mg_connection *, uint16_t)
Definition: mongoose.c:7048
Definition: mongoose.h:346
void mg_send(struct mg_connection *, const void *buf, int len)
Definition: mongoose.c:2381
void cs_base64_init(struct cs_base64_ctx *ctx, cs_base64_putc_t putc, void *user_data)
Definition: mongoose.c:169
int qos
Definition: mongoose.h:2000
int mg_is_big_endian(void)
Definition: mongoose.c:6555
struct json_token * id
Definition: mongoose.h:1862
Definition: mongoose.h:279
void cs_to_hex(char *to, const unsigned char *p, size_t len)
Definition: mongoose.c:1155
size_t size
Definition: mongoose.h:1419
Definition: mongoose.h:572
struct mg_str resp_status_msg
Definition: mongoose.h:1397
enum cs_log_level s_cs_log_level
Definition: mongoose.c:325
int mg_check_ip_acl(const char *acl, uint32_t remote_ip)
Definition: mongoose.c:2704
int timeout
Definition: mongoose.h:2528
Definition: mongoose.h:576
void * user_data
Definition: mongoose.h:826
Definition: mongoose.h:566
void cs_sha1_update(cs_sha1_ctx *, const unsigned char *data, uint32_t len)
Definition: mongoose.c:1460
const char * extra_headers
Definition: mongoose.h:1803
void cs_log_printf(const char *fmt,...)
Definition: mongoose.c:332
void mg_set_close_on_exec(sock_t)
Definition: mongoose.c:6406
cs_base64_putc_t b64_putc
Definition: mongoose.h:487
uint16_t flags
Definition: mongoose.h:2311
struct mg_str * mg_get_http_header(struct http_message *hm, const char *name)
Definition: mongoose.c:3852
cs_log_level
Definition: mongoose.h:278
int mg_rpc_create_std_error(char *, int, struct mg_rpc_request *, int code)
Definition: mongoose.c:6700
void mg_hexdump_connection(struct mg_connection *nc, const char *path, int num_bytes, int ev)
Definition: mongoose.c:6519
struct json_token * find_json_token(struct json_token *toks, const char *path)
Definition: mongoose.c:780
enum @1 state
Application states.
int chunk_size
Definition: mongoose.h:489
uint32_t bits[2]
Definition: mongoose.h:440
void mbuf_resize(struct mbuf *, size_t new_size)
Definition: mongoose.c:1223
Definition: mongoose.h:1997
struct mg_str header_names[MG_MAX_HTTP_HEADERS]
Definition: mongoose.h:1410
Definition: mongoose.h:438
struct mg_str pkt
Definition: mongoose.h:2310
Definition: mongoose.h:567
int mg_vcmp(const struct mg_str *str2, const char *str1)
Definition: mongoose.c:6331
const char * nameserver_url
Definition: mongoose.h:2526
size_t size
Definition: mongoose.h:349
Definition: mongoose.h:570
int json_emit_long(char *buf, int buf_len, long value)
const char * will_message
Definition: mongoose.h:2015
Definition: mongoose.h:714
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)
Definition: mongoose.c:6169
int json_emit_double(char *buf, int buf_len, double value)
Definition: mongoose.c:823
int mg_get_http_var(const struct mg_str *, const char *, char *dst, size_t)
Definition: mongoose.c:4864
sock_t sock
Definition: mongoose.h:719
int mg_dns_parse_record_data(struct mg_dns_message *, struct mg_dns_resource_record *, void *, size_t)
Definition: mongoose.c:7303
int mg_rpc_dispatch(const char *buf, int, char *dst, int dst_len, const char **methods, mg_rpc_handler_t *handlers)
Definition: mongoose.c:6728
const char ** error_string
Definition: mongoose.h:857
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)
Definition: mongoose.c:5021
int mg_resolve_async(struct mg_mgr *, const char *, int, mg_resolve_callback_t, void *data)
Definition: mongoose.c:7895
void mg_mgr_init(struct mg_mgr *mgr, void *user_data)
Definition: mongoose.c:1911
void mg_sock_addr_to_str(const union socket_address *sa, char *buf, size_t len, int flags)
Definition: mongoose.c:6414
void mg_set_protocol_mqtt(struct mg_connection *)
Definition: mongoose.c:6897
struct mg_connection * active_connections
Definition: mongoose.h:701
void mg_send_http_chunk(struct mg_connection *nc, const char *buf, size_t len)
Definition: mongoose.c:4901
void mg_if_recved(struct mg_connection *nc, size_t len)
Definition: mongoose.c:2825
void mg_if_connect_tcp(struct mg_connection *nc, const union socket_address *sa)
Definition: mongoose.c:2775
void mg_mqtt_publish(struct mg_connection *nc, const char *topic, uint16_t message_id, int flags, const void *data, size_t len)
Definition: mongoose.c:6959
#define nc
Pointer to mg_connection structure.
Definition: teo_ws.c:36
uint16_t message_id
Definition: mongoose.h:2002
Definition: mongoose.h:2525
struct json_token * id
Definition: mongoose.h:1869
const char * global_auth_file
Definition: mongoose.h:1750
const char * url_rewrites
Definition: mongoose.h:1776
void(* mg_resolve_callback_t)(struct mg_dns_message *, void *)
Definition: mongoose.h:2522
const char * mg_next_comma_list_entry(const char *list, struct mg_str *val, struct mg_str *eq_val)
Definition: mongoose.c:6561
uint16_t keep_alive
Definition: mongoose.h:2013
int resp_code
Definition: mongoose.h:1396
int mg_dns_copy_body(struct mbuf *, struct mg_dns_message *)
Definition: mongoose.c:7345
int mg_rpc_create_reply(char *buf, int len, const struct mg_rpc_request *req, const char *result_fmt,...)
Definition: mongoose.c:6642
unsigned char * data
Definition: mongoose.h:1418
void mg_if_connect_udp(struct mg_connection *nc)
Definition: mongoose.c:2792
Definition: mongoose.h:2006
const char * hidden_file_pattern
Definition: mongoose.h:1785
uint8_t qos
Definition: mongoose.h:2008
void mg_sock_to_str(sock_t sock, char *buf, size_t len, int flags)
Definition: mongoose.c:3467
struct sockaddr sin6
Definition: mongoose.h:669
Definition: mongoose.h:573
const char * dav_document_root
Definition: mongoose.h:1779
struct mbuf recv_mbuf
Definition: mongoose.h:723
char * buf
Definition: mongoose.h:347
const char * ssi_pattern
Definition: mongoose.h:1756
int info
Definition: test38.c:26
const char * mg_set_ssl(struct mg_connection *nc, const char *cert, const char *ca_cert)
const char * auth_domain
Definition: mongoose.h:1740
int mg_rpc_create_error(char *buf, int len, struct mg_rpc_request *req, int code, const char *message, const char *fmt,...)
Definition: mongoose.c:6682
SSL * ssl
Definition: mongoose.h:725
int len
Definition: mongoose.h:578
unsigned int flags
Definition: mongoose.h:827
int mg_open(const char *path, int flag, int mode)
Definition: mongoose.c:6363
const char * will_topic
Definition: mongoose.h:2014
void mg_send_websocket_framev(struct mg_connection *nc, int op_and_flags, const struct mg_str *strings, int num_strings)
Definition: mongoose.c:4058
FILE * mg_fopen(const char *path, const char *mode)
Definition: mongoose.c:6352
const char * mg_skip(const char *s, const char *end_string, const char *delimiters, struct mg_str *v)
Definition: mongoose.c:6295
const char * index_files
Definition: mongoose.h:1723
void * user_data
Definition: mongoose.h:704
Definition: mongoose.h:286
int err
Definition: mongoose.h:720
const char * ptr
Definition: mongoose.h:577
int mg_vcasecmp(const struct mg_str *str2, const char *str1)
Definition: mongoose.c:6322
void mbuf_remove(struct mbuf *, size_t data_size)
Definition: mongoose.c:1277
void mg_printf_http_chunk(struct mg_connection *, const char *,...)
Definition: mongoose.c:4911
int mg_printf(struct mg_connection *, const char *fmt,...)
Definition: mongoose.c:2002
#define MG_MAX_HTTP_HEADERS
Definition: mongoose.h:1351
int mg_resolve_async_opt(struct mg_mgr *, const char *, int, mg_resolve_callback_t, void *data, struct mg_resolve_async_opts opts)
Definition: mongoose.c:7902
int mg_dns_insert_header(struct mbuf *, size_t, struct mg_dns_message *)
Definition: mongoose.c:7332
size_t recv_mbuf_limit
Definition: mongoose.h:722
void * mgr_data
Definition: mongoose.h:734
void mg_mqtt_disconnect(struct mg_connection *nc)
Definition: mongoose.c:7087
Definition: mongoose.h:2294
const char ** error_string
Definition: mongoose.h:891
void mg_if_recv_tcp_cb(struct mg_connection *nc, void *buf, int len)
Definition: mongoose.c:2428
void * mgr_data
Definition: mongoose.h:705
void cs_fprint_base64(FILE *f, const unsigned char *src, int src_len)
Definition: mongoose.c:249
struct mg_mgr * mgr
Definition: mongoose.h:717
struct json_token * error_code
Definition: mongoose.h:1870
struct mg_str body
Definition: mongoose.h:1414
size_t len
Definition: mongoose.h:676
struct mg_connection * mg_next(struct mg_mgr *, struct mg_connection *)
Definition: mongoose.c:2654
void mg_mgr_free(struct mg_mgr *)
Definition: mongoose.c:1966