dname.h
Go to the documentation of this file.
1 /*
2  * dname.h
3  *
4  * dname definitions
5  *
6  * a Net::DNS like library for C
7  *
8  * (c) NLnet Labs, 2004-2006
9  *
10  * See the file LICENSE for the license
11  */
12 
39 #ifndef LDNS_DNAME_H
40 #define LDNS_DNAME_H
41 
42 #include <ldns/common.h>
43 #include <ldns/rdata.h>
44 
45 #ifdef __cplusplus
46 extern "C" {
47 #endif
48 
49 #define LDNS_DNAME_NORMALIZE tolower
50 
57 ldns_rdf *ldns_dname_cat_clone(const ldns_rdf *rd1, const ldns_rdf *rd2);
58 
66 
74 
84 ldns_rdf *
85 ldns_dname_clone_from(const ldns_rdf *d, uint16_t n);
86 
95 
101 uint8_t ldns_dname_label_count(const ldns_rdf *r);
102 
108 ldns_rdf *ldns_dname_new_frm_str(const char *str);
109 
118 ldns_rdf *ldns_dname_new(uint16_t s, void *data);
119 
127 ldns_rdf *ldns_dname_new_frm_data(uint16_t size, const void *data);
128 
134 void ldns_dname2canonical(const ldns_rdf *rdf);
135 
144 bool ldns_dname_is_subdomain(const ldns_rdf *sub, const ldns_rdf *parent);
145 
153 int ldns_dname_compare(const ldns_rdf *dname1, const ldns_rdf *dname2);
154 int ldns_dname_compare_v(const void *, const void *);
155 
165 int ldns_dname_match_wildcard(const ldns_rdf *dname, const ldns_rdf *wildcard);
166 
175 int ldns_dname_interval(const ldns_rdf *prev, const ldns_rdf *middle, const ldns_rdf *next);
176 
182 bool ldns_dname_str_absolute(const char *dname_str);
183 
189 bool ldns_dname_absolute(const ldns_rdf *dname);
190 
199 ldns_rdf * ldns_dname_label(const ldns_rdf *rdf, uint8_t labelpos);
200 
206 int ldns_dname_is_wildcard(const ldns_rdf* dname);
207 
208 #ifdef __cplusplus
209 }
210 #endif
211 
212 #endif /* LDNS_DNAME_H */
Common definitions for LDNS.
bool ldns_dname_str_absolute(const char *dname_str)
Checks whether the given dname string is absolute (i.e.
Definition: dname.c:518
int ldns_dname_is_wildcard(const ldns_rdf *dname)
Check if dname is a wildcard, starts with *.
Definition: dname.c:456
ldns_rdf * ldns_dname_cat_clone(const ldns_rdf *rd1, const ldns_rdf *rd2)
concatenates two dnames together
Definition: dname.c:52
ldns_rdf * ldns_dname_new_frm_data(uint16_t size, const void *data)
Create a new dname rdf from data (the data is copied)
Definition: dname.c:274
int ldns_dname_match_wildcard(const ldns_rdf *dname, const ldns_rdf *wildcard)
Checks whether the dname matches the given wildcard.
Definition: dname.c:464
ldns_rdf * ldns_dname_clone_from(const ldns_rdf *d, uint16_t n)
Clones the given dname from the nth label on.
Definition: dname.c:160
ldns_rdf * ldns_dname_reverse(const ldns_rdf *d)
Returns a clone of the given dname with the labels reversed.
Definition: dname.c:124
bool ldns_dname_absolute(const ldns_rdf *dname)
Checks whether the given dname is absolute (i.e.
Definition: dname.c:548
bool ldns_dname_is_subdomain(const ldns_rdf *sub, const ldns_rdf *parent)
test whether the name sub falls under parent (i.e.
Definition: dname.c:296
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.
Definition: dname.c:359
int ldns_dname_compare_v(const void *, const void *)
Given in dnssec_zone.c, also used in dnssec_sign.c:w.
Definition: dnssec_zone.c:910
ldns_rdf * ldns_dname_left_chop(const ldns_rdf *d)
chop one label off the left side of a dname.
Definition: dname.c:189
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.
Definition: dname.c:488
void ldns_dname2canonical(const ldns_rdf *rdf)
Put a dname into canonical fmt - ie.
Definition: dname.c:280
ldns_rdf * ldns_dname_new(uint16_t s, void *data)
Create a new dname rdf from a string.
Definition: dname.c:250
uint8_t ldns_dname_label_count(const ldns_rdf *r)
count the number of labels inside a LDNS_RDF_DNAME type rdf.
Definition: dname.c:214
ldns_status ldns_dname_cat(ldns_rdf *rd1, const ldns_rdf *rd2)
concatenates rd2 after rd1 (rd2 is copied, rd1 is modified)
Definition: dname.c:90
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.
Definition: dname.c:560
ldns_rdf * ldns_dname_new_frm_str(const char *str)
creates a new dname rdf from a string.
Definition: dname.c:268
enum ldns_enum_status ldns_status
Definition: error.h:146
Defines ldns_rdf and functions to manipulate those.
Resource record data field.
Definition: rdata.h:197