diff --git a/sys/include/net/nanocoap.h b/sys/include/net/nanocoap.h index f8fdd7a5e3..6bf964318f 100644 --- a/sys/include/net/nanocoap.h +++ b/sys/include/net/nanocoap.h @@ -395,6 +395,18 @@ static inline unsigned coap_get_token_len(const coap_pkt_t *pkt) return (pkt->hdr->ver_t_tkl & 0xf); } +/** + * @brief Get pointer to a message's token + * + * @param[in] pkt CoAP packet + * + * @returns pointer to the token position + */ +static inline void *coap_get_token(const coap_pkt_t *pkt) +{ + return (uint8_t*)pkt->hdr + sizeof(coap_hdr_t); +} + /** * @brief Get the total header length (4-byte header + token length) *