mirror of https://github.com/getdnsapi/getdns.git
Function to get the section of a rr_iter
This commit is contained in:
parent
d3f480009b
commit
fd9ead4fec
|
@ -31,8 +31,6 @@
|
|||
|
||||
#include "rr-iter.h"
|
||||
#include "config.h"
|
||||
#include <gldns/pkthdr.h>
|
||||
#include <gldns/gbuffer.h>
|
||||
|
||||
static void
|
||||
rr_iter_find_nxt(priv_getdns_rr_iter *i)
|
||||
|
@ -115,6 +113,7 @@ priv_getdns_rr_iter_next(priv_getdns_rr_iter *i)
|
|||
return find_rrtype(i);
|
||||
}
|
||||
|
||||
|
||||
static priv_getdns_rdf_iter *
|
||||
rdf_iter_find_nxt(priv_getdns_rdf_iter *i)
|
||||
{
|
||||
|
|
|
@ -34,6 +34,8 @@
|
|||
|
||||
#include "getdns/getdns.h"
|
||||
#include "rr-dict.h"
|
||||
#include "gldns/pkthdr.h"
|
||||
#include "gldns/gbuffer.h"
|
||||
|
||||
typedef struct priv_getdns_rr_iter {
|
||||
uint8_t *pkt;
|
||||
|
@ -62,6 +64,22 @@ priv_getdns_rr_iter *priv_getdns_rr_iter_init(priv_getdns_rr_iter *i,
|
|||
|
||||
priv_getdns_rr_iter *priv_getdns_rr_iter_next(priv_getdns_rr_iter *i);
|
||||
|
||||
static inline gldns_pkt_section
|
||||
priv_getdns_rr_iter_section(priv_getdns_rr_iter *i)
|
||||
{
|
||||
return i->n < GLDNS_QDCOUNT(i->pkt) ? LDNS_SECTION_QUESTION
|
||||
: i->n < GLDNS_QDCOUNT(i->pkt)
|
||||
+ GLDNS_ANCOUNT(i->pkt) ? GLDNS_SECTION_ANSWER
|
||||
: i->n < GLDNS_QDCOUNT(i->pkt)
|
||||
+ GLDNS_ANCOUNT(i->pkt)
|
||||
+ GLDNS_NSCOUNT(i->pkt) ? GLDNS_SECTION_AUTHORITY
|
||||
: i->n < GLDNS_QDCOUNT(i->pkt)
|
||||
+ GLDNS_ANCOUNT(i->pkt)
|
||||
+ GLDNS_NSCOUNT(i->pkt)
|
||||
+ GLDNS_ARCOUNT(i->pkt) ? GLDNS_SECTION_ADDITIONAL
|
||||
: GLDNS_SECTION_ANY;
|
||||
}
|
||||
|
||||
typedef struct piv_getdns_rdf_iter {
|
||||
uint8_t *pkt;
|
||||
uint8_t *pkt_end;
|
||||
|
@ -78,4 +96,5 @@ priv_getdns_rdf_iter *priv_getdns_rdf_iter_init(priv_getdns_rdf_iter *i,
|
|||
|
||||
priv_getdns_rdf_iter *priv_getdns_rdf_iter_next(priv_getdns_rdf_iter *i);
|
||||
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue