Go to the source code of this file.
Defines | |
#define | LDNS_DNAME_NORMALIZE tolower |
Functions | |
ldns_rdf * | ldns_dname_cat_clone (const ldns_rdf *rd1, const ldns_rdf *rd2) |
concatenates two dnames together | |
ldns_status | ldns_dname_cat (ldns_rdf *rd1, ldns_rdf *rd2) |
concatenates rd2 after rd1 (rd2 is copied, rd1 is modified) | |
ldns_rdf * | ldns_dname_reverse (const ldns_rdf *d) |
Returns a clone of the given dname with the labels reversed. | |
ldns_rdf * | ldns_dname_left_chop (const ldns_rdf *d) |
chop one label off the left side of a dname. | |
uint8_t | ldns_dname_label_count (const ldns_rdf *r) |
count the number of labels inside a LDNS_RDF_DNAME type rdf. | |
ldns_rdf * | ldns_dname_new_frm_str (const char *str) |
creates a new dname rdf from a string. | |
ldns_rdf * | ldns_dname_new (uint16_t s, void *data) |
Create a new dname rdf from a string. | |
ldns_rdf * | ldns_dname_new_frm_data (uint16_t size, const void *data) |
Create a new dname rdf from data (the data is copied). | |
void | ldns_dname2canonical (const ldns_rdf *rdf) |
Put a dname into canonical fmt - ie. | |
bool | ldns_dname_is_subdomain (const ldns_rdf *sub, const ldns_rdf *parent) |
test wether the name sub falls under parent (i.e. | |
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. | |
int | ldns_dname_interval (const ldns_rdf *prev, const ldns_rdf *middle, const ldns_rdf *next) |
check if middle lays in the interval defined by prev and next prev <= middle < next. | |
bool | ldns_dname_str_absolute (const char *dname_str) |
Checks whether the given dname string is absolute (i.e. | |
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. |
Example domain names are "www.nlnetlabs.nl." and "." (the root)
If a domain name ends with a dot ("."), it is called a Fully Qualified Domain Name (FQDN). In certain places (for instance when reading a zone file), an origin (which is just another domain name) non-FQDNs will be placed after the current. For instance, if i have a zone file where the origin has been set to "nl.", and my file contains the name "www.nlnetlabs", it will result in "www.nlnetlabs.nl.". Internally, dnames are always absolute (the dot is added when it is missing and there is no origin).
An FQDN is also known as an absolute domain name, therefore the function to check this is called ldns_dname_str_absolute
Domain names are stored in ldns_rdf structures, with the type LDNS_RDF_TYPE_DNAME
This module is *NOT* about the RR type called DNAME.
Definition in file dname.h.
concatenates two dnames together
[in] | rd1 | the leftside |
[in] | rd2 | the rightside |
Definition at line 26 of file dname.c.
References LDNS_FREE, ldns_rdf_data(), ldns_rdf_get_type(), ldns_rdf_new_frm_data(), ldns_rdf_size(), LDNS_RDF_TYPE_DNAME, and LDNS_XMALLOC.
ldns_status ldns_dname_cat | ( | ldns_rdf * | rd1, | |
ldns_rdf * | rd2 | |||
) |
concatenates rd2 after rd1 (rd2 is copied, rd1 is modified)
[in] | rd1 | the leftside |
[in] | rd2 | the rightside |
Definition at line 64 of file dname.c.
References ldns_rdf_data(), ldns_rdf_get_type(), ldns_rdf_set_data(), ldns_rdf_set_size(), ldns_rdf_size(), LDNS_RDF_TYPE_DNAME, LDNS_STATUS_ERR, LDNS_STATUS_OK, and LDNS_XREALLOC.
Returns a clone of the given dname with the labels reversed.
[in] | d | the dname to reverse |
Definition at line 93 of file dname.c.
References ldns_dname_cat(), ldns_dname_label(), ldns_dname_label_count(), ldns_dname_left_chop(), ldns_dname_new_frm_str(), ldns_rdf_clone(), and ldns_rdf_deep_free().
chop one label off the left side of a dname.
so wwww.nlnetlabs.nl, becomes nlnetlabs.nl
[in] | d | the dname to chop |
Definition at line 119 of file dname.c.
References ldns_dname_label_count(), ldns_dname_new_frm_data(), ldns_rdf_data(), ldns_rdf_get_type(), ldns_rdf_size(), and LDNS_RDF_TYPE_DNAME.
uint8_t ldns_dname_label_count | ( | const ldns_rdf * | r | ) |
count the number of labels inside a LDNS_RDF_DNAME type rdf.
[in] | *r | the rdf |
Definition at line 144 of file dname.c.
References ldns_rdf_data(), ldns_rdf_get_type(), ldns_rdf_size(), and LDNS_RDF_TYPE_DNAME.
ldns_rdf* ldns_dname_new_frm_str | ( | const char * | str | ) |
creates a new dname rdf from a string.
[in] | str | string to use |
Definition at line 195 of file dname.c.
References ldns_rdf_new_frm_str(), and LDNS_RDF_TYPE_DNAME.
ldns_rdf* ldns_dname_new | ( | uint16_t | s, | |
void * | data | |||
) |
Create a new dname rdf from a string.
[in] | s | the size of the new dname |
[in] | *data | pointer to the actual data |
Definition at line 180 of file dname.c.
References LDNS_MALLOC, ldns_rdf_set_data(), ldns_rdf_set_size(), ldns_rdf_set_type(), and LDNS_RDF_TYPE_DNAME.
ldns_rdf* ldns_dname_new_frm_data | ( | uint16_t | size, | |
const void * | data | |||
) |
Create a new dname rdf from data (the data is copied).
[in] | size | the size of the data |
[in] | *data | pointer to the actual data |
Definition at line 201 of file dname.c.
References ldns_rdf_new_frm_data(), and LDNS_RDF_TYPE_DNAME.
void ldns_dname2canonical | ( | const ldns_rdf * | rdf | ) |
Put a dname into canonical fmt - ie.
lowercase it
[in] | rdf | the dname to lowercase |
Definition at line 207 of file dname.c.
References LDNS_DNAME_NORMALIZE, ldns_rdf_data(), ldns_rdf_get_type(), ldns_rdf_size(), and LDNS_RDF_TYPE_DNAME.
test wether the name sub falls under parent (i.e.
is a subdomain of parent.
[in] | sub | the name to test |
[in] | parent | the parent's name |
Definition at line 223 of file dname.c.
References ldns_dname_label(), ldns_dname_label_count(), ldns_rdf_compare(), ldns_rdf_deep_free(), ldns_rdf_get_type(), and LDNS_RDF_TYPE_DNAME.
Compares the two dname rdf's according to the algorithm for ordering in RFC4034 Section 6.
[in] | dname1 | First dname rdf to compare |
[in] | dname2 | Second dname rdf to compare |
Definition at line 267 of file dname.c.
References ldns_dname_label_count(), LDNS_DNAME_NORMALIZE, ldns_rdf_data(), ldns_rdf_get_type(), and LDNS_RDF_TYPE_DNAME.
check if middle lays in the interval defined by prev and next prev <= middle < next.
This is usefull for nsec checking
[in] | prev | the previous dname |
[in] | middle | the dname to check |
[in] | next | the next dname return 0 on error or unknown, -1 when middle is in the interval, +1 when not |
Definition at line 371 of file dname.c.
References ldns_dname_compare(), ldns_rdf_get_type(), and LDNS_RDF_TYPE_DNAME.
bool ldns_dname_str_absolute | ( | const char * | dname_str | ) |
look inside the rdf and if it is an LDNS_RDF_TYPE_DNAME try and retrieve a specific label.
The labels are numbered starting from 0 (left most).
[in] | rdf | the rdf to look in |
[in] | labelpos | return the label with this number |
Definition at line 410 of file dname.c.
References ldns_struct_rdf::_data, ldns_struct_rdf::_size, ldns_struct_rdf::_type, LDNS_MALLOC, ldns_rdf_data(), ldns_rdf_get_type(), ldns_rdf_size(), LDNS_RDF_TYPE_DNAME, and LDNS_XMALLOC.