Update to ldns-1.6.7
[dragonfly.git] / contrib / ldns / ldns / str2host.h
1 /**
2  * str2host.h - conversion from str to the host fmt
3  *
4  * a Net::DNS like library for C
5  *
6  * (c) NLnet Labs, 2005-2006
7  *
8  * See the file LICENSE for the license
9  */
10
11 #ifndef LDNS_2HOST_H
12 #define LDNS_2HOST_H
13
14 #include <ldns/common.h>
15 #include <ldns/error.h>
16 #include <ldns/rr.h>
17 #include <ldns/rdata.h>
18 #include <ldns/packet.h>
19 #include <ldns/buffer.h>
20 #include <ctype.h>
21
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25
26 /**
27  * \file
28  *
29  * Defines functions to convert dns data in presentation format or text files
30  * to internal structures.
31  */
32
33 /**
34  * convert a byte into wireformat
35  * \param[in] rd the rdf where to put the data
36  * \param[in] bytestr the string to be converted
37  * \return ldns_status
38  */
39 ldns_status ldns_str2rdf_int8(ldns_rdf **rd, const char *bytestr);
40
41 /**
42  * convert a string to a int16 in wireformat
43  * \param[in] rd the rdf where to put the data
44  * \param[in] shortstr the string to be converted
45  * \return ldns_status
46  */
47 ldns_status ldns_str2rdf_int16(ldns_rdf **rd, const char *shortstr);
48
49 /**
50  * convert a strings into a 4 byte int in wireformat
51  * \param[in] rd the rdf where to put the data
52  * \param[in] longstr the string to be converted
53  * \return ldns_status
54  */
55 ldns_status ldns_str2rdf_int32(ldns_rdf **rd, const char *longstr);
56
57 /**
58  * convert a time string to a time value in wireformat
59  * \param[in] rd the rdf where to put the data
60  * \param[in] time the string to be converted
61  * \return ldns_status
62  */
63 ldns_status ldns_str2rdf_time(ldns_rdf **rd, const char *time);
64
65 /* convert string with NSEC3 salt to wireformat) 
66  * \param[in] rd the rdf where to put the data
67  * \param[in] str the string to be converted
68  * return ldns_status
69  */
70 ldns_status ldns_str2rdf_nsec3_salt(ldns_rdf **rd, const char *nsec3_salt);
71
72 /* convert a time period (think TTL's) to wireformat) 
73  * \param[in] rd the rdf where to put the data
74  * \param[in] str the string to be converted
75  * return ldns_status
76  */
77 ldns_status ldns_str2rdf_period(ldns_rdf **rd, const char *str);
78
79 /**
80  * convert str with an A record into wireformat
81  * \param[in] rd the rdf where to put the data
82  * \param[in] str the string to be converted
83  * \return ldns_status
84  */
85 ldns_status ldns_str2rdf_a(ldns_rdf **rd, const char *str);
86
87 /**
88  * convert the str with an AAAA record into wireformat
89  * \param[in] rd the rdf where to put the data
90  * \param[in] str the string to be converted
91  * \return ldns_status
92  */
93 ldns_status ldns_str2rdf_aaaa(ldns_rdf **rd, const char *str);
94
95 /**
96  * convert a string into wireformat (think txt record)
97  * \param[in] rd the rdf where to put the data
98  * \param[in] str the string to be converted (NULL terminated)
99  * \return ldns_status
100  */
101 ldns_status ldns_str2rdf_str(ldns_rdf **rd, const char *str);
102
103 /**
104  * convert str with the apl record into wireformat
105  * \param[in] rd the rdf where to put the data
106  * \param[in] str the string to be converted
107  * \return ldns_status
108  */
109 ldns_status ldns_str2rdf_apl(ldns_rdf **rd, const char *str);
110
111 /**
112  * convert the string with the b64 data into wireformat
113  * \param[in] rd the rdf where to put the data
114  * \param[in] str the string to be converted
115  * \return ldns_status
116  */
117 ldns_status ldns_str2rdf_b64(ldns_rdf **rd, const char *str);
118
119 /**
120  * convert the string with the b32 ext hex data into wireformat
121  * \param[in] rd the rdf where to put the data
122  * \param[in] str the string to be converted
123  * \return ldns_status
124  */
125 ldns_status ldns_str2rdf_b32_ext(ldns_rdf **rd, const char *str);
126
127 /**
128  * convert a hex value into wireformat
129  * \param[in] rd the rdf where to put the data
130  * \param[in] str the string to be converted
131  * \return ldns_status
132  */
133 ldns_status ldns_str2rdf_hex(ldns_rdf **rd, const char *str);
134
135 /**
136  * convert string with nsec into wireformat
137  * \param[in] rd the rdf where to put the data
138  * \param[in] str the string to be converted
139  * \return ldns_status
140  */
141 ldns_status ldns_str2rdf_nsec(ldns_rdf **rd, const char *str);
142
143 /**
144  * convert a rrtype into wireformat
145  * \param[in] rd the rdf where to put the data
146  * \param[in] str the string to be converted
147  * \return ldns_status
148  */
149 ldns_status ldns_str2rdf_type(ldns_rdf **rd, const char *str);
150
151 /**
152  * convert string with a classname into wireformat
153  * \param[in] rd the rdf where to put the data
154  * \param[in] str the string to be converted
155  * \return ldns_status
156  */
157 ldns_status ldns_str2rdf_class(ldns_rdf **rd, const char *str);
158
159 /**
160  * convert an certificate algorithm value into wireformat
161  * \param[in] rd the rdf where to put the data
162  * \param[in] str the string to be converted
163  * \return ldns_status
164  */
165 ldns_status ldns_str2rdf_cert_alg(ldns_rdf **rd, const char *str);
166
167 /**
168  * convert and algorithm value into wireformat
169  * \param[in] rd the rdf where to put the data
170  * \param[in] str the string to be converted
171  * \return ldns_status
172  */
173 ldns_status ldns_str2rdf_alg(ldns_rdf **rd, const char *str);
174
175 /**
176  * convert a string with a unknown RR into wireformat
177  * \param[in] rd the rdf where to put the data
178  * \param[in] str the string to be converted
179  * \return ldns_status
180  */
181 ldns_status ldns_str2rdf_unknown(ldns_rdf **rd, const char *str);
182
183 /**
184  * convert string with a tsig? RR into wireformat
185  * \param[in] rd the rdf where to put the data
186  * \param[in] str the string to be converted
187  * \return ldns_status
188  */
189 ldns_status ldns_str2rdf_tsig(ldns_rdf **rd, const char *str);
190
191 /**
192  * convert string with a protocol service into wireformat
193  * \param[in] rd the rdf where to put the data
194  * \param[in] str the string to be converted
195  * \return ldns_status
196  */
197 ldns_status ldns_str2rdf_service(ldns_rdf **rd, const char *str);
198
199 /**
200  * convert a string with a LOC RR into wireformat
201  * \param[in] rd the rdf where to put the data
202  * \param[in] str the string to be converted
203  * \return ldns_status
204  */
205 ldns_status ldns_str2rdf_loc(ldns_rdf **rd, const char *str);
206
207 /**
208  * convert string with a WKS RR into wireformat
209  * \param[in] rd the rdf where to put the data
210  * \param[in] str the string to be converted
211  * \return ldns_status
212  */
213 ldns_status ldns_str2rdf_wks(ldns_rdf **rd, const char *str);
214
215 /**
216  * convert a str with a NSAP RR into wireformat
217  * \param[in] rd the rdf where to put the data
218  * \param[in] str the string to be converted
219  * \return ldns_status
220  */
221 ldns_status ldns_str2rdf_nsap(ldns_rdf **rd, const char *str);
222
223 /**
224  * convert a str with a ATMA RR into wireformat
225  * \param[in] rd the rdf where to put the data
226  * \param[in] str the string to be converted
227  * \return ldns_status
228  */
229 ldns_status ldns_str2rdf_atma(ldns_rdf **rd, const char *str);
230
231 /**
232  * convert a str with a IPSECKEY RR into wireformat
233  * \param[in] rd the rdf where to put the data
234  * \param[in] str the string to be converted
235  * \return ldns_status
236  */
237 ldns_status ldns_str2rdf_ipseckey(ldns_rdf **rd, const char *str);
238
239 /**
240  * convert a dname string into wireformat
241  * \param[in] rd the rdf where to put the data
242  * \param[in] str the string to be converted
243  * \return ldns_status
244  */
245 ldns_status ldns_str2rdf_dname(ldns_rdf **rd, const char *str);
246
247 #ifdef __cplusplus
248 }
249 #endif
250
251 #endif /* LDNS_2HOST_H */