1 /* 2 * This file is part of the CoAP library libcoap. Please see README for terms 3 * of use. 4 */ 5 6 /* Memory pool definitions for the libcoap when used with lwIP (which has its 7 * own mechanism for quickly allocating chunks of data with known sizes). Has 8 * to be findable by lwIP (ie. an #include <lwippools.h> must either directly 9 * include this or include something more generic which includes this), and 10 * MEMP_USE_CUSTOM_POOLS has to be set in lwipopts.h. */ 11 12 #include "coap_internal.h" 13 #include <net.h> 14 #include <resource.h> 15 #include <subscribe.h> 16 17 #ifndef MEMP_NUM_COAPCONTEXT 18 #define MEMP_NUM_COAPCONTEXT 4 19 #endif 20 21 #ifndef MEMP_NUM_COAPENDPOINT 22 #define MEMP_NUM_COAPENDPOINT 4 23 #endif 24 25 /* 1 is sufficient as this is very short-lived */ 26 #ifndef MEMP_NUM_COAPPACKET 27 #define MEMP_NUM_COAPPACKET 4 28 #endif 29 30 #ifndef MEMP_NUM_COAPNODE 31 #define MEMP_NUM_COAPNODE 4 32 #endif 33 34 #ifndef MEMP_NUM_COAPPDU 35 #define MEMP_NUM_COAPPDU MEMP_NUM_COAPNODE 36 #endif 37 38 #ifndef MEMP_NUM_COAPSESSION 39 #define MEMP_NUM_COAPSESSION 4 40 #endif 41 42 #ifndef MEMP_NUM_COAP_SUBSCRIPTION 43 #define MEMP_NUM_COAP_SUBSCRIPTION 1 44 #endif 45 46 #ifndef MEMP_NUM_COAPRESOURCE 47 #define MEMP_NUM_COAPRESOURCE 4 48 #endif 49 50 #ifndef MEMP_NUM_COAPRESOURCEATTR 51 #define MEMP_NUM_COAPRESOURCEATTR 2 52 #endif 53 54 #ifndef MEMP_NUM_COAPOPTLIST 55 #define MEMP_NUM_COAPOPTLIST 4 56 #endif 57 58 #ifndef MEMP_LEN_COAPOPTLIST 59 #define MEMP_LEN_COAPOPTLIST 12 60 #endif 61 62 #ifndef MEMP_NUM_COAPSTRING 63 #define MEMP_NUM_COAPSTRING 2 64 #endif 65 66 #ifndef MEMP_LEN_COAPSTRING 67 #define MEMP_LEN_COAPSTRING 16 68 #endif 69 70 LWIP_MEMPOOL(COAP_CONTEXT, MEMP_NUM_COAPCONTEXT, sizeof(coap_context_t), "COAP_CONTEXT") 71 LWIP_MEMPOOL(COAP_ENDPOINT, MEMP_NUM_COAPENDPOINT, sizeof(coap_endpoint_t), "COAP_ENDPOINT") 72 LWIP_MEMPOOL(COAP_PACKET, MEMP_NUM_COAPPACKET, sizeof(coap_packet_t), "COAP_PACKET") 73 LWIP_MEMPOOL(COAP_NODE, MEMP_NUM_COAPNODE, sizeof(coap_queue_t), "COAP_NODE") 74 LWIP_MEMPOOL(COAP_PDU, MEMP_NUM_COAPPDU, sizeof(coap_pdu_t), "COAP_PDU") 75 LWIP_MEMPOOL(COAP_SESSION, MEMP_NUM_COAPSESSION, sizeof(coap_session_t), "COAP_SESSION") 76 LWIP_MEMPOOL(COAP_subscription, MEMP_NUM_COAP_SUBSCRIPTION, sizeof(coap_subscription_t), "COAP_subscription") 77 LWIP_MEMPOOL(COAP_RESOURCE, MEMP_NUM_COAPRESOURCE, sizeof(coap_resource_t), "COAP_RESOURCE") 78 LWIP_MEMPOOL(COAP_RESOURCEATTR, MEMP_NUM_COAPRESOURCEATTR, sizeof(coap_attr_t), "COAP_RESOURCEATTR") 79 LWIP_MEMPOOL(COAP_OPTLIST, MEMP_NUM_COAPOPTLIST, sizeof(coap_optlist_t)+MEMP_LEN_COAPOPTLIST, "COAP_OPTLIST") 80 LWIP_MEMPOOL(COAP_STRING, MEMP_NUM_COAPSTRING, sizeof(coap_string_t)+MEMP_LEN_COAPSTRING, "COAP_STRING") 81 82