 |
ldns
1.7.0
|
Go to the documentation of this file.
42 return ldns_buffer_status(buffer);
50 ldns_buffer_write_u8(buffer, 0);
52 return ldns_buffer_status(buffer);
59 uint16_t position = (uint16_t) (intptr_t) node->
data | 0xC000;
62 ldns_buffer_write_u16(buffer, position);
64 return ldns_buffer_status(buffer);
75 if (ldns_buffer_position(buffer) < 16384) {
77 node->
data = (
void *) (intptr_t) ldns_buffer_position(buffer);
89 ldns_buffer_write(buffer, data, size);
116 return ldns_buffer_status(buffer);
129 ldns_buffer_write_u8(buffer,
136 ldns_buffer_write(buffer,
141 return ldns_buffer_status(buffer);
152 for(i = 0; i < rr_count; i++) {
156 return ldns_buffer_status(buffer);
166 uint16_t rdl_pos = 0;
167 bool pre_rfc3597 =
false;
212 rdl_pos = ldns_buffer_position(buffer);
213 ldns_buffer_write_u16(buffer, 0);
225 ldns_buffer_write_u16_at(buffer, rdl_pos,
226 ldns_buffer_position(buffer)
230 return ldns_buffer_status(buffer);
243 uint16_t rdl_pos = 0;
258 rdl_pos = ldns_buffer_position(buffer);
259 ldns_buffer_write_u16(buffer, 0);
275 ldns_buffer_write_u16_at(buffer, rdl_pos,
276 ldns_buffer_position(buffer)
280 return ldns_buffer_status(buffer);
300 return ldns_buffer_status(buffer);
312 return ldns_buffer_status(buffer);
325 ldns_buffer_write_u16(buffer,
ldns_pkt_id(packet));
331 ldns_buffer_write_u8(buffer, flags);
338 ldns_buffer_write_u8(buffer, flags);
351 ldns_buffer_write_u16(buffer, arcount);
354 return ldns_buffer_status(buffer);
377 (void) ldns_hdr2buffer_wire(buffer, packet);
453 *result_size = ldns_buffer_position(buffer);
471 *result_size = ldns_buffer_position(buffer);
489 *result_size = ldns_buffer_position(buffer);
ldns_rdf * ldns_rr_rdf(const ldns_rr *rr, size_t nr)
returns the rdata field member counter.
ldns_status ldns_pkt2wire(uint8_t **dest, const ldns_pkt *packet, size_t *result_size)
Allocates an array of uint8_t at dest, and puts the wireformat of the given packet in that array.
List or Set of Resource Records.
definition for tree struct
size_t ldns_rdf_size(const ldns_rdf *rd)
returns the size of the rdf.
implementation of buffers to ease operations
#define LDNS_MAX_PACKETLEN
ldns_buffer * ldns_buffer_new(size_t capacity)
creates a new buffer with the specified capacity.
ldns_status ldns_rr_rdata2buffer_wire(ldns_buffer *buffer, const ldns_rr *rr)
Converts an rr's rdata to wireformat, while excluding the ownername and all the stuff before the rdat...
ldns_status ldns_dname2buffer_wire_compress(ldns_buffer *buffer, const ldns_rdf *name, ldns_rbtree_t *compression_data)
Copies the dname data to the buffer in wire format.
ldns_rbtree_t * ldns_rbtree_create(int(*cmpf)(const void *, const void *))
Create new tree (malloced) with given key compare function.
ldns_status ldns_pkt2buffer_wire(ldns_buffer *buffer, const ldns_pkt *packet)
Copies the packet data to the buffer in wire format.
uint16_t ldns_pkt_edns_z(const ldns_pkt *packet)
return the packet's edns z value
uint16_t ldns_pkt_id(const ldns_pkt *packet)
Read the packet id.
@ LDNS_RR_TYPE_MF
a mail forwarder (Obsolete - use MX)
@ LDNS_RR_TYPE_KX
RFC2230.
ldns_rr_list * ldns_pkt_question(const ldns_pkt *packet)
Return the packet's question section.
@ LDNS_RR_TYPE_MINFO
mailbox or mail list information
ldns_status ldns_rrsig2buffer_wire(ldns_buffer *buffer, const ldns_rr *rr)
Converts a rrsig to wireformat BUT EXCLUDE the rrsig rdata This is needed in DNSSEC verification.
ldns_status ldns_rr2wire(uint8_t **dest, const ldns_rr *rr, int section, size_t *result_size)
Allocates an array of uint8_t at dest, and puts the wireformat of the given rr in that array.
ldns_pkt_opcode ldns_pkt_get_opcode(const ldns_pkt *packet)
Read the packet's code.
ldns_rdf * ldns_rr_pop_rdf(ldns_rr *rr)
removes a rd_field member, it will be popped from the last position.
void ldns_rbtree_free(ldns_rbtree_t *rbtree)
Free the complete tree (but not its keys)
ldns_status ldns_rdf2buffer_wire_canonical(ldns_buffer *buffer, const ldns_rdf *rdf)
Copies the rdata data to the buffer in wire format If the rdata is a dname, the letters will be lower...
ldns_rdf * ldns_dname_label(const ldns_rdf *rdf, uint8_t labelpos)
look inside the rdf and if it is an LDNS_RDF_TYPE_DNAME try and retrieve a specific label.
@ LDNS_RR_TYPE_HINFO
host information
uint16_t ldns_pkt_qdcount(const ldns_pkt *packet)
Return the packet's qd count.
@ LDNS_RR_TYPE_NAPTR
RFC2915.
void ldns_rr_set_ttl(ldns_rr *rr, uint32_t ttl)
sets the ttl in the rr structure.
void ldns_rr_set_class(ldns_rr *rr, ldns_rr_class rr_class)
sets the class in the rr.
ldns_rdf * _edns_data
Arbitrary EDNS rdata.
ldns_status ldns_rr2buffer_wire(ldns_buffer *buffer, const ldns_rr *rr, int section)
Copies the rr data to the buffer in wire format.
ldns_rr * ldns_rr_new(void)
creates a new rr structure.
@ LDNS_RR_TYPE_OPT
Pseudo OPT record...
bool ldns_pkt_aa(const ldns_pkt *packet)
Read the packet's aa bit.
ldns_pkt_rcode ldns_pkt_get_rcode(const ldns_pkt *packet)
Return the packet's respons code.
const void * key
pointer to sorting key
@ LDNS_RR_TYPE_NXT
2535typecode
ldns_rbnode_t * ldns_rbtree_search(ldns_rbtree_t *rbtree, const void *key)
Find key in tree.
bool ldns_pkt_ra(const ldns_pkt *packet)
Read the packet's ra bit.
bool ldns_pkt_tc(const ldns_pkt *packet)
Read the packet's tc bit.
@ LDNS_RR_TYPE_MR
a mail rename domain name (EXPERIMENTAL)
@ LDNS_RR_TYPE_RP
RFC1183.
ldns_rr_class ldns_rr_get_class(const ldns_rr *rr)
returns the class of the rr.
void ldns_rr_free(ldns_rr *rr)
frees an RR structure
bool ldns_buffer_reserve(ldns_buffer *buffer, size_t amount)
ensures BUFFER can contain at least AMOUNT more bytes.
bool ldns_pkt_rd(const ldns_pkt *packet)
Read the packet's rd bit.
uint8_t ldns_pkt_edns_version(const ldns_pkt *packet)
return the packet's edns version
ldns_status ldns_rdf2buffer_wire_compress(ldns_buffer *buffer, const ldns_rdf *rdf, ldns_rbtree_t *compression_data)
Copies the rdata data to the buffer in wire format.
void * ldns_buffer_export(ldns_buffer *buffer)
Makes the buffer fixed and returns a pointer to the data.
ldns_status ldns_rr2buffer_wire_compress(ldns_buffer *buffer, const ldns_rr *rr, int section, ldns_rbtree_t *compression_data)
Copies the rr data to the buffer in wire format while doing DNAME compression.
@ LDNS_RR_TYPE_NS
an authoritative name server
ldns_status ldns_rr_list2buffer_wire(ldns_buffer *buffer, const ldns_rr_list *rr_list)
Copies the rr_list data to the buffer in wire format.
void ldns_buffer_free(ldns_buffer *buffer)
frees the buffer.
@ LDNS_RR_TYPE_A6
RFC2874.
@ LDNS_RR_TYPE_SOA
marks the start of a zone of authority
@ LDNS_RR_TYPE_MB
a mailbox domain name (EXPERIMENTAL)
bool ldns_pkt_ad(const ldns_pkt *packet)
Read the packet's ad bit.
ldns_rr_list * ldns_pkt_authority(const ldns_pkt *packet)
Return the packet's authority section.
void ldns_rdf_deep_free(ldns_rdf *rd)
frees a rdf structure and frees the data.
ldns_rdf * ldns_rdf_clone(const ldns_rdf *rd)
clones a rdf structure.
#define LDNS_MALLOC(type)
Memory management macros.
@ LDNS_RR_TYPE_DNAME
RFC2672.
uint8_t ldns_pkt_edns_extended_rcode(const ldns_pkt *packet)
return the packet's edns extended rcode
uint16_t ldns_pkt_nscount(const ldns_pkt *packet)
Return the packet's ns count.
void ldns_rr_set_owner(ldns_rr *rr, ldns_rdf *owner)
sets the owner in the rr structure.
void ldns_traverse_postorder(ldns_rbtree_t *tree, void(*func)(ldns_rbnode_t *, void *), void *arg)
Call function for all elements in the redblack tree, such that leaf elements are called before parent...
@ LDNS_RR_TYPE_RT
RFC1183.
enum ldns_enum_status ldns_status
@ LDNS_RDF_TYPE_DNAME
domain name
@ LDNS_SECTION_ANY
bogus section, if not interested
size_t ldns_rr_rd_count(const ldns_rr *rr)
returns the rd_count of an rr structure.
@ LDNS_RR_TYPE_PX
RFC2163.
Resource record data field.
ldns_rr_list * ldns_pkt_additional(const ldns_pkt *packet)
Return the packet's additional section.
uint32_t ldns_rr_ttl(const ldns_rr *rr)
returns the ttl of an rr structure.
uint8_t * ldns_rdf_data(const ldns_rdf *rd)
returns the data of the rdf.
bool ldns_pkt_cd(const ldns_pkt *packet)
Read the packet's cd bit.
bool ldns_rr_push_rdf(ldns_rr *rr, const ldns_rdf *f)
sets rd_field member, it will be placed in the next available spot.
uint8_t ldns_dname_label_count(const ldns_rdf *r)
count the number of labels inside a LDNS_RDF_DNAME type rdf.
bool ldns_pkt_qr(const ldns_pkt *packet)
Read the packet's qr bit.
bool ldns_pkt_edns(const ldns_pkt *pkt)
returns true if this packet needs and EDNS rr to be sent.
@ LDNS_RR_TYPE_RRSIG
DNSSEC.
@ LDNS_RR_TYPE_AFSDB
RFC1183.
ldns_rdf * ldns_dname_left_chop(const ldns_rdf *d)
chop one label off the left side of a dname.
@ LDNS_RR_TYPE_SRV
SRV record RFC2782.
ldns_rdf * ldns_rdf_new_frm_str(ldns_rdf_type type, const char *str)
creates a new rdf from a string.
const void * data
pointer to data
ldns_rr_list * ldns_pkt_answer(const ldns_pkt *packet)
Return the packet's answer section.
uint16_t ldns_pkt_ancount(const ldns_pkt *packet)
Return the packet's an count.
int ldns_dname_compare(const ldns_rdf *dname1, const ldns_rdf *dname2)
Compares the two dname rdf's according to the algorithm for ordering in RFC4034 Section 6.
@ LDNS_RR_TYPE_MD
a mail destination (Obsolete - use MX)
ldns_rr * ldns_pkt_tsig(const ldns_pkt *pkt)
Return the packet's tsig pseudo rr's.
ldns_rr * ldns_rr_list_rr(const ldns_rr_list *rr_list, size_t nr)
returns a specific rr of an rrlist.
@ LDNS_RR_COMPRESS
compression is allowed
ldns_status ldns_rr2buffer_wire_canonical(ldns_buffer *buffer, const ldns_rr *rr, int section)
Copies the rr data to the buffer in wire format, in canonical format according to RFC3597 (every dnam...
ldns_status ldns_dname2buffer_wire(ldns_buffer *buffer, const ldns_rdf *name)
Copies the dname data to the buffer in wire format.
ldns_status ldns_rdf2buffer_wire(ldns_buffer *buffer, const ldns_rdf *rdf)
Copies the rdata data to the buffer in wire format.
uint16_t ldns_pkt_edns_udp_size(const ldns_pkt *packet)
return the packet's edns udp size
@ LDNS_RR_TYPE_PTR
a domain name pointer
ldns_rbnode_t * ldns_rbtree_insert(ldns_rbtree_t *rbtree, ldns_rbnode_t *data)
Insert data into the tree.
ldns_status ldns_rdf2wire(uint8_t **dest, const ldns_rdf *rdf, size_t *result_size)
Allocates an array of uint8_t at dest, and puts the wireformat of the given rdf in that array.
#define LDNS_DNAME_NORMALIZE
ldns_rdf_type ldns_rdf_get_type(const ldns_rdf *rd)
returns the type of the rdf.
@ LDNS_RR_TYPE_MX
mail exchange
The rbnode_t struct definition.
const ldns_rr_descriptor * ldns_rr_descript(uint16_t type)
returns the resource record descriptor for the given rr type.
ldns_rdf * ldns_rr_owner(const ldns_rr *rr)
returns the owner name of an rr structure.
void ldns_rr_set_type(ldns_rr *rr, ldns_rr_type rr_type)
sets the type in the rr.
@ LDNS_SECTION_ADDITIONAL
uint16_t ldns_pkt_arcount(const ldns_pkt *packet)
Return the packet's ar count.
@ LDNS_RR_TYPE_SIG
2535typecode
@ LDNS_RR_TYPE_MG
a mail group member (EXPERIMENTAL)
@ LDNS_RR_TYPE_CNAME
the canonical name for an alias
ldns_rr_type ldns_rr_get_type(const ldns_rr *rr)
returns the type of the rr.
size_t ldns_rr_list_rr_count(const ldns_rr_list *rr_list)
returns the number of rr's in an rr_list.