1 /* $NetBSD: resolve.h,v 1.1.1.2 2011/04/14 14:09:31 elric Exp $ */
4 * Copyright (c) 1995 - 2002 Kungliga Tekniska Högskolan
5 * (Royal Institute of Technology, Stockholm, Sweden).
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
19 * 3. Neither the name of the Institute nor the names of its contributors
20 * may be used to endorse or promote products derived from this software
21 * without specific prior written permission.
23 * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
24 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
41 #ifndef ROKEN_LIB_FUNCTION
43 #define ROKEN_LIB_FUNCTION
44 #define ROKEN_LIB_CALL __cdecl
46 #define ROKEN_LIB_FUNCTION
47 #define ROKEN_LIB_CALL
56 rk_ns_t_invalid
= 0, /* Cookie. */
57 rk_ns_t_a
= 1, /* Host address. */
58 rk_ns_t_ns
= 2, /* Authoritative server. */
59 rk_ns_t_md
= 3, /* Mail destination. */
60 rk_ns_t_mf
= 4, /* Mail forwarder. */
61 rk_ns_t_cname
= 5, /* Canonical name. */
62 rk_ns_t_soa
= 6, /* Start of authority zone. */
63 rk_ns_t_mb
= 7, /* Mailbox domain name. */
64 rk_ns_t_mg
= 8, /* Mail group member. */
65 rk_ns_t_mr
= 9, /* Mail rename name. */
66 rk_ns_t_null
= 10, /* Null resource record. */
67 rk_ns_t_wks
= 11, /* Well known service. */
68 rk_ns_t_ptr
= 12, /* Domain name pointer. */
69 rk_ns_t_hinfo
= 13, /* Host information. */
70 rk_ns_t_minfo
= 14, /* Mailbox information. */
71 rk_ns_t_mx
= 15, /* Mail routing information. */
72 rk_ns_t_txt
= 16, /* Text strings. */
73 rk_ns_t_rp
= 17, /* Responsible person. */
74 rk_ns_t_afsdb
= 18, /* AFS cell database. */
75 rk_ns_t_x25
= 19, /* X_25 calling address. */
76 rk_ns_t_isdn
= 20, /* ISDN calling address. */
77 rk_ns_t_rt
= 21, /* Router. */
78 rk_ns_t_nsap
= 22, /* NSAP address. */
79 rk_ns_t_nsap_ptr
= 23, /* Reverse NSAP lookup (deprecated). */
80 rk_ns_t_sig
= 24, /* Security signature. */
81 rk_ns_t_key
= 25, /* Security key. */
82 rk_ns_t_px
= 26, /* X.400 mail mapping. */
83 rk_ns_t_gpos
= 27, /* Geographical position (withdrawn). */
84 rk_ns_t_aaaa
= 28, /* Ip6 Address. */
85 rk_ns_t_loc
= 29, /* Location Information. */
86 rk_ns_t_nxt
= 30, /* Next domain (security). */
87 rk_ns_t_eid
= 31, /* Endpoint identifier. */
88 rk_ns_t_nimloc
= 32, /* Nimrod Locator. */
89 rk_ns_t_srv
= 33, /* Server Selection. */
90 rk_ns_t_atma
= 34, /* ATM Address */
91 rk_ns_t_naptr
= 35, /* Naming Authority PoinTeR */
92 rk_ns_t_kx
= 36, /* Key Exchange */
93 rk_ns_t_cert
= 37, /* Certification record */
94 rk_ns_t_a6
= 38, /* IPv6 address (deprecates AAAA) */
95 rk_ns_t_dname
= 39, /* Non-terminal DNAME (for IPv6) */
96 rk_ns_t_sink
= 40, /* Kitchen sink (experimentatl) */
97 rk_ns_t_opt
= 41, /* EDNS0 option (meta-RR) */
98 rk_ns_t_apl
= 42, /* Address prefix list (RFC 3123) */
99 rk_ns_t_ds
= 43, /* Delegation Signer (RFC 3658) */
100 rk_ns_t_sshfp
= 44, /* SSH fingerprint */
101 rk_ns_t_tkey
= 249, /* Transaction key */
102 rk_ns_t_tsig
= 250, /* Transaction signature. */
103 rk_ns_t_ixfr
= 251, /* Incremental zone transfer. */
104 rk_ns_t_axfr
= 252, /* Transfer zone of authority. */
105 rk_ns_t_mailb
= 253, /* Transfer mailbox records. */
106 rk_ns_t_maila
= 254, /* Transfer mail agent records. */
107 rk_ns_t_any
= 255, /* Wildcard match. */
108 rk_ns_t_zxfr
= 256, /* BIND-specific, nonstandard. */
113 #define MAXDNAME 1025
116 #define mx_record rk_mx_record
117 #define srv_record rk_srv_record
118 #define key_record rk_key_record
119 #define sig_record rk_sig_record
120 #define cert_record rk_cert_record
121 #define sshfp_record rk_sshfp_record
134 struct rk_srv_record
{
141 struct rk_key_record
{
149 struct rk_sig_record
{
154 unsigned sig_expiration
;
155 unsigned sig_inception
;
159 char sig_data
[1]; /* also includes signer */
162 struct rk_cert_record
{
170 struct rk_sshfp_record
{
174 u_char sshfp_data
[1];
177 struct rk_ds_record
{
180 unsigned digest_type
;
182 u_char digest_data
[1];
185 struct rk_resource_record
{
193 struct rk_mx_record
*mx
;
194 struct rk_mx_record
*afsdb
; /* mx and afsdb are identical */
195 struct rk_srv_record
*srv
;
198 struct rk_key_record
*key
;
199 struct rk_cert_record
*cert
;
200 struct rk_sig_record
*sig
;
201 struct rk_sshfp_record
*sshfp
;
202 struct rk_ds_record
*ds
;
204 struct rk_resource_record
*next
;
207 #define rk_DNS_MAX_PACKET_SIZE 0xffff
209 struct rk_dns_header
{
212 #define rk_DNS_HEADER_RESPONSE_FLAG 1
213 #define rk_DNS_HEADER_AUTHORITIVE_ANSWER 2
214 #define rk_DNS_HEADER_TRUNCATED_MESSAGE 4
215 #define rk_DNS_HEADER_RECURSION_DESIRED 8
216 #define rk_DNS_HEADER_RECURSION_AVAILABLE 16
217 #define rk_DNS_HEADER_AUTHENTIC_DATA 32
218 #define rk_DNS_HEADER_CHECKING_DISABLED 64
220 unsigned response_code
;
228 struct rk_dns_header h
;
229 struct rk_dns_query q
;
230 struct rk_resource_record
*head
;
238 ROKEN_LIB_FUNCTION
struct rk_dns_reply
* ROKEN_LIB_CALL
239 rk_dns_lookup(const char *, const char *);
240 ROKEN_LIB_FUNCTION
void ROKEN_LIB_CALL
241 rk_dns_free_data(struct rk_dns_reply
*);
242 ROKEN_LIB_FUNCTION
int ROKEN_LIB_CALL
243 rk_dns_string_to_type(const char *name
);
244 ROKEN_LIB_FUNCTION
const char * ROKEN_LIB_CALL
245 rk_dns_type_to_string(int type
);
246 ROKEN_LIB_FUNCTION
void ROKEN_LIB_CALL
247 rk_dns_srv_order(struct rk_dns_reply
*);
253 #endif /* __RESOLVE_H__ */