1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-16 01:53:51 +01:00

nanocoap: add coap_get_token()

This commit is contained in:
Benjamin Valentin 2022-04-21 14:42:32 +02:00
parent 7bad517360
commit 328d46277d

View File

@ -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)
*