3 Definitions for address trees... */
6 * Copyright (c) 1996-2001 Internet Software Consortium.
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
13 * 1. Redistributions of source code must retain the above copyright
14 * 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.
18 * 3. Neither the name of The Internet Software Consortium nor the names
19 * of its contributors may be used to endorse or promote products derived
20 * from this software without specific prior written permission.
22 * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND
23 * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
24 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
25 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26 * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR
27 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
29 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
30 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
31 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
33 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 * This software has been written for the Internet Software Consortium
37 * by Ted Lemon in cooperation with Vixie Enterprises and Nominum, Inc.
38 * To learn more about the Internet Software Consortium, see
39 * ``http://www.isc.org/''. To learn more about Vixie Enterprises,
40 * see ``http://www.vix.com''. To learn more about Nominum, Inc., see
41 * ``http://www.nominum.com''.
44 /* A pair of pointers, suitable for making a linked list. */
45 typedef struct _pair {
50 struct option_chain_head {
55 struct enumeration_value {
61 struct enumeration *next;
63 struct enumeration_value *values;
66 /* Tree node types... */
68 #define TREE_HOST_LOOKUP 2
71 #define TREE_DATA_EXPR 5
73 /* A data buffer with a reference count. */
76 unsigned char data [1];
79 /* XXX The mechanism by which data strings are returned is currently
80 XXX broken: rather than returning an ephemeral pointer, we create
81 XXX a reference to the data in the caller's space, which the caller
82 XXX then has to dereference - instead, the reference should be
83 XXX ephemeral by default and be made a persistent reference explicitly. */
84 /* XXX on the other hand, it seems to work pretty nicely, so maybe the
85 XXX above comment is meshuggenah. */
87 /* A string of data bytes, possibly accompanied by a larger buffer. */
89 struct buffer *buffer;
90 const unsigned char *data;
91 unsigned len; /* Does not include NUL terminator, if any. */
95 enum expression_context {
96 context_any, /* indefinite */
101 context_data_or_numeric, /* indefinite */
107 struct string_list *args;
108 struct executable_statement *statements;
111 struct binding_value {
121 struct data_string data;
122 unsigned long intval;
124 #if defined (NSUPDATE)
127 struct fundef *fundef;
128 struct binding_value *bv;
133 struct binding *next;
135 struct binding_value *value;
138 struct binding_scope {
140 struct binding_scope *outer;
141 struct binding *bindings;
144 /* Expression tree structure. */
174 expr_binary_to_ascii,
177 expr_pick_first_value,
179 expr_dns_transaction,
187 expr_variable_exists,
188 expr_variable_reference,
210 struct expression *expr;
211 struct expression *offset;
212 struct expression *len;
214 struct expression *equal [2];
215 struct expression *and [2];
216 struct expression *or [2];
217 struct expression *not;
218 struct expression *add;
219 struct expression *subtract;
220 struct expression *multiply;
221 struct expression *divide;
222 struct expression *remainder;
223 struct collection *check;
225 struct expression *expr;
226 struct expression *len;
228 struct option *option;
229 struct option *config_option;
231 struct expression *offset;
232 struct expression *len;
234 struct data_string const_data;
235 struct expression *extract_int;
236 struct expression *encode_int;
237 unsigned long const_int;
238 struct expression *concat [2];
239 struct dns_host_entry *host_lookup;
240 struct option *exists;
241 struct data_string encapsulate;
243 struct expression *base;
244 struct expression *width;
245 struct expression *seperator;
246 struct expression *buffer;
249 struct expression *width;
250 struct expression *buffer;
253 struct expression *car;
254 struct expression *cdr;
257 struct expression *car;
258 struct expression *cdr;
263 struct expression *rrname;
264 struct expression *rrdata;
265 struct expression *ttl;
270 struct expression *rrname;
271 struct expression *rrdata;
272 } ns_delete, ns_exists, ns_not_exists;
275 struct expression *val;
276 struct expression *next;
280 struct expression *arglist;
285 # define EXPR_EPHEMERAL 1
288 /* DNS host entry structure... */
289 struct dns_host_entry {
292 struct data_string data;
296 struct option_cache; /* forward */
297 struct packet; /* forward */
298 struct option_state; /* forward */
299 struct decoded_option_state; /* forward */
300 struct lease; /* forward */
301 struct client_state; /* forward */
305 struct option_cache *(*lookup_func) (struct universe *,
306 struct option_state *,
308 void (*save_func) (struct universe *, struct option_state *,
309 struct option_cache *);
310 void (*foreach) (struct packet *,
311 struct lease *, struct client_state *,
312 struct option_state *, struct option_state *,
313 struct binding_scope **, struct universe *, void *,
314 void (*) (struct option_cache *, struct packet *,
315 struct lease *, struct client_state *,
316 struct option_state *,
317 struct option_state *,
318 struct binding_scope **,
319 struct universe *, void *));
320 void (*delete_func) (struct universe *universe,
321 struct option_state *, int);
322 int (*option_state_dereference) (struct universe *,
323 struct option_state *,
325 int (*decode) (struct option_state *,
326 const unsigned char *, unsigned, struct universe *);
327 int (*encapsulate) (struct data_string *, struct packet *,
328 struct lease *, struct client_state *,
329 struct option_state *, struct option_state *,
330 struct binding_scope **,
332 void (*store_tag) PROTO ((unsigned char *, u_int32_t));
333 void (*store_length) PROTO ((unsigned char *, u_int32_t));
334 int tag_size, length_size;
336 struct option *options [256];
337 struct option *enc_opt;
344 struct universe *universe;