ldns  1.9.2
packet.h
Go to the documentation of this file.
1 /*
2  * packet.h
3  *
4  * DNS packet definitions
5  *
6  * a Net::DNS like library for C
7  *
8  * (c) NLnet Labs, 2005-2006
9  *
10  * See the file LICENSE for the license
11  */
12 
21 #ifndef LDNS_PACKET_H
22 #define LDNS_PACKET_H
23 
24 #define LDNS_MAX_PACKETLEN 65535
25 
26 /* allow flags to be given to ldns_pkt_query_new */
27 #define LDNS_QR 1 /* Query Response flag */
28 #define LDNS_AA 2 /* Authoritative Answer - server flag */
29 #define LDNS_TC 4 /* TrunCated - server flag */
30 #define LDNS_RD 8 /* Recursion Desired - query flag */
31 #define LDNS_CD 16 /* Checking Disabled - query flag */
32 #define LDNS_RA 32 /* Recursion Available - server flag */
33 #define LDNS_AD 64 /* Authenticated Data - server flag */
34 
35 #include <ldns/error.h>
36 #include <ldns/common.h>
37 #include <ldns/rr.h>
38 #include <ldns/edns.h>
39 #include <sys/time.h>
40 
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44 
45 /* opcodes for pkt's */
49  LDNS_PACKET_STATUS = 2, /* there is no 3?? DNS is weird */
52 };
54 
55 /* rcodes for pkts */
68 };
70 
194 {
196  uint16_t _id;
198  bool _qr;
200  bool _aa;
202  bool _tc;
204  bool _rd;
206  bool _cd;
208  bool _ra;
210  bool _ad;
212  ldns_pkt_opcode _opcode; /* XXX 8 bits? */
214  uint8_t _rcode;
216  uint16_t _qdcount;
218  uint16_t _ancount;
220  uint16_t _nscount;
222  uint16_t _arcount;
223 };
224 typedef struct ldns_struct_hdr ldns_hdr;
225 
235 {
238  /* extra items needed in a packet */
242  struct timeval timestamp;
244  uint32_t _querytime;
246  size_t _size;
250  uint16_t _edns_udp_size;
254  uint8_t _edns_version;
255  /* OPT pseudo-RR presence flag */
256  uint8_t _edns_present;
258  uint16_t _edns_z;
271 };
272 typedef struct ldns_struct_pkt ldns_pkt;
273 
286 };
288 
299 };
300 typedef enum ldns_enum_pkt_type ldns_pkt_type;
301 
302 /* prototypes */
303 
304 /* read */
305 
311 uint16_t ldns_pkt_id(const ldns_pkt *p);
317 bool ldns_pkt_qr(const ldns_pkt *p);
323 bool ldns_pkt_aa(const ldns_pkt *p);
329 bool ldns_pkt_tc(const ldns_pkt *p);
335 bool ldns_pkt_rd(const ldns_pkt *p);
341 bool ldns_pkt_cd(const ldns_pkt *p);
347 bool ldns_pkt_ra(const ldns_pkt *p);
353 bool ldns_pkt_ad(const ldns_pkt *p);
371 uint16_t ldns_pkt_qdcount(const ldns_pkt *p);
377 uint16_t ldns_pkt_ancount(const ldns_pkt *p);
383 uint16_t ldns_pkt_nscount(const ldns_pkt *p);
389 uint16_t ldns_pkt_arcount(const ldns_pkt *p);
390 
397 
403 struct timeval ldns_pkt_timestamp(const ldns_pkt *p);
409 uint32_t ldns_pkt_querytime(const ldns_pkt *p);
410 
416 size_t ldns_pkt_size(const ldns_pkt *p);
417 
427 uint16_t ldns_pkt_section_count(const ldns_pkt *p, ldns_pkt_section s);
428 
434 ldns_rr *ldns_pkt_tsig(const ldns_pkt *p);
435 
474 
483 
512 
513 
520 bool ldns_pkt_rr(const ldns_pkt *pkt, ldns_pkt_section sec, const ldns_rr *rr);
521 
522 
529 bool ldns_pkt_set_flags(ldns_pkt *pkt, uint16_t flags);
530 
536 void ldns_pkt_set_id(ldns_pkt *p, uint16_t id);
547 void ldns_pkt_set_qr(ldns_pkt *p, bool b);
553 void ldns_pkt_set_aa(ldns_pkt *p, bool b);
559 void ldns_pkt_set_tc(ldns_pkt *p, bool b);
565 void ldns_pkt_set_rd(ldns_pkt *p, bool b);
571 void ldns_pkt_set_cd(ldns_pkt *p, bool b);
577 void ldns_pkt_set_ra(ldns_pkt *p, bool b);
583 void ldns_pkt_set_ad(ldns_pkt *p, bool b);
584 
596 void ldns_pkt_set_rcode(ldns_pkt *p, uint8_t c);
602 void ldns_pkt_set_qdcount(ldns_pkt *p, uint16_t c);
608 void ldns_pkt_set_ancount(ldns_pkt *p, uint16_t c);
614 void ldns_pkt_set_nscount(ldns_pkt *p, uint16_t c);
620 void ldns_pkt_set_arcount(ldns_pkt *p, uint16_t c);
632 void ldns_pkt_set_querytime(ldns_pkt *p, uint32_t t);
638 void ldns_pkt_set_size(ldns_pkt *p, size_t s);
639 
645 void ldns_pkt_set_timestamp(ldns_pkt *p, struct timeval timeval);
658 void ldns_pkt_set_tsig(ldns_pkt *p, ldns_rr *t);
659 
667 
673 uint16_t ldns_pkt_edns_udp_size(const ldns_pkt *packet);
679 uint8_t ldns_pkt_edns_extended_rcode(const ldns_pkt *packet);
685 uint8_t ldns_pkt_edns_version(const ldns_pkt *packet);
691 uint16_t ldns_pkt_edns_z(const ldns_pkt *packet);
697 ldns_rdf *ldns_pkt_edns_data(const ldns_pkt *packet);
698 
704 bool ldns_pkt_edns_do(const ldns_pkt *packet);
710 void ldns_pkt_set_edns_do(ldns_pkt *packet, bool value);
711 
717 bool ldns_pkt_edns_co(const ldns_pkt *packet);
723 void ldns_pkt_set_edns_co(ldns_pkt *packet, bool value);
724 
728 uint16_t ldns_pkt_edns_unassigned(const ldns_pkt *packet);
729 
735 void ldns_pkt_set_edns_unassigned(ldns_pkt *packet, uint16_t value);
736 
746 bool ldns_pkt_edns(const ldns_pkt *packet);
747 
757 
763 void ldns_pkt_set_edns_udp_size(ldns_pkt *packet, uint16_t s);
769 void ldns_pkt_set_edns_extended_rcode(ldns_pkt *packet, uint8_t c);
775 void ldns_pkt_set_edns_version(ldns_pkt *packet, uint8_t v);
781 void ldns_pkt_set_edns_z(ldns_pkt *packet, uint16_t z);
787 void ldns_pkt_set_edns_data(ldns_pkt *packet, ldns_rdf *data);
788 
796 
801 ldns_pkt *ldns_pkt_new(void);
802 
808 void ldns_pkt_free(ldns_pkt *packet);
809 
819 ldns_status ldns_pkt_query_new_frm_str(ldns_pkt **p, const char *rr_name, ldns_rr_type rr_type, ldns_rr_class rr_class , uint16_t flags);
820 
831 ldns_status ldns_pkt_ixfr_request_new_frm_str(ldns_pkt **p, const char *rr_name, ldns_rr_class rr_class, uint16_t flags, ldns_rr* soa);
832 
842 ldns_pkt *ldns_pkt_query_new(ldns_rdf *rr_name, ldns_rr_type rr_type, ldns_rr_class rr_class, uint16_t flags);
843 
854 ldns_pkt *ldns_pkt_ixfr_request_new(ldns_rdf *rr_name, ldns_rr_class rr_class, uint16_t flags, ldns_rr* soa);
855 
862 ldns_pkt *ldns_pkt_clone(const ldns_pkt *pkt);
863 
870 
877 
884 
891 
899 bool ldns_pkt_push_rr(ldns_pkt *packet, ldns_pkt_section section, ldns_rr *rr);
900 
909 
917 bool ldns_pkt_push_rr_list(ldns_pkt *packet, ldns_pkt_section section, ldns_rr_list *list);
918 
927 
933 bool ldns_pkt_empty(ldns_pkt *p);
934 
935 #ifdef __cplusplus
936 }
937 #endif
938 
939 #endif /* LDNS_PACKET_H */
Common definitions for LDNS.
Defines error numbers and functions to translate those to a readable string.
enum ldns_enum_status ldns_status
Definition: error.h:152
enum ldns_enum_pkt_type ldns_pkt_type
Definition: packet.h:300
ldns_pkt * ldns_pkt_clone(const ldns_pkt *pkt)
clones the given packet, creating a fully allocated copy
Definition: packet.c:1236
signed char ldns_pkt_edns(const ldns_pkt *packet)
returns true if this packet needs and EDNS rr to be sent.
Definition: packet.c:769
void ldns_pkt_free(ldns_pkt *packet)
frees the packet structure and all data that it contains.
Definition: packet.c:917
uint8_t ldns_pkt_edns_version(const ldns_pkt *packet)
return the packet's edns version
Definition: packet.c:222
ldns_rr_list * ldns_pkt_get_section_clone(const ldns_pkt *p, ldns_pkt_section s)
return all the rr_list's in the packet.
Definition: packet.c:463
signed char ldns_pkt_aa(const ldns_pkt *p)
Read the packet's aa bit.
Definition: packet.c:55
void ldns_pkt_set_ad(ldns_pkt *p, signed char b)
Set the packet's ad bit.
Definition: packet.c:564
void ldns_pkt_set_timestamp(ldns_pkt *p, struct timeval timeval)
Set the packet's timestamp.
Definition: packet.c:618
uint16_t ldns_pkt_section_count(const ldns_pkt *p, ldns_pkt_section s)
Return the number of RRs in the given section.
Definition: packet.c:423
signed char ldns_pkt_set_flags(ldns_pkt *pkt, uint16_t flags)
sets the flags in a packet.
Definition: packet.c:934
void ldns_pkt_set_size(ldns_pkt *p, size_t s)
Set the packet's size.
Definition: packet.c:625
void ldns_pkt_set_cd(ldns_pkt *p, signed char b)
Set the packet's cd bit.
Definition: packet.c:552
size_t ldns_pkt_size(const ldns_pkt *p)
Return the packet's size in bytes.
Definition: packet.c:186
ldns_rr * ldns_pkt_tsig(const ldns_pkt *p)
Return the packet's tsig pseudo rr's.
Definition: packet.c:484
signed char ldns_pkt_safe_push_rr_list(ldns_pkt *pkt, ldns_pkt_section sec, ldns_rr_list *list)
push an rr_list to a packet, provided the RRs are not already there.
Definition: packet.c:757
ldns_pkt * ldns_pkt_ixfr_request_new(ldns_rdf *rr_name, ldns_rr_class rr_class, uint16_t flags, ldns_rr *soa)
creates an IXFR request packet for the given name, type and class.
Definition: packet.c:1178
signed char ldns_pkt_safe_push_rr(ldns_pkt *pkt, ldns_pkt_section sec, ldns_rr *rr)
push an rr on a packet, provided the RR is not there.
Definition: packet.c:733
signed char ldns_pkt_rr(const ldns_pkt *pkt, ldns_pkt_section sec, const ldns_rr *rr)
check to see if an rr exist in the packet
Definition: packet.c:396
void ldns_pkt_set_edns_udp_size(ldns_pkt *packet, uint16_t s)
Set the packet's edns udp size.
Definition: packet.c:631
void ldns_pkt_set_additional(ldns_pkt *p, ldns_rr_list *rr)
directly set the additional section
Definition: packet.c:528
void ldns_pkt_set_edns_option_list(ldns_pkt *packet, ldns_edns_option_list *list)
Set the packet's structured EDNS data.
Definition: packet.c:661
ldns_rr_list * ldns_pkt_question(const ldns_pkt *p)
Return the packet's question section.
Definition: packet.c:127
signed char ldns_pkt_edns_co(const ldns_pkt *packet)
return the packet's edns co bit
Definition: packet.c:250
void ldns_pkt_set_answerfrom(ldns_pkt *p, ldns_rdf *r)
Set the packet's answering server.
Definition: packet.c:612
ldns_rr_list * ldns_pkt_authority(const ldns_pkt *p)
Return the packet's authority section.
Definition: packet.c:139
uint32_t ldns_pkt_querytime(const ldns_pkt *p)
Return the packet's querytime.
Definition: packet.c:192
void ldns_pkt_set_authority(ldns_pkt *p, ldns_rr_list *rr)
directly set the authority section
Definition: packet.c:546
void ldns_pkt_set_qr(ldns_pkt *p, signed char b)
Set the packet's qr bit.
Definition: packet.c:504
uint16_t ldns_pkt_ancount(const ldns_pkt *p)
Return the packet's an count.
Definition: packet.c:109
uint16_t ldns_pkt_nscount(const ldns_pkt *p)
Return the packet's ns count.
Definition: packet.c:115
signed char ldns_pkt_push_rr_list(ldns_pkt *packet, ldns_pkt_section section, ldns_rr_list *list)
push a rr_list on a packet
Definition: packet.c:745
ldns_rr_list * ldns_pkt_all_noquestion(const ldns_pkt *p)
Return the packet's answer, authority and additional sections concatenated, in a new rr_list clone.
Definition: packet.c:171
void ldns_pkt_set_aa(ldns_pkt *p, signed char b)
Set the packet's aa bit.
Definition: packet.c:510
ldns_status ldns_pkt_ixfr_request_new_frm_str(ldns_pkt **p, const char *rr_name, ldns_rr_class rr_class, uint16_t flags, ldns_rr *soa)
creates an IXFR request packet for the given name, class.
Definition: packet.c:1111
ldns_rdf * ldns_pkt_answerfrom(const ldns_pkt *p)
Return the packet's answerfrom.
Definition: packet.c:198
ldns_rr_list * ldns_pkt_rr_list_by_name(const ldns_pkt *p, const ldns_rdf *r, ldns_pkt_section s)
return all the rr with a specific name from a packet.
Definition: packet.c:286
ldns_rr_list * ldns_pkt_answer(const ldns_pkt *p)
Return the packet's answer section.
Definition: packet.c:133
enum ldns_enum_pkt_rcode ldns_pkt_rcode
Definition: packet.h:69
ldns_pkt * ldns_pkt_new(void)
allocates and initializes a ldns_pkt structure.
Definition: packet.c:863
signed char ldns_pkt_empty(ldns_pkt *p)
check if a packet is empty
Definition: packet.c:449
uint16_t ldns_pkt_id(const ldns_pkt *p)
Read the packet id.
Definition: packet.c:43
void ldns_pkt_set_edns_co(ldns_pkt *packet, signed char value)
Set the packet's edns co bit.
Definition: packet.c:256
ldns_enum_pkt_opcode
Definition: packet.h:46
@ LDNS_PACKET_IQUERY
Definition: packet.h:48
@ LDNS_PACKET_NOTIFY
Definition: packet.h:50
@ LDNS_PACKET_QUERY
Definition: packet.h:47
@ LDNS_PACKET_STATUS
Definition: packet.h:49
@ LDNS_PACKET_UPDATE
Definition: packet.h:51
void ldns_pkt_set_rd(ldns_pkt *p, signed char b)
Set the packet's rd bit.
Definition: packet.c:522
ldns_rr_list * ldns_pkt_all(const ldns_pkt *p)
Return the packet's question, answer, authority and additional sections concatenated,...
Definition: packet.c:152
signed char ldns_pkt_tc(const ldns_pkt *p)
Read the packet's tc bit.
Definition: packet.c:61
ldns_rr_list * ldns_pkt_rr_list_by_type(const ldns_pkt *p, ldns_rr_type t, ldns_pkt_section s)
return all the rr with a specific type from a packet.
Definition: packet.c:323
uint16_t ldns_pkt_edns_unassigned(const ldns_pkt *packet)
return the packet's EDNS header bits that are unassigned.
Definition: packet.c:266
signed char ldns_pkt_push_rr(ldns_pkt *packet, ldns_pkt_section section, ldns_rr *rr)
push an rr on a packet
Definition: packet.c:697
ldns_rr_list * ldns_pkt_rr_list_by_name_and_type(const ldns_pkt *packet, const ldns_rdf *ownername, ldns_rr_type type, ldns_pkt_section sec)
return all the rr with a specific type and type from a packet.
Definition: packet.c:359
void ldns_pkt_set_answer(ldns_pkt *p, ldns_rr_list *rr)
directly set the answer section
Definition: packet.c:540
void ldns_pkt_set_question(ldns_pkt *p, ldns_rr_list *rr)
directly set the question section
Definition: packet.c:534
void ldns_pkt_set_tc(ldns_pkt *p, signed char b)
Set the packet's tc bit.
Definition: packet.c:516
void ldns_pkt_set_edns_do(ldns_pkt *packet, signed char value)
Set the packet's edns do bit.
Definition: packet.c:240
signed char ldns_pkt_ra(const ldns_pkt *p)
Read the packet's ra bit.
Definition: packet.c:79
enum ldns_enum_pkt_opcode ldns_pkt_opcode
Definition: packet.h:53
void ldns_pkt_set_rcode(ldns_pkt *p, uint8_t c)
Set the packet's response code.
Definition: packet.c:576
void ldns_pkt_set_edns_z(ldns_pkt *packet, uint16_t z)
Set the packet's edns z value.
Definition: packet.c:649
enum ldns_enum_pkt_section ldns_pkt_section
Definition: packet.h:287
uint8_t ldns_pkt_edns_extended_rcode(const ldns_pkt *packet)
return the packet's edns extended rcode
Definition: packet.c:216
void ldns_pkt_set_qdcount(ldns_pkt *p, uint16_t c)
Set the packet's qd count.
Definition: packet.c:582
uint16_t ldns_pkt_qdcount(const ldns_pkt *p)
Return the packet's qd count.
Definition: packet.c:103
signed char ldns_pkt_cd(const ldns_pkt *p)
Read the packet's cd bit.
Definition: packet.c:73
void ldns_pkt_set_edns_data(ldns_pkt *packet, ldns_rdf *data)
Set the packet's EDNS data.
Definition: packet.c:655
ldns_rr_list * ldns_pkt_additional(const ldns_pkt *p)
Return the packet's additional section.
Definition: packet.c:145
ldns_pkt_type ldns_pkt_reply_type(const ldns_pkt *p)
looks inside the packet to determine what kind of packet it is, AUTH, NXDOMAIN, REFERRAL,...
Definition: packet.c:1190
void ldns_pkt_set_arcount(ldns_pkt *p, uint16_t c)
Set the packet's arcount.
Definition: packet.c:600
void ldns_pkt_set_opcode(ldns_pkt *p, ldns_pkt_opcode c)
Set the packet's opcode.
Definition: packet.c:570
ldns_pkt_opcode ldns_pkt_get_opcode(const ldns_pkt *p)
Read the packet's code.
Definition: packet.c:91
signed char ldns_pkt_edns_do(const ldns_pkt *packet)
return the packet's edns do bit
Definition: packet.c:234
uint16_t ldns_pkt_arcount(const ldns_pkt *p)
Return the packet's ar count.
Definition: packet.c:121
void ldns_pkt_set_id(ldns_pkt *p, uint16_t id)
Set the packet's id.
Definition: packet.c:490
ldns_status ldns_pkt_query_new_frm_str(ldns_pkt **p, const char *rr_name, ldns_rr_type rr_type, ldns_rr_class rr_class, uint16_t flags)
creates a query packet for the given name, type, class.
Definition: packet.c:1103
void ldns_pkt_set_querytime(ldns_pkt *p, uint32_t t)
Set the packet's query time.
Definition: packet.c:606
void ldns_pkt_set_random_id(ldns_pkt *p)
Set the packet's id to a random value.
Definition: packet.c:496
void ldns_pkt_set_ancount(ldns_pkt *p, uint16_t c)
Set the packet's an count.
Definition: packet.c:588
void ldns_pkt_set_ra(ldns_pkt *p, signed char b)
Set the packet's ra bit.
Definition: packet.c:558
void ldns_pkt_set_tsig(ldns_pkt *p, ldns_rr *t)
Set the packet's tsig rr.
Definition: packet.c:691
void ldns_pkt_set_edns_extended_rcode(ldns_pkt *packet, uint8_t c)
Set the packet's edns extended rcode.
Definition: packet.c:637
ldns_rdf * ldns_pkt_edns_data(const ldns_pkt *packet)
return the packet's EDNS data
Definition: packet.c:279
signed char ldns_pkt_qr(const ldns_pkt *p)
Read the packet's qr bit.
Definition: packet.c:49
struct timeval ldns_pkt_timestamp(const ldns_pkt *p)
Return the packet's timestamp.
Definition: packet.c:204
ldns_enum_pkt_section
The sections of a packet.
Definition: packet.h:277
@ LDNS_SECTION_ANY
bogus section, if not interested
Definition: packet.h:283
@ LDNS_SECTION_QUESTION
Definition: packet.h:278
@ LDNS_SECTION_ANSWER
Definition: packet.h:279
@ LDNS_SECTION_ADDITIONAL
Definition: packet.h:281
@ LDNS_SECTION_AUTHORITY
Definition: packet.h:280
@ LDNS_SECTION_ANY_NOQUESTION
used to get all non-question rrs from a packet
Definition: packet.h:285
signed char ldns_pkt_rd(const ldns_pkt *p)
Read the packet's rd bit.
Definition: packet.c:67
signed char ldns_pkt_ad(const ldns_pkt *p)
Read the packet's ad bit.
Definition: packet.c:85
void ldns_pkt_set_nscount(ldns_pkt *p, uint16_t c)
Set the packet's ns count.
Definition: packet.c:594
ldns_enum_pkt_rcode
Definition: packet.h:56
@ LDNS_RCODE_REFUSED
Definition: packet.h:62
@ LDNS_RCODE_YXDOMAIN
Definition: packet.h:63
@ LDNS_RCODE_FORMERR
Definition: packet.h:58
@ LDNS_RCODE_YXRRSET
Definition: packet.h:64
@ LDNS_RCODE_SERVFAIL
Definition: packet.h:59
@ LDNS_RCODE_NOTIMPL
Definition: packet.h:61
@ LDNS_RCODE_NXRRSET
Definition: packet.h:65
@ LDNS_RCODE_NOTZONE
Definition: packet.h:67
@ LDNS_RCODE_NXDOMAIN
Definition: packet.h:60
@ LDNS_RCODE_NOTAUTH
Definition: packet.h:66
@ LDNS_RCODE_NOERROR
Definition: packet.h:57
uint16_t ldns_pkt_edns_z(const ldns_pkt *packet)
return the packet's edns z value
Definition: packet.c:228
void ldns_pkt_set_section_count(ldns_pkt *p, ldns_pkt_section s, uint16_t x)
Set a packet's section count to x.
Definition: packet.c:670
ldns_edns_option_list * ldns_pkt_edns_get_option_list(ldns_pkt *packet)
Returns a list of structured EDNS options.
Definition: packet.c:843
ldns_pkt * ldns_pkt_query_new(ldns_rdf *rr_name, ldns_rr_type rr_type, ldns_rr_class rr_class, uint16_t flags)
creates a packet with a query in it for the given name, type and class.
Definition: packet.c:1170
ldns_enum_pkt_type
The different types of packets.
Definition: packet.h:292
@ LDNS_PACKET_QUESTION
Definition: packet.h:293
@ LDNS_PACKET_REFERRAL
Definition: packet.h:294
@ LDNS_PACKET_UNKNOWN
Definition: packet.h:298
@ LDNS_PACKET_NODATA
Definition: packet.h:297
@ LDNS_PACKET_NXDOMAIN
Definition: packet.h:296
@ LDNS_PACKET_ANSWER
Definition: packet.h:295
ldns_pkt_rcode ldns_pkt_get_rcode(const ldns_pkt *p)
Return the packet's response code.
Definition: packet.c:97
uint16_t ldns_pkt_edns_udp_size(const ldns_pkt *packet)
return the packet's edns udp size
Definition: packet.c:210
void ldns_pkt_set_edns_version(ldns_pkt *packet, uint8_t v)
Set the packet's edns version.
Definition: packet.c:643
void ldns_pkt_set_edns_unassigned(ldns_pkt *packet, uint16_t value)
Set the packet's EDNS header bits that are unassigned.
Definition: packet.c:272
Contains the definition of ldns_rr and functions to manipulate those.
enum ldns_enum_rr_type ldns_rr_type
Definition: rr.h:260
enum ldns_enum_rr_class ldns_rr_class
Definition: rr.h:61
signed char _rd
Recursion desired.
Definition: packet.h:204
uint16_t _id
Id of a packet.
Definition: packet.h:196
ldns_pkt_opcode _opcode
Query type.
Definition: packet.h:212
signed char _cd
Checking disabled.
Definition: packet.h:206
signed char _ra
Recursion available.
Definition: packet.h:208
uint16_t _ancount
answer sec
Definition: packet.h:218
signed char _qr
Query bit (0=query, 1=answer)
Definition: packet.h:198
signed char _tc
Packet truncated.
Definition: packet.h:202
signed char _ad
Authentic data.
Definition: packet.h:210
uint16_t _qdcount
question sec
Definition: packet.h:216
uint16_t _arcount
add sec
Definition: packet.h:222
uint8_t _rcode
Response code.
Definition: packet.h:214
uint16_t _nscount
auth sec
Definition: packet.h:220
signed char _aa
Authoritative answer.
Definition: packet.h:200
DNS packet.
Definition: packet.h:235
struct timeval timestamp
Timestamp of the time the packet was sent or created.
Definition: packet.h:242
uint8_t _edns_extended_rcode
EDNS0 Extended rcode.
Definition: packet.h:252
ldns_rr_list * _authority
Authority section.
Definition: packet.h:268
ldns_hdr * _header
Header section.
Definition: packet.h:237
uint32_t _querytime
The duration of the query this packet is an answer to.
Definition: packet.h:244
uint16_t _edns_udp_size
EDNS0 available buffer size, see RFC2671.
Definition: packet.h:250
ldns_rdf * _answerfrom
an rdf (A or AAAA) with the IP address of the server it is from
Definition: packet.h:240
uint8_t _edns_present
Definition: packet.h:256
uint8_t _edns_version
EDNS Version.
Definition: packet.h:254
size_t _size
The size of the wire format of the packet in octets.
Definition: packet.h:246
ldns_rr_list * _answer
Answer section.
Definition: packet.h:266
ldns_rdf * _edns_data
Arbitrary EDNS rdata.
Definition: packet.h:260
ldns_edns_option_list * _edns_list
Structed EDNS data.
Definition: packet.h:262
uint16_t _edns_z
Reserved EDNS data bits.
Definition: packet.h:258
ldns_rr_list * _additional
Additional section.
Definition: packet.h:270
ldns_rr * _tsig_rr
Optional tsig rr.
Definition: packet.h:248
ldns_rr_list * _question
Question section.
Definition: packet.h:264
Resource record data field.
Definition: rdata.h:203
List or Set of Resource Records.
Definition: rr.h:355
Resource Record.
Definition: rr.h:327