2 #line 1 "mongoose/src/mg_common.h" 23 #ifndef CS_MONGOOSE_SRC_COMMON_H_ 24 #define CS_MONGOOSE_SRC_COMMON_H_ 26 #define MG_VERSION "6.13" 30 #include <mg_locals.h> 34 #ifdef MG_MODULE_LINES 35 #line 1 "common/platform.h" 37 #ifndef CS_COMMON_PLATFORM_H_ 38 #define CS_COMMON_PLATFORM_H_ 46 #define CS_P_WINDOWS 2 48 #define CS_P_ESP8266 3 51 #define CS_P_CC3220 17 53 #define CS_P_TM4C129 14 56 #define CS_P_NXP_LPC 13 57 #define CS_P_NXP_KINETIS 9 67 #if defined(TARGET_IS_MSP432P4XX) || defined(__MSP432P401R__) 68 #define CS_PLATFORM CS_P_MSP432 69 #elif defined(cc3200) || defined(TARGET_IS_CC3200) 70 #define CS_PLATFORM CS_P_CC3200 71 #elif defined(cc3220) || defined(TARGET_IS_CC3220) 72 #define CS_PLATFORM CS_P_CC3220 73 #elif defined(__unix__) || defined(__APPLE__) 74 #define CS_PLATFORM CS_P_UNIX 76 #define CS_PLATFORM CS_P_WINCE 78 #define CS_PLATFORM CS_P_WINDOWS 79 #elif defined(__MBED__) 80 #define CS_PLATFORM CS_P_MBED 81 #elif defined(__USE_LPCOPEN) 82 #define CS_PLATFORM CS_P_NXP_LPC 83 #elif defined(FRDM_K64F) || defined(FREEDOM) 84 #define CS_PLATFORM CS_P_NXP_KINETIS 86 #define CS_PLATFORM CS_P_PIC32 87 #elif defined(ESP_PLATFORM) 88 #define CS_PLATFORM CS_P_ESP32 89 #elif defined(ICACHE_FLASH) 90 #define CS_PLATFORM CS_P_ESP8266 91 #elif defined(TARGET_IS_TM4C129_RA0) || defined(TARGET_IS_TM4C129_RA1) || \ 92 defined(TARGET_IS_TM4C129_RA2) 93 #define CS_PLATFORM CS_P_TM4C129 95 #define CS_PLATFORM CS_P_STM32 99 #error "CS_PLATFORM is not specified and we couldn't guess it." 104 #define MG_NET_IF_SOCKET 1 105 #define MG_NET_IF_SIMPLELINK 2 106 #define MG_NET_IF_LWIP_LOW_LEVEL 3 107 #define MG_NET_IF_PIC32 4 108 #define MG_NET_IF_NULL 5 110 #define MG_SSL_IF_OPENSSL 1 111 #define MG_SSL_IF_MBEDTLS 2 112 #define MG_SSL_IF_SIMPLELINK 3 132 #if !defined(PRINTF_LIKE) 133 #if defined(__GNUC__) || defined(__clang__) || defined(__TI_COMPILER_VERSION__) 134 #define PRINTF_LIKE(f, a) __attribute__((format(printf, f, a))) 136 #define PRINTF_LIKE(f, a) 141 #if (defined(__GNUC__) || defined(__clang__) || \ 142 defined(__TI_COMPILER_VERSION__)) && \ 144 #define WEAK __attribute__((weak)) 151 #define NORETURN __attribute__((noreturn)) 152 #define NOINLINE __attribute__((noinline)) 153 #define WARN_UNUSED_RESULT __attribute__((warn_unused_result)) 154 #define NOINSTR __attribute__((no_instrument_function)) 155 #define DO_NOT_WARN_UNUSED __attribute__((unused)) 159 #define WARN_UNUSED_RESULT 161 #define DO_NOT_WARN_UNUSED 165 #define ARRAY_SIZE(array) (sizeof(array) / sizeof(array[0])) 169 #ifdef MG_MODULE_LINES 170 #line 1 "common/platforms/platform_windows.h" 172 #ifndef CS_COMMON_PLATFORMS_PLATFORM_WINDOWS_H_ 173 #define CS_COMMON_PLATFORMS_PLATFORM_WINDOWS_H_ 174 #if CS_PLATFORM == CS_P_WINDOWS 189 #pragma warning(disable : 4127) 190 #pragma warning(disable : 4204) 193 #ifndef _WINSOCK_DEPRECATED_NO_WARNINGS 194 #define _WINSOCK_DEPRECATED_NO_WARNINGS 1 197 #ifndef _CRT_SECURE_NO_WARNINGS 198 #define _CRT_SECURE_NO_WARNINGS 211 #include <sys/stat.h> 216 #pragma comment(lib, "ws2_32.lib") 219 #include <winsock2.h> 220 #include <ws2tcpip.h> 230 #if defined(_MSC_VER) && _MSC_VER >= 1800 231 #define strdup _strdup 235 #define EINPROGRESS WSAEINPROGRESS 238 #define EWOULDBLOCK WSAEWOULDBLOCK 242 #define STR(x) STRX(x) 243 #define __func__ __FILE__ ":" STR(__LINE__) 245 #define snprintf _snprintf 246 #define vsnprintf _vsnprintf 247 #define to64(x) _atoi64(x) 248 #if !defined(__MINGW32__) && !defined(__MINGW64__) 249 #define popen(x, y) _popen((x), (y)) 250 #define pclose(x) _pclose(x) 251 #define fileno _fileno 253 #if defined(_MSC_VER) && _MSC_VER >= 1400 254 #define fseeko(x, y, z) _fseeki64((x), (y), (z)) 256 #define fseeko(x, y, z) fseek((x), (y), (z)) 258 #if defined(_MSC_VER) && _MSC_VER <= 1200 278 #define UINT16_MAX 65535 281 #define UINT32_MAX 4294967295 286 #define INT64_FMT "I64d" 287 #define INT64_X_FMT "I64x" 288 #define SIZE_T_FMT "Iu" 291 #define S_ISDIR(x) (((x) &_S_IFMT) == _S_IFDIR) 294 #define S_ISREG(x) (((x) &_S_IFMT) == _S_IFREG) 297 #define CS_DEFINE_DIRENT 301 #define va_copy __va_copy 303 #define va_copy(x, y) (x) = (y) 307 #ifndef MG_MAX_HTTP_REQUEST_SIZE 308 #define MG_MAX_HTTP_REQUEST_SIZE 8192 311 #ifndef MG_MAX_HTTP_SEND_MBUF 312 #define MG_MAX_HTTP_SEND_MBUF 4096 315 #ifndef MG_MAX_HTTP_HEADERS 316 #define MG_MAX_HTTP_HEADERS 40 319 #ifndef CS_ENABLE_STDIO 320 #define CS_ENABLE_STDIO 1 323 #ifndef MG_ENABLE_BROADCAST 324 #define MG_ENABLE_BROADCAST 1 327 #ifndef MG_ENABLE_DIRECTORY_LISTING 328 #define MG_ENABLE_DIRECTORY_LISTING 1 331 #ifndef MG_ENABLE_FILESYSTEM 332 #define MG_ENABLE_FILESYSTEM 1 335 #ifndef MG_ENABLE_HTTP_CGI 336 #define MG_ENABLE_HTTP_CGI MG_ENABLE_FILESYSTEM 340 #define MG_NET_IF MG_NET_IF_SOCKET 344 #define timegm _mkgmtime 346 #define gmtime_r(a, b) \ 353 #ifdef MG_MODULE_LINES 354 #line 1 "common/platforms/platform_unix.h" 356 #ifndef CS_COMMON_PLATFORMS_PLATFORM_UNIX_H_ 357 #define CS_COMMON_PLATFORMS_PLATFORM_UNIX_H_ 358 #if CS_PLATFORM == CS_P_UNIX 360 #ifndef _XOPEN_SOURCE 361 #define _XOPEN_SOURCE 600 365 #ifndef __STDC_FORMAT_MACROS 366 #define __STDC_FORMAT_MACROS 370 #ifndef __STDC_LIMIT_MACROS 371 #define __STDC_LIMIT_MACROS 375 #ifndef _LARGEFILE_SOURCE 376 #define _LARGEFILE_SOURCE 380 #ifndef _FILE_OFFSET_BITS 381 #define _FILE_OFFSET_BITS 64 384 #include <arpa/inet.h> 390 #include <inttypes.h> 395 #include <netinet/in.h> 403 #include <sys/param.h> 404 #include <sys/socket.h> 405 #include <sys/select.h> 406 #include <sys/stat.h> 407 #include <sys/time.h> 408 #include <sys/types.h> 412 #include <machine/endian.h> 414 #define LITTLE_ENDIAN __DARWIN_LITTLE_ENDIAN 415 #define BIG_ENDIAN __DARWIN_BIG_ENDIAN 416 #define PDP_ENDIAN __DARWIN_PDP_ENDIAN 417 #define BYTE_ORDER __DARWIN_BYTE_ORDER 427 #if !(defined(__cplusplus) && __cplusplus >= 201103L) && \ 428 !(defined(__DARWIN_C_LEVEL) && __DARWIN_C_LEVEL >= 200809L) 429 long long strtoll(
const char *,
char **,
int);
433 #define INVALID_SOCKET (-1) 434 #define SIZE_T_FMT "zu" 437 #define to64(x) strtoll(x, NULL, 10) 438 #define INT64_FMT PRId64 439 #define INT64_X_FMT PRIx64 447 #define va_copy __va_copy 449 #define va_copy(x, y) (x) = (y) 453 #define closesocket(x) close(x) 455 #ifndef MG_MAX_HTTP_REQUEST_SIZE 456 #define MG_MAX_HTTP_REQUEST_SIZE 8192 459 #ifndef MG_MAX_HTTP_SEND_MBUF 460 #define MG_MAX_HTTP_SEND_MBUF 4096 463 #ifndef MG_MAX_HTTP_HEADERS 464 #define MG_MAX_HTTP_HEADERS 40 467 #ifndef CS_ENABLE_STDIO 468 #define CS_ENABLE_STDIO 1 471 #ifndef MG_ENABLE_BROADCAST 472 #define MG_ENABLE_BROADCAST 1 475 #ifndef MG_ENABLE_DIRECTORY_LISTING 476 #define MG_ENABLE_DIRECTORY_LISTING 1 479 #ifndef MG_ENABLE_FILESYSTEM 480 #define MG_ENABLE_FILESYSTEM 1 483 #ifndef MG_ENABLE_HTTP_CGI 484 #define MG_ENABLE_HTTP_CGI MG_ENABLE_FILESYSTEM 488 #define MG_NET_IF MG_NET_IF_SOCKET 491 #ifndef MG_HOSTS_FILE_NAME 492 #define MG_HOSTS_FILE_NAME "/etc/hosts" 495 #ifndef MG_RESOLV_CONF_FILE_NAME 496 #define MG_RESOLV_CONF_FILE_NAME "/etc/resolv.conf" 501 #ifdef MG_MODULE_LINES 502 #line 1 "common/platforms/platform_esp32.h" 521 #ifndef CS_COMMON_PLATFORMS_PLATFORM_ESP32_H_ 522 #define CS_COMMON_PLATFORMS_PLATFORM_ESP32_H_ 523 #if CS_PLATFORM == CS_P_ESP32 529 #include <inttypes.h> 530 #include <machine/endian.h> 534 #include <sys/stat.h> 535 #include <sys/time.h> 537 #define SIZE_T_FMT "u" 540 #define to64(x) strtoll(x, NULL, 10) 541 #define INT64_FMT PRId64 542 #define INT64_X_FMT PRIx64 544 #define _FILE_OFFSET_BITS 32 549 #define MG_NET_IF MG_NET_IF_SOCKET 552 #ifndef CS_ENABLE_STDIO 553 #define CS_ENABLE_STDIO 1 558 #ifdef MG_MODULE_LINES 559 #line 1 "common/platforms/platform_esp8266.h" 578 #ifndef CS_COMMON_PLATFORMS_PLATFORM_ESP8266_H_ 579 #define CS_COMMON_PLATFORMS_PLATFORM_ESP8266_H_ 580 #if CS_PLATFORM == CS_P_ESP8266 585 #include <inttypes.h> 586 #include <machine/endian.h> 589 #include <sys/stat.h> 590 #include <sys/time.h> 592 #define SIZE_T_FMT "u" 595 #if !defined(MGOS_VFS_DEFINE_DIRENT) 596 #define CS_DEFINE_DIRENT 599 #define to64(x) strtoll(x, NULL, 10) 600 #define INT64_FMT PRId64 601 #define INT64_X_FMT PRIx64 603 #define _FILE_OFFSET_BITS 32 608 #define LWIP_TIMEVAL_PRIVATE 0 611 #include <lwip/opt.h> 613 #define MG_NET_IF MG_NET_IF_SOCKET 615 #define MG_NET_IF MG_NET_IF_LWIP_LOW_LEVEL 619 #ifndef CS_ENABLE_STDIO 620 #define CS_ENABLE_STDIO 1 623 #define inet_ntop(af, src, dst, size) \ 624 (((af) == AF_INET) ? ipaddr_ntoa_r((const ip_addr_t *) (src), (dst), (size)) \ 626 #define inet_pton(af, src, dst) \ 627 (((af) == AF_INET) ? ipaddr_aton((src), (ip_addr_t *) (dst)) : 0) 631 #ifdef MG_MODULE_LINES 632 #line 1 "common/platforms/platform_cc3100.h" 651 #ifndef CS_COMMON_PLATFORMS_PLATFORM_CC3100_H_ 652 #define CS_COMMON_PLATFORMS_PLATFORM_CC3100_H_ 653 #if CS_PLATFORM == CS_P_CC3100 658 #include <inttypes.h> 663 #define MG_NET_IF MG_NET_IF_SIMPLELINK 664 #define MG_SSL_IF MG_SSL_IF_SIMPLELINK 672 #include <simplelink.h> 677 #define INVALID_SOCKET (-1) 679 #define to64(x) strtoll(x, NULL, 10) 680 #define INT64_FMT PRId64 681 #define INT64_X_FMT PRIx64 682 #define SIZE_T_FMT "u" 688 int inet_pton(
int af,
const char *src,
void *dst);
692 #ifdef MG_MODULE_LINES 693 #line 1 "common/platforms/platform_cc3200.h" 712 #ifndef CS_COMMON_PLATFORMS_PLATFORM_CC3200_H_ 713 #define CS_COMMON_PLATFORMS_PLATFORM_CC3200_H_ 714 #if CS_PLATFORM == CS_P_CC3200 719 #include <inttypes.h> 725 #ifndef __TI_COMPILER_VERSION__ 727 #include <sys/time.h> 730 #define MG_NET_IF MG_NET_IF_SIMPLELINK 731 #define MG_SSL_IF MG_SSL_IF_SIMPLELINK 734 #if defined(CC3200_FS_SPIFFS) && !defined(MG_ENABLE_DIRECTORY_LISTING) 735 #define MG_ENABLE_DIRECTORY_LISTING 1 741 #define INVALID_SOCKET (-1) 742 #define SIZE_T_FMT "u" 745 #define to64(x) strtoll(x, NULL, 10) 746 #define INT64_FMT PRId64 747 #define INT64_X_FMT PRIx64 758 #ifdef __TI_COMPILER_VERSION__ 760 #define timeval SlTimeval_t 769 #ifdef __TI_COMPILER_VERSION__ 785 int _stat(
const char *pathname,
struct stat *st);
786 int stat(
const char *pathname,
struct stat *st);
788 #define __S_IFMT 0170000 790 #define __S_IFDIR 0040000 791 #define __S_IFCHR 0020000 792 #define __S_IFREG 0100000 794 #define __S_ISTYPE(mode, mask) (((mode) &__S_IFMT) == (mask)) 796 #define S_IFDIR __S_IFDIR 797 #define S_IFCHR __S_IFCHR 798 #define S_IFREG __S_IFREG 799 #define S_ISDIR(mode) __S_ISTYPE((mode), __S_IFDIR) 800 #define S_ISREG(mode) __S_ISTYPE((mode), __S_IFREG) 803 #if __TI_COMPILER_VERSION__ < 16000000 804 #define va_copy(apc, ap) ((apc) = (ap)) 809 #ifdef CC3200_FS_SLFS 813 #if (defined(CC3200_FS_SPIFFS) || defined(CC3200_FS_SLFS)) && \ 814 !defined(MG_ENABLE_FILESYSTEM) 815 #define MG_ENABLE_FILESYSTEM 1 816 #define CS_DEFINE_DIRENT 819 #ifndef CS_ENABLE_STDIO 820 #define CS_ENABLE_STDIO 1 829 #ifdef MG_MODULE_LINES 830 #line 1 "common/platforms/platform_cc3220.h" 849 #ifndef CS_COMMON_PLATFORMS_PLATFORM_CC3220_H_ 850 #define CS_COMMON_PLATFORMS_PLATFORM_CC3220_H_ 851 #if CS_PLATFORM == CS_P_CC3220 856 #include <inttypes.h> 862 #ifndef __TI_COMPILER_VERSION__ 864 #include <sys/time.h> 867 #define MG_NET_IF MG_NET_IF_SIMPLELINK 869 #define MG_SSL_IF MG_SSL_IF_SIMPLELINK 873 #if defined(CC3220_FS_SPIFFS) && !defined(MG_ENABLE_DIRECTORY_LISTING) 874 #define MG_ENABLE_DIRECTORY_LISTING 1 880 #define INVALID_SOCKET (-1) 881 #define SIZE_T_FMT "u" 884 #define to64(x) strtoll(x, NULL, 10) 885 #define INT64_FMT PRId64 886 #define INT64_X_FMT PRIx64 897 #ifdef __TI_COMPILER_VERSION__ 899 #define timeval SlTimeval_t 908 #ifdef __TI_COMPILER_VERSION__ 912 typedef unsigned int mode_t;
924 int _stat(
const char *pathname,
struct stat *st);
925 int stat(
const char *pathname,
struct stat *st);
927 #define __S_IFMT 0170000 929 #define __S_IFDIR 0040000 930 #define __S_IFCHR 0020000 931 #define __S_IFREG 0100000 933 #define __S_ISTYPE(mode, mask) (((mode) &__S_IFMT) == (mask)) 935 #define S_IFDIR __S_IFDIR 936 #define S_IFCHR __S_IFCHR 937 #define S_IFREG __S_IFREG 938 #define S_ISDIR(mode) __S_ISTYPE((mode), __S_IFDIR) 939 #define S_ISREG(mode) __S_ISTYPE((mode), __S_IFREG) 943 #ifndef CS_ENABLE_STDIO 944 #define CS_ENABLE_STDIO 1 953 #ifdef MG_MODULE_LINES 954 #line 1 "common/platforms/platform_msp432.h" 973 #ifndef CS_COMMON_PLATFORMS_PLATFORM_MSP432_H_ 974 #define CS_COMMON_PLATFORMS_PLATFORM_MSP432_H_ 975 #if CS_PLATFORM == CS_P_MSP432 980 #include <inttypes.h> 985 #ifndef __TI_COMPILER_VERSION__ 987 #include <sys/time.h> 990 #define MG_NET_IF MG_NET_IF_SIMPLELINK 991 #define MG_SSL_IF MG_SSL_IF_SIMPLELINK 996 #define INVALID_SOCKET (-1) 997 #define SIZE_T_FMT "u" 1000 #define to64(x) strtoll(x, NULL, 10) 1001 #define INT64_FMT PRId64 1002 #define INT64_X_FMT PRIx64 1005 #define fileno(x) -1 1013 #ifdef __TI_COMPILER_VERSION__ 1015 #define timeval SlTimeval_t 1020 #ifdef __TI_COMPILER_VERSION__ 1024 typedef unsigned int mode_t;
1036 int _stat(
const char *pathname,
struct stat *st);
1037 #define stat(a, b) _stat(a, b) 1039 #define __S_IFMT 0170000 1041 #define __S_IFDIR 0040000 1042 #define __S_IFCHR 0020000 1043 #define __S_IFREG 0100000 1045 #define __S_ISTYPE(mode, mask) (((mode) &__S_IFMT) == (mask)) 1047 #define S_IFDIR __S_IFDIR 1048 #define S_IFCHR __S_IFCHR 1049 #define S_IFREG __S_IFREG 1050 #define S_ISDIR(mode) __S_ISTYPE((mode), __S_IFDIR) 1051 #define S_ISREG(mode) __S_ISTYPE((mode), __S_IFREG) 1054 #define va_copy(apc, ap) ((apc) = (ap)) 1058 #ifndef CS_ENABLE_STDIO 1059 #define CS_ENABLE_STDIO 1 1062 #if (defined(CC3200_FS_SPIFFS) || defined(CC3200_FS_SLFS)) && \ 1063 !defined(MG_ENABLE_FILESYSTEM) 1064 #define MG_ENABLE_FILESYSTEM 1 1073 #ifdef MG_MODULE_LINES 1074 #line 1 "common/platforms/platform_tm4c129.h" 1093 #ifndef CS_COMMON_PLATFORMS_PLATFORM_TM4C129_H_ 1094 #define CS_COMMON_PLATFORMS_PLATFORM_TM4C129_H_ 1095 #if CS_PLATFORM == CS_P_TM4C129 1100 #include <inttypes.h> 1105 #ifndef __TI_COMPILER_VERSION__ 1107 #include <sys/time.h> 1110 #define SIZE_T_FMT "u" 1113 #define to64(x) strtoll(x, NULL, 10) 1114 #define INT64_FMT PRId64 1115 #define INT64_X_FMT PRIx64 1119 #include <lwip/opt.h> 1121 #define MG_NET_IF MG_NET_IF_SOCKET 1123 #define MG_NET_IF MG_NET_IF_LWIP_LOW_LEVEL 1126 #elif MG_NET_IF == MG_NET_IF_SIMPLELINK 1130 #ifndef CS_ENABLE_STDIO 1131 #define CS_ENABLE_STDIO 1 1134 #ifdef __TI_COMPILER_VERSION__ 1136 #define va_copy(apc, ap) ((apc) = (ap)) 1145 #ifdef MG_MODULE_LINES 1146 #line 1 "common/platforms/platform_mbed.h" 1165 #ifndef CS_COMMON_PLATFORMS_PLATFORM_MBED_H_ 1166 #define CS_COMMON_PLATFORMS_PLATFORM_MBED_H_ 1167 #if CS_PLATFORM == CS_P_MBED 1180 #include <inttypes.h> 1184 #include <sys/stat.h> 1185 #include <sys/types.h> 1192 #ifndef CS_ENABLE_STDIO 1193 #define CS_ENABLE_STDIO 1 1202 #if defined(__ARMCC_VERSION) || defined(__ICCARM__) 1203 #define _TIMEVAL_DEFINED 1204 #define gettimeofday _gettimeofday 1215 #if MG_NET_IF == MG_NET_IF_SIMPLELINK 1217 #define MG_SIMPLELINK_NO_OSI 1 1219 #include <simplelink.h> 1222 #define INVALID_SOCKET (-1) 1224 #define to64(x) strtoll(x, NULL, 10) 1225 #define INT64_FMT PRId64 1226 #define INT64_X_FMT PRIx64 1227 #define SIZE_T_FMT "u" 1233 int inet_pton(
int af,
const char *src,
void *dst);
1234 int inet_aton(
const char *cp,
struct in_addr *inp);
1241 #ifdef MG_MODULE_LINES 1242 #line 1 "common/platforms/platform_nrf51.h" 1260 #ifndef CS_COMMON_PLATFORMS_PLATFORM_NRF51_H_ 1261 #define CS_COMMON_PLATFORMS_PLATFORM_NRF51_H_ 1262 #if CS_PLATFORM == CS_P_NRF51 1266 #include <inttypes.h> 1271 #define to64(x) strtoll(x, NULL, 10) 1273 #define MG_NET_IF MG_NET_IF_LWIP_LOW_LEVEL 1275 #define MG_ENABLE_IPV6 1 1281 #if !defined(__ARMCC_VERSION) 1282 #define LWIP_TIMEVAL_PRIVATE 0 1288 #define INT64_FMT PRId64 1289 #define SIZE_T_FMT "u" 1294 #define CS_ENABLE_STRDUP defined(__ARMCC_VERSION) 1298 #ifdef MG_MODULE_LINES 1299 #line 1 "common/platforms/platform_nrf52.h" 1317 #ifndef CS_COMMON_PLATFORMS_PLATFORM_NRF52_H_ 1318 #define CS_COMMON_PLATFORMS_PLATFORM_NRF52_H_ 1319 #if CS_PLATFORM == CS_P_NRF52 1324 #include <inttypes.h> 1325 #include <stdbool.h> 1330 #define to64(x) strtoll(x, NULL, 10) 1332 #define MG_NET_IF MG_NET_IF_LWIP_LOW_LEVEL 1334 #define MG_ENABLE_IPV6 1 1336 #if !defined(ENOSPC) 1344 #if !defined(__ARMCC_VERSION) 1345 #define LWIP_TIMEVAL_PRIVATE 0 1348 #define INT64_FMT PRId64 1349 #define SIZE_T_FMT "u" 1354 #define CS_ENABLE_STRDUP defined(__ARMCC_VERSION) 1358 #ifdef MG_MODULE_LINES 1359 #line 1 "common/platforms/simplelink/cs_simplelink.h" 1378 #ifndef CS_COMMON_PLATFORMS_SIMPLELINK_CS_SIMPLELINK_H_ 1379 #define CS_COMMON_PLATFORMS_SIMPLELINK_CS_SIMPLELINK_H_ 1381 #if defined(MG_NET_IF) && MG_NET_IF == MG_NET_IF_SIMPLELINK 1384 #if !defined(__SIMPLELINK_H__) 1386 #include <stdbool.h> 1388 #ifndef __TI_COMPILER_VERSION__ 1398 #if CS_PLATFORM == CS_P_CC3220 1399 #include <ti/drivers/net/wifi/porting/user.h> 1400 #include <ti/drivers/net/wifi/simplelink.h> 1401 #include <ti/drivers/net/wifi/sl_socket.h> 1402 #include <ti/drivers/net/wifi/netapp.h> 1406 #define PROVISIONING_API_H_ 1407 #include <simplelink/user.h> 1408 #undef PROVISIONING_API_H_ 1409 #undef SL_INC_STD_BSD_API_NAMING 1411 #include <simplelink/include/simplelink.h> 1412 #include <simplelink/include/netapp.h> 1417 #define AF_INET SL_AF_INET 1419 #define socklen_t SlSocklen_t 1420 #define sockaddr SlSockAddr_t 1421 #define sockaddr_in SlSockAddrIn_t 1422 #define in_addr SlInAddr_t 1424 #define SOCK_STREAM SL_SOCK_STREAM 1425 #define SOCK_DGRAM SL_SOCK_DGRAM 1427 #define htonl sl_Htonl 1428 #define ntohl sl_Ntohl 1429 #define htons sl_Htons 1430 #define ntohs sl_Ntohs 1433 #define EACCES SL_EACCES 1435 #ifndef EAFNOSUPPORT 1436 #define EAFNOSUPPORT SL_EAFNOSUPPORT 1439 #define EAGAIN SL_EAGAIN 1442 #define EBADF SL_EBADF 1445 #define EINVAL SL_EINVAL 1448 #define ENOMEM SL_ENOMEM 1451 #define EWOULDBLOCK SL_EWOULDBLOCK 1462 int inet_pton(
int af,
const char *src,
void *dst);
1485 #if SL_MAJOR_VERSION_NUM < 2 1487 #define SL_ERROR_BSD_EAGAIN SL_EAGAIN 1488 #define SL_ERROR_BSD_EALREADY SL_EALREADY 1489 #define SL_ERROR_BSD_ENOPROTOOPT SL_ENOPROTOOPT 1490 #define SL_ERROR_BSD_ESECDATEERROR SL_ESECDATEERROR 1491 #define SL_ERROR_BSD_ESECSNOVERIFY SL_ESECSNOVERIFY 1492 #define SL_ERROR_FS_FAILED_TO_ALLOCATE_MEM SL_FS_ERR_FAILED_TO_ALLOCATE_MEM 1493 #define SL_ERROR_FS_FILE_HAS_NOT_BEEN_CLOSE_CORRECTLY \ 1494 SL_FS_FILE_HAS_NOT_BEEN_CLOSE_CORRECTLY 1495 #define SL_ERROR_FS_FILE_NAME_EXIST SL_FS_FILE_NAME_EXIST 1496 #define SL_ERROR_FS_FILE_NOT_EXISTS SL_FS_ERR_FILE_NOT_EXISTS 1497 #define SL_ERROR_FS_NO_AVAILABLE_NV_INDEX SL_FS_ERR_NO_AVAILABLE_NV_INDEX 1498 #define SL_ERROR_FS_NOT_ENOUGH_STORAGE_SPACE SL_FS_ERR_NO_AVAILABLE_BLOCKS 1499 #define SL_ERROR_FS_NOT_SUPPORTED SL_FS_ERR_NOT_SUPPORTED 1500 #define SL_ERROR_FS_WRONG_FILE_NAME SL_FS_WRONG_FILE_NAME 1501 #define SL_ERROR_FS_INVALID_HANDLE SL_FS_ERR_INVALID_HANDLE 1502 #define SL_NETCFG_MAC_ADDRESS_GET SL_MAC_ADDRESS_GET 1503 #define SL_SOCKET_FD_ZERO SL_FD_ZERO 1504 #define SL_SOCKET_FD_SET SL_FD_SET 1505 #define SL_SOCKET_FD_ISSET SL_FD_ISSET 1506 #define SL_SO_SECURE_DOMAIN_NAME_VERIFICATION SO_SECURE_DOMAIN_NAME_VERIFICATION 1508 #define SL_FS_READ FS_MODE_OPEN_READ 1509 #define SL_FS_WRITE FS_MODE_OPEN_WRITE 1511 #define SL_FI_FILE_SIZE(fi) ((fi).FileLen) 1512 #define SL_FI_FILE_MAX_SIZE(fi) ((fi).AllocatedLen) 1514 #define SlDeviceVersion_t SlVersionFull 1515 #define sl_DeviceGet sl_DevGet 1516 #define SL_DEVICE_GENERAL SL_DEVICE_GENERAL_CONFIGURATION 1517 #define SL_LEN_TYPE _u8 1518 #define SL_OPT_TYPE _u8 1522 #define FS_MODE_OPEN_CREATE(max_size, flag) \ 1523 (SL_FS_CREATE | SL_FS_CREATE_MAX_SIZE(max_size)) 1524 #define SL_FI_FILE_SIZE(fi) ((fi).Len) 1525 #define SL_FI_FILE_MAX_SIZE(fi) ((fi).MaxSize) 1527 #define SL_LEN_TYPE _u16 1528 #define SL_OPT_TYPE _u16 1537 #ifdef MG_MODULE_LINES 1538 #line 1 "common/platforms/platform_wince.h" 1540 #ifndef CS_COMMON_PLATFORMS_PLATFORM_WINCE_H_ 1541 #define CS_COMMON_PLATFORMS_PLATFORM_WINCE_H_ 1543 #if CS_PLATFORM == CS_P_WINCE 1557 #pragma warning(disable : 4127) 1558 #pragma warning(disable : 4204) 1560 #ifndef _WINSOCK_DEPRECATED_NO_WARNINGS 1561 #define _WINSOCK_DEPRECATED_NO_WARNINGS 1 1564 #ifndef _CRT_SECURE_NO_WARNINGS 1565 #define _CRT_SECURE_NO_WARNINGS 1575 #pragma comment(lib, "ws2.lib") 1577 #include <winsock2.h> 1578 #include <ws2tcpip.h> 1579 #include <windows.h> 1581 #define strdup _strdup 1584 #define EINPROGRESS WSAEINPROGRESS 1588 #define EWOULDBLOCK WSAEWOULDBLOCK 1592 #define EAGAIN EWOULDBLOCK 1597 #define STR(x) STRX(x) 1598 #define __func__ __FILE__ ":" STR(__LINE__) 1601 #define snprintf _snprintf 1602 #define fileno _fileno 1603 #define vsnprintf _vsnprintf 1604 #define sleep(x) Sleep((x) *1000) 1605 #define to64(x) _atoi64(x) 1606 #define rmdir _rmdir 1608 #if defined(_MSC_VER) && _MSC_VER >= 1400 1609 #define fseeko(x, y, z) _fseeki64((x), (y), (z)) 1611 #define fseeko(x, y, z) fseek((x), (y), (z)) 1616 #if _MSC_VER >= 1700 1619 typedef signed char int8_t;
1620 typedef unsigned char uint8_t;
1633 #define UINT16_MAX 65535 1637 #define UINT32_MAX 4294967295 1641 #define pid_t HANDLE 1644 #define INT64_FMT "I64d" 1645 #define INT64_X_FMT "I64x" 1647 #define SIZE_T_FMT "u" 1650 #define CS_DEFINE_DIRENT 1654 #define va_copy __va_copy 1656 #define va_copy(x, y) (x) = (y) 1660 #ifndef MG_MAX_HTTP_REQUEST_SIZE 1661 #define MG_MAX_HTTP_REQUEST_SIZE 8192 1664 #ifndef MG_MAX_HTTP_SEND_MBUF 1665 #define MG_MAX_HTTP_SEND_MBUF 4096 1668 #ifndef MG_MAX_HTTP_HEADERS 1669 #define MG_MAX_HTTP_HEADERS 40 1672 #ifndef CS_ENABLE_STDIO 1673 #define CS_ENABLE_STDIO 1 1676 #define abort() DebugBreak(); 1685 #ifndef MG_ENABLE_THREADS 1686 #define MG_ENABLE_THREADS 0 1689 #ifndef MG_ENABLE_FILESYSTEM 1690 #define MG_ENABLE_FILESYSTEM 1 1694 #define MG_NET_IF MG_NET_IF_SOCKET 1709 #define ENOENT ERROR_PATH_NOT_FOUND 1713 #define EACCES ERROR_ACCESS_DENIED 1717 #define ENOMEM ERROR_NOT_ENOUGH_MEMORY 1720 #ifndef _UINTPTR_T_DEFINED 1728 #define S_ISDIR(x) (((x) &_S_IFDIR) != 0) 1732 #define S_ISREG(x) (((x) &_S_IFREG) != 0) 1735 int open(
const char *filename,
int oflag,
int pmode);
1741 #ifdef MG_MODULE_LINES 1742 #line 1 "common/platforms/platform_nxp_lpc.h" 1761 #ifndef CS_COMMON_PLATFORMS_PLATFORM_NXP_LPC_H_ 1762 #define CS_COMMON_PLATFORMS_PLATFORM_NXP_LPC_H_ 1764 #if CS_PLATFORM == CS_P_NXP_LPC 1770 #define SIZE_T_FMT "u" 1772 #define INT64_FMT "lld" 1773 #define INT64_X_FMT "llx" 1778 #define MG_NET_IF MG_NET_IF_LWIP_LOW_LEVEL 1787 #ifdef __REDLIB_INTERFACE_VERSION__ 1790 #define LWIP_TIMEVAL_PRIVATE 1 1792 #define va_copy(d, s) __builtin_va_copy(d, s) 1794 #define CS_ENABLE_TO64 1 1795 #define to64(x) cs_to64(x) 1797 #define CS_ENABLE_STRDUP 1 1801 #include <sys/time.h> 1802 #define LWIP_TIMEVAL_PRIVATE 0 1803 #define to64(x) strtoll(x, NULL, 10) 1809 #ifdef MG_MODULE_LINES 1810 #line 1 "common/platforms/platform_nxp_kinetis.h" 1829 #ifndef CS_COMMON_PLATFORMS_PLATFORM_NXP_KINETIS_H_ 1830 #define CS_COMMON_PLATFORMS_PLATFORM_NXP_KINETIS_H_ 1832 #if CS_PLATFORM == CS_P_NXP_KINETIS 1835 #include <inttypes.h> 1837 #include <sys/time.h> 1839 #define SIZE_T_FMT "u" 1841 #define to64(x) strtoll(x, NULL, 10) 1842 #define INT64_FMT "lld" 1843 #define INT64_X_FMT "llx" 1848 #define MG_NET_IF MG_NET_IF_LWIP_LOW_LEVEL 1851 #define LWIP_TIMEVAL_PRIVATE 0 1855 #ifdef MG_MODULE_LINES 1856 #line 1 "common/platforms/platform_pic32.h" 1875 #ifndef CS_COMMON_PLATFORMS_PLATFORM_PIC32_H_ 1876 #define CS_COMMON_PLATFORMS_PLATFORM_PIC32_H_ 1878 #if CS_PLATFORM == CS_P_PIC32 1880 #define MG_NET_IF MG_NET_IF_PIC32 1887 #include <system_config.h> 1888 #include <system_definitions.h> 1890 #include <sys/types.h> 1892 typedef TCP_SOCKET
sock_t;
1893 #define to64(x) strtoll(x, NULL, 10) 1895 #define SIZE_T_FMT "lu" 1896 #define INT64_FMT "lld" 1898 #ifndef CS_ENABLE_STDIO 1899 #define CS_ENABLE_STDIO 1 1907 #ifdef MG_MODULE_LINES 1908 #line 1 "common/platforms/platform_stm32.h" 1927 #ifndef CS_COMMON_PLATFORMS_PLATFORM_STM32_H_ 1928 #define CS_COMMON_PLATFORMS_PLATFORM_STM32_H_ 1929 #if CS_PLATFORM == CS_P_STM32 1937 #include <sys/stat.h> 1938 #include <sys/time.h> 1939 #include <sys/types.h> 1943 #include <stm32_sdk_hal.h> 1945 #define to64(x) strtoll(x, NULL, 10) 1946 #define INT64_FMT "lld" 1947 #define SIZE_T_FMT "u" 1951 #ifndef CS_ENABLE_STDIO 1952 #define CS_ENABLE_STDIO 1 1955 #ifndef MG_ENABLE_FILESYSTEM 1956 #define MG_ENABLE_FILESYSTEM 1 1961 #ifdef MG_MODULE_LINES 1962 #line 1 "common/platforms/lwip/mg_lwip.h" 1981 #ifndef CS_COMMON_PLATFORMS_LWIP_MG_LWIP_H_ 1982 #define CS_COMMON_PLATFORMS_LWIP_MG_LWIP_H_ 1999 #if CS_PLATFORM == CS_P_NRF51 || CS_PLATFORM == CS_P_NRF52 2003 #include <lwip/opt.h> 2004 #include <lwip/err.h> 2005 #include <lwip/ip_addr.h> 2006 #include <lwip/inet.h> 2007 #include <lwip/netdb.h> 2008 #include <lwip/dns.h> 2010 #ifndef LWIP_PROVIDE_ERRNO 2015 #include <lwip/sockets.h> 2019 #define LWIP_SOCKET 1 2020 #include <lwip/sockets.h> 2022 #define LWIP_SOCKET 0 2025 #define INVALID_SOCKET (-1) 2026 #define SOMAXCONN 10 2029 #if MG_NET_IF == MG_NET_IF_LWIP_LOW_LEVEL 2033 int interval,
int count);
2038 #define ipX_2_ip(x) (x) 2044 #ifdef MG_MODULE_LINES 2045 #line 1 "common/cs_md5.h" 2064 #ifndef CS_COMMON_MD5_H_ 2065 #define CS_COMMON_MD5_H_ 2069 #ifndef CS_DISABLE_MD5 2070 #define CS_DISABLE_MD5 0 2080 unsigned char in[64];
2092 #ifdef MG_MODULE_LINES 2093 #line 1 "common/cs_sha1.h" 2112 #ifndef CS_COMMON_SHA1_H_ 2113 #define CS_COMMON_SHA1_H_ 2115 #ifndef CS_DISABLE_SHA1 2116 #define CS_DISABLE_SHA1 0 2119 #if !CS_DISABLE_SHA1 2130 unsigned char buffer[64];
2136 void cs_hmac_sha1(
const unsigned char *key,
size_t key_len,
2137 const unsigned char *text,
size_t text_len,
2138 unsigned char out[20]);
2146 #ifdef MG_MODULE_LINES 2147 #line 1 "common/cs_time.h" 2166 #ifndef CS_COMMON_CS_TIME_H_ 2167 #define CS_COMMON_CS_TIME_H_ 2191 #ifdef MG_MODULE_LINES 2192 #line 1 "common/mg_str.h" 2211 #ifndef CS_COMMON_MG_STR_H_ 2212 #define CS_COMMON_MG_STR_H_ 2238 #define MG_MK_STR(str_literal) \ 2239 { str_literal, sizeof(str_literal) - 1 } 2240 #define MG_NULL_STR \ 2292 #ifdef MG_MODULE_LINES 2293 #line 1 "common/mbuf.h" 2319 #ifndef CS_COMMON_MBUF_H_ 2320 #define CS_COMMON_MBUF_H_ 2325 #if defined(__cplusplus) 2329 #ifndef MBUF_SIZE_MULTIPLIER 2330 #define MBUF_SIZE_MULTIPLIER 1.5 2333 #ifndef MBUF_SIZE_MAX_HEADROOM 2335 #define MBUF_SIZE_MAX_HEADROOM BUFSIZ 2337 #define MBUF_SIZE_MAX_HEADROOM 1024 2387 #if defined(__cplusplus) 2392 #ifdef MG_MODULE_LINES 2393 #line 1 "common/cs_base64.h" 2412 #ifndef CS_COMMON_CS_BASE64_H_ 2413 #define CS_COMMON_CS_BASE64_H_ 2415 #ifndef DISABLE_BASE64 2416 #define DISABLE_BASE64 0 2432 unsigned char chunk[3];
2452 int cs_base64_decode(
const unsigned char *s,
int len,
char *dst,
int *dec_len);
2461 #ifdef MG_MODULE_LINES 2462 #line 1 "common/str_util.h" 2481 #ifndef CS_COMMON_STR_UTIL_H_ 2482 #define CS_COMMON_STR_UTIL_H_ 2490 #ifndef CS_ENABLE_STRDUP 2491 #define CS_ENABLE_STRDUP 0 2494 #ifndef CS_ENABLE_TO64 2495 #define CS_ENABLE_TO64 0 2502 #if !defined(_MSC_VER) || _MSC_VER >= 1900 2503 #define CS_STRINGIFY_LIT(...) #__VA_ARGS__ 2505 #define CS_STRINGIFY_LIT(x) #x 2517 #define CS_STRINGIFY_MACRO(x) CS_STRINGIFY_LIT(x) 2526 size_t c_strnlen(
const char *s,
size_t maxlen);
2531 int c_snprintf(
char *buf,
size_t buf_size,
const char *format, ...)
2537 int c_vsnprintf(
char *buf,
size_t buf_size, const
char *format, va_list ap);
2543 const
char *
c_strnstr(const
char *s, const
char *find,
size_t slen);
2550 void cs_to_hex(
char *to, const
unsigned char *p,
size_t len);
2556 void cs_from_hex(
char *to, const
char *p,
size_t len);
2558 #if CS_ENABLE_STRDUP 2562 char *
strdup(
const char *src);
2570 int64_t
cs_to64(
const char *s);
2576 int mg_ncasecmp(
const char *s1,
const char *s2,
size_t len);
2581 int mg_casecmp(
const char *s1,
const char *s2);
2604 int mg_avprintf(
char **buf,
size_t size, const
char *fmt, va_list ap);
2648 size_t mg_match_prefix(const
char *pattern,
int pattern_len, const
char *str);
2660 #ifdef MG_MODULE_LINES 2661 #line 1 "common/queue.h" 2696 #ifndef _SYS_QUEUE_H_ 2697 #define _SYS_QUEUE_H_ 2772 #ifdef QUEUE_MACRO_DEBUG 2781 #define TRACEBUF struct qm_trace trace; 2782 #define TRACEBUF_INITIALIZER { __LINE__, 0, __FILE__, NULL } , 2783 #define TRASHIT(x) do {(x) = (void *)-1;} while (0) 2784 #define QMD_SAVELINK(name, link) void **name = (void *)&(link) 2786 #define QMD_TRACE_HEAD(head) do { \ 2787 (head)->trace.prevline = (head)->trace.lastline; \ 2788 (head)->trace.prevfile = (head)->trace.lastfile; \ 2789 (head)->trace.lastline = __LINE__; \ 2790 (head)->trace.lastfile = __FILE__; \ 2793 #define QMD_TRACE_ELEM(elem) do { \ 2794 (elem)->trace.prevline = (elem)->trace.lastline; \ 2795 (elem)->trace.prevfile = (elem)->trace.lastfile; \ 2796 (elem)->trace.lastline = __LINE__; \ 2797 (elem)->trace.lastfile = __FILE__; \ 2801 #define QMD_TRACE_ELEM(elem) 2802 #define QMD_TRACE_HEAD(head) 2803 #define QMD_SAVELINK(name, link) 2805 #define TRACEBUF_INITIALIZER 2813 #define QUEUE_TYPEOF(type) type 2815 #define QUEUE_TYPEOF(type) struct type 2821 #define SLIST_HEAD(name, type) \ 2823 struct type *slh_first; \ 2826 #define SLIST_CLASS_HEAD(name, type) \ 2828 class type *slh_first; \ 2831 #define SLIST_HEAD_INITIALIZER(head) \ 2834 #define SLIST_ENTRY(type) \ 2836 struct type *sle_next; \ 2839 #define SLIST_CLASS_ENTRY(type) \ 2841 class type *sle_next; \ 2847 #define SLIST_EMPTY(head) ((head)->slh_first == NULL) 2849 #define SLIST_FIRST(head) ((head)->slh_first) 2851 #define SLIST_FOREACH(var, head, field) \ 2852 for ((var) = SLIST_FIRST((head)); \ 2854 (var) = SLIST_NEXT((var), field)) 2856 #define SLIST_FOREACH_FROM(var, head, field) \ 2857 for ((var) = ((var) ? (var) : SLIST_FIRST((head))); \ 2859 (var) = SLIST_NEXT((var), field)) 2861 #define SLIST_FOREACH_SAFE(var, head, field, tvar) \ 2862 for ((var) = SLIST_FIRST((head)); \ 2863 (var) && ((tvar) = SLIST_NEXT((var), field), 1); \ 2866 #define SLIST_FOREACH_FROM_SAFE(var, head, field, tvar) \ 2867 for ((var) = ((var) ? (var) : SLIST_FIRST((head))); \ 2868 (var) && ((tvar) = SLIST_NEXT((var), field), 1); \ 2871 #define SLIST_FOREACH_PREVPTR(var, varp, head, field) \ 2872 for ((varp) = &SLIST_FIRST((head)); \ 2873 ((var) = *(varp)) != NULL; \ 2874 (varp) = &SLIST_NEXT((var), field)) 2876 #define SLIST_INIT(head) do { \ 2877 SLIST_FIRST((head)) = NULL; \ 2880 #define SLIST_INSERT_AFTER(slistelm, elm, field) do { \ 2881 SLIST_NEXT((elm), field) = SLIST_NEXT((slistelm), field); \ 2882 SLIST_NEXT((slistelm), field) = (elm); \ 2885 #define SLIST_INSERT_HEAD(head, elm, field) do { \ 2886 SLIST_NEXT((elm), field) = SLIST_FIRST((head)); \ 2887 SLIST_FIRST((head)) = (elm); \ 2890 #define SLIST_NEXT(elm, field) ((elm)->field.sle_next) 2892 #define SLIST_REMOVE(head, elm, type, field) do { \ 2893 QMD_SAVELINK(oldnext, (elm)->field.sle_next); \ 2894 if (SLIST_FIRST((head)) == (elm)) { \ 2895 SLIST_REMOVE_HEAD((head), field); \ 2898 QUEUE_TYPEOF(type) *curelm = SLIST_FIRST(head); \ 2899 while (SLIST_NEXT(curelm, field) != (elm)) \ 2900 curelm = SLIST_NEXT(curelm, field); \ 2901 SLIST_REMOVE_AFTER(curelm, field); \ 2903 TRASHIT(*oldnext); \ 2906 #define SLIST_REMOVE_AFTER(elm, field) do { \ 2907 SLIST_NEXT(elm, field) = \ 2908 SLIST_NEXT(SLIST_NEXT(elm, field), field); \ 2911 #define SLIST_REMOVE_HEAD(head, field) do { \ 2912 SLIST_FIRST((head)) = SLIST_NEXT(SLIST_FIRST((head)), field); \ 2915 #define SLIST_SWAP(head1, head2, type) do { \ 2916 QUEUE_TYPEOF(type) *swap_first = SLIST_FIRST(head1); \ 2917 SLIST_FIRST(head1) = SLIST_FIRST(head2); \ 2918 SLIST_FIRST(head2) = swap_first; \ 2924 #define STAILQ_HEAD(name, type) \ 2926 struct type *stqh_first; \ 2927 struct type **stqh_last; \ 2930 #define STAILQ_CLASS_HEAD(name, type) \ 2932 class type *stqh_first; \ 2933 class type **stqh_last; \ 2936 #define STAILQ_HEAD_INITIALIZER(head) \ 2937 { NULL, &(head).stqh_first } 2939 #define STAILQ_ENTRY(type) \ 2941 struct type *stqe_next; \ 2944 #define STAILQ_CLASS_ENTRY(type) \ 2946 class type *stqe_next; \ 2952 #define STAILQ_CONCAT(head1, head2) do { \ 2953 if (!STAILQ_EMPTY((head2))) { \ 2954 *(head1)->stqh_last = (head2)->stqh_first; \ 2955 (head1)->stqh_last = (head2)->stqh_last; \ 2956 STAILQ_INIT((head2)); \ 2960 #define STAILQ_EMPTY(head) ((head)->stqh_first == NULL) 2962 #define STAILQ_FIRST(head) ((head)->stqh_first) 2964 #define STAILQ_FOREACH(var, head, field) \ 2965 for((var) = STAILQ_FIRST((head)); \ 2967 (var) = STAILQ_NEXT((var), field)) 2969 #define STAILQ_FOREACH_FROM(var, head, field) \ 2970 for ((var) = ((var) ? (var) : STAILQ_FIRST((head))); \ 2972 (var) = STAILQ_NEXT((var), field)) 2974 #define STAILQ_FOREACH_SAFE(var, head, field, tvar) \ 2975 for ((var) = STAILQ_FIRST((head)); \ 2976 (var) && ((tvar) = STAILQ_NEXT((var), field), 1); \ 2979 #define STAILQ_FOREACH_FROM_SAFE(var, head, field, tvar) \ 2980 for ((var) = ((var) ? (var) : STAILQ_FIRST((head))); \ 2981 (var) && ((tvar) = STAILQ_NEXT((var), field), 1); \ 2984 #define STAILQ_INIT(head) do { \ 2985 STAILQ_FIRST((head)) = NULL; \ 2986 (head)->stqh_last = &STAILQ_FIRST((head)); \ 2989 #define STAILQ_INSERT_AFTER(head, tqelm, elm, field) do { \ 2990 if ((STAILQ_NEXT((elm), field) = STAILQ_NEXT((tqelm), field)) == NULL)\ 2991 (head)->stqh_last = &STAILQ_NEXT((elm), field); \ 2992 STAILQ_NEXT((tqelm), field) = (elm); \ 2995 #define STAILQ_INSERT_HEAD(head, elm, field) do { \ 2996 if ((STAILQ_NEXT((elm), field) = STAILQ_FIRST((head))) == NULL) \ 2997 (head)->stqh_last = &STAILQ_NEXT((elm), field); \ 2998 STAILQ_FIRST((head)) = (elm); \ 3001 #define STAILQ_INSERT_TAIL(head, elm, field) do { \ 3002 STAILQ_NEXT((elm), field) = NULL; \ 3003 *(head)->stqh_last = (elm); \ 3004 (head)->stqh_last = &STAILQ_NEXT((elm), field); \ 3007 #define STAILQ_LAST(head, type, field) \ 3008 (STAILQ_EMPTY((head)) ? NULL : \ 3009 __containerof((head)->stqh_last, \ 3010 QUEUE_TYPEOF(type), field.stqe_next)) 3012 #define STAILQ_NEXT(elm, field) ((elm)->field.stqe_next) 3014 #define STAILQ_REMOVE(head, elm, type, field) do { \ 3015 QMD_SAVELINK(oldnext, (elm)->field.stqe_next); \ 3016 if (STAILQ_FIRST((head)) == (elm)) { \ 3017 STAILQ_REMOVE_HEAD((head), field); \ 3020 QUEUE_TYPEOF(type) *curelm = STAILQ_FIRST(head); \ 3021 while (STAILQ_NEXT(curelm, field) != (elm)) \ 3022 curelm = STAILQ_NEXT(curelm, field); \ 3023 STAILQ_REMOVE_AFTER(head, curelm, field); \ 3025 TRASHIT(*oldnext); \ 3028 #define STAILQ_REMOVE_AFTER(head, elm, field) do { \ 3029 if ((STAILQ_NEXT(elm, field) = \ 3030 STAILQ_NEXT(STAILQ_NEXT(elm, field), field)) == NULL) \ 3031 (head)->stqh_last = &STAILQ_NEXT((elm), field); \ 3034 #define STAILQ_REMOVE_HEAD(head, field) do { \ 3035 if ((STAILQ_FIRST((head)) = \ 3036 STAILQ_NEXT(STAILQ_FIRST((head)), field)) == NULL) \ 3037 (head)->stqh_last = &STAILQ_FIRST((head)); \ 3040 #define STAILQ_SWAP(head1, head2, type) do { \ 3041 QUEUE_TYPEOF(type) *swap_first = STAILQ_FIRST(head1); \ 3042 QUEUE_TYPEOF(type) **swap_last = (head1)->stqh_last; \ 3043 STAILQ_FIRST(head1) = STAILQ_FIRST(head2); \ 3044 (head1)->stqh_last = (head2)->stqh_last; \ 3045 STAILQ_FIRST(head2) = swap_first; \ 3046 (head2)->stqh_last = swap_last; \ 3047 if (STAILQ_EMPTY(head1)) \ 3048 (head1)->stqh_last = &STAILQ_FIRST(head1); \ 3049 if (STAILQ_EMPTY(head2)) \ 3050 (head2)->stqh_last = &STAILQ_FIRST(head2); \ 3057 #define LIST_HEAD(name, type) \ 3059 struct type *lh_first; \ 3062 #define LIST_CLASS_HEAD(name, type) \ 3064 class type *lh_first; \ 3067 #define LIST_HEAD_INITIALIZER(head) \ 3070 #define LIST_ENTRY(type) \ 3072 struct type *le_next; \ 3073 struct type **le_prev; \ 3076 #define LIST_CLASS_ENTRY(type) \ 3078 class type *le_next; \ 3079 class type **le_prev; \ 3086 #if (defined(_KERNEL) && defined(INVARIANTS)) 3087 #define QMD_LIST_CHECK_HEAD(head, field) do { \ 3088 if (LIST_FIRST((head)) != NULL && \ 3089 LIST_FIRST((head))->field.le_prev != \ 3090 &LIST_FIRST((head))) \ 3091 panic("Bad list head %p first->prev != head", (head)); \ 3094 #define QMD_LIST_CHECK_NEXT(elm, field) do { \ 3095 if (LIST_NEXT((elm), field) != NULL && \ 3096 LIST_NEXT((elm), field)->field.le_prev != \ 3097 &((elm)->field.le_next)) \ 3098 panic("Bad link elm %p next->prev != elm", (elm)); \ 3101 #define QMD_LIST_CHECK_PREV(elm, field) do { \ 3102 if (*(elm)->field.le_prev != (elm)) \ 3103 panic("Bad link elm %p prev->next != elm", (elm)); \ 3106 #define QMD_LIST_CHECK_HEAD(head, field) 3107 #define QMD_LIST_CHECK_NEXT(elm, field) 3108 #define QMD_LIST_CHECK_PREV(elm, field) 3111 #define LIST_EMPTY(head) ((head)->lh_first == NULL) 3113 #define LIST_FIRST(head) ((head)->lh_first) 3115 #define LIST_FOREACH(var, head, field) \ 3116 for ((var) = LIST_FIRST((head)); \ 3118 (var) = LIST_NEXT((var), field)) 3120 #define LIST_FOREACH_FROM(var, head, field) \ 3121 for ((var) = ((var) ? (var) : LIST_FIRST((head))); \ 3123 (var) = LIST_NEXT((var), field)) 3125 #define LIST_FOREACH_SAFE(var, head, field, tvar) \ 3126 for ((var) = LIST_FIRST((head)); \ 3127 (var) && ((tvar) = LIST_NEXT((var), field), 1); \ 3130 #define LIST_FOREACH_FROM_SAFE(var, head, field, tvar) \ 3131 for ((var) = ((var) ? (var) : LIST_FIRST((head))); \ 3132 (var) && ((tvar) = LIST_NEXT((var), field), 1); \ 3135 #define LIST_INIT(head) do { \ 3136 LIST_FIRST((head)) = NULL; \ 3139 #define LIST_INSERT_AFTER(listelm, elm, field) do { \ 3140 QMD_LIST_CHECK_NEXT(listelm, field); \ 3141 if ((LIST_NEXT((elm), field) = LIST_NEXT((listelm), field)) != NULL)\ 3142 LIST_NEXT((listelm), field)->field.le_prev = \ 3143 &LIST_NEXT((elm), field); \ 3144 LIST_NEXT((listelm), field) = (elm); \ 3145 (elm)->field.le_prev = &LIST_NEXT((listelm), field); \ 3148 #define LIST_INSERT_BEFORE(listelm, elm, field) do { \ 3149 QMD_LIST_CHECK_PREV(listelm, field); \ 3150 (elm)->field.le_prev = (listelm)->field.le_prev; \ 3151 LIST_NEXT((elm), field) = (listelm); \ 3152 *(listelm)->field.le_prev = (elm); \ 3153 (listelm)->field.le_prev = &LIST_NEXT((elm), field); \ 3156 #define LIST_INSERT_HEAD(head, elm, field) do { \ 3157 QMD_LIST_CHECK_HEAD((head), field); \ 3158 if ((LIST_NEXT((elm), field) = LIST_FIRST((head))) != NULL) \ 3159 LIST_FIRST((head))->field.le_prev = &LIST_NEXT((elm), field);\ 3160 LIST_FIRST((head)) = (elm); \ 3161 (elm)->field.le_prev = &LIST_FIRST((head)); \ 3164 #define LIST_NEXT(elm, field) ((elm)->field.le_next) 3166 #define LIST_PREV(elm, head, type, field) \ 3167 ((elm)->field.le_prev == &LIST_FIRST((head)) ? NULL : \ 3168 __containerof((elm)->field.le_prev, \ 3169 QUEUE_TYPEOF(type), field.le_next)) 3171 #define LIST_REMOVE(elm, field) do { \ 3172 QMD_SAVELINK(oldnext, (elm)->field.le_next); \ 3173 QMD_SAVELINK(oldprev, (elm)->field.le_prev); \ 3174 QMD_LIST_CHECK_NEXT(elm, field); \ 3175 QMD_LIST_CHECK_PREV(elm, field); \ 3176 if (LIST_NEXT((elm), field) != NULL) \ 3177 LIST_NEXT((elm), field)->field.le_prev = \ 3178 (elm)->field.le_prev; \ 3179 *(elm)->field.le_prev = LIST_NEXT((elm), field); \ 3180 TRASHIT(*oldnext); \ 3181 TRASHIT(*oldprev); \ 3184 #define LIST_SWAP(head1, head2, type, field) do { \ 3185 QUEUE_TYPEOF(type) *swap_tmp = LIST_FIRST(head1); \ 3186 LIST_FIRST((head1)) = LIST_FIRST((head2)); \ 3187 LIST_FIRST((head2)) = swap_tmp; \ 3188 if ((swap_tmp = LIST_FIRST((head1))) != NULL) \ 3189 swap_tmp->field.le_prev = &LIST_FIRST((head1)); \ 3190 if ((swap_tmp = LIST_FIRST((head2))) != NULL) \ 3191 swap_tmp->field.le_prev = &LIST_FIRST((head2)); \ 3197 #define TAILQ_HEAD(name, type) \ 3199 struct type *tqh_first; \ 3200 struct type **tqh_last; \ 3204 #define TAILQ_CLASS_HEAD(name, type) \ 3206 class type *tqh_first; \ 3207 class type **tqh_last; \ 3211 #define TAILQ_HEAD_INITIALIZER(head) \ 3212 { NULL, &(head).tqh_first, TRACEBUF_INITIALIZER } 3214 #define TAILQ_ENTRY(type) \ 3216 struct type *tqe_next; \ 3217 struct type **tqe_prev; \ 3221 #define TAILQ_CLASS_ENTRY(type) \ 3223 class type *tqe_next; \ 3224 class type **tqe_prev; \ 3231 #if (defined(_KERNEL) && defined(INVARIANTS)) 3232 #define QMD_TAILQ_CHECK_HEAD(head, field) do { \ 3233 if (!TAILQ_EMPTY(head) && \ 3234 TAILQ_FIRST((head))->field.tqe_prev != \ 3235 &TAILQ_FIRST((head))) \ 3236 panic("Bad tailq head %p first->prev != head", (head)); \ 3239 #define QMD_TAILQ_CHECK_TAIL(head, field) do { \ 3240 if (*(head)->tqh_last != NULL) \ 3241 panic("Bad tailq NEXT(%p->tqh_last) != NULL", (head)); \ 3244 #define QMD_TAILQ_CHECK_NEXT(elm, field) do { \ 3245 if (TAILQ_NEXT((elm), field) != NULL && \ 3246 TAILQ_NEXT((elm), field)->field.tqe_prev != \ 3247 &((elm)->field.tqe_next)) \ 3248 panic("Bad link elm %p next->prev != elm", (elm)); \ 3251 #define QMD_TAILQ_CHECK_PREV(elm, field) do { \ 3252 if (*(elm)->field.tqe_prev != (elm)) \ 3253 panic("Bad link elm %p prev->next != elm", (elm)); \ 3256 #define QMD_TAILQ_CHECK_HEAD(head, field) 3257 #define QMD_TAILQ_CHECK_TAIL(head, headname) 3258 #define QMD_TAILQ_CHECK_NEXT(elm, field) 3259 #define QMD_TAILQ_CHECK_PREV(elm, field) 3262 #define TAILQ_CONCAT(head1, head2, field) do { \ 3263 if (!TAILQ_EMPTY(head2)) { \ 3264 *(head1)->tqh_last = (head2)->tqh_first; \ 3265 (head2)->tqh_first->field.tqe_prev = (head1)->tqh_last; \ 3266 (head1)->tqh_last = (head2)->tqh_last; \ 3267 TAILQ_INIT((head2)); \ 3268 QMD_TRACE_HEAD(head1); \ 3269 QMD_TRACE_HEAD(head2); \ 3273 #define TAILQ_EMPTY(head) ((head)->tqh_first == NULL) 3275 #define TAILQ_FIRST(head) ((head)->tqh_first) 3277 #define TAILQ_FOREACH(var, head, field) \ 3278 for ((var) = TAILQ_FIRST((head)); \ 3280 (var) = TAILQ_NEXT((var), field)) 3282 #define TAILQ_FOREACH_FROM(var, head, field) \ 3283 for ((var) = ((var) ? (var) : TAILQ_FIRST((head))); \ 3285 (var) = TAILQ_NEXT((var), field)) 3287 #define TAILQ_FOREACH_SAFE(var, head, field, tvar) \ 3288 for ((var) = TAILQ_FIRST((head)); \ 3289 (var) && ((tvar) = TAILQ_NEXT((var), field), 1); \ 3292 #define TAILQ_FOREACH_FROM_SAFE(var, head, field, tvar) \ 3293 for ((var) = ((var) ? (var) : TAILQ_FIRST((head))); \ 3294 (var) && ((tvar) = TAILQ_NEXT((var), field), 1); \ 3297 #define TAILQ_FOREACH_REVERSE(var, head, headname, field) \ 3298 for ((var) = TAILQ_LAST((head), headname); \ 3300 (var) = TAILQ_PREV((var), headname, field)) 3302 #define TAILQ_FOREACH_REVERSE_FROM(var, head, headname, field) \ 3303 for ((var) = ((var) ? (var) : TAILQ_LAST((head), headname)); \ 3305 (var) = TAILQ_PREV((var), headname, field)) 3307 #define TAILQ_FOREACH_REVERSE_SAFE(var, head, headname, field, tvar) \ 3308 for ((var) = TAILQ_LAST((head), headname); \ 3309 (var) && ((tvar) = TAILQ_PREV((var), headname, field), 1); \ 3312 #define TAILQ_FOREACH_REVERSE_FROM_SAFE(var, head, headname, field, tvar) \ 3313 for ((var) = ((var) ? (var) : TAILQ_LAST((head), headname)); \ 3314 (var) && ((tvar) = TAILQ_PREV((var), headname, field), 1); \ 3317 #define TAILQ_INIT(head) do { \ 3318 TAILQ_FIRST((head)) = NULL; \ 3319 (head)->tqh_last = &TAILQ_FIRST((head)); \ 3320 QMD_TRACE_HEAD(head); \ 3323 #define TAILQ_INSERT_AFTER(head, listelm, elm, field) do { \ 3324 QMD_TAILQ_CHECK_NEXT(listelm, field); \ 3325 if ((TAILQ_NEXT((elm), field) = TAILQ_NEXT((listelm), field)) != NULL)\ 3326 TAILQ_NEXT((elm), field)->field.tqe_prev = \ 3327 &TAILQ_NEXT((elm), field); \ 3329 (head)->tqh_last = &TAILQ_NEXT((elm), field); \ 3330 QMD_TRACE_HEAD(head); \ 3332 TAILQ_NEXT((listelm), field) = (elm); \ 3333 (elm)->field.tqe_prev = &TAILQ_NEXT((listelm), field); \ 3334 QMD_TRACE_ELEM(&(elm)->field); \ 3335 QMD_TRACE_ELEM(&(listelm)->field); \ 3338 #define TAILQ_INSERT_BEFORE(listelm, elm, field) do { \ 3339 QMD_TAILQ_CHECK_PREV(listelm, field); \ 3340 (elm)->field.tqe_prev = (listelm)->field.tqe_prev; \ 3341 TAILQ_NEXT((elm), field) = (listelm); \ 3342 *(listelm)->field.tqe_prev = (elm); \ 3343 (listelm)->field.tqe_prev = &TAILQ_NEXT((elm), field); \ 3344 QMD_TRACE_ELEM(&(elm)->field); \ 3345 QMD_TRACE_ELEM(&(listelm)->field); \ 3348 #define TAILQ_INSERT_HEAD(head, elm, field) do { \ 3349 QMD_TAILQ_CHECK_HEAD(head, field); \ 3350 if ((TAILQ_NEXT((elm), field) = TAILQ_FIRST((head))) != NULL) \ 3351 TAILQ_FIRST((head))->field.tqe_prev = \ 3352 &TAILQ_NEXT((elm), field); \ 3354 (head)->tqh_last = &TAILQ_NEXT((elm), field); \ 3355 TAILQ_FIRST((head)) = (elm); \ 3356 (elm)->field.tqe_prev = &TAILQ_FIRST((head)); \ 3357 QMD_TRACE_HEAD(head); \ 3358 QMD_TRACE_ELEM(&(elm)->field); \ 3361 #define TAILQ_INSERT_TAIL(head, elm, field) do { \ 3362 QMD_TAILQ_CHECK_TAIL(head, field); \ 3363 TAILQ_NEXT((elm), field) = NULL; \ 3364 (elm)->field.tqe_prev = (head)->tqh_last; \ 3365 *(head)->tqh_last = (elm); \ 3366 (head)->tqh_last = &TAILQ_NEXT((elm), field); \ 3367 QMD_TRACE_HEAD(head); \ 3368 QMD_TRACE_ELEM(&(elm)->field); \ 3371 #define TAILQ_LAST(head, headname) \ 3372 (*(((struct headname *)((head)->tqh_last))->tqh_last)) 3374 #define TAILQ_NEXT(elm, field) ((elm)->field.tqe_next) 3376 #define TAILQ_PREV(elm, headname, field) \ 3377 (*(((struct headname *)((elm)->field.tqe_prev))->tqh_last)) 3379 #define TAILQ_REMOVE(head, elm, field) do { \ 3380 QMD_SAVELINK(oldnext, (elm)->field.tqe_next); \ 3381 QMD_SAVELINK(oldprev, (elm)->field.tqe_prev); \ 3382 QMD_TAILQ_CHECK_NEXT(elm, field); \ 3383 QMD_TAILQ_CHECK_PREV(elm, field); \ 3384 if ((TAILQ_NEXT((elm), field)) != NULL) \ 3385 TAILQ_NEXT((elm), field)->field.tqe_prev = \ 3386 (elm)->field.tqe_prev; \ 3388 (head)->tqh_last = (elm)->field.tqe_prev; \ 3389 QMD_TRACE_HEAD(head); \ 3391 *(elm)->field.tqe_prev = TAILQ_NEXT((elm), field); \ 3392 TRASHIT(*oldnext); \ 3393 TRASHIT(*oldprev); \ 3394 QMD_TRACE_ELEM(&(elm)->field); \ 3397 #define TAILQ_SWAP(head1, head2, type, field) do { \ 3398 QUEUE_TYPEOF(type) *swap_first = (head1)->tqh_first; \ 3399 QUEUE_TYPEOF(type) **swap_last = (head1)->tqh_last; \ 3400 (head1)->tqh_first = (head2)->tqh_first; \ 3401 (head1)->tqh_last = (head2)->tqh_last; \ 3402 (head2)->tqh_first = swap_first; \ 3403 (head2)->tqh_last = swap_last; \ 3404 if ((swap_first = (head1)->tqh_first) != NULL) \ 3405 swap_first->field.tqe_prev = &(head1)->tqh_first; \ 3407 (head1)->tqh_last = &(head1)->tqh_first; \ 3408 if ((swap_first = (head2)->tqh_first) != NULL) \ 3409 swap_first->field.tqe_prev = &(head2)->tqh_first; \ 3411 (head2)->tqh_last = &(head2)->tqh_first; \ 3415 #ifdef MG_MODULE_LINES 3416 #line 1 "mongoose/src/mg_features.h" 3423 #ifndef CS_MONGOOSE_SRC_FEATURES_H_ 3424 #define CS_MONGOOSE_SRC_FEATURES_H_ 3426 #ifndef MG_DISABLE_HTTP_DIGEST_AUTH 3427 #define MG_DISABLE_HTTP_DIGEST_AUTH 0 3430 #ifndef MG_DISABLE_HTTP_KEEP_ALIVE 3431 #define MG_DISABLE_HTTP_KEEP_ALIVE 0 3434 #ifndef MG_DISABLE_PFS 3435 #define MG_DISABLE_PFS 0 3438 #ifndef MG_DISABLE_WS_RANDOM_MASK 3439 #define MG_DISABLE_WS_RANDOM_MASK 0 3442 #ifndef MG_ENABLE_ASYNC_RESOLVER 3443 #define MG_ENABLE_ASYNC_RESOLVER 1 3446 #ifndef MG_ENABLE_BROADCAST 3447 #define MG_ENABLE_BROADCAST 0 3450 #ifndef MG_ENABLE_COAP 3451 #define MG_ENABLE_COAP 0 3454 #ifndef MG_ENABLE_DEBUG 3455 #define MG_ENABLE_DEBUG 0 3458 #ifndef MG_ENABLE_DIRECTORY_LISTING 3459 #define MG_ENABLE_DIRECTORY_LISTING 0 3462 #ifndef MG_ENABLE_DNS 3463 #define MG_ENABLE_DNS 1 3466 #ifndef MG_ENABLE_DNS_SERVER 3467 #define MG_ENABLE_DNS_SERVER 0 3470 #ifndef MG_ENABLE_FAKE_DAVLOCK 3471 #define MG_ENABLE_FAKE_DAVLOCK 0 3474 #ifndef MG_ENABLE_FILESYSTEM 3475 #define MG_ENABLE_FILESYSTEM 0 3478 #ifndef MG_ENABLE_GETADDRINFO 3479 #define MG_ENABLE_GETADDRINFO 0 3482 #ifndef MG_ENABLE_HEXDUMP 3483 #define MG_ENABLE_HEXDUMP CS_ENABLE_STDIO 3486 #ifndef MG_ENABLE_HTTP 3487 #define MG_ENABLE_HTTP 1 3490 #ifndef MG_ENABLE_HTTP_CGI 3491 #define MG_ENABLE_HTTP_CGI 0 3494 #ifndef MG_ENABLE_HTTP_SSI 3495 #define MG_ENABLE_HTTP_SSI MG_ENABLE_FILESYSTEM 3498 #ifndef MG_ENABLE_HTTP_SSI_EXEC 3499 #define MG_ENABLE_HTTP_SSI_EXEC 0 3502 #ifndef MG_ENABLE_HTTP_STREAMING_MULTIPART 3503 #define MG_ENABLE_HTTP_STREAMING_MULTIPART 0 3506 #ifndef MG_ENABLE_HTTP_WEBDAV 3507 #define MG_ENABLE_HTTP_WEBDAV 0 3510 #ifndef MG_ENABLE_HTTP_WEBSOCKET 3511 #define MG_ENABLE_HTTP_WEBSOCKET MG_ENABLE_HTTP 3514 #ifndef MG_ENABLE_IPV6 3515 #define MG_ENABLE_IPV6 0 3518 #ifndef MG_ENABLE_MQTT 3519 #define MG_ENABLE_MQTT 1 3522 #ifndef MG_ENABLE_SOCKS 3523 #define MG_ENABLE_SOCKS 0 3526 #ifndef MG_ENABLE_MQTT_BROKER 3527 #define MG_ENABLE_MQTT_BROKER 0 3530 #ifndef MG_ENABLE_SSL 3531 #define MG_ENABLE_SSL 0 3534 #ifndef MG_ENABLE_SYNC_RESOLVER 3535 #define MG_ENABLE_SYNC_RESOLVER 0 3538 #ifndef MG_ENABLE_STDIO 3539 #define MG_ENABLE_STDIO CS_ENABLE_STDIO 3543 #define MG_NET_IF MG_NET_IF_SOCKET 3547 #define MG_SSL_IF MG_SSL_IF_OPENSSL 3550 #ifndef MG_ENABLE_THREADS 3552 #define MG_ENABLE_THREADS 1 3554 #define MG_ENABLE_THREADS 0 3558 #if MG_ENABLE_DEBUG && !defined(CS_ENABLE_DEBUG) 3559 #define CS_ENABLE_DEBUG 1 3563 #if MG_ENABLE_MQTT_BROKER && !MG_ENABLE_MQTT 3564 #undef MG_ENABLE_MQTT 3565 #define MG_ENABLE_MQTT 1 3568 #ifndef MG_ENABLE_HTTP_URL_REWRITES 3569 #define MG_ENABLE_HTTP_URL_REWRITES \ 3570 (CS_PLATFORM == CS_P_WINDOWS || CS_PLATFORM == CS_P_UNIX) 3573 #ifndef MG_ENABLE_SNTP 3574 #define MG_ENABLE_SNTP 0 3577 #ifndef MG_ENABLE_EXTRA_ERRORS_DESC 3578 #define MG_ENABLE_EXTRA_ERRORS_DESC 0 3581 #ifndef MG_ENABLE_CALLBACK_USERDATA 3582 #define MG_ENABLE_CALLBACK_USERDATA 0 3585 #if MG_ENABLE_CALLBACK_USERDATA 3586 #define MG_UD_ARG(ud) , ud 3587 #define MG_CB(cb, ud) cb, ud 3589 #define MG_UD_ARG(ud) 3590 #define MG_CB(cb, ud) cb 3594 #ifdef MG_MODULE_LINES 3595 #line 1 "mongoose/src/mg_net_if.h" 3602 #ifndef CS_MONGOOSE_SRC_NET_IF_H_ 3603 #define CS_MONGOOSE_SRC_NET_IF_H_ 3621 #define MG_MAIN_IFACE 0 3640 time_t (*poll)(
struct mg_iface *iface,
int timeout_ms);
3728 #ifdef MG_MODULE_LINES 3729 #line 1 "mongoose/src/mg_ssl_if.h" 3736 #ifndef CS_MONGOOSE_SRC_SSL_IF_H_ 3737 #define CS_MONGOOSE_SRC_SSL_IF_H_ 3769 const char **err_msg);
3786 #ifdef MG_MODULE_LINES 3787 #line 1 "mongoose/src/mg_net.h" 3816 #ifndef CS_MONGOOSE_SRC_NET_H_ 3817 #define CS_MONGOOSE_SRC_NET_H_ 3823 #ifndef MG_VPRINTF_BUFFER_SIZE 3824 #define MG_VPRINTF_BUFFER_SIZE 100 3827 #ifdef MG_USE_READ_WRITE 3828 #define MG_RECV_FUNC(s, b, l, f) read(s, b, l) 3829 #define MG_SEND_FUNC(s, b, l, f) write(s, b, l) 3831 #define MG_RECV_FUNC(s, b, l, f) recv(s, b, l, f) 3832 #define MG_SEND_FUNC(s, b, l, f) send(s, b, l, f) 3841 struct sockaddr_in sin;
3843 struct sockaddr_in6 sin6;
3845 struct sockaddr sin6;
3856 void *ev_data MG_UD_ARG(
void *
user_data));
3859 #define MG_EV_POLL 0 3860 #define MG_EV_ACCEPT 1 3861 #define MG_EV_CONNECT 2 3862 #define MG_EV_RECV 3 3863 #define MG_EV_SEND 4 3864 #define MG_EV_CLOSE 5 3865 #define MG_EV_TIMER 6 3872 #if MG_ENABLE_HEXDUMP 3875 #if MG_ENABLE_BROADCAST 3906 void (*proto_data_destructor)(
void *proto_data);
3922 #define MG_F_LISTENING (1 << 0) 3923 #define MG_F_UDP (1 << 1) 3924 #define MG_F_RESOLVING (1 << 2) 3925 #define MG_F_CONNECTING (1 << 3) 3926 #define MG_F_SSL (1 << 4) 3927 #define MG_F_SSL_HANDSHAKE_DONE (1 << 5) 3928 #define MG_F_WANT_READ (1 << 6) 3929 #define MG_F_WANT_WRITE (1 << 7) 3930 #define MG_F_IS_WEBSOCKET (1 << 8) 3933 #define MG_F_SEND_AND_CLOSE (1 << 10) 3934 #define MG_F_CLOSE_IMMEDIATELY (1 << 11) 3935 #define MG_F_WEBSOCKET_NO_DEFRAG (1 << 12) 3936 #define MG_F_DELETE_CHUNK (1 << 13) 3937 #define MG_F_ENABLE_BROADCAST (1 << 14) 3939 #define MG_F_USER_1 (1 << 20) 3940 #define MG_F_USER_2 (1 << 21) 3941 #define MG_F_USER_3 (1 << 22) 3942 #define MG_F_USER_4 (1 << 23) 3943 #define MG_F_USER_5 (1 << 24) 3944 #define MG_F_USER_6 (1 << 25) 4005 #if MG_ENABLE_BROADCAST 4258 #if MG_ENABLE_SSL && MG_NET_IF != MG_NET_IF_SIMPLELINK 4274 const char *ca_cert);
4287 #if defined(__GNUC__) 4309 #if MG_ENABLE_SYNC_RESOLVER 4320 int mg_resolve(
const char *domain_name,
char *ip_addr_buf,
size_t buf_len);
4381 #ifdef MG_MODULE_LINES 4382 #line 1 "mongoose/src/mg_uri.h" 4393 #ifndef CS_MONGOOSE_SRC_URI_H_ 4394 #define CS_MONGOOSE_SRC_URI_H_ 4427 unsigned int *port,
struct mg_str *path,
struct mg_str *query,
4428 struct mg_str *fragment);
4440 const struct mg_str *host,
unsigned int port,
4442 const struct mg_str *fragment,
int normalize_path,
4451 #ifdef MG_MODULE_LINES 4452 #line 1 "mongoose/src/mg_util.h" 4463 #ifndef CS_MONGOOSE_SRC_UTIL_H_ 4464 #define CS_MONGOOSE_SRC_UTIL_H_ 4477 #define MG_MAX_PATH PATH_MAX 4479 #define MG_MAX_PATH 256 4492 const char *
mg_skip(
const char *s,
const char *end_string,
4493 const char *delimiters,
struct mg_str *
v);
4514 #if MG_ENABLE_FILESYSTEM 4531 FILE *
mg_fopen(
const char *path,
const char *mode);
4540 int mg_open(
const char *path,
int flag,
int mode);
4547 size_t mg_fread(
void *ptr,
size_t size,
size_t count, FILE *
f);
4554 size_t mg_fwrite(
const void *ptr,
size_t size,
size_t count, FILE *
f);
4558 #if MG_ENABLE_THREADS 4565 void *
mg_start_thread(
void *(*thread_func)(
void *),
void *thread_func_param);
4570 #define MG_SOCK_STRINGIFY_IP 1 4571 #define MG_SOCK_STRINGIFY_PORT 2 4572 #define MG_SOCK_STRINGIFY_REMOTE 4 4589 #if MG_NET_IF == MG_NET_IF_SOCKET 4602 #if MG_ENABLE_HEXDUMP 4611 int mg_hexdump(
const void *buf,
int len,
char *dst,
int dst_len);
4614 void mg_hexdumpf(FILE *fp,
const void *buf,
int len);
4624 const void *buf,
int num_bytes,
int ev);
4657 #define MG_URL_ENCODE_F_SPACE_AS_PLUS (1 << 0) 4658 #define MG_URL_ENCODE_F_UPPERCASE_HEX (1 << 1) 4660 const struct
mg_str safe, unsigned int flags);
4669 #ifdef MG_MODULE_LINES 4670 #line 1 "mongoose/src/mg_http.h" 4681 #ifndef CS_MONGOOSE_SRC_HTTP_H_ 4682 #define CS_MONGOOSE_SRC_HTTP_H_ 4693 #ifndef MG_MAX_HTTP_HEADERS 4694 #define MG_MAX_HTTP_HEADERS 20 4697 #ifndef MG_MAX_HTTP_REQUEST_SIZE 4698 #define MG_MAX_HTTP_REQUEST_SIZE 1024 4701 #ifndef MG_MAX_HTTP_SEND_MBUF 4702 #define MG_MAX_HTTP_SEND_MBUF 1024 4705 #ifndef MG_CGI_ENVIRONMENT_SIZE 4706 #define MG_CGI_ENVIRONMENT_SIZE 8192 4734 struct mg_str header_names[MG_MAX_HTTP_HEADERS];
4735 struct mg_str header_values[MG_MAX_HTTP_HEADERS];
4738 #if MG_ENABLE_HTTP_WEBSOCKET 4764 #define MG_EV_HTTP_REQUEST 100 4765 #define MG_EV_HTTP_REPLY 101 4766 #define MG_EV_HTTP_CHUNK 102 4767 #define MG_EV_SSI_CALL 105 4768 #define MG_EV_SSI_CALL_CTX 106 4770 #if MG_ENABLE_HTTP_WEBSOCKET 4771 #define MG_EV_WEBSOCKET_HANDSHAKE_REQUEST 111 4772 #define MG_EV_WEBSOCKET_HANDSHAKE_DONE 112 4773 #define MG_EV_WEBSOCKET_FRAME 113 4774 #define MG_EV_WEBSOCKET_CONTROL_FRAME 114 4777 #if MG_ENABLE_HTTP_STREAMING_MULTIPART 4778 #define MG_EV_HTTP_MULTIPART_REQUEST 121 4779 #define MG_EV_HTTP_PART_BEGIN 122 4780 #define MG_EV_HTTP_PART_DATA 123 4781 #define MG_EV_HTTP_PART_END 124 4783 #define MG_EV_HTTP_MULTIPART_REQUEST_END 125 4840 #if MG_ENABLE_HTTP_WEBSOCKET 4856 const char *extra_headers);
4869 const char *host,
const char *protocol,
4870 const char *extra_headers);
4874 const char *host,
const char *protocol,
4875 const char *extra_headers,
const char *user,
4881 const struct mg_str path,
4882 const struct mg_str host,
4883 const struct mg_str protocol,
4884 const struct mg_str extra_headers,
4885 const struct mg_str user,
4886 const struct mg_str pass);
4911 const char *url,
const char *protocol,
4912 const char *extra_headers);
4923 const char *extra_headers);
4944 const void *
data,
size_t data_len);
4951 const struct mg_str *strings,
int num_strings);
4960 const char *
fmt, ...);
4963 #define WEBSOCKET_OP_CONTINUE 0 4964 #define WEBSOCKET_OP_TEXT 1 4965 #define WEBSOCKET_OP_BINARY 2 4966 #define WEBSOCKET_OP_CLOSE 8 4967 #define WEBSOCKET_OP_PING 9 4968 #define WEBSOCKET_OP_PONG 10 4982 #define WEBSOCKET_DONT_FIN 0x100 4997 int mg_url_decode(
const char *src,
int src_len,
char *dst,
int dst_len,
4998 int is_form_url_encoded);
5000 extern void mg_hash_md5_v(
size_t num_msgs,
const uint8_t *msgs[],
5001 const size_t *msg_lens, uint8_t *digest);
5002 extern void mg_hash_sha1_v(
size_t num_msgs,
const uint8_t *msgs[],
5003 const size_t *msg_lens, uint8_t *digest);
5008 #define MG_AUTH_FLAG_IS_DIRECTORY (1 << 0) 5009 #define MG_AUTH_FLAG_IS_GLOBAL_PASS_FILE (1 << 1) 5010 #define MG_AUTH_FLAG_ALLOW_MISSING_FILE (1 << 2) 5020 const char *domain,
const char *passwords_file,
5027 const char *domain);
5036 #ifdef MG_MODULE_LINES 5037 #line 1 "mongoose/src/mg_http_server.h" 5043 #ifndef CS_MONGOOSE_SRC_HTTP_SERVER_H_ 5044 #define CS_MONGOOSE_SRC_HTTP_SERVER_H_ 5116 char *pass,
size_t pass_len);
5124 char *pass,
size_t pass_len);
5163 size_t var_name_len,
char *file_name,
5164 size_t file_name_len,
const char **chunk,
5179 #if MG_ENABLE_FILESYSTEM 5281 #if MG_ENABLE_HTTP_URL_REWRITES 5384 const struct mg_str extra_headers);
5386 #if MG_ENABLE_HTTP_STREAMING_MULTIPART 5426 MG_UD_ARG(
void *user_data));
5469 const char *uri_path,
5490 struct mg_str auth_domain, FILE *fp);
5532 const char *extra_headers);
5552 const struct mg_str location,
5553 const struct mg_str extra_headers);
5570 int64_t content_length,
const char *extra_headers);
5577 #if MG_ENABLE_HTTP_URL_REWRITES 5600 #ifdef MG_MODULE_LINES 5601 #line 1 "mongoose/src/mg_http_client.h" 5607 #ifndef CS_MONGOOSE_SRC_HTTP_CLIENT_H_ 5608 #define CS_MONGOOSE_SRC_HTTP_CLIENT_H_ 5641 const char *extra_headers,
const char *post_data);
5652 struct mg_connect_opts opts,
const char *url,
const char *extra_headers,
5653 const char *post_data);
5657 const char *method,
const char *uri,
5658 const char *auth_domain,
const char *user,
5659 const char *passwd,
const char *nonce);
5665 #ifdef MG_MODULE_LINES 5666 #line 1 "mongoose/src/mg_mqtt.h" 5689 #ifndef CS_MONGOOSE_SRC_MQTT_H_ 5690 #define CS_MONGOOSE_SRC_MQTT_H_ 5737 #define MG_MQTT_CMD_CONNECT 1 5738 #define MG_MQTT_CMD_CONNACK 2 5739 #define MG_MQTT_CMD_PUBLISH 3 5740 #define MG_MQTT_CMD_PUBACK 4 5741 #define MG_MQTT_CMD_PUBREC 5 5742 #define MG_MQTT_CMD_PUBREL 6 5743 #define MG_MQTT_CMD_PUBCOMP 7 5744 #define MG_MQTT_CMD_SUBSCRIBE 8 5745 #define MG_MQTT_CMD_SUBACK 9 5746 #define MG_MQTT_CMD_UNSUBSCRIBE 10 5747 #define MG_MQTT_CMD_UNSUBACK 11 5748 #define MG_MQTT_CMD_PINGREQ 12 5749 #define MG_MQTT_CMD_PINGRESP 13 5750 #define MG_MQTT_CMD_DISCONNECT 14 5753 #define MG_MQTT_EVENT_BASE 200 5754 #define MG_EV_MQTT_CONNECT (MG_MQTT_EVENT_BASE + MG_MQTT_CMD_CONNECT) 5755 #define MG_EV_MQTT_CONNACK (MG_MQTT_EVENT_BASE + MG_MQTT_CMD_CONNACK) 5756 #define MG_EV_MQTT_PUBLISH (MG_MQTT_EVENT_BASE + MG_MQTT_CMD_PUBLISH) 5757 #define MG_EV_MQTT_PUBACK (MG_MQTT_EVENT_BASE + MG_MQTT_CMD_PUBACK) 5758 #define MG_EV_MQTT_PUBREC (MG_MQTT_EVENT_BASE + MG_MQTT_CMD_PUBREC) 5759 #define MG_EV_MQTT_PUBREL (MG_MQTT_EVENT_BASE + MG_MQTT_CMD_PUBREL) 5760 #define MG_EV_MQTT_PUBCOMP (MG_MQTT_EVENT_BASE + MG_MQTT_CMD_PUBCOMP) 5761 #define MG_EV_MQTT_SUBSCRIBE (MG_MQTT_EVENT_BASE + MG_MQTT_CMD_SUBSCRIBE) 5762 #define MG_EV_MQTT_SUBACK (MG_MQTT_EVENT_BASE + MG_MQTT_CMD_SUBACK) 5763 #define MG_EV_MQTT_UNSUBSCRIBE (MG_MQTT_EVENT_BASE + MG_MQTT_CMD_UNSUBSCRIBE) 5764 #define MG_EV_MQTT_UNSUBACK (MG_MQTT_EVENT_BASE + MG_MQTT_CMD_UNSUBACK) 5765 #define MG_EV_MQTT_PINGREQ (MG_MQTT_EVENT_BASE + MG_MQTT_CMD_PINGREQ) 5766 #define MG_EV_MQTT_PINGRESP (MG_MQTT_EVENT_BASE + MG_MQTT_CMD_PINGRESP) 5767 #define MG_EV_MQTT_DISCONNECT (MG_MQTT_EVENT_BASE + MG_MQTT_CMD_DISCONNECT) 5770 #define MG_MQTT_RETAIN 0x1 5771 #define MG_MQTT_DUP 0x4 5772 #define MG_MQTT_QOS(qos) ((qos) << 1) 5773 #define MG_MQTT_GET_QOS(flags) (((flags) &0x6) >> 1) 5774 #define MG_MQTT_SET_QOS(flags, qos) (flags) = ((flags) & ~0x6) | ((qos) << 1) 5777 #define MG_MQTT_CLEAN_SESSION 0x02 5778 #define MG_MQTT_HAS_WILL 0x04 5779 #define MG_MQTT_WILL_RETAIN 0x20 5780 #define MG_MQTT_HAS_PASSWORD 0x40 5781 #define MG_MQTT_HAS_USER_NAME 0x80 5782 #define MG_MQTT_GET_WILL_QOS(flags) (((flags) &0x18) >> 3) 5783 #define MG_MQTT_SET_WILL_QOS(flags, qos) \ 5784 (flags) = ((flags) & ~0x18) | ((qos) << 3) 5787 #define MG_EV_MQTT_CONNACK_ACCEPTED 0 5788 #define MG_EV_MQTT_CONNACK_UNACCEPTABLE_VERSION 1 5789 #define MG_EV_MQTT_CONNACK_IDENTIFIER_REJECTED 2 5790 #define MG_EV_MQTT_CONNACK_SERVER_UNAVAILABLE 3 5791 #define MG_EV_MQTT_CONNACK_BAD_AUTH 4 5792 #define MG_EV_MQTT_CONNACK_NOT_AUTHORIZED 5 5822 uint16_t message_id,
int flags,
const void *
data,
5828 size_t topics_len, uint16_t message_id);
5832 size_t topics_len, uint16_t message_id);
5857 uint16_t message_id);
5876 struct mg_str *topic, uint8_t *qos,
int pos);
5896 #ifdef MG_MODULE_LINES 5897 #line 1 "mongoose/src/mg_mqtt_server.h" 5920 #ifndef CS_MONGOOSE_SRC_MQTT_BROKER_H_ 5921 #define CS_MONGOOSE_SRC_MQTT_BROKER_H_ 5923 #if MG_ENABLE_MQTT_BROKER 5932 #ifndef MG_MQTT_MAX_SESSION_SUBSCRIPTIONS 5933 #define MG_MQTT_MAX_SESSION_SUBSCRIPTIONS 512 6003 #ifdef MG_MODULE_LINES 6004 #line 1 "mongoose/src/mg_dns.h" 6015 #ifndef CS_MONGOOSE_SRC_DNS_H_ 6016 #define CS_MONGOOSE_SRC_DNS_H_ 6024 #define MG_DNS_A_RECORD 0x01 6025 #define MG_DNS_CNAME_RECORD 0x05 6026 #define MG_DNS_PTR_RECORD 0x0c 6027 #define MG_DNS_TXT_RECORD 0x10 6028 #define MG_DNS_AAAA_RECORD 0x1c 6029 #define MG_DNS_SRV_RECORD 0x21 6030 #define MG_DNS_MX_RECORD 0x0f 6031 #define MG_DNS_ANY_RECORD 0xff 6032 #define MG_DNS_NSEC_RECORD 0x2f 6034 #define MG_MAX_DNS_QUESTIONS 32 6035 #define MG_MAX_DNS_ANSWERS 32 6037 #define MG_DNS_MESSAGE 100 6125 const char *
name,
size_t nlen,
const void *rdata,
6150 char *dst,
int dst_len);
6170 #ifdef MG_MODULE_LINES 6171 #line 1 "mongoose/src/mg_dns_server.h" 6184 #ifndef CS_MONGOOSE_SRC_DNS_SERVER_H_ 6185 #define CS_MONGOOSE_SRC_DNS_SERVER_H_ 6187 #if MG_ENABLE_DNS_SERVER 6195 #define MG_DNS_SERVER_DEFAULT_TTL 3600 6244 const char *name,
int rtype,
int ttl,
const void *rdata,
6267 #ifdef MG_MODULE_LINES 6268 #line 1 "mongoose/src/mg_resolv.h" 6279 #ifndef CS_MONGOOSE_SRC_RESOLV_H_ 6280 #define CS_MONGOOSE_SRC_RESOLV_H_ 6351 #ifdef MG_MODULE_LINES 6352 #line 1 "mongoose/src/mg_coap.h" 6385 #ifndef CS_MONGOOSE_SRC_COAP_H_ 6386 #define CS_MONGOOSE_SRC_COAP_H_ 6390 #define MG_COAP_MSG_TYPE_FIELD 0x2 6391 #define MG_COAP_CODE_CLASS_FIELD 0x4 6392 #define MG_COAP_CODE_DETAIL_FIELD 0x8 6393 #define MG_COAP_MSG_ID_FIELD 0x10 6394 #define MG_COAP_TOKEN_FIELD 0x20 6395 #define MG_COAP_OPTIOMG_FIELD 0x40 6396 #define MG_COAP_PAYLOAD_FIELD 0x80 6398 #define MG_COAP_ERROR 0x10000 6399 #define MG_COAP_FORMAT_ERROR (MG_COAP_ERROR | 0x20000) 6400 #define MG_COAP_IGNORE (MG_COAP_ERROR | 0x40000) 6401 #define MG_COAP_NOT_ENOUGH_DATA (MG_COAP_ERROR | 0x80000) 6402 #define MG_COAP_NETWORK_ERROR (MG_COAP_ERROR | 0x100000) 6404 #define MG_COAP_MSG_CON 0 6405 #define MG_COAP_MSG_NOC 1 6406 #define MG_COAP_MSG_ACK 2 6407 #define MG_COAP_MSG_RST 3 6408 #define MG_COAP_MSG_MAX 3 6410 #define MG_COAP_CODECLASS_REQUEST 0 6411 #define MG_COAP_CODECLASS_RESP_OK 2 6412 #define MG_COAP_CODECLASS_CLIENT_ERR 4 6413 #define MG_COAP_CODECLASS_SRV_ERR 5 6415 #define MG_COAP_EVENT_BASE 300 6416 #define MG_EV_COAP_CON (MG_COAP_EVENT_BASE + MG_COAP_MSG_CON) 6417 #define MG_EV_COAP_NOC (MG_COAP_EVENT_BASE + MG_COAP_MSG_NOC) 6418 #define MG_EV_COAP_ACK (MG_COAP_EVENT_BASE + MG_COAP_MSG_ACK) 6419 #define MG_EV_COAP_RST (MG_COAP_EVENT_BASE + MG_COAP_MSG_RST) 6458 uint32_t
number,
char *value,
6519 #ifdef MG_MODULE_LINES 6520 #line 1 "mongoose/src/mg_sntp.h" 6527 #ifndef CS_MONGOOSE_SRC_SNTP_H_ 6528 #define CS_MONGOOSE_SRC_SNTP_H_ 6532 #define MG_SNTP_EVENT_BASE 500 6538 #define MG_SNTP_REPLY (MG_SNTP_EVENT_BASE + 1) 6541 #define MG_SNTP_MALFORMED_REPLY (MG_SNTP_EVENT_BASE + 2) 6544 #define MG_SNTP_FAILED (MG_SNTP_EVENT_BASE + 3) 6557 const char *sntp_server_name);
6571 const char *sntp_server_name);
6576 #ifdef MG_MODULE_LINES 6577 #line 1 "mongoose/src/mg_socks.h" 6584 #ifndef CS_MONGOOSE_SRC_SOCKS_H_ 6585 #define CS_MONGOOSE_SRC_SOCKS_H_ 6589 #define MG_SOCKS_VERSION 5 6591 #define MG_SOCKS_HANDSHAKE_DONE MG_F_USER_1 6592 #define MG_SOCKS_CONNECT_DONE MG_F_USER_2 int mg_resolve(const char *domain_name, char *ip_addr_buf, size_t buf_len)
Definition: mongoose.c:2654
struct mg_connection * nc
Definition: mongoose.h:5942
int inet_pton(int af, const char *src, void *dst)
void * data
Definition: mongoose.h:3631
const char * ssl_ca_cert
Definition: mongoose.h:4163
Definition: mongoose.h:6056
const char * cgi_file_pattern
Definition: mongoose.h:5322
int sl_set_ssl_opts(int sock, struct mg_connection *nc)
void mg_hash_md5_v(size_t num_msgs, const uint8_t *msgs[], const size_t *msg_lens, uint8_t *digest)
struct mg_iface * mg_if_create_iface(const struct mg_iface_vtable *vtable, struct mg_mgr *mgr)
Definition: mongoose.c:3556
Definition: mongoose.h:6046
struct mg_connection * mg_sntp_get_time(struct mg_mgr *mgr, mg_event_handler_t event_handler, const char *sntp_server_name)
int mg_set_protocol_coap(struct mg_connection *nc)
void mg_mbuf_append_base64_putc(char ch, void *user_data)
struct mg_str mg_strdup(const struct mg_str s)
Definition: mongoose.c:1702
Definition: mongoose.h:4740
struct mg_dns_message * msg
Definition: mongoose.h:6198
struct mg_connection * mg_next(struct mg_mgr *mgr, struct mg_connection *c)
Definition: mongoose.c:3354
void mg_set_protocol_http_websocket(struct mg_connection *nc)
void mg_http_reverse_proxy(struct mg_connection *nc, const struct http_message *hm, struct mg_str mount, struct mg_str upstream)
const char * mg_strchr(const struct mg_str s, int c)
Definition: mongoose.c:1712
int accept_literal
Definition: mongoose.h:6303
void mg_http_serve_file(struct mg_connection *nc, struct http_message *hm, const char *path, const struct mg_str mime_type, const struct mg_str extra_headers)
Definition: mongoose.h:5461
unsigned __int64 uint64_t
Definition: mongoose.h:273
int _stat(const char *pathname, struct stat *st)
struct mg_connection * mg_connect_ws(struct mg_mgr *mgr, MG_CB(mg_event_handler_t event_handler, void *user_data), const char *url, const char *protocol, const char *extra_headers)
void mg_if_connect_cb(struct mg_connection *nc, int err)
Definition: mongoose.c:3093
union socket_address sa
Definition: mongoose.h:3895
mg_event_handler_t handler
Definition: mongoose.h:3907
const char * custom_mime_types
Definition: mongoose.h:5331
const char * server_name
Definition: mongoose.h:3761
void cs_sha1_init(cs_sha1_ctx *)
Definition: mongoose.c:1408
void mg_send_websocket_handshake(struct mg_connection *nc, const char *uri, const char *extra_headers)
void mbuf_free(struct mbuf *)
Definition: mongoose.c:1539
mg_event_handler_t proto_handler
Definition: mongoose.h:3904
double ev_timer_time
Definition: mongoose.h:3900
SOCKET sock_t
Definition: mongoose.h:275
unsigned char flags
Definition: mongoose.h:5722
Definition: mongoose.h:5721
int mg_resolve_async(struct mg_mgr *mgr, const char *name, int query, mg_resolve_callback_t cb, void *data)
struct mg_iface * mg_find_iface(struct mg_mgr *mgr, const struct mg_iface_vtable *vtable, struct mg_iface *from)
Definition: mongoose.c:3565
Definition: mongoose.h:2774
const char * topic
Definition: mongoose.h:5717
struct mg_mqtt_session * mg_mqtt_next(struct mg_mqtt_broker *brk, struct mg_mqtt_session *s)
int mg_dns_parse_record_data(struct mg_dns_message *msg, struct mg_dns_resource_record *rr, void *data, size_t data_len)
void cs_base64_finish(struct cs_base64_ctx *ctx)
Definition: mongoose.c:298
Definition: mongoose.h:6289
long ssize_t
Definition: mongoose.h:775
Definition: mongoose.h:6042
void * mg_start_thread(void *(*thread_func)(void *), void *thread_func_param)
const char * ssl_cipher_suites
Definition: mongoose.h:4106
const char * cipher_suites
Definition: mongoose.h:3762
struct mg_iface * iface
Definition: mongoose.h:4146
size_t mbuf_insert(struct mbuf *, size_t, const void *, size_t)
Definition: mongoose.c:1567
Definition: mongoose.h:5184
uint8_t code_detail
Definition: mongoose.h:6437
void mg_mqtt_unsubscribe(struct mg_connection *nc, char **topics, size_t topics_len, uint16_t message_id)
int only_literal
Definition: mongoose.h:6304
int cs_base64_decode(const unsigned char *s, int len, char *dst, int *dec_len)
Definition: mongoose.c:408
Definition: mongoose.h:3754
void mbuf_init(struct mbuf *, size_t initial_capacity)
Definition: mongoose.c:1532
in_addr_t inet_addr(const char *cp)
void cs_base64_update(struct cs_base64_ctx *ctx, const char *str, size_t len)
Definition: mongoose.c:286
mg_socks_handshake_method
Definition: mongoose.h:6595
void mg_mqtt_connack(struct mg_connection *nc, uint8_t return_code)
const char * mime_type
Definition: mongoose.c:6015
Definition: mongoose.h:3635
Definition: mongoose.h:6605
Definition: mongoose.h:6426
const char * nameserver
Definition: mongoose.h:3882
Definition: mongoose.h:6621
struct mg_str mg_url_encode_opt(const struct mg_str src, const struct mg_str safe, unsigned int flags)
uint32_t mg_coap_parse(struct mbuf *io, struct mg_coap_message *cm)
uint32_t mg_coap_send_ack(struct mg_connection *nc, uint16_t msg_id)
int mg_hexdump(const void *buf, int len, char *dst, int dst_len)
uint8_t msg_type
Definition: mongoose.h:6435
int mg_dns_encode_name(struct mbuf *io, const char *name, size_t len)
struct mg_connection * mg_add_sock(struct mg_mgr *mgr, sock_t sock, MG_CB(mg_event_handler_t handler, void *user_data))
struct mg_connection * mg_connect_http(struct mg_mgr *mgr, MG_CB(mg_event_handler_t event_handler, void *user_data), const char *url, const char *extra_headers, const char *post_data)
int c_snprintf(char *buf, size_t buf_size, const char *format,...) PRINTF_LIKE(3
Definition: mongoose.c:2006
int mg_printf(struct mg_connection *conn, const char *fmt,...)
Definition: mongoose.c:2613
short int16_t
Definition: mongoose.h:270
void mg_if_recv_udp_cb(struct mg_connection *nc, void *buf, int len, union socket_address *sa, size_t sa_len)
void mg_http_send_digest_auth_request(struct mg_connection *c, const char *domain)
struct sockaddr sa
Definition: mongoose.h:3840
Definition: mongoose.h:2429
void mg_mqtt_puback(struct mg_connection *nc, uint16_t message_id)
Definition: mongoose.h:4043
const char * password
Definition: mongoose.h:5727
Definition: mongoose.h:6612
double cs_time(void)
Definition: mongoose.c:918
struct mg_str name
Definition: mongoose.h:6047
const char * ip_acl
Definition: mongoose.h:5279
int num_ifaces
Definition: mongoose.h:3879
const char ** error_string
Definition: mongoose.h:4046
double mg_time(void)
Definition: mongoose.c:3485
const char * psk_key
Definition: mongoose.h:3764
size_t start
Definition: mongoose.h:6200
struct mg_str mg_mk_str(const char *s)
Definition: mongoose.c:1654
void mg_mqtt_broker_init(struct mg_mqtt_broker *brk, void *user_data)
const char * per_directory_auth_file
Definition: mongoose.h:5200
int inet_aton(const char *cp, struct in_addr *inp)
uint32_t flags
Definition: mongoose.h:6434
Definition: mongoose.h:3972
const char * document_root
Definition: mongoose.h:5186
const char * hexdump_file
Definition: mongoose.h:3873
void mg_sntp_send_request(struct mg_connection *c)
Definition: mongoose.h:5731
Definition: mongoose.h:6620
char * strdup(const char *src)
Definition: mongoose.c:2066
void * user_data
Definition: mongoose.h:2434
int mg_if_poll(struct mg_connection *nc, double now)
Definition: mongoose.c:2439
void mg_set_protocol_socks(struct mg_connection *c)
Definition: mongoose.h:6291
struct mg_str mg_next_comma_list_entry_n(struct mg_str list, struct mg_str *val, struct mg_str *eq_val)
Definition: mongoose.c:2216
uint8_t connack_ret_code
Definition: mongoose.h:5701
struct mg_connection * mg_connect(struct mg_mgr *mgr, const char *address, MG_CB(mg_event_handler_t handler, void *user_data))
struct mg_mqtt_broker * brk
Definition: mongoose.h:5940
uint16_t keep_alive_timer
Definition: mongoose.h:5707
uint32_t mg_coap_compose(struct mg_coap_message *cm, struct mbuf *io)
Definition: mongoose.h:5939
void mg_mqtt_suback(struct mg_connection *nc, uint8_t *qoss, size_t qoss_len, uint16_t message_id)
struct mg_connection * prev
Definition: mongoose.h:3889
int rclass
Definition: mongoose.h:6049
unsigned short uint16_t
Definition: mongoose.h:271
void mg_if_accept_tcp_cb(struct mg_connection *nc, union socket_address *sa, size_t sa_len)
Definition: mongoose.c:2840
void mg_send_head(struct mg_connection *n, int status_code, int64_t content_length, const char *extra_headers)
void mg_mqtt_pong(struct mg_connection *nc)
Definition: mongoose.h:4077
struct mg_iface * iface
Definition: mongoose.h:4047
int stat(const char *pathname, struct stat *st)
struct mg_str mg_strstrip(struct mg_str s)
Definition: mongoose.c:1762
const char * nameserver
Definition: mongoose.h:3976
void cs_md5_final(unsigned char *md, cs_md5_ctx *c)
size_t mg_match_prefix(const char *pattern, int pattern_len, const char *str)
Definition: mongoose.c:2298
int num_answers
Definition: mongoose.h:6061
void mg_send_mqtt_handshake(struct mg_connection *nc, const char *client_id)
int int mg_avprintf(char **buf, size_t size, const char *fmt, va_list ap)
Definition: mongoose.c:2158
Definition: mongoose.h:2127
int kiss_of_death
Definition: mongoose.h:6548
Definition: mongoose.h:2221
const char * fmt
Definition: mongoose.h:4297
void * priv_2
Definition: mongoose.h:3917
int mg_parse_http(const char *s, int n, struct http_message *hm, int is_req)
Definition: mongoose.c:6162
time_t tv_sec
Definition: mongoose.h:1209
size_t len
Definition: mongoose.h:2344
void(* mg_event_handler_t)(struct mg_connection *nc, int ev, void *ev_data MG_UD_ARG(void *user_data))
Definition: mongoose.h:3855
void mg_send_websocket_handshake2(struct mg_connection *nc, const char *path, const char *host, const char *protocol, const char *extra_headers)
void mg_hexdump_connection(struct mg_connection *nc, const char *path, const void *buf, int num_bytes, int ev)
int mg_dns_copy_questions(struct mbuf *io, struct mg_dns_message *msg)
double mg_mgr_min_timer(const struct mg_mgr *mgr)
Definition: mongoose.c:3586
void mg_mqtt_pubcomp(struct mg_connection *nc, uint16_t message_id)
long suseconds_t
Definition: mongoose.h:1207
void mg_ssl_if_conn_close_notify(struct mg_connection *nc)
Definition: mongoose.c:5269
uint16_t msg_id
Definition: mongoose.h:6438
int asprintf(char **strp, const char *fmt,...)
Definition: mongoose.h:6597
int int c_vsnprintf(char *buf, size_t buf_size, const char *format, va_list ap)
Definition: mongoose.c:1822
void * user_data
Definition: mongoose.h:4143
void mg_printf_http_chunk(struct mg_connection *nc, const char *fmt,...)
const char * prevfile
Definition: mongoose.h:2778
const char * enable_directory_listing
Definition: mongoose.h:5216
struct mg_connection * next
Definition: mongoose.h:3889
struct mbuf * io
Definition: mongoose.h:6199
const struct mg_iface_vtable * vtable
Definition: mongoose.h:3632
int mg_stat(const char *path, cs_stat_t *st)
Definition: mongoose.h:6292
int mg_socketpair(sock_t[2], int sock_type)
Definition: mongoose.c:4227
struct mg_coap_option * options
Definition: mongoose.h:6440
const char * ssl_psk_identity
Definition: mongoose.h:4191
mg_event_handler_t f
Definition: mongoose.h:3915
bool mg_start_task(int priority, int stack_size, mg_init_cb mg_init)
const char * user_name
Definition: mongoose.h:5726
const char * p
Definition: mongoose.h:2222
Definition: mongoose.h:6040
Definition: mongoose.h:6606
void mg_printf_websocket_frame(struct mg_connection *nc, int op_and_flags, const char *fmt,...)
Definition: mongoose.h:6626
const char * lastfile
Definition: mongoose.h:2777
Definition: mongoose.h:6599
void * user_data
Definition: mongoose.h:4078
void mg_dns_send_reply(struct mg_connection *nc, struct mg_dns_reply *r)
int mg_sock_addr_to_str(const union socket_address *sa, char *buf, size_t len, int flags)
void mg_register_http_endpoint_opt(struct mg_connection *nc, const char *uri_path, mg_event_handler_t handler, struct mg_http_endpoint_opts opts)
enum mg_ssl_if_result mg_ssl_if_conn_init(struct mg_connection *nc, const struct mg_ssl_if_conn_params *params, const char **err_msg)
Definition: mongoose.c:5054
const struct mg_iface_vtable * mg_ifaces[]
Definition: mongoose.c:3550
struct mg_connection * mg_add_sock_opt(struct mg_mgr *mgr, sock_t sock, MG_CB(mg_event_handler_t handler, void *user_data), struct mg_add_sock_opts opts)
int mg_parse_uri(const struct mg_str uri, struct mg_str *scheme, struct mg_str *user_info, struct mg_str *host, unsigned int *port, struct mg_str *path, struct mg_str *query, struct mg_str *fragment)
Definition: mongoose.c:5509
const char * ssl_key
Definition: mongoose.h:4158
const char * mg_strstr(const struct mg_str haystack, const struct mg_str needle)
Definition: mongoose.c:1749
size_t _off_t
Definition: mongoose.h:774
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)
void(* cs_base64_putc_t)(char, void *)
Definition: mongoose.h:2427
void cs_base64_encode(const unsigned char *src, int src_len, char *dst)
Definition: mongoose.c:344
void mg_send_mqtt_handshake_opt(struct mg_connection *nc, const char *client_id, struct mg_send_mqtt_handshake_opts)
const char * dav_auth_file
Definition: mongoose.h:5316
struct mg_coap_option * mg_coap_add_option(struct mg_coap_message *cm, uint32_t number, char *value, size_t len)
mg_ssl_if_result
Definition: mongoose.h:3750
struct mg_str(* mg_fu_fname_fn)(struct mg_connection *nc, struct mg_str fname)
Definition: mongoose.h:5389
void mg_if_can_send_cb(struct mg_connection *nc)
Definition: mongoose.c:3013
int mg_http_parse_header(struct mg_str *hdr, const char *var_name, char *buf, size_t buf_size) __attribute__((deprecated))
void mg_mgr_free(struct mg_mgr *mgr)
Definition: mongoose.c:2558
int num_ifaces
Definition: mongoose.h:3974
mg_resolve_err
Definition: mongoose.h:6288
void * proto_data
Definition: mongoose.h:3905
time_t last_io_time
Definition: mongoose.h:3899
struct mg_connection * mg_connect_opt(struct mg_mgr *mgr, const char *address, MG_CB(mg_event_handler_t handler, void *user_data), struct mg_connect_opts opts)
unsigned long uintptr_t
Definition: mongoose.h:259
double time
Definition: mongoose.h:6550
void mbuf_trim(struct mbuf *)
Definition: mongoose.c:1562
int mg_dns_insert_header(struct mbuf *io, size_t pos, struct mg_dns_message *msg)
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:1461
size_t mg_dns_uncompress_name(struct mg_dns_message *msg, struct mg_str *name, char *dst, int dst_len)
int num_questions
Definition: mongoose.h:6060
Definition: mongoose.h:6598
unsigned long flags
Definition: mongoose.h:3920
Definition: mongoose.h:6623
unsigned long lastline
Definition: mongoose.h:2775
void sl_restart_cb(struct mg_mgr *mgr)
void * user_data
Definition: mongoose.h:4753
uint32_t st_mtime
Definition: mongoose.h:1698
suseconds_t tv_usec
Definition: mongoose.h:1210
void mg_register_http_endpoint(struct mg_connection *nc, const char *uri_path, MG_CB(mg_event_handler_t handler, void *user_data))
void mg_set_protocol_mqtt(struct mg_connection *nc)
mg_dns_resource_record_kind
Definition: mongoose.h:6039
void mg_mbuf_append_base64(struct mbuf *mbuf, const void *data, size_t len)
uint8_t connect_flags
Definition: mongoose.h:5706
int mg_mqtt_vmatch_topic_expression(const char *exp, struct mg_str topic)
const char * file_name
Definition: mongoose.h:4749
struct mg_iface * mg_socks_mk_iface(struct mg_mgr *, const char *proxy_addr)
Definition: mongoose.c:4558
void mg_set_nameserver(struct mg_mgr *mgr, const char *nameserver)
void mg_file_upload_handler(struct mg_connection *nc, int ev, void *ev_data, mg_fu_fname_fn local_name_fn MG_UD_ARG(void *user_data))
void mg_basic_auth_header(const struct mg_str user, const struct mg_str pass, struct mbuf *buf)
void mg_if_can_recv_cb(struct mg_connection *nc)
Definition: mongoose.c:2892
Definition: mongoose.h:3839
struct mg_connection * listener
Definition: mongoose.h:3890
void * user_data
Definition: mongoose.h:5462
const char * ssl_psk_key
Definition: mongoose.h:4192
Definition: mongoose.h:3870
struct mg_dns_resource_record * mg_dns_next_record(struct mg_dns_message *msg, int query, struct mg_dns_resource_record *prev)
const char * mg_set_ssl(struct mg_connection *nc, const char *cert, const char *ca_cert)
Definition: mongoose.c:5455
size_t mbuf_append(struct mbuf *, const void *data, size_t data_size)
Definition: mongoose.c:1611
Definition: mongoose.h:4757
const char * key
Definition: mongoose.h:3759
void cs_md5_init(cs_md5_ctx *c)
Definition: mongoose.c:1082
void * user_data
Definition: mongoose.h:3908
int rtype
Definition: mongoose.h:6048
Definition: mongoose.c:4585
int ttl
Definition: mongoose.h:6050
unsigned int mode_t
Definition: mongoose.h:773
unsigned int uint32_t
Definition: mongoose.h:269
void mg_http_send_error(struct mg_connection *nc, int code, const char *reason)
struct mg_mgr * mgr
Definition: mongoose.h:3630
int mg_conn_addr_to_str(struct mg_connection *c, char *buf, size_t len, int flags)
int mg_casecmp(const char *s1, const char *s2)
Definition: mongoose.c:2143
const char * ssl_cert
Definition: mongoose.h:4153
Definition: mongoose.h:6546
void mg_ssl_if_init()
Definition: mongoose.c:5023
void(* mg_resolve_callback_t)(struct mg_dns_message *dns_message, void *user_data, enum mg_resolve_err)
Definition: mongoose.h:6295
int mg_get_http_basic_auth(struct http_message *hm, char *user, size_t user_len, char *pass, size_t pass_len)
int cmd
Definition: mongoose.h:5695
unsigned int flags
Definition: mongoose.h:4079
int mg_http_parse_header2(struct mg_str *hdr, const char *var_name, char **buf, size_t buf_size)
const char * cgi_interpreter
Definition: mongoose.h:5325
Definition: mongoose.h:6611
const char * cert
Definition: mongoose.h:3758
const char * inet_ntop(int af, const void *src, char *dst, socklen_t size)
int mg_resolve_from_hosts_file(const char *host, union socket_address *usa)
uint16_t transaction_id
Definition: mongoose.h:6059
Definition: mongoose.h:4710
void mg_base64_encode(const unsigned char *src, int src_len, char *dst)
int mg_normalize_uri_path(const struct mg_str *in, struct mg_str *out)
Definition: mongoose.c:5639
mode_t st_mode
Definition: mongoose.h:779
int mg_dns_encode_record(struct mbuf *io, struct mg_dns_resource_record *rr, const char *name, size_t nlen, const void *rdata, size_t rlen)
unsigned int flags
Definition: mongoose.h:4144
int mg_http_check_digest_auth(struct http_message *hm, const char *auth_domain, FILE *fp)
struct mg_iface * iface
Definition: mongoose.h:3919
size_t c_strnlen(const char *s, size_t maxlen)
Definition: mongoose.c:1805
Definition: mongoose.h:4142
int mg_ncasecmp(const char *s1, const char *s2, size_t len)
Definition: mongoose.c:2132
const char * var_name
Definition: mongoose.h:4750
int mg_mqtt_next_subscribe_topic(struct mg_mqtt_message *msg, struct mg_str *topic, uint8_t *qos, int pos)
Definition: mongoose.h:1208
char * inet_ntoa(struct in_addr in)
int mg_url_decode(const char *src, int src_len, char *dst, int dst_len, int is_form_url_encoded)
unsigned char flags
Definition: mongoose.h:4743
struct _stati64 cs_stat_t
Definition: mongoose.h:289
void mg_mqtt_pubrel(struct mg_connection *nc, uint16_t message_id)
void cs_sha1_final(unsigned char digest[20], cs_sha1_ctx *)
Definition: mongoose.c:1437
void mg_mqtt_subscribe(struct mg_connection *nc, const struct mg_mqtt_topic_expression *topics, size_t topics_len, uint16_t message_id)
int open(const char *filename, int oflag, int pmode)
const char * psk_identity
Definition: mongoose.h:3763
int mg_check_digest_auth(struct mg_str method, struct mg_str uri, struct mg_str username, struct mg_str cnonce, struct mg_str response, struct mg_str qop, struct mg_str nc, struct mg_str nonce, struct mg_str auth_domain, FILE *fp)
const char * ssl_key
Definition: mongoose.h:4092
double cs_timegm(const struct tm *tm)
Definition: mongoose.c:946
int mg_parse_dns(const char *buf, int len, struct mg_dns_message *msg)
void cs_md5_update(cs_md5_ctx *c, const unsigned char *data, size_t len)
Definition: mongoose.c:1174
int max_retries
Definition: mongoose.h:6301
int mg_get_http_var(const struct mg_str *buf, const char *name, char *dst, size_t dst_len)
void mg_mqtt_broker(struct mg_connection *brk, int ev, void *data)
int socklen_t
Definition: mongoose.h:262
int mg_ssl_if_read(struct mg_connection *nc, void *buf, size_t buf_size)
Definition: mongoose.c:5237
Definition: mongoose.h:6604
int mg_base64_decode(const unsigned char *s, int len, char *dst)
const char * nameserver
Definition: mongoose.h:4147
void mg_send_websocket_frame(struct mg_connection *nc, int op_and_flags, const void *data, size_t data_len)
Definition: mongoose.h:6290
long long strtoll(const char *, char **, int)
void mg_http_send_redirect(struct mg_connection *nc, int status_code, const struct mg_str location, const struct mg_str extra_headers)
int int32_t
Definition: mongoose.h:268
Definition: mongoose.h:2342
void mg_send(struct mg_connection *, const void *buf, int len)
Definition: mongoose.c:2861
void cs_base64_init(struct cs_base64_ctx *ctx, cs_base64_putc_t putc, void *user_data)
Definition: mongoose.c:279
void mg_run_in_task(void(*cb)(struct mg_mgr *mgr, void *arg), void *cb_arg)
int qos
Definition: mongoose.h:5696
Definition: mongoose.h:3753
int settimeofday(const struct timeval *tv, const void *tz)
int mg_is_big_endian(void)
int mg_mgr_poll(struct mg_mgr *mgr, int milli)
Definition: mongoose.c:2589
const char * nameserver
Definition: mongoose.h:6300
void mg_lwip_set_keepalive_params(struct mg_connection *nc, int idle, int interval, int count)
mg_socks_command
Definition: mongoose.h:6603
int len
Definition: mongoose.h:5697
Definition: mongoose.h:6433
void cs_to_hex(char *to, const unsigned char *p, size_t len)
Definition: mongoose.c:2077
double mg_set_timer(struct mg_connection *c, double timestamp)
Definition: mongoose.c:3434
size_t size
Definition: mongoose.h:4742
Definition: mongoose.h:777
struct mg_connection * mg_connect_http_opt(struct mg_mgr *mgr, MG_CB(mg_event_handler_t ev_handler, void *user_data), struct mg_connect_opts opts, const char *url, const char *extra_headers, const char *post_data)
enum mg_ssl_if_result mg_ssl_if_handshake(struct mg_connection *nc)
Definition: mongoose.c:5205
Definition: mongoose.h:6624
int _wstati64(const wchar_t *path, cs_stat_t *st)
uint32_t mg_coap_send_message(struct mg_connection *nc, struct mg_coap_message *cm)
struct mg_str mg_mk_str_n(const char *s, size_t len)
Definition: mongoose.c:1661
const char int mg_vprintf(struct mg_connection *, const char *fmt, va_list ap)
Definition: mongoose.c:2599
size_t mg_fread(void *ptr, size_t size, size_t count, FILE *f)
struct mg_iface ** ifaces
Definition: mongoose.h:3881
void mg_ssl_if_conn_free(struct mg_connection *nc)
Definition: mongoose.c:5275
struct mg_connection ** dns_conn
Definition: mongoose.h:6305
int mg_check_ip_acl(const char *acl, uint32_t remote_ip)
Definition: mongoose.c:3404
struct mg_mqtt_topic_expression * subscriptions
Definition: mongoose.h:5945
int timeout
Definition: mongoose.h:6302
struct mg_str mg_url_encode(const struct mg_str src)
int gettimeofday(struct timeval *t, void *tz)
Definition: compat_time.c:29
void * user_data
Definition: mongoose.h:4044
struct mg_connection * mg_sntp_connect(struct mg_mgr *mgr, MG_CB(mg_event_handler_t event_handler, void *user_data), const char *sntp_server_name)
void cs_sha1_update(cs_sha1_ctx *, const unsigned char *data, uint32_t len)
Definition: mongoose.c:1417
const char * extra_headers
Definition: mongoose.h:5337
Definition: mongoose.h:6618
double last_control_time
Definition: mongoose.h:5733
struct mg_str mg_strdup_nul(const struct mg_str s)
Definition: mongoose.c:1707
void mg_set_close_on_exec(sock_t)
cs_base64_putc_t b64_putc
Definition: mongoose.h:2431
uint16_t flags
Definition: mongoose.h:6058
struct mg_str * mg_get_http_header(struct http_message *hm, const char *name)
Definition: mongoose.c:6226
uint32_t st_size
Definition: mongoose.h:1699
struct mg_connection * mg_if_accept_new_conn(struct mg_connection *lc)
Definition: mongoose.c:2823
int mg_parse_http_basic_auth(struct mg_str *hdr, char *user, size_t user_len, char *pass, size_t pass_len)
unsigned char uint8_t
Definition: mongoose.h:267
struct http_message * req
Definition: mongoose.h:4758
struct mg_coap_option * optiomg_tail
Definition: mongoose.h:6442
int chunk_size
Definition: mongoose.h:2433
void mg_mqtt_ping(struct mg_connection *nc)
Definition: mongoose.h:6197
int slfs_open(const unsigned char *fname, uint32_t flags)
void mbuf_resize(struct mbuf *, size_t new_size)
Definition: mongoose.c:1547
int mg_http_is_authorized(struct http_message *hm, struct mg_str path, const char *domain, const char *passwords_file, int flags)
Definition: mongoose.h:5694
Definition: mongoose.h:1697
int mg_vcmp(const struct mg_str *str2, const char *str1)
Definition: mongoose.c:1667
Definition: mongoose.h:6613
size_t size
Definition: mongoose.h:2345
int mg_strncmp(const struct mg_str str1, const struct mg_str str2, size_t n)
Definition: mongoose.c:1734
const char * ssl_server_name
Definition: mongoose.h:4183
Definition: mongoose.h:6622
Dynamically growing list, elems is always NULL terminated, call list_ensure_size() to alloc elems...
Definition: list.h:18
void(* mg_init_cb)(struct mg_mgr *mgr)
Definition: mongoose.h:1467
struct mg_connection * mg_bind(struct mg_mgr *mgr, const char *address, MG_CB(mg_event_handler_t handler, void *user_data))
int st_ino
Definition: mongoose.h:778
void mg_set_protocol_dns(struct mg_connection *nc)
const char * will_message
Definition: mongoose.h:5725
Definition: mongoose.h:3888
int mg_mqtt_match_topic_expression(struct mg_str exp, struct mg_str topic)
const char * ca_cert
Definition: mongoose.h:3760
struct mg_connection * mg_bind_opt(struct mg_mgr *mgr, const char *address, MG_CB(mg_event_handler_t handler, void *user_data), struct mg_bind_opts opts)
sock_t sock
Definition: mongoose.h:3893
int status
Definition: mongoose.h:4752
const char ** error_string
Definition: mongoose.h:4080
void mg_hexdumpf(FILE *fp, const void *buf, int len)
void mg_broadcast(struct mg_mgr *mgr, mg_event_handler_t cb, void *data, size_t len)
Definition: mongoose.c:3359
void mg_mgr_init_opt(struct mg_mgr *mgr, void *user_data, struct mg_mgr_init_opts opts)
Definition: mongoose.c:2506
__int64 int64_t
Definition: mongoose.h:272
const char * ssl_ca_cert
Definition: mongoose.h:4094
uint32_t st_mode
Definition: mongoose.h:1700
void mg_mgr_init(struct mg_mgr *mgr, void *user_data)
Definition: mongoose.c:2500
struct mg_connection * active_connections
Definition: mongoose.h:3871
void mg_send_http_chunk(struct mg_connection *nc, const char *buf, size_t len)
void * user_data
Definition: mongoose.h:5944
void mg_coap_free_options(struct mg_coap_message *cm)
void mg_mqtt_publish(struct mg_connection *nc, const char *topic, uint16_t message_id, int flags, const void *data, size_t len)
int mg_asprintf(char **buf, size_t size, const char *fmt,...) PRINTF_LIKE(3
Definition: mongoose.c:2148
int mg_resolve_async_opt(struct mg_mgr *mgr, const char *name, int query, mg_resolve_callback_t cb, void *data, struct mg_resolve_async_opts opts)
uint16_t message_id
Definition: mongoose.h:5702
Definition: mongoose.h:6625
void * ssl_if_data
Definition: mongoose.h:3902
void mg_printf_html_escape(struct mg_connection *nc, const char *fmt,...)
Definition: mongoose.h:6299
size_t mg_fwrite(const void *ptr, size_t size, size_t count, FILE *f)
const char * global_auth_file
Definition: mongoose.h:5213
const char * url_rewrites
Definition: mongoose.h:5306
struct mg_connection * mg_connect_ws_opt(struct mg_mgr *mgr, MG_CB(mg_event_handler_t ev_handler, void *user_data), struct mg_connect_opts opts, const char *url, const char *protocol, const char *extra_headers)
const char * mg_next_comma_list_entry(const char *list, struct mg_str *val, struct mg_str *eq_val)
Definition: mongoose.c:2206
void mg_serve_http(struct mg_connection *nc, struct http_message *hm, struct mg_serve_http_opts opts)
size_t mg_match_prefix_n(const struct mg_str pattern, const struct mg_str str)
Definition: mongoose.c:2252
uint16_t keep_alive
Definition: mongoose.h:5723
int resp_code
Definition: mongoose.h:4720
__attribute__((format(printf, 2, 3))) int mg_printf(struct mg_connection *
int mg_num_ifaces
Definition: mongoose.c:3554
void mg_mqtt_unsuback(struct mg_connection *nc, uint16_t message_id)
Definition: mongoose.h:2077
Definition: mongoose.h:4748
void cs_from_hex(char *to, const char *p, size_t len)
Definition: mongoose.c:2099
unsigned char * data
Definition: mongoose.h:4741
Definition: mongoose.h:3752
off_t st_size
Definition: mongoose.h:782
void mg_mqtt_pubrec(struct mg_connection *nc, uint16_t message_id)
Definition: mongoose.h:3629
Definition: mongoose.h:5716
const char * hidden_file_pattern
Definition: mongoose.h:5319
uint8_t qos
Definition: mongoose.h:5718
uint16_t keep_alive
Definition: mongoose.h:5732
void mg_sock_to_str(sock_t sock, char *buf, size_t len, int flags)
Definition: mongoose.c:4282
int mg_strcmp(const struct mg_str str1, const struct mg_str str2)
Definition: mongoose.c:1721
uint32_t number
Definition: mongoose.h:6428
const char * dav_document_root
Definition: mongoose.h:5310
char * buf
Definition: mongoose.h:2343
const char * ssi_pattern
Definition: mongoose.h:5276
const char * auth_domain
Definition: mongoose.h:5203
const char * auth_domain
Definition: mongoose.h:5464
enum mg_ssl_if_result mg_ssl_if_conn_accept(struct mg_connection *nc, struct mg_connection *lc)
Definition: mongoose.c:5027
signed char int8_t
Definition: mongoose.h:266
size_t num_subscriptions
Definition: mongoose.h:5943
int bool
Definition: mongoose.h:225
struct mg_dns_reply mg_dns_create_reply(struct mbuf *io, struct mg_dns_message *msg)
int st_nlink
Definition: mongoose.h:780
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, const char *nonce)
int64_t cs_to64(const char *s)
Definition: mongoose.c:2110
Definition: mongoose.h:3757
void mg_send_websocket_handshake3v(struct mg_connection *nc, const struct mg_str path, const struct mg_str host, const struct mg_str protocol, const struct mg_str extra_headers, const struct mg_str user, const struct mg_str pass)
uint32_t in_addr_t
Definition: mongoose.h:276
long intptr_t
Definition: mongoose.h:260
unsigned int flags
Definition: mongoose.h:4045
int mg_open(const char *path, int flag, int mode)
const char * will_topic
Definition: mongoose.h:5724
void mg_send_websocket_framev(struct mg_connection *nc, int op_and_flags, const struct mg_str *strings, int num_strings)
FILE * mg_fopen(const char *path, const char *mode)
uint8_t code_class
Definition: mongoose.h:6436
const char * mg_skip(const char *s, const char *end_string, const char *delimiters, struct mg_str *v)
const char * index_files
Definition: mongoose.h:5189
void * user_data
Definition: mongoose.h:3878
int num_calls
Definition: mongoose.h:3880
mg_socks_address_type
Definition: mongoose.h:6610
void * user_data
Definition: mongoose.h:5951
time_t st_mtime
Definition: mongoose.h:781
int mg_dns_reply_record(struct mg_dns_reply *reply, struct mg_dns_resource_record *question, const char *name, int rtype, int ttl, const void *rdata, size_t rdata_len)
int err
Definition: mongoose.h:3894
void mg_send_dns_query(struct mg_connection *nc, const char *name, int query_type)
int mg_vcasecmp(const struct mg_str *str2, const char *str1)
Definition: mongoose.c:1677
struct mg_iface * iface
Definition: mongoose.h:4081
Definition: mongoose.h:3751
const char * ssl_cipher_suites
Definition: mongoose.h:4175
void mbuf_remove(struct mbuf *, size_t data_size)
Definition: mongoose.c:1616
Definition: mongoose.h:6596
void mg_send_response_line(struct mg_connection *nc, int status_code, const char *extra_headers)
const char * c_strnstr(const char *s, const char *find, size_t slen)
Definition: mongoose.c:2047
void mg_send_websocket_handshake3(struct mg_connection *nc, const char *path, const char *host, const char *protocol, const char *extra_headers, const char *user, const char *pass)
mg_socks_response
Definition: mongoose.h:6617
const char * ssl_cert
Definition: mongoose.h:4089
const struct mg_iface_vtable ** ifaces
Definition: mongoose.h:3975
const char * auth_file
Definition: mongoose.h:5465
size_t recv_mbuf_limit
Definition: mongoose.h:3896
void * mgr_data
Definition: mongoose.h:3918
void mg_mqtt_disconnect(struct mg_connection *nc)
Definition: mongoose.h:6041
unsigned long prevline
Definition: mongoose.h:2776
const char ** error_string
Definition: mongoose.h:4145
uint8_t protocol_version
Definition: mongoose.h:5705
struct mg_coap_option * next
Definition: mongoose.h:6427
void cs_fprint_base64(FILE *f, const unsigned char *src, int src_len)
Definition: mongoose.c:360
struct mg_mgr * mgr
Definition: mongoose.h:3891
const struct mg_iface_vtable * main_iface
Definition: mongoose.h:3973
int mg_assemble_uri(const struct mg_str *scheme, const struct mg_str *user_info, const struct mg_str *host, unsigned int port, const struct mg_str *path, const struct mg_str *query, const struct mg_str *fragment, int normalize_path, struct mg_str *uri)
Definition: mongoose.c:5673
Definition: mongoose.h:5949
int mg_ssl_if_write(struct mg_connection *nc, const void *data, size_t len)
Definition: mongoose.c:5246
size_t len
Definition: mongoose.h:2223
void mg_hash_sha1_v(size_t num_msgs, const uint8_t *msgs[], const size_t *msg_lens, uint8_t *digest)
void * v
Definition: mongoose.h:3910
Definition: mongoose.h:6619