diff --git a/sys/include/net/nanocoap.h b/sys/include/net/nanocoap.h index 257e5ba491..a663379868 100644 --- a/sys/include/net/nanocoap.h +++ b/sys/include/net/nanocoap.h @@ -582,18 +582,6 @@ static inline void *coap_get_token(const coap_pkt_t *pkt) return coap_hdr_data_ptr(pkt->hdr); } -/** - * @brief Get the total header length (4-byte header + token length) - * - * @param[in] pkt CoAP packet - * - * @returns total header length - */ -static inline unsigned coap_get_total_hdr_len(const coap_pkt_t *pkt) -{ - return sizeof(coap_hdr_t) + coap_get_token_len(pkt); -} - /** * @brief Get the total length of a CoAP packet in the packet buffer * @@ -676,6 +664,19 @@ static inline uint8_t *coap_hdr_data_ptr(const coap_hdr_t *hdr) return ((uint8_t *)hdr) + sizeof(coap_hdr_t) + coap_hdr_tkl_ext_len(hdr); } +/** + * @brief Get the total header length (4-byte header + token length) + * + * @param[in] pkt CoAP packet + * + * @returns total header length + */ +static inline unsigned coap_get_total_hdr_len(const coap_pkt_t *pkt) +{ + return sizeof(coap_hdr_t) + coap_hdr_tkl_ext_len(pkt->hdr) + + coap_get_token_len(pkt); +} + /** * @brief Write the given raw message code to given CoAP header *