]>
git.ipfire.org Git - thirdparty/dhcp.git/blob - includes/tree.h
3 Definitions for address trees... */
6 * Copyright (c) 2004,2007-2008 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
25 * https://www.isc.org/
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 * ``https://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_OLD)
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
,
209 struct expression
*expr
;
210 struct expression
*offset
;
211 struct expression
*len
;
213 struct expression
*equal
[2];
214 struct expression
*and [2];
215 struct expression
*or [2];
216 struct expression
*not;
217 struct expression
*add
;
218 struct expression
*subtract
;
219 struct expression
*multiply
;
220 struct expression
*divide
;
221 struct expression
*remainder
;
222 struct collection
*check
;
224 struct expression
*expr
;
225 struct expression
*len
;
227 struct expression
*lcase
;
228 struct expression
*ucase
;
229 struct option
*option
;
230 struct option
*config_option
;
232 struct expression
*offset
;
233 struct expression
*len
;
235 struct data_string const_data
;
236 struct expression
*extract_int
;
237 struct expression
*encode_int
;
238 unsigned long const_int
;
239 struct expression
*concat
[2];
240 struct dns_host_entry
*host_lookup
;
241 struct option
*exists
;
242 struct data_string encapsulate
;
244 struct expression
*base
;
245 struct expression
*width
;
246 struct expression
*separator
;
247 struct expression
*buffer
;
250 struct expression
*width
;
251 struct expression
*buffer
;
254 struct expression
*car
;
255 struct expression
*cdr
;
258 struct expression
*car
;
259 struct expression
*cdr
;
264 struct expression
*rrname
;
265 struct expression
*rrdata
;
266 struct expression
*ttl
;
271 struct expression
*rrname
;
272 struct expression
*rrdata
;
273 } ns_delete
, ns_exists
, ns_not_exists
;
276 struct expression
*val
;
277 struct expression
*next
;
281 struct expression
*arglist
;
286 # define EXPR_EPHEMERAL 1
289 /* DNS host entry structure... */
290 struct dns_host_entry
{
293 struct data_string data
;
297 struct option_cache
; /* forward */
298 struct packet
; /* forward */
299 struct option_state
; /* forward */
300 struct decoded_option_state
; /* forward */
301 struct lease
; /* forward */
302 struct client_state
; /* forward */
306 struct option_cache
*(*lookup_func
) (struct universe
*,
307 struct option_state
*,
309 void (*save_func
) (struct universe
*, struct option_state
*,
310 struct option_cache
*, isc_boolean_t
);
311 void (*foreach
) (struct packet
*,
312 struct lease
*, struct client_state
*,
313 struct option_state
*, struct option_state
*,
314 struct binding_scope
**, struct universe
*, void *,
315 void (*) (struct option_cache
*, struct packet
*,
316 struct lease
*, struct client_state
*,
317 struct option_state
*,
318 struct option_state
*,
319 struct binding_scope
**,
320 struct universe
*, void *));
321 void (*delete_func
) (struct universe
*universe
,
322 struct option_state
*, int);
323 int (*option_state_dereference
) (struct universe
*,
324 struct option_state
*,
326 int (*decode
) (struct option_state
*,
327 const unsigned char *, unsigned, struct universe
*);
328 int (*encapsulate
) (struct data_string
*, struct packet
*,
329 struct lease
*, struct client_state
*,
330 struct option_state
*, struct option_state
*,
331 struct binding_scope
**,
333 u_int32_t (*get_tag
) (const unsigned char *);
334 void (*store_tag
) PROTO ((unsigned char *, u_int32_t
));
335 u_int32_t (*get_length
) (const unsigned char *);
336 void (*store_length
) PROTO ((unsigned char *, u_int32_t
));
337 int tag_size
, length_size
;
338 unsigned site_code_min
, end
;
339 option_name_hash_t
*name_hash
;
340 option_code_hash_t
*code_hash
;
341 struct option
*enc_opt
;
344 /* Flags should probably become condensed. */
345 int concat_duplicates
;
351 struct universe
*universe
;