]>
git.ipfire.org Git - thirdparty/dhcp.git/blob - includes/tree.h
b0574fb1c08ed9e71dafdf2a89f2b7cb5aac2ed6
3 Definitions for address trees... */
6 * Copyright (c) 2004-2017 by Internet Systems Consortium, Inc. ("ISC")
7 * Copyright (c) 1996-2003 by Internet Software Consortium
9 * This Source Code Form is subject to the terms of the Mozilla Public
10 * License, v. 2.0. If a copy of the MPL was not distributed with this
11 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
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 * Newmarket, NH 03857 USA
25 * https://www.isc.org/
29 /* A pair of pointers, suitable for making a linked list. */
30 typedef struct _pair
{
35 struct option_chain_head
{
40 struct enumeration_value
{
46 struct enumeration
*next
;
49 struct enumeration_value
*values
;
52 /* Tree node types... */
54 #define TREE_HOST_LOOKUP 2
57 #define TREE_DATA_EXPR 5
59 /* A data buffer with a reference count. */
62 unsigned char data
[1];
65 /* XXX The mechanism by which data strings are returned is currently
66 XXX broken: rather than returning an ephemeral pointer, we create
67 XXX a reference to the data in the caller's space, which the caller
68 XXX then has to dereference - instead, the reference should be
69 XXX ephemeral by default and be made a persistent reference explicitly. */
70 /* XXX on the other hand, it seems to work pretty nicely, so maybe the
71 XXX above comment is meshuggenah. */
72 /* XXX I think the above comment tries to say this:
73 XXX http://tinyurl.com/2tjqre */
75 /* A string of data bytes, possibly accompanied by a larger buffer. */
77 struct buffer
*buffer
;
78 const unsigned char *data
;
79 unsigned len
; /* Does not include NUL terminator, if any. */
83 enum expression_context
{
84 context_any
, /* indefinite */
89 context_data_or_numeric
, /* indefinite */
95 struct string_list
*args
;
96 struct executable_statement
*statements
;
99 struct binding_value
{
109 struct data_string data
;
110 unsigned long intval
;
112 struct fundef
*fundef
;
113 struct binding_value
*bv
;
118 struct binding
*next
;
120 struct binding_value
*value
;
123 struct binding_scope
{
125 struct binding_scope
*outer
;
126 struct binding
*bindings
;
129 /* Expression tree structure. */
159 expr_binary_to_ascii
,
162 expr_pick_first_value
,
164 expr_dns_transaction
,
172 expr_variable_exists
,
173 expr_variable_reference
,
202 struct expression
*expr
;
203 struct expression
*offset
;
204 struct expression
*len
;
206 struct expression
*equal
[2];
207 struct expression
*and [2];
208 struct expression
*or [2];
209 struct expression
*not;
210 struct expression
*add
;
211 struct expression
*subtract
;
212 struct expression
*multiply
;
213 struct expression
*divide
;
214 struct expression
*remainder
;
215 struct collection
*check
;
217 struct expression
*expr
;
218 struct expression
*len
;
220 struct expression
*lcase
;
221 struct expression
*ucase
;
222 struct option
*option
;
223 struct option
*config_option
;
225 struct expression
*offset
;
226 struct expression
*len
;
228 struct data_string const_data
;
229 struct expression
*extract_int
;
230 struct expression
*encode_int
;
231 unsigned long const_int
;
232 struct expression
*concat
[2];
233 struct dns_host_entry
*host_lookup
;
234 struct option
*exists
;
235 struct data_string encapsulate
;
237 struct expression
*base
;
238 struct expression
*width
;
239 struct expression
*separator
;
240 struct expression
*buffer
;
243 struct expression
*width
;
244 struct expression
*buffer
;
247 struct expression
*car
;
248 struct expression
*cdr
;
251 struct expression
*car
;
252 struct expression
*cdr
;
257 struct expression
*rrname
;
258 struct expression
*rrdata
;
259 struct expression
*ttl
;
264 struct expression
*rrname
;
265 struct expression
*rrdata
;
266 } ns_delete
, ns_exists
, ns_not_exists
;
269 struct expression
*val
;
270 struct expression
*next
;
274 struct expression
*arglist
;
278 struct expression
*relay
;
279 struct expression
*roption
;
283 # define EXPR_EPHEMERAL 1
286 /* DNS host entry structure... */
287 struct dns_host_entry
{
290 struct data_string data
;
294 struct option_cache
; /* forward */
295 struct packet
; /* forward */
296 struct option_state
; /* forward */
297 struct decoded_option_state
; /* forward */
298 struct lease
; /* forward */
299 struct client_state
; /* forward */
303 struct option_cache
*(*lookup_func
) (struct universe
*,
304 struct option_state
*,
306 void (*save_func
) (struct universe
*, struct option_state
*,
307 struct option_cache
*, isc_boolean_t
);
308 void (*foreach
) (struct packet
*,
309 struct lease
*, struct client_state
*,
310 struct option_state
*, struct option_state
*,
311 struct binding_scope
**, struct universe
*, void *,
312 void (*) (struct option_cache
*, struct packet
*,
313 struct lease
*, struct client_state
*,
314 struct option_state
*,
315 struct option_state
*,
316 struct binding_scope
**,
317 struct universe
*, void *));
318 void (*delete_func
) (struct universe
*universe
,
319 struct option_state
*, int);
320 int (*option_state_dereference
) (struct universe
*,
321 struct option_state
*,
323 int (*decode
) (struct option_state
*,
324 const unsigned char *, unsigned, struct universe
*);
325 int (*encapsulate
) (struct data_string
*, struct packet
*,
326 struct lease
*, struct client_state
*,
327 struct option_state
*, struct option_state
*,
328 struct binding_scope
**,
330 u_int32_t (*get_tag
) (const unsigned char *);
331 void (*store_tag
) (unsigned char *, u_int32_t
);
332 u_int32_t (*get_length
) (const unsigned char *);
333 void (*store_length
) (unsigned char *, u_int32_t
);
334 int tag_size
, length_size
;
335 unsigned site_code_min
, end
;
336 option_name_hash_t
*name_hash
;
337 option_code_hash_t
*code_hash
;
338 struct option
*enc_opt
;
341 /* Flags should probably become condensed. */
342 int concat_duplicates
;
348 struct universe
*universe
;