ldns_rdf_compare
# rr.h and other general rr funcs
-ldns_rr, ldns_rr_new, ldns_rr_new_frm_type, ldns_rr_new_frm_str, ldns_rr_new_frm_fp, ldns_rr_free, ldns_rr_print
-ldns_rr_set_owner, ldns_rr_set_ttl, ldns_rr_set_type, ldns_rr_set_rd_count, ldns_rr_set_class, ldns_rr_set_rdf
-ldns_rr_push_rdf, ldns_rr_pop_rdf
-ldns_rr_rdf, ldns_rr_owner, ldns_rr_rd_count, ldns_rr_ttl, ldns_rr_get_class
-ldns_rr_list_rr_count, ldns_rr_list_set_rr_count
-ldns_rr_list_new, ldns_rr_list_free
-ldns_rr_list_cat, ldns_rr_list_push_rr, ldns_rr_list_pop_rr
-ldns_is_rrset
-ldns_rr_set_push_rr, ldns_rr_set_pop_rr
-ldns_get_rr_class_by_name
-ldns_rr_list_deep_clone
-ldns_rr_list_sort
-ldns_rr_compare, ldns_rr_compare_ds
-ldns_rr_uncompressed_size
-ldns_rr2canonical
-ldns_rr_label_count
+ldns_rr, ldns_rr_class, ldns_rr_type, ldns_rr_compress, ldns_rr_list | ldns_rr_new, ldns_rr_set_owner, ldns_rr_push_rdf, ldns_rr_rdf, ldns_rr_list_rr_count, ldns_rr_list_new, ldns_rr_list_cat, ldns_is_rrset, ldns_rr_set_push_rr, ldns_get_rr_class_by_name, ldns_rr_list_deep_clone, ldns_rr_list_sort, ldns_rr_compare, ldns_rr_uncompressed_size, ldns_rr2canonical, ldns_rr_label_count
+ldns_rr_new, ldns_rr_new_frm_type, ldns_rr_new_frm_str, ldns_rr_new_frm_fp, ldns_rr_free, ldns_rr_print | ldns_rr, ldns_rr_list
+ldns_rr_set_owner, ldns_rr_set_ttl, ldns_rr_set_type, ldns_rr_set_rd_count, ldns_rr_set_class, ldns_rr_set_rdf | ldns_rr, ldns_rr_list
+ldns_rr_push_rdf, ldns_rr_pop_rdf | ldns_rr, ldns_rr_list
+ldns_rr_rdf, ldns_rr_owner, ldns_rr_rd_count, ldns_rr_ttl, ldns_rr_get_class | ldns_rr, ldns_rr_list
+ldns_rr_list_rr_count, ldns_rr_list_set_rr_count | ldns_rr, ldns_rr_list
+ldns_rr_list_new, ldns_rr_list_free | ldns_rr, ldns_rr_list
+ldns_rr_list_cat, ldns_rr_list_push_rr, ldns_rr_list_pop_rr | ldns_rr, ldns_rr_list
+ldns_is_rrset | ldns_rr, ldns_rr_list
+ldns_rr_set_push_rr, ldns_rr_set_pop_rr | ldns_rr, ldns_rr_list
+ldns_get_rr_class_by_name | ldns_rr, ldns_rr_list
+ldns_rr_list_deep_clone | ldns_rr, ldns_rr_list
+ldns_rr_list_sort | ldns_rr, ldns_rr_list
+ldns_rr_compare, ldns_rr_compare_ds | ldns_rr, ldns_rr_list
+ldns_rr_uncompressed_size | ldns_rr, ldns_rr_list
+ldns_rr2canonical | ldns_rr, ldns_rr_list
+ldns_rr_label_count | ldns_rr, ldns_rr_list
+
# packet.h
ldns_pkt, ldns_pkt_section, ldns_pkt_type | ldns_pkt_new, ldns_pkt_id, ldns_pkt_set_flags, ldns_pkt_edns
}
/**
- * returns the number of bytes the buffer can hold
+ * returns the number of bytes the buffer can hold.
*/
INLINE size_t
ldns_buffer_capacity(ldns_buffer *buffer)
typedef enum ldns_enum_pkt_section ldns_pkt_section;
/**
- * the different types of packets
+ * The different types of packets
*/
enum ldns_enum_pkt_type {
LDNS_PACKET_QUESTION,
ldns_rr_list *ldns_pkt_rr_list_by_name_and_type(ldns_pkt *packet, ldns_rdf *ownername, ldns_rr_type type, ldns_pkt_section sec);
/**
- * Set the flags in a packet
+ * sets the flags in a packet.
* \param[in] pkt the packet to operate on
* \param[in] flags ORed values: LDNS_QR| LDNS_AR for instance
* \return true on success otherwise false
void ldns_pkt_set_tsig(ldns_pkt *p, ldns_rr *t);
/**
- * look inside the packet to determine
+ * looks inside the packet to determine
* what kind of packet it is, AUTH, NXDOMAIN, REFERRAL, etc.
* \param[in] p the packet to examine
* \return the type of packet
ldns_rdf *ldns_pkt_edns_data(const ldns_pkt *packet);
/**
- * Returns true if this packet needs and EDNS rr to be sent
+ * returns true if this packet needs and EDNS rr to be sent.
* At the moment the only reason is an expected packet
* size larger than 512 bytes, but for instance dnssec would
- * be a good reason too
+ * be a good reason too.
*
* \param[in] packet the packet to check
* \return true if packet needs edns rr
void ldns_pkt_set_edns_data(ldns_pkt *packet, ldns_rdf *data);
/**
- * Allocates and initializes a ldns_pkt structure
+ * allocates and initializes a ldns_pkt structure.
* \return pointer to the new packet
*/
ldns_pkt *ldns_pkt_new();
/**
- * Frees the packet structure and all data that it contains
+ * frees the packet structure and all data that it contains.
* \param[in] packet The packet structure to free
* \return void
*/
void ldns_pkt_free(ldns_pkt *packet);
/**
- * Creates a query packet for the given name, type, class
+ * creates a query packet for the given name, type, class.
* \param[in] rr_name the name to query for (as string)
* \param[in] rr_type the type to query for
* \param[in] rr_class the class to query for
ldns_pkt *ldns_pkt_query_new_frm_str(const char *rr_name, ldns_rr_type rr_type, ldns_rr_class rr_class , uint16_t flags);
/**
- * Create a packet with a query in it
+ * 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_type the type to query for
* \param[in] rr_class the class to query for
typedef enum ldns_enum_rdf_type ldns_rdf_type;
/**
- * Resource record data
+ * Resource record data.
*
* The data is a network ordered array of bytes, which size is specified by
* the (16-bit) size field. To correctly parse it, use the type
/* write access functions */
/**
- * set the size of the rdf
+ * sets the size of the rdf.
* \param[in] *rd the rdf to operate on
* \param[in] size the new size
* \return void
*/
void ldns_rdf_set_size(ldns_rdf *rd, uint16_t size);
/**
- * set the size of the rdf
+ * sets the size of the rdf.
* \param[in] *rd the rdf to operate on
* \param[in] type the new type
* \return void
*/
void ldns_rdf_set_type(ldns_rdf *rd, ldns_rdf_type type);
/**
- * set the size of the rdf
+ * sets the size of the rdf.
* \param[in] *rd the rdf to operate on
* \param[in] data* pointer to the new data
* \return void
/* read access */
/**
- * return the size of the rdf
+ * returns the size of the rdf.
* \param[in] *rd the rdf to read from
* \return uint16_t with the size
*/
uint16_t ldns_rdf_size(const ldns_rdf *rd);
/**
- * Return the type of the rdf. We need to insert _get_
+ * returns the type of the rdf. We need to insert _get_
* here to prevent conflict the the rdf_type TYPE.
* \param[in] *rd the rdf to read from
* \return ldns_rdf_type with the type
*/
ldns_rdf_type ldns_rdf_get_type(const ldns_rdf *rd);
/**
- * return the data of the rdf
+ * returns the data of the rdf.
* \param[in] *rd the rdf to read from
* \return uint8_t* pointer to the rdf's data
*/
/* creator functions */
/**
- * Allocate a new rdf structure and fill it.
+ * allocates a new rdf structure and fills it.
* This function DOES NOT copy the contents from
* the buffer, unlinke ldns_rdf_new_frm_data()
* \param[in] type type of the rdf
ldns_rdf *ldns_rdf_new(ldns_rdf_type type, uint16_t size, void *data);
/**
- * Allocate a new rdf structure and fill it.
+ * allocates a new rdf structure and fills it.
* This function _does_ copy the contents from
* the buffer, unlinke ldns_rdf_new()
* \param[in] type type of the rdf
ldns_rdf *ldns_rdf_new_frm_data(ldns_rdf_type type, uint16_t size, const void *data);
/**
- * Create a new rdf from a string
+ * creates a new rdf from a string.
* \param[in] type type to use
* \param[in] str string to use
* \return ldns_rdf*
ldns_rdf *ldns_rdf_new_frm_str(ldns_rdf_type type, const char *str);
/**
- * Create a new rdf from a file containing a string
+ * creates a new rdf from a file containing a string.
* \param[in] type type to use
* \param[in] fp the file pointer to use
* \return ldns_rdf*
/* destroy functions */
/**
- * Free a rdf structure leave the
- * data pointer intact
+ * frees a rdf structure, leaving the
+ * data pointer intact.
* \param[in] rd the pointer to be freed
* \return void
*/
void ldns_rdf_free(ldns_rdf *rd);
/**
- * free a rdf structure _and_ free the
+ * frees a rdf structure _and_ frees the
* data. rdf should be created with _new_frm_data
* \param[in] rd the rdf structure to be freed
* \return void
/* conversion functions */
/**
- * return the rdf containing the native uint8_t repr.
+ * returns the rdf containing the native uint8_t repr.
* \param[in] type the ldns_rdf type to use
* \param[in] value the uint8_t to use
* \return ldns_rdf* with the converted value
ldns_rdf *ldns_native2rdf_int8(ldns_rdf_type type, uint8_t value);
/**
- * return the rdf containing the native uint16_t repr.
+ * returns the rdf containing the native uint16_t representation.
* \param[in] type the ldns_rdf type to use
* \param[in] value the uint16_t to use
* \return ldns_rdf* with the converted value
ldns_rdf *ldns_native2rdf_int16(ldns_rdf_type type, uint16_t value);
/**
- * Returns an rdf that contains the given int32 value
+ * returns an rdf that contains the given int32 value.
*
* Because multiple rdf types can contain an int32, the
* type must be specified
ldns_rdf *ldns_native2rdf_int32(ldns_rdf_type type, uint32_t value);
/**
- * Returns an int16_data rdf that contains the data in the
- * given array, preceded by an int16 specifying the length
+ * returns an int16_data rdf that contains the data in the
+ * given array, preceded by an int16 specifying the length.
*
* The memory is copied, and an LDNS_RDF_TYPE_INT16DATA is returned
* \param[in] size the size of the data
ldns_rdf *ldns_native2rdf_int16_data(uint16_t size, uint8_t *data);
/**
- * reverse an rdf, only actually usefull for AAAA and A records
- * the returned rdf has the type LDNS_RDF_TYPE_DNAME!
+ * reverses an rdf, only actually useful for AAAA and A records.
+ * The returned rdf has the type LDNS_RDF_TYPE_DNAME!
* \param[in] *rd rdf to be reversed
* \return the reversed rdf (a newly created rdf)
*/
ldns_rdf *ldns_rdf_address_reverse(ldns_rdf *rd);
/**
- * return the native uint8_t repr. from the rdf
+ * returns the native uint8_t representation from the rdf.
* \param[in] rd the ldns_rdf to operate on
* \return uint8_t the value extracted
*/
uint8_t ldns_rdf2native_int8(ldns_rdf *rd);
/**
- * return the native uint16_t repr. from the rdf
+ * returns the native uint16_t representation from the rdf.
* \param[in] rd the ldns_rdf to operate on
* \return uint16_t the value extracted
*/
uint16_t ldns_rdf2native_int16(ldns_rdf *rd);
/**
- * return the native uint32_t repr. from the rdf
+ * returns the native uint32_t representation from the rdf.
* \param[in] rd the ldns_rdf to operate on
* \return uint32_t the value extracted
*/
uint32_t ldns_rdf2native_int32(ldns_rdf *rd);
/**
- * convert a ttl value (5d2h) to a long
+ * converts a ttl value (like 5d2h) to a long.
* \param[in] nptr the start of the string
* \param[out] endptr points to the last char in case of error
* \return the convert duration value
uint32_t ldns_str2period(const char *nptr, const char **endptr);
/**
- * return the native sockaddr repr. from the rdf
+ * returns the native sockaddr representation from the rdf.
* \param[in] rd the ldns_rdf to operate on
* \return struct sockaddr* the address in the format so other
* functions can use it (sendto)
/* misc */
/**
- * remove \\DDD, \\[space] and other escapes from the input
- * See RFC 1035, section 5.1
+ * removes \\DDD, \\[space] and other escapes from the input.
+ * See RFC 1035, section 5.1.
* \param[in] word what to check
* \param[in] length the string
* \return ldns_status mesg
ldns_status ldns_octet(char *word, size_t *length);
/**
- * clone a rdf structure. The data is copied
+ * clones a rdf structure. The data is copied.
* \param[in] rd rdf to be copied
* \return a new rdf structure
*/
ldns_rdf *ldns_rdf_deep_clone(const ldns_rdf *rd);
/**
- * Compare two rdf's. Order is canonical.
+ * compares two rdf's. Order is canonical.
* \param[in] rd1 the first one
* \param[in] rd2 the second one
* \return 0 if equal
};
typedef enum ldns_enum_rr_class ldns_rr_class;
+/**
+ * Used to specify whether compression is allowed.
+ */
enum ldns_enum_rr_compress
{
/** compression is allowed */
};
typedef struct ldns_struct_rr_list ldns_rr_list;
-/*
+/*TODO where in docs? with rr?
* struct to hold the whole set of rd_fields
*
* How does the whole rdata_field list look. This is called
typedef struct ldns_struct_rr_descriptor ldns_rr_descriptor;
/**
- * create a new rr structure.
+ * creates a new rr structure.
* \return ldns_rr *
*/
ldns_rr* ldns_rr_new(void);
/**
- * create a new rr structure and based on the type
+ * creates a new rr structure, based on the given type.
* alloc enough space to hold all the rdf's
*/
ldns_rr* ldns_rr_new_frm_type(ldns_rr_type t);
/**
- * free a RR structure
+ * frees an RR structure
* \param[in] *rr the RR to be freed
* \return void
*/
void ldns_rr_free(ldns_rr *rr);
/**
- * create a rr from a string
- * string should be a fully filled in rr, like
- * ownername <space> TTL <space> CLASS <space> TYPE <space> RDATA
+ * creates an rr from a string.
+ * The string should be a fully filled-in rr, like
+ * ownername <space> TTL <space> CLASS <space> TYPE <space> RDATA.
* \param[in] str the string to convert
* \return the new rr
*/
ldns_rr* ldns_rr_new_frm_str(const char *str);
/**
- * Create a new rr from a file containing a string
- * \param[in] fp the file pointer to use
+ * creates a new rr from a file containing a string.
+ * \param[in] fp the file pointer to use
* \return ldns_rr*
*/
ldns_rr* ldns_rr_new_frm_fp(FILE *fp);
/**
- * set the owner in the rr structure
+ * sets the owner in the rr structure.
* \param[in] *rr rr to operate on
* \param[in] *owner set to this owner
* \return void
void ldns_rr_set_owner(ldns_rr *rr, ldns_rdf *owner);
/**
- * set the ttl in the rr structure
+ * sets the ttl in the rr structure.
* \param[in] *rr rr to operate on
* \param[in] ttl set to this ttl
* \return void
void ldns_rr_set_ttl(ldns_rr *rr, uint32_t ttl);
/**
- * set the rd_count in the rr
+ * sets the rd_count in the rr.
* \param[in] *rr rr to operate on
* \param[in] count set to this count
* \return void
void ldns_rr_set_rd_count(ldns_rr *rr, uint16_t count);
/**
- * set the type in the rr
+ * sets the type in the rr.
* \param[in] *rr rr to operate on
* \param[in] rr_type set to this type
* \return void
void ldns_rr_set_type(ldns_rr *rr, ldns_rr_type rr_type);
/**
- * set the class in the rr
+ * sets the class in the rr.
* \param[in] *rr rr to operate on
* \param[in] rr_class set to this class
* \return void
void ldns_rr_set_class(ldns_rr *rr, ldns_rr_class rr_class);
/**
- * set a rdf member, it will be set on the
- * position given. The old value is returned, like pop
+ * sets a rdf member, it will be set on the
+ * position given. The old value is returned, like pop.
* \param[in] *rr the rr to operate on
* \param[in] *f the rdf to set
* \param[in] position the position the set the rdf
ldns_rdf* ldns_rr_set_rdf(ldns_rr *rr, ldns_rdf *f, uint16_t position);
/**
- * set rd_field member, it will be
- * placed in the next available spot
+ * sets rd_field member, it will be
+ * placed in the next available spot.
* \param[in] *rr rr to operate on
* \param[in] *f the data field member to set
* \return bool
bool ldns_rr_push_rdf(ldns_rr *rr, ldns_rdf *f);
/**
- * remove a rd_field member, it will be
- * popped from the last place
+ * removes a rd_field member, it will be
+ * popped from the last position.
* \param[in] *rr rr to operate on
* \return rdf which was popped (null if nothing)
*/
ldns_rdf* ldns_rr_pop_rdf(ldns_rr *rr);
/**
- * return the rdata field member counter
+ * returns the rdata field member counter.
* \param[in] *rr rr to operate on
* \param[in] nr the number of the rdf to return
* \return ldns_rdf *
ldns_rdf* ldns_rr_rdf(const ldns_rr *rr, uint16_t nr);
/**
- * return the owner name of an rr structure
+ * returns the owner name of an rr structure.
* \param[in] *rr rr to operate on
* \return ldns_rdf *
*/
ldns_rdf* ldns_rr_owner(const ldns_rr *rr);
/**
- * return the ttl of an rr structure
+ * returns the ttl of an rr structure.
* \param[in] *rr the rr to read from
* \return the ttl of the rr
*/
uint32_t ldns_rr_ttl(const ldns_rr *rr);
/**
- * return the rd_count of an rr structure
+ * returns the rd_count of an rr structure.
* \param[in] *rr the rr to read from
* \return the rd count of the rr
*/
uint16_t ldns_rr_rd_count(const ldns_rr *rr);
/**
- * Returns the type of the rr
+ * returns the type of the rr.
* \param[in] *rr the rr to read from
* \return the type of the rr
*/
ldns_rr_type ldns_rr_get_type(const ldns_rr *rr);
/**
- * Returns the class of the rr
+ * returns the class of the rr.
* \param[in] *rr the rr to read from
* \return the class of the rr
*/
/* rr_lists */
/**
- * return the number of rr's in a rr_list
+ * returns the number of rr's in an rr_list.
* \param[in] rr_list the rr_list to read from
* \return the number of rr's
*/
uint16_t ldns_rr_list_rr_count(ldns_rr_list *rr_list);
/**
- * set the number of rr's in a rr_list
+ * sets the number of rr's in an rr_list.
* \param[in] rr_list the rr_list to set the count on
* \param[in] count the number of rr in this list
* \return void
void ldns_rr_list_set_rr_count(ldns_rr_list *rr_list, uint16_t count);
/**
- * return a specific rr of an rrlist
+ * returns a specific rr of an rrlist.
* \param[in] rr_list the rr_list to read from
* \param[in] nr return this rr
* \return the rr at position nr
ldns_rr* ldns_rr_list_rr(ldns_rr_list *rr_list, uint16_t nr);
/**
- * create a new rr_list strcture
+ * creates a new rr_list structure.
* \return a new rr_list structure
*/
ldns_rr_list* ldns_rr_list_new();
/**
- * free an rr_list structure
+ * frees an rr_list structure.
* \param[in] rr_list the list to free
* \return void
*/
void ldns_rr_list_free(ldns_rr_list *rr_list);
/**
- * concatenate two ldns_rr_lists together
+ * concatenates two ldns_rr_lists together.
* \param[in] left the leftside
* \param[in] right the rightside
* \return a new rr_list with leftside/rightside concatenated
ldns_rr_list* ldns_rr_list_cat(ldns_rr_list *left, ldns_rr_list *right);
/**
- * push an rr to a rrlist
+ * pushes an rr to an rrlist.
* \param[in] rr_list the rr_list to push to
* \param[in] rr the rr to push
* \return false on error, otherwise true
bool ldns_rr_list_push_rr(ldns_rr_list *rr_list, ldns_rr *rr);
/**
- * pop the last rr from a rrlist
+ * pops the last rr from an rrlist.
* \param[in] rr_list the rr_list to pop from
* \return NULL if nothing to pop. Otherwise the popped RR
*/
ldns_rr* ldns_rr_list_pop_rr(ldns_rr_list *rr_list);
/**
- * check if an rr_list is a rrset
+ * checks if an rr_list is a rrset.
* \param[in] rr_list the rr_list to check
* \return true if it is an rrset otherwise false
*/
bool ldns_is_rrset(ldns_rr_list *rr_list);
/**
- * Push an rr to an rrset (which really are rr_list's)
+ * pushes an rr to an rrset (which really are rr_list's).
* \param[in] *rr_list the rrset to push the rr to
* \param[in] *rr the rr to push
* \return true if the push succeeded otherwise false
bool ldns_rr_set_push_rr(ldns_rr_list *rr_list, ldns_rr *rr);
/**
- * pop the last rr from a rrset. This function is there only
+ * pops the last rr from an rrset. This function is there only
* for the symmetry.
* \param[in] rr_list the rr_list to pop from
* \return NULL if nothing to pop. Otherwise the popped RR
/**
- * retrieve a rrtype by looking up its name
+ * retrieves a rrtype by looking up its name.
* \param[in] name a string with the name
* \return the type which corresponds with the name
*/
ldns_rr_type ldns_get_rr_type_by_name(const char *name);
/**
- * retrieve a class by looking up its name
+ * retrieves a class by looking up its name.
* \param[in] name string with the name
* \return the cass which corresponds with the name
*/
ldns_rr_class ldns_get_rr_class_by_name(const char *name);
/**
- * clone a rr and all its data
+ * clones a rr and all its data
* \param[in] rr the rr to clone
* \return the new rr or NULL on failure
*/
ldns_rr* ldns_rr_deep_clone(const ldns_rr *rr);
/**
- * Clone an rr list
+ * clones an rrlist.
* \param[in] rrlist the rrlist to clone
* \return the cloned rr list
*/
ldns_rr_list* ldns_rr_list_deep_clone(ldns_rr_list *rrlist);
/**
- * sort an rr_list. the sorting is done inband
+ * sorts an rr_list. the sorting is done inband.
* \param[in] unsorted the rr_list to be sorted
* \return void
*/
void ldns_rr_list_sort(ldns_rr_list *unsorted);
/**
- * Compare two rr
+ * compares two rrs.
* \param[in] rr1 the first one
* \param[in] rr2 the second one
* \return 0 if equal
int ldns_rr_compare(const ldns_rr *rr1, const ldns_rr *rr2);
/**
- * Returns true of the given rr's are equal.
+ * returns true of the given rr's are equal.
* Also returns true if one record is a DS that represents the
* same DNSKEY record as the other record
* \param[in] rr1 the first rr
bool ldns_rr_compare_ds(const ldns_rr *rr1, const ldns_rr *rr2);
/**
- * calculate the uncompressed size of an RR
+ * calculates the uncompressed size of an RR.
* \param[in] r the rr to operate on
* \return size of the rr
*/
size_t ldns_rr_uncompressed_size(const ldns_rr *r);
/**
- * convert each dname in a rr to its canonical form
+ * converts each dname in a rr to its canonical form.
* \param[in] rr the rr to work on
* \return void
*/
void ldns_rr2canonical(ldns_rr *rr);
/**
- * convert each dname in each rr in a rr_list to its canonical form
+ * converts each dname in each rr in a rr_list to its canonical form.
* \param[in] rr_list the rr_list to work on
* \return void
*/
void ldns_rr_list2canonical(ldns_rr_list *rr_list);
/**
- * count the number of labels of the ownername
+ * counts the number of labels of the ownername.
* \param[in] rr count the labels of this rr
* \return the number of labels
*/