2 * Copyright (c) 1995 - 2002 Kungliga Tekniska Högskolan
3 * (Royal Institute of Technology, Stockholm, Sweden).
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
17 * 3. Neither the name of the Institute nor the names of its contributors
18 * may be used to endorse or promote products derived from this software
19 * without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
39 #ifndef ROKEN_LIB_FUNCTION
41 #define ROKEN_LIB_FUNCTION _stdcall
43 #define ROKEN_LIB_FUNCTION
48 rk_ns_t_invalid
= 0, /* Cookie. */
49 rk_ns_t_a
= 1, /* Host address. */
50 rk_ns_t_ns
= 2, /* Authoritative server. */
51 rk_ns_t_md
= 3, /* Mail destination. */
52 rk_ns_t_mf
= 4, /* Mail forwarder. */
53 rk_ns_t_cname
= 5, /* Canonical name. */
54 rk_ns_t_soa
= 6, /* Start of authority zone. */
55 rk_ns_t_mb
= 7, /* Mailbox domain name. */
56 rk_ns_t_mg
= 8, /* Mail group member. */
57 rk_ns_t_mr
= 9, /* Mail rename name. */
58 rk_ns_t_null
= 10, /* Null resource record. */
59 rk_ns_t_wks
= 11, /* Well known service. */
60 rk_ns_t_ptr
= 12, /* Domain name pointer. */
61 rk_ns_t_hinfo
= 13, /* Host information. */
62 rk_ns_t_minfo
= 14, /* Mailbox information. */
63 rk_ns_t_mx
= 15, /* Mail routing information. */
64 rk_ns_t_txt
= 16, /* Text strings. */
65 rk_ns_t_rp
= 17, /* Responsible person. */
66 rk_ns_t_afsdb
= 18, /* AFS cell database. */
67 rk_ns_t_x25
= 19, /* X_25 calling address. */
68 rk_ns_t_isdn
= 20, /* ISDN calling address. */
69 rk_ns_t_rt
= 21, /* Router. */
70 rk_ns_t_nsap
= 22, /* NSAP address. */
71 rk_ns_t_nsap_ptr
= 23, /* Reverse NSAP lookup (deprecated). */
72 rk_ns_t_sig
= 24, /* Security signature. */
73 rk_ns_t_key
= 25, /* Security key. */
74 rk_ns_t_px
= 26, /* X.400 mail mapping. */
75 rk_ns_t_gpos
= 27, /* Geographical position (withdrawn). */
76 rk_ns_t_aaaa
= 28, /* Ip6 Address. */
77 rk_ns_t_loc
= 29, /* Location Information. */
78 rk_ns_t_nxt
= 30, /* Next domain (security). */
79 rk_ns_t_eid
= 31, /* Endpoint identifier. */
80 rk_ns_t_nimloc
= 32, /* Nimrod Locator. */
81 rk_ns_t_srv
= 33, /* Server Selection. */
82 rk_ns_t_atma
= 34, /* ATM Address */
83 rk_ns_t_naptr
= 35, /* Naming Authority PoinTeR */
84 rk_ns_t_kx
= 36, /* Key Exchange */
85 rk_ns_t_cert
= 37, /* Certification record */
86 rk_ns_t_a6
= 38, /* IPv6 address (deprecates AAAA) */
87 rk_ns_t_dname
= 39, /* Non-terminal DNAME (for IPv6) */
88 rk_ns_t_sink
= 40, /* Kitchen sink (experimentatl) */
89 rk_ns_t_opt
= 41, /* EDNS0 option (meta-RR) */
90 rk_ns_t_apl
= 42, /* Address prefix list (RFC 3123) */
91 rk_ns_t_ds
= 43, /* Delegation Signer (RFC 3658) */
92 rk_ns_t_sshfp
= 44, /* SSH fingerprint */
93 rk_ns_t_tkey
= 249, /* Transaction key */
94 rk_ns_t_tsig
= 250, /* Transaction signature. */
95 rk_ns_t_ixfr
= 251, /* Incremental zone transfer. */
96 rk_ns_t_axfr
= 252, /* Transfer zone of authority. */
97 rk_ns_t_mailb
= 253, /* Transfer mailbox records. */
98 rk_ns_t_maila
= 254, /* Transfer mail agent records. */
99 rk_ns_t_any
= 255, /* Wildcard match. */
100 rk_ns_t_zxfr
= 256, /* BIND-specific, nonstandard. */
104 /* We use these, but they are not always present in <arpa/nameser.h> */
157 #define MAXDNAME 1025
160 #define dns_query rk_dns_query
161 #define mx_record rk_mx_record
162 #define srv_record rk_srv_record
163 #define key_record rk_key_record
164 #define sig_record rk_sig_record
165 #define cert_record rk_cert_record
166 #define sshfp_record rk_sshfp_record
167 #define resource_record rk_resource_record
168 #define dns_reply rk_dns_reply
170 #define dns_lookup rk_dns_lookup
171 #define dns_free_data rk_dns_free_data
172 #define dns_string_to_type rk_dns_string_to_type
173 #define dns_type_to_string rk_dns_type_to_string
174 #define dns_srv_order rk_dns_srv_order
207 unsigned sig_expiration
;
208 unsigned sig_inception
;
212 char sig_data
[1]; /* also includes signer */
223 struct sshfp_record
{
227 u_char sshfp_data
[1];
233 unsigned digest_type
;
235 u_char digest_data
[1];
238 struct resource_record
{
246 struct mx_record
*mx
;
247 struct mx_record
*afsdb
; /* mx and afsdb are identical */
248 struct srv_record
*srv
;
251 struct key_record
*key
;
252 struct cert_record
*cert
;
253 struct sig_record
*sig
;
254 struct sshfp_record
*sshfp
;
255 struct ds_record
*ds
;
257 struct resource_record
*next
;
260 #define rk_DNS_MAX_PACKET_SIZE 0xffff
265 #define rk_DNS_HEADER_RESPONSE_FLAG 1
266 #define rk_DNS_HEADER_AUTHORITIVE_ANSWER 2
267 #define rk_DNS_HEADER_TRUNCATED_MESSAGE 4
268 #define rk_DNS_HEADER_RECURSION_DESIRED 8
269 #define rk_DNS_HEADER_RECURSION_AVAILABLE 16
270 #define rk_DNS_HEADER_AUTHENTIC_DATA 32
271 #define rk_DNS_HEADER_CHECKING_DISABLED 64
273 unsigned response_code
;
283 struct resource_record
*head
;
287 struct dns_reply
* ROKEN_LIB_FUNCTION
288 dns_lookup(const char *, const char *);
289 void ROKEN_LIB_FUNCTION
290 dns_free_data(struct dns_reply
*);
291 int ROKEN_LIB_FUNCTION
292 dns_string_to_type(const char *name
);
293 const char *ROKEN_LIB_FUNCTION
294 dns_type_to_string(int type
);
295 void ROKEN_LIB_FUNCTION
296 dns_srv_order(struct dns_reply
*);
298 #endif /* __RESOLVE_H__ */