aboutsummaryrefslogtreecommitdiffstats
path: root/ldns/packet.h
diff options
context:
space:
mode:
Diffstat (limited to 'ldns/packet.h')
-rw-r--r--ldns/packet.h26
1 files changed, 15 insertions, 11 deletions
diff --git a/ldns/packet.h b/ldns/packet.h
index 9dca06f56274..e29941936638 100644
--- a/ldns/packet.h
+++ b/ldns/packet.h
@@ -23,8 +23,8 @@
#define LDNS_MAX_PACKETLEN 65535
-/* allow flags to be given to mk_query */
-#define LDNS_QR 1 /* QueRy - query flag */
+/* allow flags to be given to ldns_pkt_query_new */
+#define LDNS_QR 1 /* Query Response flag */
#define LDNS_AA 2 /* Authoritative Answer - server flag */
#define LDNS_TC 4 /* TrunCated - server flag */
#define LDNS_RD 8 /* Recursion Desired - query flag */
@@ -235,7 +235,7 @@ struct ldns_struct_pkt
/** Header section */
ldns_hdr *_header;
/* extra items needed in a packet */
- /** The size of the wire format of the packet in octets */
+ /** an rdf (A or AAAA) with the IP address of the server it is from */
ldns_rdf *_answerfrom;
/** Timestamp of the time the packet was sent or created */
struct timeval timestamp;
@@ -251,6 +251,8 @@ struct ldns_struct_pkt
uint8_t _edns_extended_rcode;
/** EDNS Version */
uint8_t _edns_version;
+ /* OPT pseudo-RR presence flag */
+ uint8_t _edns_present;
/** Reserved EDNS data bits */
uint16_t _edns_z;
/** Arbitrary EDNS rdata */
@@ -484,7 +486,7 @@ ldns_rr_list *ldns_pkt_get_section_clone(const ldns_pkt *p, ldns_pkt_section s);
* \param[in] s the packet's section
* \return a list with the rr's or NULL if none were found
*/
-ldns_rr_list *ldns_pkt_rr_list_by_name(ldns_pkt *p, ldns_rdf *r, ldns_pkt_section s);
+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 type from a packet. Optionally
* specify from which section in the packet
@@ -512,7 +514,7 @@ ldns_rr_list *ldns_pkt_rr_list_by_name_and_type(const ldns_pkt *packet, const ld
* \param[in] sec in which section to look
* \param[in] rr the rr to look for
*/
-bool ldns_pkt_rr(ldns_pkt *pkt, ldns_pkt_section sec, ldns_rr *rr);
+bool ldns_pkt_rr(const ldns_pkt *pkt, ldns_pkt_section sec, const ldns_rr *rr);
/**
@@ -658,7 +660,7 @@ void ldns_pkt_set_tsig(ldns_pkt *p, ldns_rr *t);
* \param[in] p the packet to examine
* \return the type of packet
*/
-ldns_pkt_type ldns_pkt_reply_type(ldns_pkt *p);
+ldns_pkt_type ldns_pkt_reply_type(const ldns_pkt *p);
/**
* return the packet's edns udp size
@@ -777,14 +779,15 @@ ldns_status ldns_pkt_query_new_frm_str(ldns_pkt **p, const char *rr_name, ldns_r
* \param[in] rr_name the name to query for (as string)
* \param[in] rr_class the class to query for
* \param[in] flags packet flags
- * \param[in] soa soa record to be added to the authority section
+ * \param[in] soa soa record to be added to the authority section (not copied).
* \return LDNS_STATUS_OK or a ldns_status mesg with the error
*/
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 a packet with a query in it for the given name, type and class.
- * \param[in] rr_name the name to query for
+ * \param[in] rr_name the name to query for (not copied).
+ * The returned packet will take ownership of rr_name, so the caller should not free it.
* \param[in] rr_type the type to query for
* \param[in] rr_class the class to query for
* \param[in] flags packet flags
@@ -795,10 +798,11 @@ ldns_pkt *ldns_pkt_query_new(ldns_rdf *rr_name, ldns_rr_type rr_type, ldns_rr_cl
/**
* creates an IXFR request packet for the given name, type and class.
* adds the SOA record to the authority section.
- * \param[in] rr_name the name to query for
+ * \param[in] rr_name the name to query for (not copied).
+ * The returned packet will take ownership of rr_name, so the caller should not free it.
* \param[in] rr_class the class to query for
* \param[in] flags packet flags
- * \param[in] soa soa record to be added to the authority section
+ * \param[in] soa soa record to be added to the authority section (not copied).
* \return ldns_pkt* a pointer to the new pkt
*/
ldns_pkt *ldns_pkt_ixfr_request_new(ldns_rdf *rr_name, ldns_rr_class rr_class, uint16_t flags, ldns_rr* soa);
@@ -809,7 +813,7 @@ ldns_pkt *ldns_pkt_ixfr_request_new(ldns_rdf *rr_name, ldns_rr_class rr_class, u
* \param[in] pkt the packet to clone
* \return ldns_pkt* pointer to the new packet
*/
-ldns_pkt *ldns_pkt_clone(ldns_pkt *pkt);
+ldns_pkt *ldns_pkt_clone(const ldns_pkt *pkt);
/**
* directly set the additional section