You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

81 lines
2.4 KiB

From 265f4bb3d661b32fb3ec58712c48982bab433a52 Mon Sep 17 00:00:00 2001
From: Patrick Grosse <patrick.grosse@uni-muenster.de>
Date: Sat, 25 Mar 2017 10:35:03 +0100
Subject: [PATCH 3/6] change flag from DEBUG to MICROCOAP_DEBUG
---
coap.c | 8 ++++----
coap.h | 12 +++++++++++-
2 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/coap.c b/coap.c
index 4d036f5..407d1d2 100644
--- a/coap.c
+++ b/coap.c
@@ -9,7 +9,7 @@
extern void endpoint_setup(void);
extern const coap_endpoint_t endpoints[];
-#ifdef DEBUG
+#ifdef MICROCOAP_DEBUG
void coap_dumpHeader(coap_header_t *hdr)
{
printf("Header:\n");
@@ -21,7 +21,7 @@ void coap_dumpHeader(coap_header_t *hdr)
}
#endif
-#ifdef DEBUG
+#ifdef MICROCOAP_DEBUG
void coap_dump(const uint8_t *buf, size_t buflen, bool bare)
{
if (bare)
@@ -186,7 +186,7 @@ int coap_parseOptionsAndPayload(coap_option_t *options, uint8_t *numOptions, coa
return 0;
}
-#ifdef DEBUG
+#ifdef MICROCOAP_DEBUG
void coap_dumpOptions(coap_option_t *opts, size_t numopt)
{
size_t i;
@@ -200,7 +200,7 @@ void coap_dumpOptions(coap_option_t *opts, size_t numopt)
}
#endif
-#ifdef DEBUG
+#ifdef MICROCOAP_DEBUG
void coap_dumpPacket(coap_packet_t *pkt)
{
coap_dumpHeader(&pkt->hdr);
diff --git a/coap.h b/coap.h
index c67c7ce..8c91369 100644
--- a/coap.h
+++ b/coap.h
@@ -158,12 +158,22 @@ typedef struct
///////////////////////
+#ifdef MICROCOAP_DEBUG
void coap_dumpPacket(coap_packet_t *pkt);
+#else
+#define coap_dumpPacket(pkt)
+#endif
+
+#ifdef MICROCOAP_DEBUG
+void coap_dump(const uint8_t *buf, size_t buflen, bool bare);
+#else
+#define coap_dump(buf, buflen, bare)
+#endif
+
int coap_parse(coap_packet_t *pkt, const uint8_t *buf, size_t buflen);
int coap_buffer_to_string(char *strbuf, size_t strbuflen, const coap_buffer_t *buf);
const coap_option_t *coap_findOptions(const coap_packet_t *pkt, uint8_t num, uint8_t *count);
int coap_build(uint8_t *buf, size_t *buflen, const coap_packet_t *pkt);
-void coap_dump(const uint8_t *buf, size_t buflen, bool bare);
int coap_make_response(coap_rw_buffer_t *scratch, coap_packet_t *pkt, const uint8_t *content, size_t content_len, uint8_t msgid_hi, uint8_t msgid_lo, const coap_buffer_t* tok, coap_responsecode_t rspcode, coap_content_type_t content_type);
int coap_handle_req(coap_rw_buffer_t *scratch, const coap_packet_t *inpkt, coap_packet_t *outpkt);
void coap_option_nibble(uint32_t value, uint8_t *nibble);
--
2.7.4