From 2ddd8ce1a9e9a419bf80c5a1670a6640dd10c568 Mon Sep 17 00:00:00 2001 From: Lasse Lueder Date: Thu, 25 Oct 2018 09:50:26 +0200 Subject: [PATCH] net/nanocoap: define coap_data_ptr --- sys/include/net/nanocoap.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/sys/include/net/nanocoap.h b/sys/include/net/nanocoap.h index 37d10ee4ac..a459aeebfb 100644 --- a/sys/include/net/nanocoap.h +++ b/sys/include/net/nanocoap.h @@ -951,6 +951,18 @@ static inline unsigned coap_get_id(coap_pkt_t *pkt) return ntohs(pkt->hdr->id); } +/** + * @brief Get the start of data after the header + * + * @param[in] hdr Header of CoAP packet in contiguous memory + * + * @returns pointer to first byte after the header + */ +static inline uint8_t *coap_hdr_data_ptr(coap_hdr_t *hdr) +{ + return ((uint8_t *)hdr) + sizeof(coap_hdr_t); +} + /** * @brief Get the total header length (4-byte header + token length) *