36static struct element *reduce_equal_expression(
struct element *left,
38static void debug(
const char* fmt, ...);
90 arg =
mapGet(expr,
"exists");
92 debug(
"can't get exists argument");
97 debug(
"can't get exists option universe");
102 debug(
"can't get exists option name");
114 snprintf(result,
sizeof(result),
141 arg =
mapGet(expr,
"equal");
143 debug(
"can't get equal argument");
146 left =
mapGet(arg,
"left");
148 debug(
"can't get equal left branch");
151 right =
mapGet(arg,
"right");
153 debug(
"can't get equal right branch");
156 return reduce_equal_expression(left, right);
175 arg =
mapGet(expr,
"not-equal");
177 debug(
"can't get not-equal argument");
180 left =
mapGet(arg,
"left");
182 debug(
"can't get not-equal left branch");
185 right =
mapGet(arg,
"right");
187 debug(
"can't get not-equal right branch");
190 equal = reduce_equal_expression(left, right);
238 arg =
mapGet(expr,
"and");
240 debug(
"can't get and argument");
243 left =
mapGet(arg,
"left");
245 debug(
"can't get and left branch");
248 right =
mapGet(arg,
"right");
250 debug(
"can't get and right branch");
284 debug(
"can't get or argument");
287 left =
mapGet(arg,
"left");
289 debug(
"can't get or left branch");
292 right =
mapGet(arg,
"right");
294 debug(
"can't get or right branch");
320 arg =
mapGet(expr,
"not");
322 debug(
"can't get not argument");
408 arg =
mapGet(expr,
"substring");
410 debug(
"can't get substring argument");
413 string =
mapGet(arg,
"expression");
414 if (
string == NULL) {
415 debug(
"can't get substring expression");
418 offset =
mapGet(arg,
"offset");
419 if (offset == NULL) {
420 debug(
"can't get substring offset");
425 debug(
"can't get substring length");
437 debug(
"substring with a negative offset (%lld)",
446 debug(
"substring with a negative length (%lld)",
452 snprintf(buf,
sizeof(buf),
453 ",%u,%u)", (
unsigned)off, (
unsigned)len);
475 arg =
mapGet(expr,
"suffix");
477 debug(
"can't get suffix argument");
480 string =
mapGet(arg,
"expression");
481 if (
string == NULL) {
482 debug(
"can't get suffix expression");
487 debug(
"can't get suffix length");
499 debug(
"suffix with a negative length (%lld)",
505 snprintf(buf,
sizeof(buf),
",-%u,all)", (
unsigned)len);
543 arg =
mapGet(expr,
"option");
545 debug(
"can't get option argument");
550 debug(
"can't get option universe");
555 debug(
"can't get option name");
567 snprintf(result,
sizeof(result),
581 debug(
"get hardware for DHCPv6");
585 "concat(substring(pkt4.htype,-1,all),pkt4.mac)");
599 debug(
"get hw-type for DHCPv6");
602 result =
makeString(-1,
"substring(pkt4.htype,-1,all)");
616 debug(
"get hw-address for DHCPv6");
631 arg =
mapGet(expr,
"const-data");
633 debug(
"can't get const-data argument");
665 arg =
mapGet(expr,
"concat");
667 debug(
"can't get concat argument");
670 left =
mapGet(arg,
"left");
672 debug(
"can't get concat left branch");
675 right =
mapGet(arg,
"right");
677 debug(
"can't get concat right branch");
848 debug(
"unexpected null: this expression was not evaluated");
858 debug(
"unexpected gethostname: this expression was not "
883 debug(
"get v6relay for DHCPv4");
886 arg =
mapGet(expr,
"v6relay");
888 debug(
"can't get v6relay argument");
891 relay =
mapGet(arg,
"relay");
893 debug(
"can't get v6relay relay");
901 debug(
"v6relay called with illegal relay (%lld)",
905 arg =
mapGet(arg,
"relay-option");
907 debug(
"can't get v6relay relay-option");
912 debug(
"can't get v6relay option universe");
917 debug(
"can't get v6relay option name");
926 snprintf(result,
sizeof(result),
935 snprintf(result,
sizeof(result),
936 "relay6[%d].option[%u].hex",
960reduce_equal_expression(
struct element *left,
struct element *right)
1008debug(
const char* fmt, ...)
1012 va_start(list, fmt);
1013 vfprintf(stderr, fmt, list);
1014 fprintf(stderr,
"\n");
void concatString(struct string *s, const struct string *a)
struct string * makeString(int l, const char *s)
struct string * allocString(void)
void appendString(struct string *s, const char *a)
struct string * stringValue(struct element *e)
isc_boolean_t mapContains(const struct element *m, const char *k)
struct string * quote(struct string *s)
struct element * createString(const struct string *s)
struct element * mapGet(struct element *m, const char *k)
int64_t intValue(const struct element *e)
struct option * option_lookup_name(const char *, const char *)
struct element * reduce_data_expression(struct element *expr)
struct element * reduce_numeric_expression(struct element *expr)
struct element * reduce_boolean_expression(struct element *expr)
const struct space * space
int is_data_expression(struct expression *expr)