mirror of
https://github.com/obgm/libcoap.git
synced 2026-11-21 06:49:05 +03:00
When there is a limited stack size, having large data items on the stack can easily cause stack overflows. This makes integration with any constrained stack O/S a lot easier. include/coap2/coap_mutex.h: Create coap_ mutex functions which are platform independent to protect the (now) static variables if compiled with "-DCOAP_CONSTRAINED_STACK=1" Makefile.am: Include include/coap2/coap_mutex.h for distribution coap_config.h.contiki: coap_config.h.lwip: As CONTIKI and LWIP have constrained stacks, set "#define COAP_CONSTRAINED_STACK 1" src/coap_debug.c: src/coap_io.c: src/net.c: coap_show_pdu() coap_log_impl() coap_run_once() coap_read_session() coap_read_endpoint() Move large data items out of the functions' stack and make them static variables (defined within the function) if COAP_CONSTRAINED_STACK is defined. Protect the usage of these static variables by mutexes. Note: if "-DCOAP_CONSTRAINED_STACK=0" is used, then the stack will not be constrained.
28 lines
636 B
Plaintext
28 lines
636 B
Plaintext
#ifndef _CONFIG_H_
|
|
#define _CONFIG_H_
|
|
|
|
#include <lwip/opt.h>
|
|
#include <lwip/debug.h>
|
|
#include <lwip/def.h> /* provide ntohs, htons */
|
|
|
|
#define WITH_LWIP 1
|
|
|
|
#ifndef COAP_CONSTRAINED_STACK
|
|
#define COAP_CONSTRAINED_STACK 1
|
|
#endif
|
|
|
|
#define PACKAGE_NAME "libcoap-lwip"
|
|
#define PACKAGE_VERSION "?"
|
|
#define PACKAGE_STRING PACKAGE_NAME PACKAGE_VERSION
|
|
|
|
#define assert(x) LWIP_ASSERT("CoAP assert failed", x)
|
|
|
|
/* it's just provided by libc. i hope we don't get too many of those, as
|
|
* actually we'd need autotools again to find out what environment we're
|
|
* building in */
|
|
#define HAVE_STRNLEN 1
|
|
|
|
#define HAVE_LIMITS_H
|
|
|
|
#endif /* _CONFIG_H_ */
|