ISC DHCP  4.3.3-P1
A reference DHCPv4 and DHCPv6 implementation
tree.c File Reference
#include "dhcpd.h"
#include <omapip/omapip_p.h>
#include <ctype.h>
#include <sys/wait.h>

Go to the source code of this file.

Macros

#define DS_SPRINTF_SIZE   128
 

Functions

int data_string_sprintfa (struct data_string *ds, const char *fmt,...)
 
pair cons (caddr_t car, pair cdr)
 
int make_const_option_cache (struct option_cache **oc, struct buffer **buffer, u_int8_t *data, unsigned len, struct option *option, const char *file, int line)
 
int make_host_lookup (struct expression **expr, const char *name)
 
int enter_dns_host (struct dns_host_entry **dh, const char *name)
 
int make_const_data (struct expression **expr, const unsigned char *data, unsigned len, int terminated, int allocate, const char *file, int line)
 
int make_const_int (struct expression **expr, unsigned long val)
 
int make_concat (struct expression **expr, struct expression *left, struct expression *right)
 
int make_encapsulation (struct expression **expr, struct data_string *name)
 
int make_substring (struct expression **new, struct expression *expr, struct expression *offset, struct expression *length)
 
int make_limit (struct expression **new, struct expression *expr, int limit)
 
int option_cache (struct option_cache **oc, struct data_string *dp, struct expression *expr, struct option *option, const char *file, int line)
 
int make_let (struct executable_statement **result, const char *name)
 
int evaluate_expression (struct binding_value **result, struct packet *packet, struct lease *lease, struct client_state *client_state, struct option_state *in_options, struct option_state *cfg_options, struct binding_scope **scope, struct expression *expr, const char *file, int line)
 
int binding_value_dereference (struct binding_value **v, const char *file, int line)
 
int evaluate_boolean_expression (int *result, struct packet *packet, struct lease *lease, struct client_state *client_state, struct option_state *in_options, struct option_state *cfg_options, struct binding_scope **scope, struct expression *expr)
 
int evaluate_data_expression (struct data_string *result, struct packet *packet, struct lease *lease, struct client_state *client_state, struct option_state *in_options, struct option_state *cfg_options, struct binding_scope **scope, struct expression *expr, const char *file, int line)
 
int evaluate_numeric_expression (unsigned long *result, struct packet *packet, struct lease *lease, struct client_state *client_state, struct option_state *in_options, struct option_state *cfg_options, struct binding_scope **scope, struct expression *expr)
 
int evaluate_option_cache (struct data_string *result, struct packet *packet, struct lease *lease, struct client_state *client_state, struct option_state *in_options, struct option_state *cfg_options, struct binding_scope **scope, struct option_cache *oc, const char *file, int line)
 
int evaluate_boolean_option_cache (int *ignorep, struct packet *packet, struct lease *lease, struct client_state *client_state, struct option_state *in_options, struct option_state *cfg_options, struct binding_scope **scope, struct option_cache *oc, const char *file, int line)
 
int evaluate_boolean_expression_result (int *ignorep, struct packet *packet, struct lease *lease, struct client_state *client_state, struct option_state *in_options, struct option_state *cfg_options, struct binding_scope **scope, struct expression *expr)
 
void expression_dereference (struct expression **eptr, const char *file, int line)
 
int is_boolean_expression (struct expression *expr)
 
int is_data_expression (struct expression *expr)
 
int is_numeric_expression (struct expression *expr)
 
int is_compound_expression (struct expression *expr)
 
int op_precedence (enum expr_op op1, enum expr_op op2)
 
enum expression_context expression_context (struct expression *expr)
 
enum expression_context op_context (enum expr_op op)
 
int write_expression (FILE *file, struct expression *expr, int col, int indent, int firstp)
 
struct bindingfind_binding (struct binding_scope *scope, const char *name)
 
int free_bindings (struct binding_scope *scope, const char *file, int line)
 
int binding_scope_dereference (struct binding_scope **ptr, const char *file, int line)
 
int fundef_dereference (struct fundef **ptr, const char *file, int line)
 
struct bindingcreate_binding (struct binding_scope **scope, const char *name)
 
int bind_ds_value (struct binding_scope **scope, const char *name, struct data_string *value)
 
int find_bound_string (struct data_string *value, struct binding_scope *scope, const char *name)
 
int unset (struct binding_scope *scope, const char *name)
 
int concat_dclists (struct data_string *result, struct data_string *list1, struct data_string *list2)
 Adds two Dc-formatted lists into a single Dc-formatted list. More...
 

Variables

struct binding_scopeglobal_scope
 

Macro Definition Documentation

#define DS_SPRINTF_SIZE   128

Definition at line 43 of file tree.c.

Function Documentation

int bind_ds_value ( struct binding_scope **  scope,
const char *  name,
struct data_string value 
)

Definition at line 4069 of file tree.c.

int binding_scope_dereference ( struct binding_scope **  ptr,
const char *  file,
int  line 
)

Definition at line 3775 of file tree.c.

int binding_value_dereference ( struct binding_value **  v,
const char *  file,
int  line 
)

Definition at line 653 of file tree.c.

int concat_dclists ( struct data_string result,
struct data_string list1,
struct data_string list2 
)

Adds two Dc-formatted lists into a single Dc-formatted list.

Given two data_strings containing compressed lists, it constructs a third data_string containing a single compressed list:

  1. Decompressing the first list into a buffer
  2. Decompressing the second list onto the end of the buffer
  3. Compressing the buffer into the result

If either list is empty, the result will be the equal to the compressed content of the non-empty list. If both lists are empty, the result will be an "empty" list: a 1 byte buffer containing 0x00.

It relies on two functions to decompress and compress:

  • MRns_name_uncompress_list() - produces a null-terminated string of comma-separated domain-names from a buffer containing "Dc" formatted data
  • MRns_name_compress_list() - produces a buffer containing "Dc" formatted data from a null-terminated string containing comma-separated domain-names
Parameters
resultdata_string which will contain the combined list in Dc format
list1data_string containing first Dc formatted list
list2data_string containing second Dc formatted list
Returns
0 if there is an error, the length of the new list when successful

Definition at line 4166 of file tree.c.

pair cons ( caddr_t  car,
pair  cdr 
)

Definition at line 138 of file tree.c.

struct binding* create_binding ( struct binding_scope **  scope,
const char *  name 
)

Definition at line 4038 of file tree.c.

int data_string_sprintfa ( struct data_string ds,
const char *  fmt,
  ... 
)

Definition at line 57 of file tree.c.

int enter_dns_host ( struct dns_host_entry **  dh,
const char *  name 
)

Definition at line 205 of file tree.c.

int evaluate_boolean_expression ( int result,
struct packet packet,
struct lease lease,
struct client_state client_state,
struct option_state in_options,
struct option_state cfg_options,
struct binding_scope **  scope,
struct expression expr 
)

Definition at line 695 of file tree.c.

int evaluate_boolean_expression_result ( int ignorep,
struct packet packet,
struct lease lease,
struct client_state client_state,
struct option_state in_options,
struct option_state cfg_options,
struct binding_scope **  scope,
struct expression expr 
)

Definition at line 2769 of file tree.c.

int evaluate_boolean_option_cache ( int ignorep,
struct packet packet,
struct lease lease,
struct client_state client_state,
struct option_state in_options,
struct option_state cfg_options,
struct binding_scope **  scope,
struct option_cache oc,
const char *  file,
int  line 
)

Definition at line 2722 of file tree.c.

int evaluate_data_expression ( struct data_string result,
struct packet packet,
struct lease lease,
struct client_state client_state,
struct option_state in_options,
struct option_state cfg_options,
struct binding_scope **  scope,
struct expression expr,
const char *  file,
int  line 
)

Definition at line 1115 of file tree.c.

int evaluate_expression ( struct binding_value **  result,
struct packet packet,
struct lease lease,
struct client_state client_state,
struct option_state in_options,
struct option_state cfg_options,
struct binding_scope **  scope,
struct expression expr,
const char *  file,
int  line 
)

Definition at line 501 of file tree.c.

int evaluate_numeric_expression ( unsigned long *  result,
struct packet packet,
struct lease lease,
struct client_state client_state,
struct option_state in_options,
struct option_state cfg_options,
struct binding_scope **  scope,
struct expression expr 
)

Definition at line 2218 of file tree.c.

int evaluate_option_cache ( struct data_string result,
struct packet packet,
struct lease lease,
struct client_state client_state,
struct option_state in_options,
struct option_state cfg_options,
struct binding_scope **  scope,
struct option_cache oc,
const char *  file,
int  line 
)

Definition at line 2688 of file tree.c.

Definition at line 3195 of file tree.c.

void expression_dereference ( struct expression **  eptr,
const char *  file,
int  line 
)

Definition at line 2802 of file tree.c.

struct binding* find_binding ( struct binding_scope scope,
const char *  name 
)

Definition at line 3744 of file tree.c.

int find_bound_string ( struct data_string value,
struct binding_scope scope,
const char *  name 
)

Definition at line 4092 of file tree.c.

int free_bindings ( struct binding_scope scope,
const char *  file,
int  line 
)

Definition at line 3759 of file tree.c.

int fundef_dereference ( struct fundef **  ptr,
const char *  file,
int  line 
)

Definition at line 3818 of file tree.c.

int is_boolean_expression ( struct expression expr)

Definition at line 3020 of file tree.c.

int is_compound_expression ( struct expression expr)

Definition at line 3086 of file tree.c.

int is_data_expression ( struct expression expr)

Definition at line 3037 of file tree.c.

int is_numeric_expression ( struct expression expr)

Definition at line 3067 of file tree.c.

int make_concat ( struct expression **  expr,
struct expression left,
struct expression right 
)

Definition at line 269 of file tree.c.

int make_const_data ( struct expression **  expr,
const unsigned char *  data,
unsigned  len,
int  terminated,
int  allocate,
const char *  file,
int  line 
)

Definition at line 220 of file tree.c.

int make_const_int ( struct expression **  expr,
unsigned long  val 
)

Definition at line 255 of file tree.c.

int make_const_option_cache ( struct option_cache **  oc,
struct buffer **  buffer,
u_int8_t *  data,
unsigned  len,
struct option option,
const char *  file,
int  line 
)

Definition at line 150 of file tree.c.

int make_encapsulation ( struct expression **  expr,
struct data_string name 
)

Definition at line 299 of file tree.c.

int make_host_lookup ( struct expression **  expr,
const char *  name 
)

Definition at line 189 of file tree.c.

int make_let ( struct executable_statement **  result,
const char *  name 
)

Definition at line 378 of file tree.c.

int make_limit ( struct expression **  new,
struct expression expr,
int  limit 
)

Definition at line 332 of file tree.c.

int make_substring ( struct expression **  new,
struct expression expr,
struct expression offset,
struct expression length 
)

Definition at line 314 of file tree.c.

enum expression_context op_context ( enum expr_op  op)

Definition at line 3206 of file tree.c.

int op_precedence ( enum expr_op  op1,
enum expr_op  op2 
)

Definition at line 3189 of file tree.c.

int option_cache ( struct option_cache **  oc,
struct data_string dp,
struct expression expr,
struct option option,
const char *  file,
int  line 
)

Definition at line 364 of file tree.c.

int unset ( struct binding_scope scope,
const char *  name 
)

Definition at line 4123 of file tree.c.

int write_expression ( FILE *  file,
struct expression expr,
int  col,
int  indent,
int  firstp 
)

Definition at line 3287 of file tree.c.

Variable Documentation

struct binding_scope* global_scope

Definition at line 39 of file tree.c.