diff --git a/sys/net/application_layer/cord/ep/cord_ep.c b/sys/net/application_layer/cord/ep/cord_ep.c index 42e47a77c9beb..58a6fdd76dd6d 100644 --- a/sys/net/application_layer/cord/ep/cord_ep.c +++ b/sys/net/application_layer/cord/ep/cord_ep.c @@ -18,6 +18,7 @@ * @} */ +#include #include #include "mutex.h" @@ -28,15 +29,11 @@ #include "net/ipv6/addr.h" #include "net/cord/ep.h" #include "net/cord/common.h" -#include "net/cord/config.h" #ifdef MODULE_CORD_EP_STANDALONE #include "net/cord/ep_standalone.h" #endif -#define ENABLE_DEBUG 0 -#include "debug.h" - #define FLAG_SUCCESS (0x0001) #define FLAG_TIMEOUT (0x0002) #define FLAG_ERR (0x0004) @@ -87,7 +84,7 @@ static void _on_register(const gcoap_request_memo_t *memo, coap_pkt_t* pdu, thread_flags_t flag = FLAG_ERR; if ((memo->state == GCOAP_MEMO_RESP) && - (pdu->hdr->code == COAP_CODE_CREATED)) { + (coap_get_code_raw(pdu) == COAP_CODE_CREATED)) { /* read the location header and save the RD details on success */ if (coap_get_location_path(pdu, (uint8_t *)_rd_loc, sizeof(_rd_loc)) > 0) { @@ -110,7 +107,7 @@ static void _on_update_remove(unsigned req_state, coap_pkt_t *pdu, uint8_t code) { thread_flags_t flag = FLAG_ERR; - if ((req_state == GCOAP_MEMO_RESP) && (pdu->hdr->code == code)) { + if ((req_state == GCOAP_MEMO_RESP) && (coap_get_code_raw(pdu) == code)) { flag = FLAG_SUCCESS; } else if (req_state == GCOAP_MEMO_TIMEOUT) { @@ -147,7 +144,7 @@ static int _update_remove(unsigned code, gcoap_resp_handler_t handle) if (res < 0) { return CORD_EP_ERR; } - coap_hdr_set_type(pkt.hdr, COAP_TYPE_CON); + coap_pkt_set_type(&pkt, COAP_TYPE_CON); ssize_t pkt_len = coap_opt_finish(&pkt, COAP_OPT_FINISH_NONE); /* send request */ @@ -223,7 +220,7 @@ static int _discover_internal(const sock_udp_ep_t *remote, if (res < 0) { return CORD_EP_ERR; } - coap_hdr_set_type(pkt.hdr, COAP_TYPE_CON); + coap_pkt_set_type(&pkt, COAP_TYPE_CON); coap_opt_add_uri_query(&pkt, "rt", "core.rd"); size_t pkt_len = coap_opt_finish(&pkt, COAP_OPT_FINISH_NONE); res = gcoap_req_send(buf, pkt_len, remote, NULL, _on_discover, NULL, GCOAP_SOCKET_TYPE_UNDEF); @@ -277,7 +274,7 @@ int cord_ep_register(const sock_udp_ep_t *remote, const char *regif) goto end; } /* set some packet options and write query string */ - coap_hdr_set_type(pkt.hdr, COAP_TYPE_CON); + coap_pkt_set_type(&pkt, COAP_TYPE_CON); coap_opt_add_uint(&pkt, COAP_OPT_CONTENT_FORMAT, COAP_FORMAT_LINK); res = cord_common_add_qstring(&pkt); if (res < 0) { diff --git a/sys/net/application_layer/cord/epsim/cord_epsim.c b/sys/net/application_layer/cord/epsim/cord_epsim.c index 0f24d4b91ad74..742d0f247148f 100644 --- a/sys/net/application_layer/cord/epsim/cord_epsim.c +++ b/sys/net/application_layer/cord/epsim/cord_epsim.c @@ -23,9 +23,7 @@ #include "assert.h" #include "net/gcoap.h" #include "net/cord/epsim.h" -#include "net/cord/config.h" #include "net/cord/common.h" -#include "net/ipv6/addr.h" #define BUFSIZE (128U) @@ -59,7 +57,7 @@ int cord_epsim_register(const sock_udp_ep_t *rd_ep) return CORD_EPSIM_ERROR; } /* make packet confirmable */ - coap_hdr_set_type(pkt.hdr, COAP_TYPE_CON); + coap_pkt_set_type(&pkt, COAP_TYPE_CON); /* add Uri-Query options */ if (cord_common_add_qstring(&pkt) < 0) { return CORD_EPSIM_ERROR; diff --git a/sys/net/application_layer/cord/lc/cord_lc.c b/sys/net/application_layer/cord/lc/cord_lc.c index 72d8fd9f0ed30..2a103a28de937 100644 --- a/sys/net/application_layer/cord/lc/cord_lc.c +++ b/sys/net/application_layer/cord/lc/cord_lc.c @@ -183,7 +183,7 @@ static ssize_t _lookup_raw(const cord_lc_rd_t *rd, unsigned content_format, DEBUG("cord_lc: unsupported content format\n"); return CORD_LC_ERR; } - coap_hdr_set_type(pkt.hdr, COAP_TYPE_CON); + coap_pkt_set_type(&pkt, COAP_TYPE_CON); coap_opt_add_uint(&pkt, COAP_OPT_ACCEPT, content_format); pkt_len = coap_opt_finish(&pkt, COAP_OPT_FINISH_NONE); @@ -251,7 +251,7 @@ static int _send_rd_init_req(coap_pkt_t *pkt, const sock_udp_ep_t *remote, return CORD_LC_ERR; } - coap_hdr_set_type(pkt->hdr, COAP_TYPE_CON); + coap_pkt_set_type(pkt, COAP_TYPE_CON); coap_opt_add_uri_query(pkt, "rt", "core.rd-lookup-*"); ssize_t pkt_len = coap_opt_finish(pkt, COAP_OPT_FINISH_NONE);