diff options
author | Ted Lemon <source@isc.org> | 1998-06-25 03:35:31 +0000 |
---|---|---|
committer | Ted Lemon <source@isc.org> | 1998-06-25 03:35:31 +0000 |
commit | 50d92f585aafc1abb8c0f1c69d61489105b9df7d (patch) | |
tree | e270e4f9ce36e62fcef1a6553ebceb1fbef3567d /includes | |
parent | f442d71842fb4b1b1ffeaeca4fe4eca010074c42 (diff) | |
download | isc-dhcp-50d92f585aafc1abb8c0f1c69d61489105b9df7d.tar.gz |
Merge tree struct into expression struct. tree_cache -> option_cache. Move data_string and expression structs from dhcpd.h. Fix up dns_host_entry struct. Add a per-universe set function.
Diffstat (limited to 'includes')
-rw-r--r-- | includes/tree.h | 103 |
1 files changed, 72 insertions, 31 deletions
diff --git a/includes/tree.h b/includes/tree.h index e5440ef9..e4a62841 100644 --- a/includes/tree.h +++ b/includes/tree.h @@ -3,7 +3,8 @@ Definitions for address trees... */ /* - * Copyright (c) 1995 The Internet Software Consortium. All rights reserved. + * Copyright (c) 1995, 1998 The Internet Software Consortium. + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -50,55 +51,95 @@ typedef struct _pair { #define TREE_HOST_LOOKUP 2 #define TREE_CONST 3 #define TREE_LIMIT 4 +#define TREE_DATA_EXPR 5 -/* Tree structure for deferred evaluation of changing values. */ -struct tree { - int op; +/* A string of data bytes, possibly accompanied by a larger buffer. */ +struct data_string { + unsigned char *data, *buffer; + int len; + int terminated; +}; + +/* Expression tree structure. */ + +struct expression { + enum { + expr_check, + expr_equal, + expr_substring, + expr_suffix, + expr_concat, + expr_host_lookup, + expr_and, + expr_or, + expr_not, + expr_option, + expr_hardware, + expr_packet, + expr_const_data, + expr_extract_int8, + expr_extract_int16, + expr_extract_int32, + expr_const_int, + } op; union { - struct concat { - struct tree *left; - struct tree *right; - } concat; - struct host_lookup { - struct dns_host_entry *host; - } host_lookup; - struct const_val { - unsigned char *data; - int len; - } const_val; - struct limit { - struct tree *tree; - int limit; - } limit; + struct { + struct expression *expr; + struct expression *offset; + struct expression *len; + } substring; + struct expression *equal [2]; + struct expression *and [2]; + struct expression *or [2]; + struct expression *not; + struct collection *check; + struct { + struct expression *expr; + struct expression *len; + } suffix; + struct option *option; + struct { + struct expression *offset; + struct expression *len; + } packet; + struct data_string const_data; + struct { + struct expression *expr; + struct expression *width; + } extract_int; + unsigned long const_int; + struct expression *concat [2]; + struct dns_host_entry *host_lookup; } data; -}; + int flags; +# define EXPR_EPHEMERAL 1 +}; /* DNS host entry structure... */ struct dns_host_entry { char *hostname; - unsigned char *data; - int data_len; + char *buffer; int buf_len; + int data_len; TIME timeout; }; -struct tree_cache { - unsigned char *value; - int len; - int buf_size; - TIME timeout; - struct tree *tree; - int flags; -#define TC_AWAITING_RESOLUTION 1 -#define TC_TEMPORARY 2 +struct option_cache { + struct expression *expression; + struct option *option; }; struct data_string; /* forward */ struct packet; /* forward */ +struct option_state; /* forward */ +enum statement_op; /* forward */ struct universe { char *name; struct data_string (*lookup_func) PROTO ((struct packet *, int)); + void (*set_func) PROTO ((struct option_state *, + struct option_cache *, + enum statement_op)); struct hash_table *hash; struct option *options [256]; }; |