summaryrefslogtreecommitdiffstats
blob: 09416cd2252738067fd56f191c04500f91f936b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
/**
 * str2host.h - conversion from str to the host fmt
 *
 * a Net::DNS like library for C
 *
 * (c) NLnet Labs, 2005-2006
 *
 * See the file LICENSE for the license
 */

#ifndef LDNS_2HOST_H
#define LDNS_2HOST_H

#include <ldns/common.h>
#include <ldns/error.h>
#include <ldns/rr.h>
#include <ldns/rdata.h>
#include <ldns/packet.h>
#include <ldns/buffer.h>
#include <ctype.h>

#ifdef __cplusplus
extern "C" {
#endif

/**
 * \file
 *
 * Defines functions to convert dns data in presentation format or text files
 * to internal structures.
 */

/**
 * convert a byte into wireformat
 * \param[in] rd the rdf where to put the data
 * \param[in] bytestr the string to be converted
 * \return ldns_status
 */
ldns_status ldns_str2rdf_int8(ldns_rdf **rd, const char *bytestr);

/**
 * convert a string to a int16 in wireformat
 * \param[in] rd the rdf where to put the data
 * \param[in] shortstr the string to be converted
 * \return ldns_status
 */
ldns_status ldns_str2rdf_int16(ldns_rdf **rd, const char *shortstr);

/**
 * convert a strings into a 4 byte int in wireformat
 * \param[in] rd the rdf where to put the data
 * \param[in] longstr the string to be converted
 * \return ldns_status
 */
ldns_status ldns_str2rdf_int32(ldns_rdf **rd, const char *longstr);

/**
 * convert a time string to a time value in wireformat
 * \param[in] rd the rdf where to put the data
 * \param[in] time the string to be converted
 * \return ldns_status
 */
ldns_status ldns_str2rdf_time(ldns_rdf **rd, const char *time);

/* convert string with NSEC3 salt to wireformat) 
 * \param[in] rd the rdf where to put the data
 * \param[in] str the string to be converted
 * return ldns_status
 */
ldns_status ldns_str2rdf_nsec3_salt(ldns_rdf **rd, const char *nsec3_salt);

/* convert a time period (think TTL's) to wireformat) 
 * \param[in] rd the rdf where to put the data
 * \param[in] str the string to be converted
 * return ldns_status
 */
ldns_status ldns_str2rdf_period(ldns_rdf **rd, const char *str);

/**
 * convert str with an A record into wireformat
 * \param[in] rd the rdf where to put the data
 * \param[in] str the string to be converted
 * \return ldns_status
 */
ldns_status ldns_str2rdf_a(ldns_rdf **rd, const char *str);

/**
 * convert the str with an AAAA record into wireformat
 * \param[in] rd the rdf where to put the data
 * \param[in] str the string to be converted
 * \return ldns_status
 */
ldns_status ldns_str2rdf_aaaa(ldns_rdf **rd, const char *str);

/**
 * convert a string into wireformat (think txt record)
 * \param[in] rd the rdf where to put the data
 * \param[in] str the string to be converted (NULL terminated)
 * \return ldns_status
 */
ldns_status ldns_str2rdf_str(ldns_rdf **rd, const char *str);

/**
 * convert str with the apl record into wireformat
 * \param[in] rd the rdf where to put the data
 * \param[in] str the string to be converted
 * \return ldns_status
 */
ldns_status ldns_str2rdf_apl(ldns_rdf **rd, const char *str);

/**
 * convert the string with the b64 data into wireformat
 * \param[in] rd the rdf where to put the data
 * \param[in] str the string to be converted
 * \return ldns_status
 */
ldns_status ldns_str2rdf_b64(ldns_rdf **rd, const char *str);

/**
 * convert the string with the b32 ext hex data into wireformat
 * \param[in] rd the rdf where to put the data
 * \param[in] str the string to be converted
 * \return ldns_status
 */
ldns_status ldns_str2rdf_b32_ext(ldns_rdf **rd, const char *str);

/**
 * convert a hex value into wireformat
 * \param[in] rd the rdf where to put the data
 * \param[in] str the string to be converted
 * \return ldns_status
 */
ldns_status ldns_str2rdf_hex(ldns_rdf **rd, const char *str);

/**
 * convert string with nsec into wireformat
 * \param[in] rd the rdf where to put the data
 * \param[in] str the string to be converted
 * \return ldns_status
 */
ldns_status ldns_str2rdf_nsec(ldns_rdf **rd, const char *str);

/**
 * convert a rrtype into wireformat
 * \param[in] rd the rdf where to put the data
 * \param[in] str the string to be converted
 * \return ldns_status
 */
ldns_status ldns_str2rdf_type(ldns_rdf **rd, const char *str);

/**
 * convert string with a classname into wireformat
 * \param[in] rd the rdf where to put the data
 * \param[in] str the string to be converted
 * \return ldns_status
 */
ldns_status ldns_str2rdf_class(ldns_rdf **rd, const char *str);

/**
 * convert an certificate algorithm value into wireformat
 * \param[in] rd the rdf where to put the data
 * \param[in] str the string to be converted
 * \return ldns_status
 */
ldns_status ldns_str2rdf_cert_alg(ldns_rdf **rd, const char *str);

/**
 * convert and algorithm value into wireformat
 * \param[in] rd the rdf where to put the data
 * \param[in] str the string to be converted
 * \return ldns_status
 */
ldns_status ldns_str2rdf_alg(ldns_rdf **rd, const char *str);

/**
 * convert a string with a unknown RR into wireformat
 * \param[in] rd the rdf where to put the data
 * \param[in] str the string to be converted
 * \return ldns_status
 */
ldns_status ldns_str2rdf_unknown(ldns_rdf **rd, const char *str);

/**
 * convert string with a tsig? RR into wireformat
 * \param[in] rd the rdf where to put the data
 * \param[in] str the string to be converted
 * \return ldns_status
 */
ldns_status ldns_str2rdf_tsig(ldns_rdf **rd, const char *str);

/**
 * convert string with a protocol service into wireformat
 * \param[in] rd the rdf where to put the data
 * \param[in] str the string to be converted
 * \return ldns_status
 */
ldns_status ldns_str2rdf_service(ldns_rdf **rd, const char *str);

/**
 * convert a string with a LOC RR into wireformat
 * \param[in] rd the rdf where to put the data
 * \param[in] str the string to be converted
 * \return ldns_status
 */
ldns_status ldns_str2rdf_loc(ldns_rdf **rd, const char *str);

/**
 * convert string with a WKS RR into wireformat
 * \param[in] rd the rdf where to put the data
 * \param[in] str the string to be converted
 * \return ldns_status
 */
ldns_status ldns_str2rdf_wks(ldns_rdf **rd, const char *str);

/**
 * convert a str with a NSAP RR into wireformat
 * \param[in] rd the rdf where to put the data
 * \param[in] str the string to be converted
 * \return ldns_status
 */
ldns_status ldns_str2rdf_nsap(ldns_rdf **rd, const char *str);

/**
 * convert a str with a ATMA RR into wireformat
 * \param[in] rd the rdf where to put the data
 * \param[in] str the string to be converted
 * \return ldns_status
 */
ldns_status ldns_str2rdf_atma(ldns_rdf **rd, const char *str);

/**
 * convert a str with a IPSECKEY RR into wireformat
 * \param[in] rd the rdf where to put the data
 * \param[in] str the string to be converted
 * \return ldns_status
 */
ldns_status ldns_str2rdf_ipseckey(ldns_rdf **rd, const char *str);

/**
 * convert a dname string into wireformat
 * \param[in] rd the rdf where to put the data
 * \param[in] str the string to be converted
 * \return ldns_status
 */
ldns_status ldns_str2rdf_dname(ldns_rdf **rd, const char *str);

#ifdef __cplusplus
}
#endif

#endif /* LDNS_2HOST_H */