67#if defined (DEBUG_EXPRESSIONS)
75#if defined (DEBUG_EXPRESSIONS)
76 log_debug (
"exec: statements returns %d", status);
95#if defined (DEBUG_EXPRESSIONS)
101 if (
r->data.on.statements)
107#if defined (DEBUG_EXPRESSIONS)
113 if (
r->data.on.statements)
119#if defined (DEBUG_EXPRESSIONS)
125 if (
r->data.on.statements)
134#if defined (DEBUG_EXPRESSIONS)
140 r->data.s_switch.expr,
141 r->data.s_switch.statements));
142#if defined (DEBUG_EXPRESSIONS)
143 log_debug (
"exec: switch: case %lx", (
unsigned long)
e);
171#if defined (DEBUG_EXPRESSIONS)
173 ? (
rc ?
"true" :
"false")
182 rc ?
r->data.ie.tc :
r->data.ie.fc,
193#if defined (DEBUG_EXPRESSIONS)
195 (status ?
"succeeded" :
"failed"));
205 int i, argc =
r->
data.execute.argc;
241 log_debug(
"execute_statement failed argv[%d]",
i);
251 if ((
p =
fork()) > 0) {
268 for (
i = 0;
i <= argc;
i++) {
275 log_fatal(
"Impossible case at %s:%d (ENABLE_EXECUTE "
276 "is not defined).",
MDL);
286#if defined (DEBUG_EXPRESSIONS)
288 (status ?
"succeeded" :
"failed"));
295#if defined (DEBUG_EXPRESSIONS)
298 :
"<unnamed class>"));
304#if defined (DEBUG_EXPRESSIONS)
312#if defined (DEBUG_EXPRESSIONS)
315 ?
"supersede" :
"send"),
316 r->data.option->option->universe->name,
317 r->data.option->option->name);
321#if defined (DEBUG_EXPRESSIONS)
323 r->data.option->option->universe->name,
324 r->data.option->option->name);
328#if defined (DEBUG_EXPRESSIONS)
330 r->data.option->option->universe->name,
331 r->data.option->option->name);
335#if defined (DEBUG_EXPRESSIONS)
337 r->data.option->option->universe->name,
338 r->data.option->option->name);
355 log_error(
"set %s: can't allocate scope",
361#if defined (DEBUG_EXPRESSIONS)
372 (
r->data.set.name) + 1,
393 scope,
r->data.set.expr,
407 r->data.set.expr->data.func,
412#if defined (DEBUG_EXPRESSIONS)
414 (
binding && status ?
"" :
" (failed)"));
421 if (!scope || !*scope)
431#if defined (DEBUG_EXPRESSIONS)
432 log_debug (
"exec: unset %s: %s",
r->data.unset,
433 (status ?
"found" :
"not found"));
440#if defined (DEBUG_EXPRESSIONS)
458 (
e->data.let.name + 1),
477 scope,
e->data.set.expr,
MDL));
482#if defined (DEBUG_EXPRESSIONS)
484 (
binding && status ?
"" :
"failed"));
488 if (!
e->data.let.statements) {
489 }
else if (
e->data.let.statements->op ==
491 e =
e->data.let.statements;
513#if defined (DEBUG_EXPRESSIONS)
518 switch (
r->data.log.priority) {
519 case log_priority_fatal:
523 case log_priority_error:
527 case log_priority_debug:
531 case log_priority_info:
637#if defined (POINTER_DEBUG)
646 if ((*ptr) ->
refcnt > 0) {
651 if ((*ptr) ->
refcnt < 0) {
653#if defined (DEBUG_RC_HISTORY)
656#if defined (POINTER_DEBUG)
666 switch ((*ptr) ->
op) {
668 if ((*ptr) ->
data.statements)
674 if ((*ptr) ->
data.on.statements)
680 if ((*ptr) ->
data.s_switch.statements)
683 if ((*ptr) ->
data.s_switch.expr)
689 if ((*ptr) ->
data.s_switch.expr)
695 if ((*ptr) ->
data.ie.expr)
698 if ((*ptr) ->
data.ie.tc)
701 if ((*ptr) ->
data.ie.fc)
707 if ((*ptr) ->
data.eval)
713 if ((*ptr) ->
data.eval)
719 if ((*ptr)->data.set.name)
721 if ((*ptr)->data.set.expr)
727 if ((*ptr)->data.unset)
732 if ((*ptr)->data.execute.command)
734 if ((*ptr)->data.execute.arglist)
744 if ((*ptr) ->
data.option)
764#if defined ENABLE_EXECUTE
768 const char *
s, *
t, *
dot;
796 if (
r ->
data.on.statements) {
799 r ->
data.on.statements,
812 r ->
data.s_switch.expr,
828 r ->
data.s_switch.expr,
849 if (
x ->
data.ie.fc &&
861 if (
x ->
data.ie.fc) {
947 "",
"",
r ->
data.set.name);
960 "",
"",
r ->
data.set.name);
970 switch (
r ->
data.log.priority) {
1001#ifdef ENABLE_EXECUTE
1009 r->data.execute.command,
1020 log_fatal(
"Impossible case at %s:%d (ENABLE_EXECUTE "
1021 "is not defined).",
MDL);
1057 memset (&cd, 0,
sizeof cd);
1069 scope,
s->data.c_case,
MDL));
1097 scope,
s->data.c_case));
1098 if (
sub &&
n ==
c) {
1121 int (*callback) (
struct
1129 for (foo =
stmt; foo; foo = foo->
next) {
1130 if ((*callback) (foo,
vp,
condp) != 0)
#define rc_register(file, line, reference, addr, refcnt, d, f)
void data_string_forget(struct data_string *data, const char *file, int line)
int fundef_reference(struct fundef **ptr, struct fundef *src, const char *file, int line)
int executable_statement_reference(struct executable_statement **ptr, struct executable_statement *bp, const char *file, int line)
int binding_scope_reference(struct binding_scope **ptr, struct binding_scope *bp, const char *file, int line)
int binding_scope_allocate(struct binding_scope **ptr, const char *file, int line)
int binding_value_allocate(struct binding_value **cptr, const char *file, int line)
int option_cache_dereference(struct option_cache **ptr, const char *file, int line)
void set_option(struct universe *universe, struct option_state *options, struct option_cache *option, enum statement_op op)
void parse_vendor_option(struct packet *packet, struct lease *lease, struct client_state *client_state, struct option_state *in_options, struct option_state *out_options, struct binding_scope **scope)
Parse a vendor option (option 43)
int token_indent_data_string(FILE *file, int col, int indent, const char *prefix, const char *suffix, struct data_string *data)
int token_print_indent_concat(FILE *file, int col, int indent, const char *prefix, const char *suffix,...)
void indent_spaces(FILE *file, int indent)
int token_print_indent(FILE *file, int col, int indent, const char *prefix, const char *suffix, const char *buf)
void classify(struct packet *packet, struct class *class)
struct universe dhcp_universe
int execute_statements(struct binding_value **result, struct packet *packet, struct lease *lease, struct client_state *client_state, struct option_state *in_options, struct option_state *out_options, struct binding_scope **scope, struct executable_statement *statements, struct on_star *on_star)
void execute_statements_in_scope(struct binding_value **result, struct packet *packet, struct lease *lease, struct client_state *client_state, struct option_state *in_options, struct option_state *out_options, struct binding_scope **scope, struct group *group, struct group *limiting_group, struct on_star *on_star)
int executable_statement_foreach(struct executable_statement *stmt, int(*callback)(struct executable_statement *, void *, int), void *vp, int condp)
void write_statements(FILE *file, struct executable_statement *statements, int indent)
int executable_statement_dereference(struct executable_statement **ptr, const char *file, int line)
int find_matching_case(struct executable_statement **ep, struct packet *packet, struct lease *lease, struct client_state *client_state, struct option_state *in_options, struct option_state *out_options, struct binding_scope **scope, struct expression *expr, struct executable_statement *stmt)
@ supersede_option_statement
@ default_option_statement
@ prepend_option_statement
@ append_option_statement
void * dmalloc(size_t, const char *, int)
void dfree(void *, const char *, int)
int log_error(const char *,...) __attribute__((__format__(__printf__
int int int log_debug(const char *,...) __attribute__((__format__(__printf__
void log_fatal(const char *,...) __attribute__((__format__(__printf__
int int log_info(const char *,...) __attribute__((__format__(__printf__
union binding_value::value value
enum binding_value::@15 type
struct binding_value * value
const unsigned char * data
struct executable_statement::@7::@11 let
struct executable_statement::@7::@10 s_switch
enum executable_statement::statement_op op
struct executable_statement * tc
struct executable_statement::@7::@8 ie
struct executable_statement::@7::@9 on
union executable_statement::@7 data
struct executable_statement * next
struct executable_statement * fc
struct executable_statement * statements
union expression::expr_union data
struct executable_statement * statements
struct executable_statement * on_commit
struct executable_statement * on_expiry
struct executable_statement * on_release
int binding_scope_dereference(struct binding_scope **ptr, const char *file, int line)
int write_expression(FILE *file, struct expression *expr, int col, int indent, int firstp)
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)
struct binding * find_binding(struct binding_scope *scope, const char *name)
void expression_dereference(struct expression **eptr, const char *file, int line)
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 is_data_expression(struct expression *expr)
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 binding_value_dereference(struct binding_value **v, 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)
struct expression::expr_union::@25 arg
struct expression * arglist