mirror of
https://github.com/obgm/libcoap.git
synced 2026-11-06 17:52:54 +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.