3 Definitions for address trees... */
6 * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
7 * Copyright (c) 1996-2003 by Internet Software Consortium
9 * Permission to use, copy, modify, and distribute this software for any
10 * purpose with or without fee is hereby granted, provided that the above
11 * copyright notice and this permission notice appear in all copies.
13 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
14 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
15 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
16 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
17 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
18 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
19 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
21 * Internet Systems Consortium, Inc.
23 * Redwood City, CA 94063
27 * This software has been written for Internet Systems Consortium
28 * by Ted Lemon in cooperation with Vixie Enterprises and Nominum, Inc.
29 * To learn more about Internet Systems Consortium, see
30 * ``http://www.isc.org/''. To learn more about Vixie Enterprises,
31 * see ``http://www.vix.com''. To learn more about Nominum, Inc., see
32 * ``http://www.nominum.com''.
35 /* A pair of pointers, suitable for making a linked list. */
36 typedef struct _pair
{
41 struct option_chain_head
{
46 struct enumeration_value
{
52 struct enumeration
*next
;
54 struct enumeration_value
*values
;
57 /* Tree node types... */
59 #define TREE_HOST_LOOKUP 2
62 #define TREE_DATA_EXPR 5
64 /* A data buffer with a reference count. */
67 unsigned char data
[1];
70 /* XXX The mechanism by which data strings are returned is currently
71 XXX broken: rather than returning an ephemeral pointer, we create
72 XXX a reference to the data in the caller's space, which the caller
73 XXX then has to dereference - instead, the reference should be
74 XXX ephemeral by default and be made a persistent reference explicitly. */
75 /* XXX on the other hand, it seems to work pretty nicely, so maybe the
76 XXX above comment is meshuggenah. */
78 /* A string of data bytes, possibly accompanied by a larger buffer. */
80 struct buffer
*buffer
;
81 const unsigned char *data
;
82 unsigned len
; /* Does not include NUL terminator, if any. */
86 enum expression_context
{
87 context_any
, /* indefinite */
92 context_data_or_numeric
, /* indefinite */
98 struct string_list
*args
;
99 struct executable_statement
*statements
;
102 struct binding_value
{
112 struct data_string data
;
113 unsigned long intval
;
115 #if defined (NSUPDATE)
118 struct fundef
*fundef
;
119 struct binding_value
*bv
;
124 struct binding
*next
;
126 struct binding_value
*value
;
129 struct binding_scope
{
131 struct binding_scope
*outer
;
132 struct binding
*bindings
;
135 /* Expression tree structure. */
165 expr_binary_to_ascii
,
168 expr_pick_first_value
,
170 expr_dns_transaction
,
178 expr_variable_exists
,
179 expr_variable_reference
,
201 struct expression
*expr
;
202 struct expression
*offset
;
203 struct expression
*len
;
205 struct expression
*equal
[2];
206 struct expression
*and [2];
207 struct expression
*or [2];
208 struct expression
*not;
209 struct expression
*add
;
210 struct expression
*subtract
;
211 struct expression
*multiply
;
212 struct expression
*divide
;
213 struct expression
*remainder
;
214 struct collection
*check
;
216 struct expression
*expr
;
217 struct expression
*len
;
219 struct option
*option
;
220 struct option
*config_option
;
222 struct expression
*offset
;
223 struct expression
*len
;
225 struct data_string const_data
;
226 struct expression
*extract_int
;
227 struct expression
*encode_int
;
228 unsigned long const_int
;
229 struct expression
*concat
[2];
230 struct dns_host_entry
*host_lookup
;
231 struct option
*exists
;
232 struct data_string encapsulate
;
234 struct expression
*base
;
235 struct expression
*width
;
236 struct expression
*seperator
;
237 struct expression
*buffer
;
240 struct expression
*width
;
241 struct expression
*buffer
;
244 struct expression
*car
;
245 struct expression
*cdr
;
248 struct expression
*car
;
249 struct expression
*cdr
;
254 struct expression
*rrname
;
255 struct expression
*rrdata
;
256 struct expression
*ttl
;
261 struct expression
*rrname
;
262 struct expression
*rrdata
;
263 } ns_delete
, ns_exists
, ns_not_exists
;
266 struct expression
*val
;
267 struct expression
*next
;
271 struct expression
*arglist
;
276 # define EXPR_EPHEMERAL 1
279 /* DNS host entry structure... */
280 struct dns_host_entry
{
283 struct data_string data
;
287 struct option_cache
; /* forward */
288 struct packet
; /* forward */
289 struct option_state
; /* forward */
290 struct decoded_option_state
; /* forward */
291 struct lease
; /* forward */
292 struct client_state
; /* forward */
296 struct option_cache
*(*lookup_func
) (struct universe
*,
297 struct option_state
*,
299 void (*save_func
) (struct universe
*, struct option_state
*,
300 struct option_cache
*);
301 void (*foreach
) (struct packet
*,
302 struct lease
*, struct client_state
*,
303 struct option_state
*, struct option_state
*,
304 struct binding_scope
**, struct universe
*, void *,
305 void (*) (struct option_cache
*, struct packet
*,
306 struct lease
*, struct client_state
*,
307 struct option_state
*,
308 struct option_state
*,
309 struct binding_scope
**,
310 struct universe
*, void *));
311 void (*delete_func
) (struct universe
*universe
,
312 struct option_state
*, int);
313 int (*option_state_dereference
) (struct universe
*,
314 struct option_state
*,
316 int (*decode
) (struct option_state
*,
317 const unsigned char *, unsigned, struct universe
*);
318 int (*encapsulate
) (struct data_string
*, struct packet
*,
319 struct lease
*, struct client_state
*,
320 struct option_state
*, struct option_state
*,
321 struct binding_scope
**,
323 void (*store_tag
) PROTO ((unsigned char *, u_int32_t
));
324 void (*store_length
) PROTO ((unsigned char *, u_int32_t
));
325 int tag_size
, length_size
;
327 struct option
*options
[256];
328 struct option
*enc_opt
;
335 struct universe
*universe
;