mirror of
https://github.com/obgm/libcoap.git
synced 2026-12-05 20:02:19 +03:00
Merge pull request #208 from mrdeep1/build-lwip
Update code to build LwIP and Contiki from the examples directory
This commit is contained in:
26 files changed
+537
-159
No files matched your search
@@ -30,7 +30,9 @@ typedef struct coap_address_t {
|
||||
ip_addr_t addr;
|
||||
} coap_address_t;
|
||||
|
||||
#define _coap_address_equals_impl(A, B) (!!ip_addr_cmp(&(A)->addr,&(B)->addr))
|
||||
#define _coap_address_equals_impl(A, B) \
|
||||
((A)->port == (B)->port \
|
||||
&& (!!ip_addr_cmp(&(A)->addr,&(B)->addr)))
|
||||
|
||||
#define _coap_address_isany_impl(A) ip_addr_isany(&(A)->addr)
|
||||
|
||||
|
||||
@@ -186,8 +186,11 @@ struct pbuf *coap_packet_extract_pbuf(struct coap_packet_t *packet);
|
||||
*/
|
||||
struct coap_packet_t {
|
||||
struct pbuf *pbuf;
|
||||
const coap_endpoint_t *local_interface;
|
||||
uint16_t srcport;
|
||||
const struct coap_endpoint_t *local_interface;
|
||||
coap_address_t src; /**< the packet's source address */
|
||||
coap_address_t dst; /**< the packet's destination address */
|
||||
int ifindex; /**< the interface index */
|
||||
// uint16_t srcport;
|
||||
};
|
||||
#else
|
||||
struct coap_packet_t {
|
||||
|
||||
@@ -119,7 +119,10 @@ void coap_log_impl(coap_log_t level, const char *format, ...);
|
||||
*
|
||||
* @param level One of the LOG_* values.
|
||||
*/
|
||||
#define coap_log(level, ...) do { if ((level)<=(int)coap_get_log_level()) coap_log_impl((level), __VA_ARGS__); } while(0)
|
||||
#define coap_log(level, ...) do { \
|
||||
if ((int)((level))<=(int)coap_get_log_level()) \
|
||||
coap_log_impl((level), __VA_ARGS__); \
|
||||
} while(0)
|
||||
#endif
|
||||
|
||||
/* A set of convenience macros for common log levels. */
|
||||
|
||||
@@ -51,6 +51,22 @@
|
||||
#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")
|
||||
@@ -60,3 +76,6 @@ LWIP_MEMPOOL(COAP_SESSION, MEMP_NUM_COAPSESSION, sizeof(coap_session_t), "COAP_S
|
||||
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")
|
||||
|
||||
+1
-1
@@ -294,7 +294,7 @@ typedef struct coap_pdu_t {
|
||||
size_t max_size; /**< maximum size for token, options and payload, or zero for variable size pdu */
|
||||
uint8_t *token; /**< first byte of token, if any, or options */
|
||||
uint8_t *data; /**< first byte of payload, if any */
|
||||
#ifdef LWIP
|
||||
#ifdef WITH_LWIP
|
||||
struct pbuf *pbuf; /**< lwIP PBUF. The package data will always reside
|
||||
* inside the pbuf's payload, but this pointer
|
||||
* has to be kept because no exact offset can be
|
||||
|
||||
Reference in new issue
Block a user