mirror of
https://github.com/cesanta/mongoose.git
synced 2026-10-08 08:54:54 +07:00
217 lines
4.7 KiB
C
217 lines
4.7 KiB
C
#pragma once
|
|
|
|
#ifndef MG_ENABLE_LOG
|
|
#define MG_ENABLE_LOG 1
|
|
#endif
|
|
|
|
#ifndef MG_ENABLE_CUSTOM_CALLOC
|
|
#define MG_ENABLE_CUSTOM_CALLOC 0
|
|
#endif
|
|
|
|
#ifndef MG_ENABLE_CUSTOM_LOG
|
|
#define MG_ENABLE_CUSTOM_LOG 0 // Let user define their own MG_LOG
|
|
#endif
|
|
|
|
#ifndef MG_ENABLE_TCPIP
|
|
#define MG_ENABLE_TCPIP 0 // Mongoose built-in network stack
|
|
#endif
|
|
|
|
#ifndef MG_ENABLE_LWIP
|
|
#define MG_ENABLE_LWIP 0 // lWIP network stack
|
|
#endif
|
|
|
|
#ifndef MG_ENABLE_FREERTOS_TCP
|
|
#define MG_ENABLE_FREERTOS_TCP 0 // Amazon FreeRTOS-TCP network stack
|
|
#endif
|
|
|
|
#ifndef MG_ENABLE_RL
|
|
#define MG_ENABLE_RL 0 // ARM MDK network stack
|
|
#endif
|
|
|
|
#ifndef MG_ENABLE_SOCKET
|
|
#define MG_ENABLE_SOCKET !MG_ENABLE_TCPIP
|
|
#endif
|
|
|
|
#ifndef MG_ENABLE_POLL
|
|
#define MG_ENABLE_POLL 0
|
|
#endif
|
|
|
|
#ifndef MG_ENABLE_EPOLL
|
|
#define MG_ENABLE_EPOLL 0
|
|
#endif
|
|
|
|
#ifndef MG_ENABLE_FATFS
|
|
#define MG_ENABLE_FATFS 0
|
|
#endif
|
|
|
|
#ifndef MG_ENABLE_SSI
|
|
#define MG_ENABLE_SSI 0
|
|
#endif
|
|
|
|
#ifndef MG_ENABLE_IPV6
|
|
#define MG_ENABLE_IPV6 0
|
|
#endif
|
|
|
|
#ifndef MG_IPV6_V6ONLY
|
|
#define MG_IPV6_V6ONLY 0 // IPv6 socket binds only to V6, not V4 address
|
|
#endif
|
|
|
|
#ifndef MG_ENABLE_MD5
|
|
#define MG_ENABLE_MD5 1
|
|
#endif
|
|
|
|
// Set MG_ENABLE_WINSOCK=0 for Win32 builds with other external IP stack not
|
|
// mentioned in arch_win32.h
|
|
#ifndef MG_ENABLE_WINSOCK
|
|
#define MG_ENABLE_WINSOCK 1
|
|
#endif
|
|
|
|
#ifndef MG_ENABLE_DIRLIST
|
|
#define MG_ENABLE_DIRLIST 0
|
|
#endif
|
|
|
|
#ifndef MG_ENABLE_CUSTOM_RANDOM
|
|
#define MG_ENABLE_CUSTOM_RANDOM 0
|
|
#endif
|
|
|
|
#ifndef MG_ENABLE_CUSTOM_MILLIS
|
|
#define MG_ENABLE_CUSTOM_MILLIS 0
|
|
#endif
|
|
|
|
#ifndef MG_ENABLE_PACKED_FS
|
|
#define MG_ENABLE_PACKED_FS 0
|
|
#endif
|
|
|
|
#ifndef MG_ENABLE_ASSERT
|
|
#define MG_ENABLE_ASSERT 0
|
|
#endif
|
|
|
|
#ifndef MG_IO_SIZE
|
|
#define MG_IO_SIZE 512 // Granularity of the send/recv IO buffer growth
|
|
#endif
|
|
|
|
#ifndef MG_MAX_RECV_SIZE
|
|
#define MG_MAX_RECV_SIZE (3UL * 1024UL * 1024UL) // Maximum recv IO buffer size
|
|
#endif
|
|
|
|
#ifndef MG_DATA_SIZE
|
|
#define MG_DATA_SIZE 32 // struct mg_connection :: data size
|
|
#endif
|
|
|
|
#ifndef MG_MAX_HTTP_HEADERS
|
|
#define MG_MAX_HTTP_HEADERS 30
|
|
#endif
|
|
|
|
#ifndef MG_HTTP_INDEX
|
|
#define MG_HTTP_INDEX "index.html"
|
|
#endif
|
|
|
|
#ifndef MG_PATH_MAX
|
|
#ifdef PATH_MAX
|
|
#define MG_PATH_MAX PATH_MAX
|
|
#else
|
|
#define MG_PATH_MAX 128
|
|
#endif
|
|
#endif
|
|
|
|
#ifndef MG_SOCK_LISTEN_BACKLOG_SIZE
|
|
#define MG_SOCK_LISTEN_BACKLOG_SIZE 128
|
|
#endif
|
|
|
|
#ifndef MG_DIRSEP
|
|
#define MG_DIRSEP '/'
|
|
#endif
|
|
|
|
#ifndef MG_ENABLE_POSIX_FS
|
|
#define MG_ENABLE_POSIX_FS 0
|
|
#endif
|
|
|
|
#ifndef MG_INVALID_SOCKET
|
|
#define MG_INVALID_SOCKET (-1)
|
|
#endif
|
|
|
|
#ifndef MG_SOCKET_TYPE
|
|
#define MG_SOCKET_TYPE int
|
|
#endif
|
|
|
|
#ifndef MG_SOCKET_ERRNO
|
|
#define MG_SOCKET_ERRNO errno
|
|
#endif
|
|
|
|
#if MG_ENABLE_EPOLL
|
|
#define MG_EPOLL_ADD(c) \
|
|
do { \
|
|
struct epoll_event ev = {EPOLLIN | EPOLLERR | EPOLLHUP, {c}}; \
|
|
epoll_ctl(c->mgr->epoll_fd, EPOLL_CTL_ADD, (int) (size_t) c->fd, &ev); \
|
|
} while (0)
|
|
#define MG_EPOLL_MOD(c, wr) \
|
|
do { \
|
|
struct epoll_event ev = {EPOLLIN | EPOLLERR | EPOLLHUP, {c}}; \
|
|
if (wr) ev.events |= EPOLLOUT; \
|
|
epoll_ctl(c->mgr->epoll_fd, EPOLL_CTL_MOD, (int) (size_t) c->fd, &ev); \
|
|
} while (0)
|
|
#else
|
|
#define MG_EPOLL_ADD(c)
|
|
#define MG_EPOLL_MOD(c, wr)
|
|
#endif
|
|
|
|
#ifndef MG_ENABLE_PROFILE
|
|
#define MG_ENABLE_PROFILE 0
|
|
#endif
|
|
|
|
#ifndef MG_ENABLE_TCPIP_DRIVER_INIT // mg_mgr_init() will also initialize
|
|
#define MG_ENABLE_TCPIP_DRIVER_INIT 1 // enabled built-in driver for
|
|
#endif // Mongoose built-in network stack
|
|
|
|
#ifndef MG_TCPIP_IP // e.g. MG_IPV4(192, 168, 0, 223)
|
|
#define MG_TCPIP_IP MG_IPV4(0, 0, 0, 0) // Default is 0.0.0.0 (DHCP)
|
|
#endif
|
|
|
|
#ifndef MG_TCPIP_MASK
|
|
#define MG_TCPIP_MASK MG_IPV4(0, 0, 0, 0) // Default is 0.0.0.0 (DHCP)
|
|
#endif
|
|
|
|
#ifndef MG_TCPIP_GW
|
|
#define MG_TCPIP_GW MG_IPV4(0, 0, 0, 0) // Default is 0.0.0.0 (DHCP)
|
|
#endif
|
|
|
|
#if MG_ENABLE_IPV6
|
|
|
|
#ifndef MG_TCPIP_GLOBAL
|
|
#define MG_TCPIP_GLOBAL MG_IPV6(0, 0, 0, 0, 0, 0, 0, 0)
|
|
#endif
|
|
|
|
#ifndef MG_TCPIP_IPV6_LINKLOCAL
|
|
#define MG_TCPIP_IPV6_LINKLOCAL MG_IPV6(0, 0, 0, 0, 0, 0, 0, 0)
|
|
#endif
|
|
|
|
#ifndef MG_TCPIP_PREFIX_LEN
|
|
#define MG_TCPIP_PREFIX_LEN 0
|
|
#endif
|
|
|
|
#ifndef MG_TCPIP_GW6
|
|
#define MG_TCPIP_GW6 MG_IPV6(0, 0, 0, 0, 0, 0, 0, 0)
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#ifndef MG_SET_MAC_ADDRESS
|
|
#define MG_SET_MAC_ADDRESS(mac)
|
|
#endif
|
|
|
|
#ifndef MG_TCPIP_DHCPNAME_SIZE
|
|
#define MG_TCPIP_DHCPNAME_SIZE 18 // struct mg_tcpip_if :: dhcp_name size
|
|
#endif
|
|
|
|
#ifndef MG_SET_WIFI_CONFIG
|
|
#define MG_SET_WIFI_CONFIG(data)
|
|
#endif
|
|
|
|
#ifndef MG_ENABLE_TCPIP_PRINT_DEBUG_STATS
|
|
#define MG_ENABLE_TCPIP_PRINT_DEBUG_STATS 0
|
|
#endif
|
|
|
|
#ifndef MG_ENABLE_CHACHA20
|
|
#define MG_ENABLE_CHACHA20 1 // When set to 0, GCM is used. For MG_TLS_BUILTIN
|
|
#endif
|