mirror of
https://github.com/obgm/libcoap.git
synced 2026-11-06 17:52:54 +03:00
include/coap2/coap_subscribe_internal.h and include/coap2/coap_session_internal.h contain the information not exposed to applications. This internal information was moved out of the respective include/coap2/subscribe.h and include/coap2/coap_session.h files comprising of the coap_subscription_t and coap_endpoint_t definitions. To ease inter .h file dependencies, a new file include/coap2/coap_forward_decls.h is added to include forward declarations for both libcoap and applications. Makefile.am: Include include/coap2/coap_*internal.h as files for distribution, but not installed for applications to use. Include include/coap2/coap_forward_decls.h, so it is installed for applications. include/coap2/coap.h.in: Include "coap_forward_decls.h" include/coap2/coap_forward_decls.h: (New) Forward declare structures and typedef the structures defined in coap_internal.h. include/coap2/coap_internal.h: (New) Includes all the required #include files that libcoap internally needs. include/coap2/coap_session_internal.h: (New) Include the coap_endpoint_t information taken from include/coap2/coap_session.h. include/coap2/coap_session.h: Remove coap_endpoint_t definition. include/coap2/lwippools.h: Add in coap_forward_decls.h and coap_internal.h to handle the LwIP memory allocations. include/coap2/resource.h: Add in "block.h" to allow things to build. include/coap2/coap_subscribe_internal.h: (New) Include the coap_subscription_t information taken from include/coap2/subscribe.h. include/coap2/subscribe.h: Remove coap_subscription_t definition. libcoap-2.map: libcoap-2.sym: Updated, removing coap_subscription_init(). src/address.c: src/asyn.c: src/block.c: src/coap_debug.c: src/coap_event.c: src/coap_gnutls.c: src/coap_hashkey.c: src/coap_io.c: src/coap_io_lwip.c: src/coap_notls.c: src/coap_openssl.c: src/coap_session.c: src/coap_time.c: src/coap_tinydtls.c: src/encode.c: src/mem.c: src/net.c: src/option.c: src/pdu.c: src/resource.c: src/str.c: src/subscribe.c: src/uri.c: Add in '#include "coap_internal.h"' to the source files. Remove other libcoap #include files. win32/libcoap.vcxproj: win32/libcoap.vcxproj.filters: Update for Windows build (not tested). examples/contiki/server.c: src/coap_io.c: Remove knowledge of endpoint from the server and update Contiki's version of coap_run_once() to do the work instead. ==== Other structures (plus some internal required #defines) will follow as separate PRs.
82 lines
2.5 KiB
C
82 lines
2.5 KiB
C
/*
|
|
* This file is part of the CoAP library libcoap. Please see README for terms
|
|
* of use.
|
|
*/
|
|
|
|
/* Memory pool definitions for the libcoap when used with lwIP (which has its
|
|
* own mechanism for quickly allocating chunks of data with known sizes). Has
|
|
* to be findable by lwIP (ie. an #include <lwippools.h> must either directly
|
|
* include this or include something more generic which includes this), and
|
|
* MEMP_USE_CUSTOM_POOLS has to be set in lwipopts.h. */
|
|
|
|
#include "coap_internal.h"
|
|
#include <net.h>
|
|
#include <resource.h>
|
|
#include <subscribe.h>
|
|
|
|
#ifndef MEMP_NUM_COAPCONTEXT
|
|
#define MEMP_NUM_COAPCONTEXT 1
|
|
#endif
|
|
|
|
#ifndef MEMP_NUM_COAPENDPOINT
|
|
#define MEMP_NUM_COAPENDPOINT 1
|
|
#endif
|
|
|
|
/* 1 is sufficient as this is very short-lived */
|
|
#ifndef MEMP_NUM_COAPPACKET
|
|
#define MEMP_NUM_COAPPACKET 1
|
|
#endif
|
|
|
|
#ifndef MEMP_NUM_COAPNODE
|
|
#define MEMP_NUM_COAPNODE 4
|
|
#endif
|
|
|
|
#ifndef MEMP_NUM_COAPPDU
|
|
#define MEMP_NUM_COAPPDU MEMP_NUM_COAPNODE
|
|
#endif
|
|
|
|
#ifndef MEMP_NUM_COAPSESSION
|
|
#define MEMP_NUM_COAPSESSION 2
|
|
#endif
|
|
|
|
#ifndef MEMP_NUM_COAP_SUBSCRIPTION
|
|
#define MEMP_NUM_COAP_SUBSCRIPTION 4
|
|
#endif
|
|
|
|
#ifndef MEMP_NUM_COAPRESOURCE
|
|
#define MEMP_NUM_COAPRESOURCE 10
|
|
#endif
|
|
|
|
#ifndef MEMP_NUM_COAPRESOURCEATTR
|
|
#define MEMP_NUM_COAPRESOURCEATTR 20
|
|
#endif
|
|
|
|
#ifndef MEMP_NUM_COAPOPTLIST
|
|
#define MEMP_NUM_COAPOPTLIST 1
|
|
#endif
|
|
|
|
#ifndef MEMP_LEN_COAPOPTLIST
|
|
#define MEMP_LEN_COAPOPTLIST 12
|
|
#endif
|
|
|
|
#ifndef MEMP_NUM_COAPSTRING
|
|
#define MEMP_NUM_COAPSTRING 10
|
|
#endif
|
|
|
|
#ifndef MEMP_LEN_COAPSTRING
|
|
#define MEMP_LEN_COAPSTRING 32
|
|
#endif
|
|
|
|
LWIP_MEMPOOL(COAP_CONTEXT, MEMP_NUM_COAPCONTEXT, sizeof(coap_context_t), "COAP_CONTEXT")
|
|
LWIP_MEMPOOL(COAP_ENDPOINT, MEMP_NUM_COAPENDPOINT, sizeof(coap_endpoint_t), "COAP_ENDPOINT")
|
|
LWIP_MEMPOOL(COAP_PACKET, MEMP_NUM_COAPPACKET, sizeof(coap_packet_t), "COAP_PACKET")
|
|
LWIP_MEMPOOL(COAP_NODE, MEMP_NUM_COAPNODE, sizeof(coap_queue_t), "COAP_NODE")
|
|
LWIP_MEMPOOL(COAP_PDU, MEMP_NUM_COAPPDU, sizeof(coap_pdu_t), "COAP_PDU")
|
|
LWIP_MEMPOOL(COAP_SESSION, MEMP_NUM_COAPSESSION, sizeof(coap_session_t), "COAP_SESSION")
|
|
LWIP_MEMPOOL(COAP_subscription, MEMP_NUM_COAP_SUBSCRIPTION, sizeof(coap_subscription_t), "COAP_subscription")
|
|
LWIP_MEMPOOL(COAP_RESOURCE, MEMP_NUM_COAPRESOURCE, sizeof(coap_resource_t), "COAP_RESOURCE")
|
|
LWIP_MEMPOOL(COAP_RESOURCEATTR, MEMP_NUM_COAPRESOURCEATTR, sizeof(coap_attr_t), "COAP_RESOURCEATTR")
|
|
LWIP_MEMPOOL(COAP_OPTLIST, MEMP_NUM_COAPOPTLIST, sizeof(coap_optlist_t)+MEMP_LEN_COAPOPTLIST, "COAP_OPTLIST")
|
|
LWIP_MEMPOOL(COAP_STRING, MEMP_NUM_COAPSTRING, sizeof(coap_string_t)+MEMP_LEN_COAPSTRING, "COAP_STRING")
|
|
|