mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-18 19:31:02 +00:00
Make mongoose more bare-metal Keil friendly. Declare settings after arch. Introduce MG_ENABLE_FILE
This commit is contained in:
1 parent
9e0f04dc8b
commit
30bfb245f5
13 files changed
+141
-123
No files matched your search
+96
-91
@@ -25,82 +25,6 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef MG_ENABLE_SOCKET
|
||||
#define MG_ENABLE_SOCKET 1
|
||||
#endif
|
||||
|
||||
#ifndef MG_ENABLE_MBEDTLS
|
||||
#define MG_ENABLE_MBEDTLS 0
|
||||
#endif
|
||||
|
||||
#ifndef MG_ENABLE_OPENSSL
|
||||
#define MG_ENABLE_OPENSSL 0
|
||||
#endif
|
||||
|
||||
#ifndef MG_ENABLE_CUSTOM_TLS
|
||||
#define MG_ENABLE_CUSTOM_TLS 0
|
||||
#endif
|
||||
|
||||
#ifndef MG_ENABLE_SSI
|
||||
#define MG_ENABLE_SSI 1
|
||||
#endif
|
||||
|
||||
#ifndef MG_ENABLE_IPV6
|
||||
#define MG_ENABLE_IPV6 0
|
||||
#endif
|
||||
|
||||
#ifndef MG_ENABLE_LOG
|
||||
#define MG_ENABLE_LOG 1
|
||||
#endif
|
||||
|
||||
#ifndef MG_ENABLE_MD5
|
||||
#define MG_ENABLE_MD5 0
|
||||
#endif
|
||||
|
||||
// Set MG_ENABLE_WINSOCK=0 for Win32 builds with external IP stack (like LWIP)
|
||||
#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_PACKED_FS
|
||||
#define MG_ENABLE_PACKED_FS 0
|
||||
#endif
|
||||
|
||||
// Granularity of the send/recv IO buffer growth
|
||||
#ifndef MG_IO_SIZE
|
||||
#define MG_IO_SIZE 2048
|
||||
#endif
|
||||
|
||||
// Maximum size of the recv IO buffer
|
||||
#ifndef MG_MAX_RECV_BUF_SIZE
|
||||
#define MG_MAX_RECV_BUF_SIZE (3 * 1024 * 1024)
|
||||
#endif
|
||||
|
||||
#ifndef MG_MAX_HTTP_HEADERS
|
||||
#define MG_MAX_HTTP_HEADERS 40
|
||||
#endif
|
||||
|
||||
#ifndef MG_HTTP_INDEX
|
||||
#define MG_HTTP_INDEX "index.html"
|
||||
#endif
|
||||
|
||||
#ifndef MG_PATH_MAX
|
||||
#define MG_PATH_MAX PATH_MAX
|
||||
#endif
|
||||
|
||||
#ifndef MG_SOCK_LISTEN_BACKLOG_SIZE
|
||||
#define MG_SOCK_LISTEN_BACKLOG_SIZE 128
|
||||
#endif
|
||||
|
||||
|
||||
#define MG_ARCH_CUSTOM 0
|
||||
#define MG_ARCH_UNIX 1
|
||||
#define MG_ARCH_WIN32 2
|
||||
@@ -205,11 +129,6 @@ static __inline struct tm *localtime_r(time_t *t, struct tm *tm) {
|
||||
#include <sys/types.h>
|
||||
#include <time.h>
|
||||
|
||||
#undef MG_PATH_MAX
|
||||
#undef MG_ENABLE_DIRLIST
|
||||
|
||||
#define MG_DIRSEP '/'
|
||||
#define MG_INT64_FMT "%lld"
|
||||
#define MG_PATH_MAX 128
|
||||
#define MG_ENABLE_DIRLIST 1
|
||||
|
||||
@@ -237,11 +156,6 @@ static __inline struct tm *localtime_r(time_t *t, struct tm *tm) {
|
||||
|
||||
#include <esp_system.h>
|
||||
|
||||
#undef MG_PATH_MAX
|
||||
#undef MG_ENABLE_DIRLIST
|
||||
|
||||
#define MG_DIRSEP '/'
|
||||
#define MG_INT64_FMT "%lld"
|
||||
#define MG_PATH_MAX 128
|
||||
#define MG_ENABLE_DIRLIST 1
|
||||
|
||||
@@ -321,9 +235,6 @@ static inline void *mg_calloc(int cnt, size_t size) {
|
||||
#include <FreeRTOS_Sockets.h>
|
||||
#include <task.h>
|
||||
|
||||
#define MG_INT64_FMT "%lld"
|
||||
#define MG_DIRSEP '/'
|
||||
|
||||
// Why FreeRTOS-TCP did not implement a clean BSD API, but its own thing
|
||||
// with FreeRTOS_ prefix, is beyond me
|
||||
#define IPPROTO_TCP FREERTOS_IPPROTO_TCP
|
||||
@@ -418,9 +329,7 @@ struct timeval {
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#define MG_DIRSEP '/'
|
||||
#define MG_INT64_FMT "%" PRId64
|
||||
#undef MG_ENABLE_DIRLIST
|
||||
#define MG_ENABLE_DIRLIST 1
|
||||
|
||||
#endif
|
||||
@@ -525,6 +434,102 @@ static __inline struct tm *localtime_r(time_t *t, struct tm *tm) {
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef MG_ENABLE_SOCKET
|
||||
#define MG_ENABLE_SOCKET 1
|
||||
#endif
|
||||
|
||||
#ifndef MG_ENABLE_MBEDTLS
|
||||
#define MG_ENABLE_MBEDTLS 0
|
||||
#endif
|
||||
|
||||
#ifndef MG_ENABLE_OPENSSL
|
||||
#define MG_ENABLE_OPENSSL 0
|
||||
#endif
|
||||
|
||||
#ifndef MG_ENABLE_CUSTOM_TLS
|
||||
#define MG_ENABLE_CUSTOM_TLS 0
|
||||
#endif
|
||||
|
||||
#ifndef MG_ENABLE_SSI
|
||||
#define MG_ENABLE_SSI 1
|
||||
#endif
|
||||
|
||||
#ifndef MG_ENABLE_IPV6
|
||||
#define MG_ENABLE_IPV6 0
|
||||
#endif
|
||||
|
||||
#ifndef MG_ENABLE_LOG
|
||||
#define MG_ENABLE_LOG 1
|
||||
#endif
|
||||
|
||||
#ifndef MG_ENABLE_MD5
|
||||
#define MG_ENABLE_MD5 0
|
||||
#endif
|
||||
|
||||
// Set MG_ENABLE_WINSOCK=0 for Win32 builds with external IP stack (like LWIP)
|
||||
#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_PACKED_FS
|
||||
#define MG_ENABLE_PACKED_FS 0
|
||||
#endif
|
||||
|
||||
// Granularity of the send/recv IO buffer growth
|
||||
#ifndef MG_IO_SIZE
|
||||
#define MG_IO_SIZE 2048
|
||||
#endif
|
||||
|
||||
// Maximum size of the recv IO buffer
|
||||
#ifndef MG_MAX_RECV_BUF_SIZE
|
||||
#define MG_MAX_RECV_BUF_SIZE (3 * 1024 * 1024)
|
||||
#endif
|
||||
|
||||
#ifndef MG_MAX_HTTP_HEADERS
|
||||
#define MG_MAX_HTTP_HEADERS 40
|
||||
#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_INT64_FMT
|
||||
#define MG_INT64_FMT "%lld"
|
||||
#endif
|
||||
|
||||
#ifndef MG_ENABLE_FILE
|
||||
#if defined(FOPEN_MAX)
|
||||
#define MG_ENABLE_FILE 1
|
||||
#else
|
||||
#define MG_ENABLE_FILE 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
Reference in new issue
Block a user