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 <net.h> 13 #include <resource.h> 14 #include <subscribe.h> 15 16 #ifndef MEMP_NUM_COAPCONTEXT 17 #define MEMP_NUM_COAPCONTEXT 1 18 #endif 19 20 #ifndef MEMP_NUM_COAPENDPOINT 21 #define MEMP_NUM_COAPENDPOINT 1 22 #endif 23 24 /* 1 is sufficient as this is very short-lived */ 25 #ifndef MEMP_NUM_COAPPACKET 26 #define MEMP_NUM_COAPPACKET 1 27 #endif 28 29 #ifndef MEMP_NUM_COAPNODE 30 #define MEMP_NUM_COAPNODE 4 31 #endif 32 33 #ifndef MEMP_NUM_COAPPDU 34 #define MEMP_NUM_COAPPDU MEMP_NUM_COAPNODE 35 #endif 36 37 #ifndef MEMP_NUM_COAP_SUBSCRIPTION 38 #define MEMP_NUM_COAP_SUBSCRIPTION 4 39 #endif 40 41 #ifndef MEMP_NUM_COAPRESOURCE 42 #define MEMP_NUM_COAPRESOURCE 10 43 #endif 44 45 #ifndef MEMP_NUM_COAPRESOURCEATTR 46 #define MEMP_NUM_COAPRESOURCEATTR 20 47 #endif 48 49 LWIP_MEMPOOL(COAP_CONTEXT, MEMP_NUM_COAPCONTEXT, sizeof(coap_context_t), "COAP_CONTEXT") 50 LWIP_MEMPOOL(COAP_ENDPOINT, MEMP_NUM_COAPENDPOINT, sizeof(coap_endpoint_t), "COAP_ENDPOINT") 51 LWIP_MEMPOOL(COAP_PACKET, MEMP_NUM_COAPPACKET, sizeof(coap_packet_t), "COAP_PACKET") 52 LWIP_MEMPOOL(COAP_NODE, MEMP_NUM_COAPNODE, sizeof(coap_queue_t), "COAP_NODE") 53 LWIP_MEMPOOL(COAP_PDU, MEMP_NUM_COAPPDU, sizeof(coap_pdu_t), "COAP_PDU") 54 LWIP_MEMPOOL(COAP_subscription, MEMP_NUM_COAP_SUBSCRIPTION, sizeof(coap_subscription_t), "COAP_subscription") 55 LWIP_MEMPOOL(COAP_RESOURCE, MEMP_NUM_COAPRESOURCE, sizeof(coap_resource_t), "COAP_RESOURCE") 56 LWIP_MEMPOOL(COAP_RESOURCEATTR, MEMP_NUM_COAPRESOURCEATTR, sizeof(coap_attr_t), "COAP_RESOURCEATTR") 57