]> git.ipfire.org Git - thirdparty/dhcp.git/blob - includes/minires/minires.h
- Support for compressed 'domain name list' style DHCP option contents, and
[thirdparty/dhcp.git] / 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 int MRns_name_compress(const char *, u_char *, size_t, const unsigned char **,
49 const unsigned char **);
50 int MRns_name_unpack(const unsigned char *, const unsigned char *,
51 const unsigned char *, unsigned char *, size_t);
52 int MRns_name_ntop(const unsigned char *, char *, size_t);
53
54 #if defined (MINIRES_LIB)
55 #define res_update minires_update
56 #define res_mkupdate minires_mkupdate
57 #define res_mkupdrec minires_mkupdrec
58 #define res_freeupdrec minires_freeupdrec
59 #define res_nmkupdate minires_nmkupdate
60 #define res_nupdate minires_nupdate
61 #define __p_type_syms MR__p_type_syms
62 #define dn_comp MRdn_comp
63 #define loc_aton MRloc_aton
64 #define sym_ston MRsym_ston
65 #define res_buildservicelist MRres_buildservicelist
66 #define res_destroyservicelist MRres_destroyservicelist
67 #define res_buildprotolist MRres_buildprotolist
68 #define res_destroyprotolist MRres_destroyprotolist
69 #define res_servicenumber MRres_servicenumber
70 #define res_protocolnumber MRres_protocolnumber
71 #define res_protocolname MRres_protocolname
72 #define res_servicename MRres_servicename
73 #define ns_datetosecs MRns_datetosecs
74 #define b64_pton MRb64_pton
75 #define res_ninit minires_ninit
76 #define res_randomid MRres_randomid
77 #define res_findzonecut MRres_findzonecut
78 #define res_nsend MRres_nsend
79 #define res_nsendsigned MRres_nsendsigned
80 #define ns_samename MRns_samename
81 #define res_nameinquery MRres_nameinquery
82 #define res_queriesmatch MRres_queriesmatch
83 #define dn_expand MRdn_expand
84 #define ns_get16 MRns_get16
85 #define res_close MRres_close
86 #define res_nclose MRres_nclose
87 #define res_ourserver_p MRres_ourserver_p
88 #define ns_sign MRns_sign
89 #define p_class MRp_class
90 #define p_section MRp_section
91 #define ns_makecanon MRns_makecanon
92 #define ns_parserr MRns_parserr
93 #define ns_samedomain MRns_samedomain
94 #define ns_name_uncompress MRns_name_uncompress
95 #define res_nmkquery MRres_nmkquery
96 #define ns_initparse MRns_initparse
97 #define res_nquery MRres_nquery
98 #define res_nsearch MRres_nsearch
99 #define res_hostalias MRres_hostalias
100 #define res_nquerydomain MRres_nquerydomain
101 #define ns_skiprr MRns_skiprr
102 #define dn_skipname MRdn_skipname
103 #define ns_name_ntol MRns_name_ntol
104 #define ns_sign_tcp_init MRns_sign_tcp_init
105 #define ns_sign_tcp MRns_sign_tcp
106 #define ns_name_ntop MRns_name_ntop
107 #define ns_name_pton MRns_name_pton
108 #define ns_name_unpack MRns_name_unpack
109 #define ns_name_pack MRns_name_pack
110 #define ns_name_compress MRns_name_compress
111 #define ns_name_skip MRns_name_skip
112 #define ns_subdomain MRns_subdomain
113 #define ns_find_tsig MRns_find_tsig
114 #define ns_verify MRns_verify
115 #define ns_verify_tcp_init MRns_verify_tcp_init
116 #define ns_verify_tcp MRns_verify_tcp
117 #define b64_ntop MRb64_ntop
118
119 extern const struct res_sym __p_type_syms[];
120 extern time_t cur_time;
121
122 int dn_comp (const char *,
123 unsigned char *, unsigned, unsigned char **, unsigned char **);
124 int loc_aton (const char *, u_char *);
125 int sym_ston (const struct res_sym *, const char *, int *);
126 void res_buildservicelist (void);
127 void res_destroyservicelist (void);
128 void res_buildprotolist(void);
129 void res_destroyprotolist(void);
130 int res_servicenumber(const char *);
131 int res_protocolnumber(const char *);
132 const char *res_protocolname(int);
133 const char *res_servicename(u_int16_t, const char *);
134 u_int32_t ns_datetosecs (const char *cp, int *errp);
135 int b64_pton (char const *, unsigned char *, size_t);
136 unsigned int res_randomid (void);
137 isc_result_t res_findzonecut (res_state, const char *, ns_class, int, char *,
138 size_t, struct in_addr *, int, int *, void *);
139 isc_result_t res_nsend (res_state,
140 double *, unsigned, double *, unsigned, unsigned *);
141 isc_result_t res_nsendsigned (res_state, double *, unsigned, ns_tsig_key *,
142 double *, unsigned, unsigned *);
143 int ns_samename (const char *, const char *);
144 int res_nameinquery (const char *, int, int,
145 const unsigned char *, const unsigned char *);
146 int res_queriesmatch (const unsigned char *, const unsigned char *,
147 const unsigned char *, const unsigned char *);
148 int dn_expand (const unsigned char *,
149 const unsigned char *, const unsigned char *, char *, unsigned);
150 unsigned int ns_get16 (const unsigned char *);
151 void res_close (void);
152 void res_nclose (res_state);
153 int res_ourserver_p (const res_state, const struct sockaddr_in *);
154 isc_result_t ns_sign (unsigned char *, unsigned *,
155 unsigned, int, void *, const unsigned char *,
156 unsigned, unsigned char *, unsigned *, time_t);
157 const char *p_class (int);
158 const char *p_section (int section, int opcode);
159 isc_result_t ns_makecanon (const char *, char *, size_t);
160 isc_result_t ns_parserr (ns_msg *, ns_sect, int, ns_rr *);
161 int ns_samedomain (const char *, const char *);
162 int ns_name_uncompress (const u_char *, const u_char *,
163 const u_char *, char *, size_t);
164 isc_result_t res_nmkquery (res_state, int, const char *, ns_class, ns_type,
165 const unsigned char *, unsigned,
166 const unsigned char *, double *,
167 unsigned, unsigned *);
168 isc_result_t ns_initparse (const unsigned char *, unsigned, ns_msg *);
169 isc_result_t res_nquery(res_state, const char *,
170 ns_class, ns_type, double *, unsigned, unsigned *);
171 isc_result_t res_nsearch(res_state, const char *,
172 ns_class, ns_type, double *, unsigned, unsigned *);
173 const char *res_hostalias (const res_state, const char *, char *, size_t);
174 isc_result_t res_nquerydomain(res_state, const char *, const char *,
175 ns_class class, ns_type type,
176 double *, unsigned, unsigned *);
177
178 isc_result_t ns_skiprr(const unsigned char *,
179 const unsigned char *, ns_sect, int, int *);
180 int dn_skipname (const unsigned char *, const unsigned char *);
181 u_int32_t getULong (const unsigned char *);
182 int32_t getLong (const unsigned char *);
183 u_int32_t getUShort (const unsigned char *);
184 int32_t getShort (const unsigned char *);
185 u_int32_t getUChar (const unsigned char *);
186 void putULong (unsigned char *, u_int32_t);
187 void putLong (unsigned char *, int32_t);
188 void putUShort (unsigned char *, u_int32_t);
189 void putShort (unsigned char *, int32_t);
190 void putUChar (unsigned char *, u_int32_t);
191 int ns_name_ntol (const unsigned char *, unsigned char *, size_t);
192 isc_result_t ns_sign_tcp_init (void *, const unsigned char *,
193 unsigned, ns_tcp_tsig_state *);
194 isc_result_t ns_sign_tcp (unsigned char *,
195 unsigned *, unsigned, int, ns_tcp_tsig_state *, int);
196 int ns_name_pton (const char *, unsigned char *, size_t);
197 int ns_name_pack (const unsigned char *, unsigned char *,
198 unsigned, const unsigned char **, const unsigned char **);
199 int ns_name_compress (const char *, unsigned char *,
200 size_t, const unsigned char **, const unsigned char **);
201 int ns_name_skip (const unsigned char **, const unsigned char *);
202 int ns_subdomain (const char *, const char *);
203 unsigned char *ns_find_tsig (unsigned char *, unsigned char *);
204 isc_result_t ns_verify (unsigned char *, unsigned *, void *,
205 const unsigned char *,
206 unsigned, unsigned char *, unsigned *, time_t *, int);
207 isc_result_t ns_verify_tcp_init (void *, const unsigned char *, unsigned,
208 ns_tcp_tsig_state *);
209 isc_result_t ns_verify_tcp (unsigned char *, unsigned *,
210 ns_tcp_tsig_state *, int);
211 int b64_ntop (unsigned char const *, size_t, char *, size_t);
212
213 ns_rcode find_cached_zone (const char *, ns_class, char *,
214 size_t, struct in_addr *, int, int *, void *);
215 int find_tsig_key (ns_tsig_key **, const char *, void *);
216 int forget_zone (void *);
217 int repudiate_zone (void *);
218 void cache_found_zone (ns_class, char *, struct in_addr *, int);
219 isc_result_t uerr2isc (int);
220 isc_result_t ns_rcode_to_isc (int);
221
222 #define DprintQ(a,b,c,d)
223 #define Dprint(a,b)
224 #define Perror(a, b, c, d)
225 #define Aerror(a, b, c, d, e)
226 #define DPRINTF(x)
227
228 #define USE_MD5
229 #endif
230
231 #if defined (TRACING)
232 void trace_mr_statp_setup (res_state);
233 #endif