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 
117 ldns_rdf *ldns_dname_new(uint16_t s, void *data);
118 
126 ldns_rdf *ldns_dname_new_frm_data(uint16_t size, const void *data);
127 
133 void ldns_dname2canonical(const ldns_rdf *rdf);
134 
143 bool ldns_dname_is_subdomain(const ldns_rdf *sub, const ldns_rdf *parent);
144 
152 int ldns_dname_compare(const ldns_rdf *dname1, const ldns_rdf *dname2);
153 
163 int ldns_dname_match_wildcard(const ldns_rdf *dname, const ldns_rdf *wildcard);
164 
173 int ldns_dname_interval(const ldns_rdf *prev, const ldns_rdf *middle, const ldns_rdf *next);
174 
180 bool ldns_dname_str_absolute(const char *dname_str);
181 
187 bool ldns_dname_absolute(const ldns_rdf *dname);
188 
197 ldns_rdf * ldns_dname_label(const ldns_rdf *rdf, uint8_t labelpos);
198 
204 int ldns_dname_is_wildcard(const ldns_rdf* dname);
205 
206 #ifdef __cplusplus
207 }
208 #endif
209 
210 #endif /* LDNS_DNAME_H */
DSA *char * d
Definition: keys.c:662
ldns_rdf * ldns_dname_reverse(const ldns_rdf *dname)
Returns a clone of the given dname with the labels reversed.
Definition: dname.c:124
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
int ldns_dname_compare(const ldns_rdf *dname1, const ldns_rdf *dname2)
Compares the two dname rdf&#39;s according to the algorithm for ordering in RFC4034 Section 6...
Definition: dname.c:356
Defines ldns_rdf and functions to manipulate those.
void ldns_dname2canonical(const ldns_rdf *rd)
Put a dname into canonical fmt - ie.
Definition: dname.c:277
ldns_rdf * ldns_dname_left_chop(const ldns_rdf *d)
chop one label off the left side of a dname.
Definition: dname.c:189
ldns_rdf * ldns_dname_new_frm_str(const char *str)
creates a new dname rdf from a string.
Definition: dname.c:265
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
int ldns_dname_is_wildcard(const ldns_rdf *dname)
Check if dname is a wildcard, starts with *.
Definition: dname.c:453
ldns_status ldns_dname_cat(ldns_rdf *rd1, ldns_rdf *rd2)
concatenates rd2 after rd1 (rd2 is copied, rd1 is modified)
Definition: dname.c:90
ldns_rdf * ldns_dname_cat_clone(const ldns_rdf *rd1, const ldns_rdf *rd2)
concatenates two dnames together
Definition: dname.c:52
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 &lt;= middle &lt; next.
Definition: dname.c:485
enum ldns_enum_status ldns_status
Definition: error.h:122
bool ldns_dname_str_absolute(const char *dname_str)
Checks whether the given dname string is absolute (i.e.
Definition: dname.c:515
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:271
bool ldns_dname_is_subdomain(const ldns_rdf *sub, const ldns_rdf *parent)
test wether the name sub falls under parent (i.e.
Definition: dname.c:293
Resource record data field.
Definition: rdata.h:138
Common definitions for LDNS.
int ldns_dname_match_wildcard(const ldns_rdf *dname, const ldns_rdf *wildcard)
Checks whether the dname matches the given wildcard.
Definition: dname.c:461
bool ldns_dname_absolute(const ldns_rdf *rdf)
Checks whether the given dname is absolute (i.e.
Definition: dname.c:544
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:556
ldns_rdf * ldns_dname_new(uint16_t s, void *d)
Create a new dname rdf from a string.
Definition: dname.c:250