Commit bbcf0f92 authored by Jan Včelák's avatar Jan Včelák 🚀

pkt: add knot_pkt_rr_offset() to get RR position in wire

parent 4718d143
......@@ -599,6 +599,16 @@ const knot_rrset_t *knot_pkt_rr(const knot_pktsection_t *section, uint16_t i)
return section->pkt->rr + section->pos + i;
}
_public_
uint16_t knot_pkt_rr_offset(const knot_pktsection_t *section, uint16_t i)
{
if (section == NULL || section->pkt == NULL) {
return -1;
}
return section->pkt->rr_info[section->pos + i].pos;
}
_public_
int knot_pkt_parse(knot_pkt_t *pkt, unsigned flags)
{
......
......@@ -245,6 +245,10 @@ const knot_pktsection_t *knot_pkt_section(const knot_pkt_t *pkt,
/*! \brief Get RRSet from the packet section. */
const knot_rrset_t *knot_pkt_rr(const knot_pktsection_t *section, uint16_t i);
/*! \brief Get RRSet offset in the packet wire. */
uint16_t knot_pkt_rr_offset(const knot_pktsection_t *section, uint16_t i);
/*
* Packet parsing API.
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment