]>
git.ipfire.org Git - thirdparty/dhcp.git/blob - includes/tree.h
3 Definitions for address trees... */
6 * Copyright (c) 2004,2007 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
;
55 struct enumeration_value
*values
;
58 /* Tree node types... */
60 #define TREE_HOST_LOOKUP 2
63 #define TREE_DATA_EXPR 5
65 /* A data buffer with a reference count. */
68 unsigned char data
[1];
71 /* XXX The mechanism by which data strings are returned is currently
72 XXX broken: rather than returning an ephemeral pointer, we create
73 XXX a reference to the data in the caller's space, which the caller
74 XXX then has to dereference - instead, the reference should be
75 XXX ephemeral by default and be made a persistent reference explicitly. */
76 /* XXX on the other hand, it seems to work pretty nicely, so maybe the
77 XXX above comment is meshuggenah. */
78 /* XXX I think the above comment tries to say this:
79 XXX http://tinyurl.com/2tjqre */
81 /* A string of data bytes, possibly accompanied by a larger buffer. */
83 struct buffer
*buffer
;
84 const unsigned char *data
;
85 unsigned len
; /* Does not include NUL terminator, if any. */
89 enum expression_context
{
90 context_any
, /* indefinite */
95 context_data_or_numeric
, /* indefinite */
101 struct string_list
*args
;
102 struct executable_statement
*statements
;
105 struct binding_value
{
115 struct data_string data
;
116 unsigned long intval
;
118 #if defined (NSUPDATE)
121 struct fundef
*fundef
;
122 struct binding_value
*bv
;
127 struct binding
*next
;
129 struct binding_value
*value
;
132 struct binding_scope
{
134 struct binding_scope
*outer
;
135 struct binding
*bindings
;
138 /* Expression tree structure. */
168 expr_binary_to_ascii
,
171 expr_pick_first_value
,
173 expr_dns_transaction
,
181 expr_variable_exists
,
182 expr_variable_reference
,
208 struct expression
*expr
;
209 struct expression
*offset
;
210 struct expression
*len
;
212 struct expression
*equal
[2];
213 struct expression
*and [2];
214 struct expression
*or [2];
215 struct expression
*not;
216 struct expression
*add
;
217 struct expression
*subtract
;
218 struct expression
*multiply
;
219 struct expression
*divide
;
220 struct expression
*remainder
;
221 struct collection
*check
;
223 struct expression
*expr
;
224 struct expression
*len
;
226 struct expression
*lcase
;
227 struct expression
*ucase
;
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
*separator
;
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
*, isc_boolean_t
);
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 u_int32_t (*get_tag
) (const unsigned char *);
333 void (*store_tag
) PROTO ((unsigned char *, u_int32_t
));
334 u_int32_t (*get_length
) (const unsigned char *);
335 void (*store_length
) PROTO ((unsigned char *, u_int32_t
));
336 int tag_size
, length_size
;
337 unsigned site_code_min
, end
;
338 option_name_hash_t
*name_hash
;
339 option_code_hash_t
*code_hash
;
340 struct option
*enc_opt
;
343 /* Flags should probably become condensed. */
344 int concat_duplicates
;
350 struct universe
*universe
;