diff --git a/mongoose.c b/mongoose.c index e81ee37d..7e55896d 100644 --- a/mongoose.c +++ b/mongoose.c @@ -13727,7 +13727,9 @@ void mg_lwip_mgr_schedule_poll(struct mg_mgr *mgr); #include #include +#if CS_PLATFORM != CS_P_STM32 #include +#endif #include /* Amalgamated: #include "common/cs_dbg.h" */ @@ -13949,7 +13951,8 @@ void mg_lwip_if_connect_tcp(struct mg_connection *nc, * Lwip included in the SDKs for nRF5x chips has different type for the * callback of `udp_recv()` */ -#if CS_PLATFORM == CS_P_NRF51 || CS_PLATFORM == CS_P_NRF52 +#if CS_PLATFORM == CS_P_NRF51 || CS_PLATFORM == CS_P_NRF52 || \ + CS_PLATFORM == CS_P_STM32 static void mg_lwip_udp_recv_cb(void *arg, struct udp_pcb *pcb, struct pbuf *p, const ip_addr_t *addr, u16_t port) #else diff --git a/mongoose.h b/mongoose.h index bc5336bd..1ea14da0 100644 --- a/mongoose.h +++ b/mongoose.h @@ -1532,72 +1532,18 @@ char* inet_ntoa(struct in_addr in); #define CS_COMMON_PLATFORMS_PLATFORM_STM32_H_ #if CS_PLATFORM == CS_P_STM32 +#include #include +#include #include #include #include #include -/* - * Fake declarations to get c_hello compiling w/out network - * TODO(alashkin): remove this during working on stm32/cude networking - */ - -typedef int sock_t; - -struct in_addr{ - int s_addr; -}; - -struct sockaddr { - int sa_family; -}; - -struct sockaddr_in { - int sin_family; - int sin_port; - struct in_addr sin_addr; -}; - -#define INVALID_SOCKET -1 -#define SOCK_DGRAM -1 -#define SOCK_STREAM -1 -#define AF_INET -1 - #define to64(x) strtoll(x, NULL, 10) - -#define INT64_FMT "ld" +#define INT64_FMT PRId64 #define SIZE_T_FMT "u" -#define htonl(x) (x) -#define htons(x) (x) -#define ntohs(x) (x) -#define ntohl(x) (x) - -#define F_GETFL -1 -#define F_SETFL -1 -#define O_NONBLOCK -1 -#define fcntl(x1, x2, x3) (-1) -#define socket(x1, x2, x3) (-1) -#define connect(x1, x2, x3) (-1) -#define setsockopt(x1, x2, x3, x4, x5) (-1) -#define closesocket(x) -typedef int socklen_t; -#define accept(x1, x2, x3) (-1) -#define SOMAXCONN -1 -#define listen(x1, x2) (-1) -#define bind(x1, x2, x3) (-1) -#define getsockname(x1, x2, x3) (-1) -#define sendto(x1, x2, x3, x4, x5, x6) (-1) -#define send(x1, x2, x3, x4) (-1) -#define recvfrom(x1, x2, x3, x4, x5, x6) (-1) -#define getsockopt(x1, x2, x3, x4, x5) (-1) -#define getpeername(x1, x2, x3) (-1) -#define recv(s, b, l, f) (-1) -#define select(x1, x2, x3, x4, x5) (0) - -const char *inet_ntop(int af, const void *src, char *dst, int size); - #endif /* CS_PLATFORM == CS_P_STM32 */ #endif /* CS_COMMON_PLATFORMS_PLATFORM_STM32_H_ */ #ifdef MG_MODULE_LINES