Merge from vendor branch BIND:
[dragonfly.git] / contrib / dhcp-3.0 / includes / minires / minires.h
1 /*
2  * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
3  * Copyright (c) 2001-2003 by Internet Software Consortium
4  *
5  * Permission to use, copy, modify, and distribute this software for any
6  * purpose with or without fee is hereby granted, provided that the above
7  * copyright notice and this permission notice appear in all copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
10  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11  * MERCHANTABILITY AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR
12  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
15  * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16  *
17  *   Internet Systems Consortium, Inc.
18  *   950 Charter Street
19  *   Redwood City, CA 94063
20  *   <info@isc.org>
21  *   http://www.isc.org/
22  */
23
24 #include "cdefs.h"
25 #include "osdep.h"
26
27 #define _ns_flagdata MR_ns_flagdata
28
29 #include "minires/resolv.h"
30 #include "minires/res_update.h"
31 #include "isc-dhcp/result.h"
32
33 /*
34  * Based on the Dynamic DNS reference implementation by Viraj Bais
35  * <viraj_bais@ccm.fm.intel.com>
36  */
37
38 int minires_mkupdate (ns_updrec *, unsigned char *, unsigned);
39 int minires_update (ns_updrec *);
40 ns_updrec *minires_mkupdrec (int, const char *, unsigned int,
41                              unsigned int, unsigned long);
42 void minires_freeupdrec (ns_updrec *);
43 int minires_nmkupdate (res_state, ns_updrec *, double *, unsigned *);
44 isc_result_t minires_nupdate (res_state, ns_updrec *);
45 int minires_ninit (res_state);
46 ns_rcode isc_rcode_to_ns (isc_result_t);
47
48 #if defined (MINIRES_LIB)
49 #define res_update minires_update
50 #define res_mkupdate minires_mkupdate
51 #define res_mkupdrec minires_mkupdrec
52 #define res_freeupdrec minires_freeupdrec
53 #define res_nmkupdate minires_nmkupdate
54 #define res_nupdate minires_nupdate
55 #define __p_type_syms MR__p_type_syms
56 #define dn_comp MRdn_comp
57 #define loc_aton MRloc_aton
58 #define sym_ston MRsym_ston
59 #define res_buildservicelist MRres_buildservicelist
60 #define res_destroyservicelist MRres_destroyservicelist
61 #define res_buildprotolist MRres_buildprotolist
62 #define res_destroyprotolist MRres_destroyprotolist
63 #define res_servicenumber MRres_servicenumber
64 #define res_protocolnumber MRres_protocolnumber
65 #define res_protocolname MRres_protocolname
66 #define res_servicename MRres_servicename
67 #define ns_datetosecs MRns_datetosecs
68 #define b64_pton MRb64_pton
69 #define res_ninit minires_ninit
70 #define res_randomid MRres_randomid
71 #define res_findzonecut MRres_findzonecut
72 #define res_nsend MRres_nsend
73 #define res_nsendsigned MRres_nsendsigned
74 #define ns_samename MRns_samename
75 #define res_nameinquery MRres_nameinquery
76 #define res_queriesmatch MRres_queriesmatch
77 #define dn_expand MRdn_expand
78 #define ns_get16 MRns_get16
79 #define res_close MRres_close
80 #define res_nclose MRres_nclose
81 #define res_ourserver_p MRres_ourserver_p
82 #define ns_sign MRns_sign
83 #define p_class MRp_class
84 #define p_section MRp_section
85 #define ns_makecanon MRns_makecanon
86 #define ns_parserr MRns_parserr
87 #define ns_samedomain MRns_samedomain
88 #define ns_name_uncompress MRns_name_uncompress
89 #define res_nmkquery MRres_nmkquery
90 #define ns_initparse MRns_initparse
91 #define res_nquery MRres_nquery
92 #define res_nsearch MRres_nsearch
93 #define res_hostalias MRres_hostalias
94 #define res_nquerydomain MRres_nquerydomain
95 #define ns_skiprr MRns_skiprr
96 #define dn_skipname MRdn_skipname
97 #define ns_name_ntol MRns_name_ntol
98 #define ns_sign_tcp_init MRns_sign_tcp_init
99 #define ns_sign_tcp MRns_sign_tcp
100 #define ns_name_ntop MRns_name_ntop
101 #define ns_name_pton MRns_name_pton
102 #define ns_name_unpack MRns_name_unpack
103 #define ns_name_pack MRns_name_pack
104 #define ns_name_compress MRns_name_compress
105 #define ns_name_skip MRns_name_skip
106 #define ns_subdomain MRns_subdomain
107 #define ns_find_tsig MRns_find_tsig
108 #define ns_verify MRns_verify
109 #define ns_verify_tcp_init MRns_verify_tcp_init
110 #define ns_verify_tcp MRns_verify_tcp
111 #define b64_ntop MRb64_ntop
112
113 extern const struct res_sym __p_type_syms[];
114 extern time_t cur_time;
115
116 int dn_comp (const char *,
117              unsigned char *, unsigned, unsigned char **, unsigned char **);
118 int loc_aton (const char *, u_char *);
119 int sym_ston (const struct res_sym *, const char *, int *);
120 void  res_buildservicelist (void);
121 void res_destroyservicelist (void);
122 void res_buildprotolist(void);
123 void res_destroyprotolist(void);
124 int res_servicenumber(const char *);
125 int res_protocolnumber(const char *);
126 const char *res_protocolname(int);
127 const char *res_servicename(u_int16_t, const char *);
128 u_int32_t ns_datetosecs (const char *cp, int *errp);
129 int b64_pton (char const *, unsigned char *, size_t);
130 unsigned int res_randomid (void);
131 isc_result_t res_findzonecut (res_state, const char *, ns_class, int, char *,
132                               size_t, struct in_addr *, int, int *, void *);
133 isc_result_t res_nsend (res_state,
134                         double *, unsigned, double *, unsigned, unsigned *);
135 isc_result_t res_nsendsigned (res_state, double *, unsigned, ns_tsig_key *,
136                               double *, unsigned, unsigned *);
137 int ns_samename (const char *, const char *);
138 int res_nameinquery (const char *, int, int,
139                      const unsigned char *, const unsigned char *);
140 int res_queriesmatch (const unsigned char *, const unsigned char *,
141                       const unsigned char *, const unsigned char *);
142 int dn_expand (const unsigned char *,
143                const unsigned char *, const unsigned char *, char *, unsigned);
144 unsigned int ns_get16 (const unsigned char *);
145 void res_close (void);
146 void res_nclose (res_state);
147 int res_ourserver_p (const res_state, const struct sockaddr_in *);
148 isc_result_t ns_sign (unsigned char *, unsigned *,
149                       unsigned, int, void *, const unsigned char *,
150                       unsigned, unsigned char *, unsigned *, time_t);
151 const char *p_class (int);
152 const char *p_section (int section, int opcode);
153 isc_result_t ns_makecanon (const char *, char *, size_t);
154 isc_result_t ns_parserr (ns_msg *, ns_sect, int, ns_rr *);
155 int ns_samedomain (const char *, const char *);
156 int ns_name_uncompress (const u_char *, const u_char *,
157                             const u_char *, char *, size_t);
158 isc_result_t res_nmkquery (res_state, int, const char *, ns_class, ns_type,
159                            const unsigned char *, unsigned,
160                            const unsigned char *, double *,
161                            unsigned, unsigned *);
162 isc_result_t ns_initparse (const unsigned char *, unsigned, ns_msg *);
163 isc_result_t res_nquery(res_state, const char *,
164                         ns_class, ns_type, double *, unsigned, unsigned *);
165 isc_result_t res_nsearch(res_state, const char *,
166                          ns_class, ns_type, double *, unsigned, unsigned *);
167 const char *res_hostalias (const res_state, const char *, char *, size_t);
168 isc_result_t res_nquerydomain(res_state, const char *, const char *,
169                               ns_class class, ns_type type,
170                               double *, unsigned, unsigned *);
171
172 isc_result_t ns_skiprr(const unsigned char *,
173                        const unsigned char *, ns_sect, int, int *);
174 int dn_skipname (const unsigned char *, const unsigned char *);
175 u_int32_t getULong (const unsigned char *);
176 int32_t getLong (const unsigned char *);
177 u_int32_t getUShort (const unsigned char *);
178 int32_t getShort (const unsigned char *);
179 u_int32_t getUChar (const unsigned char *);
180 void putULong (unsigned char *, u_int32_t);
181 void putLong (unsigned char *, int32_t);
182 void putUShort (unsigned char *, u_int32_t);
183 void putShort (unsigned char *, int32_t);
184 void putUChar (unsigned char *, u_int32_t);
185 int ns_name_ntol (const unsigned char *, unsigned char *, size_t);
186 isc_result_t ns_sign_tcp_init (void *, const unsigned char *,
187                                unsigned, ns_tcp_tsig_state *);
188 isc_result_t ns_sign_tcp (unsigned char *,
189                           unsigned *, unsigned, int, ns_tcp_tsig_state *, int);
190 int ns_name_ntop (const unsigned char *, char *, size_t);
191 int ns_name_pton (const char *, unsigned char *, size_t);
192 int ns_name_unpack (const unsigned char *, const unsigned char *,
193                     const unsigned char *, unsigned char *, size_t);
194 int ns_name_pack (const unsigned char *, unsigned char *,
195                   unsigned, const unsigned char **, const unsigned char **);
196 int ns_name_compress (const char *, unsigned char *,
197                       size_t, const unsigned char **, const unsigned char **);
198 int ns_name_skip (const unsigned char **, const unsigned char *);
199 int ns_subdomain (const char *, const char *);
200 unsigned char *ns_find_tsig (unsigned char *, unsigned char *);
201 isc_result_t ns_verify (unsigned char *, unsigned *, void *,
202                         const unsigned char *,
203                         unsigned, unsigned char *, unsigned *, time_t *, int);
204 isc_result_t ns_verify_tcp_init (void *, const unsigned char *, unsigned,
205                                  ns_tcp_tsig_state *);
206 isc_result_t ns_verify_tcp (unsigned char *, unsigned *,
207                             ns_tcp_tsig_state *, int);
208 int b64_ntop (unsigned char const *, size_t, char *, size_t);
209
210 ns_rcode find_cached_zone (const char *, ns_class, char *,
211                            size_t, struct in_addr *, int, int *, void *);
212 int find_tsig_key (ns_tsig_key **, const char *, void *);
213 int forget_zone (void *);
214 int repudiate_zone (void *);
215 void cache_found_zone (ns_class, char *, struct in_addr *, int);
216 isc_result_t uerr2isc (int);
217 isc_result_t ns_rcode_to_isc (int);
218
219 #define DprintQ(a,b,c,d)
220 #define Dprint(a,b)
221 #define Perror(a, b, c, d)
222 #define Aerror(a, b, c, d, e)
223 #define DPRINTF(x)
224
225 #define USE_MD5
226 #endif
227
228 #if defined (TRACING)
229 void trace_mr_statp_setup (res_state);
230 #endif