]>
git.ipfire.org Git - thirdparty/dhcp.git/blob - includes/tree.h
e7392fc0339ebcb532e326127d22b9e5762764bf
3 Definitions for address trees... */
6 * Copyright (c) 1996-1999 Internet Software Consortium.
7 * Use is subject to license terms which appear in the file named
8 * ISC-LICENSE that should have accompanied this file when you
9 * received it. If a file named ISC-LICENSE did not accompany this
10 * file, or you are not sure the one you have is correct, you may
11 * obtain an applicable copy of the license at:
13 * http://www.isc.org/isc-license-1.0.html.
15 * This file is part of the ISC DHCP distribution. The documentation
16 * associated with this file is listed in the file DOCUMENTATION,
17 * included in the top-level directory of this release.
19 * Support and other services are available for ISC products - see
20 * http://www.isc.org for more information.
23 /* A pair of pointers, suitable for making a linked list. */
24 typedef struct _pair
{
29 /* Tree node types... */
31 #define TREE_HOST_LOOKUP 2
34 #define TREE_DATA_EXPR 5
36 /* A data buffer with a reference count. */
39 unsigned char data
[1];
42 /* XXX The mechanism by which data strings are returned is currently
43 XXX broken: rather than returning an ephemeral pointer, we create
44 XXX a reference to the data in the caller's space, which the caller
45 XXX then has to dereference - instead, the reference should be
46 XXX ephemeral by default and be made a persistent reference explicitly. */
47 /* XXX on the other hand, it seems to work pretty nicely, so maybe the
48 XXX above comment is meshuggenah. */
50 /* A string of data bytes, possibly accompanied by a larger buffer. */
52 struct buffer
*buffer
;
53 const unsigned char *data
;
54 unsigned len
; /* Does not include NUL terminator, if any. */
58 enum expression_context
{
59 context_any
, /* indefinite */
64 context_data_or_numeric
, /* indefinite */
70 struct string_list
*args
;
71 struct executable_statement
*statements
;
74 struct binding_value
{
84 struct data_string data
;
87 #if defined (NSUPDATE)
90 struct fundef
*fundef
;
91 struct binding_value
*bv
;
98 struct binding_value
*value
;
101 struct binding_scope
{
102 struct binding_scope
*outer
;
103 struct binding
*bindings
;
106 /* Expression tree structure. */
136 expr_binary_to_ascii
,
139 expr_pick_first_value
,
141 expr_dns_transaction
,
149 expr_variable_exists
,
150 expr_variable_reference
,
168 struct expression
*expr
;
169 struct expression
*offset
;
170 struct expression
*len
;
172 struct expression
*equal
[2];
173 struct expression
*and [2];
174 struct expression
*or [2];
175 struct expression
*not;
176 struct expression
*add
;
177 struct expression
*subtract
;
178 struct expression
*multiply
;
179 struct expression
*divide
;
180 struct expression
*remainder
;
181 struct collection
*check
;
183 struct expression
*expr
;
184 struct expression
*len
;
186 struct option
*option
;
187 struct option
*config_option
;
189 struct expression
*offset
;
190 struct expression
*len
;
192 struct data_string const_data
;
193 struct expression
*extract_int
;
194 struct expression
*encode_int
;
195 unsigned long const_int
;
196 struct expression
*concat
[2];
197 struct dns_host_entry
*host_lookup
;
198 struct option
*exists
;
199 struct data_string encapsulate
;
201 struct expression
*base
;
202 struct expression
*width
;
203 struct expression
*seperator
;
204 struct expression
*buffer
;
207 struct expression
*width
;
208 struct expression
*buffer
;
211 struct expression
*car
;
212 struct expression
*cdr
;
215 struct expression
*car
;
216 struct expression
*cdr
;
221 struct expression
*rrname
;
222 struct expression
*rrdata
;
223 struct expression
*ttl
;
228 struct expression
*rrname
;
229 struct expression
*rrdata
;
230 } ns_delete
, ns_exists
, ns_not_exists
;
233 struct expression
*val
;
234 struct expression
*next
;
238 struct expression
*arglist
;
243 # define EXPR_EPHEMERAL 1
246 /* DNS host entry structure... */
247 struct dns_host_entry
{
250 struct data_string data
;
254 struct option_cache
; /* forward */
255 struct packet
; /* forward */
256 struct option_state
; /* forward */
257 struct decoded_option_state
; /* forward */
258 struct lease
; /* forward */
262 struct option_cache
*(*lookup_func
) PROTO ((struct universe
*,
263 struct option_state
*,
265 void (*save_func
) PROTO ((struct universe
*, struct option_state
*,
266 struct option_cache
*));
267 int (*get_func
) PROTO ((struct data_string
*, struct universe
*,
268 struct packet
*, struct lease
*,
269 struct option_state
*, struct option_state
*,
270 struct option_state
*, struct binding_scope
*,
272 void (*set_func
) PROTO ((struct universe
*, struct option_state
*,
273 struct option_cache
*, enum statement_op
));
275 void (*delete_func
) PROTO ((struct universe
*universe
,
276 struct option_state
*, int));
277 int (*option_state_dereference
) PROTO ((struct universe
*,
278 struct option_state
*,
280 int (*encapsulate
) PROTO ((struct data_string
*, struct packet
*,
281 struct lease
*, struct option_state
*,
282 struct option_state
*,
283 struct binding_scope
*, struct universe
*));
284 void (*store_tag
) PROTO ((unsigned char *, u_int32_t
));
285 void (*store_length
) PROTO ((unsigned char *, u_int32_t
));
286 int tag_size
, length_size
;
287 struct hash_table
*hash
;
288 struct option
*options
[256];
295 struct universe
*universe
;