ISC DHCP 4.4.3-P1
A reference DHCPv4 and DHCPv6 implementation
 
Loading...
Searching...
No Matches
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.
 

Variables

struct binding_scopeglobal_scope
 

Macro Definition Documentation

◆ DS_SPRINTF_SIZE

#define DS_SPRINTF_SIZE   128

Definition at line 42 of file tree.c.

Function Documentation

◆ bind_ds_value()

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

Definition at line 4080 of file tree.c.

◆ binding_scope_dereference()

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

Definition at line 3786 of file tree.c.

◆ binding_value_dereference()

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

Definition at line 652 of file tree.c.

◆ concat_dclists()

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 4177 of file tree.c.

◆ cons()

pair cons ( caddr_t car,
pair cdr )

Definition at line 137 of file tree.c.

◆ create_binding()

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

Definition at line 4049 of file tree.c.

◆ data_string_sprintfa()

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

Definition at line 56 of file tree.c.

◆ enter_dns_host()

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

Definition at line 204 of file tree.c.

◆ evaluate_boolean_expression()

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 694 of file tree.c.

◆ evaluate_boolean_expression_result()

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 2780 of file tree.c.

◆ evaluate_boolean_option_cache()

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 2733 of file tree.c.

◆ evaluate_data_expression()

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 1126 of file tree.c.

◆ evaluate_expression()

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 500 of file tree.c.

◆ evaluate_numeric_expression()

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 2229 of file tree.c.

◆ evaluate_option_cache()

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 2699 of file tree.c.

◆ expression_context()

Definition at line 3206 of file tree.c.

◆ expression_dereference()

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

Definition at line 2813 of file tree.c.

◆ find_binding()

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

Definition at line 3755 of file tree.c.

◆ find_bound_string()

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

Definition at line 4103 of file tree.c.

◆ free_bindings()

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

Definition at line 3770 of file tree.c.

◆ fundef_dereference()

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

Definition at line 3829 of file tree.c.

◆ is_boolean_expression()

int is_boolean_expression ( struct expression * expr)

Definition at line 3031 of file tree.c.

◆ is_compound_expression()

int is_compound_expression ( struct expression * expr)

Definition at line 3097 of file tree.c.

◆ is_data_expression()

int is_data_expression ( struct expression * expr)

Definition at line 3048 of file tree.c.

◆ is_numeric_expression()

int is_numeric_expression ( struct expression * expr)

Definition at line 3078 of file tree.c.

◆ make_concat()

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

Definition at line 268 of file tree.c.

◆ make_const_data()

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 219 of file tree.c.

◆ make_const_int()

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

Definition at line 254 of file tree.c.

◆ make_const_option_cache()

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 149 of file tree.c.

◆ make_encapsulation()

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

Definition at line 298 of file tree.c.

◆ make_host_lookup()

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

Definition at line 188 of file tree.c.

◆ make_let()

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

Definition at line 377 of file tree.c.

◆ make_limit()

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

Definition at line 331 of file tree.c.

◆ make_substring()

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

Definition at line 313 of file tree.c.

◆ op_context()

static enum expression_context op_context ( enum expr_op op)

Definition at line 3217 of file tree.c.

◆ op_precedence()

static int op_precedence ( enum expr_op op1,
enum expr_op op2 )

Definition at line 3200 of file tree.c.

◆ option_cache()

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 363 of file tree.c.

◆ unset()

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

Definition at line 4134 of file tree.c.

◆ write_expression()

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

Definition at line 3298 of file tree.c.

Variable Documentation

◆ global_scope

struct binding_scope* global_scope

Definition at line 38 of file tree.c.