if (gmp_sscanf(sym->identifier, "%Zu%n", v, &len) != 1 ||
(int)strlen(sym->identifier) != len) {
mpz_clear(v);
- if (sym->dtype != &integer_type)
- return NULL;
return error(&sym->location, "Could not parse %s",
sym->dtype->desc);
}
return symbolic_constant_print(&pkttype_type_tbl, expr);
}
-static struct error_record *pkttype_type_parse(const struct expr *sym,
- struct expr **res)
-{
- struct error_record *erec;
- const struct symbolic_constant *s;
-
- for (s = pkttype_type_tbl.symbols; s->identifier != NULL; s++) {
- if (!strcmp(sym->identifier, s->identifier)) {
- *res = constant_expr_alloc(&sym->location, sym->dtype,
- sym->dtype->byteorder,
- sym->dtype->size,
- &s->value);
- return NULL;
- }
- }
-
- *res = NULL;
- erec = sym->dtype->basetype->parse(sym, res);
- if (erec != NULL)
- return erec;
- if (*res)
- return NULL;
-
- return symbolic_constant_parse(sym, &pkttype_type_tbl, res);
-}
-
static const struct datatype pkttype_type = {
.type = TYPE_PKTTYPE,
.name = "pkt_type",
.size = BITS_PER_BYTE,
.basetype = &integer_type,
.print = pkttype_type_print,
- .parse = pkttype_type_parse,
+ .sym_tbl = &pkttype_type_tbl,
};
static struct symbol_table *devgroup_tbl;
},
};
-static struct error_record *ethertype_parse(const struct expr *sym,
- struct expr **res)
-{
- struct error_record *erec;
-
- *res = NULL;
- erec = sym->dtype->basetype->parse(sym, res);
- if (erec != NULL)
- return erec;
- if (*res)
- return NULL;
- return symbolic_constant_parse(sym, ðertype_tbl, res);
-}
-
static void ethertype_print(const struct expr *expr)
{
return symbolic_constant_print(ðertype_tbl, expr);
.basetype = &integer_type,
.basefmt = "0x%.4Zx",
.print = ethertype_print,
- .parse = ethertype_parse,
+ .sym_tbl = ðertype_tbl,
};
#define ETHHDR_TEMPLATE(__name, __dtype, __member) \
ct state invalid drop;ok
ct state established accept;ok
ct state 8;ok;ct state new
+ct state xxx;fail
ct direction original;ok
ct direction != original;ok
ct direction != reply;ok
ct direction {reply, original};ok
- ct direction != {reply, original};ok
+ct direction xxx;fail
ct status expected;ok
ct status != expected;ok
ct status seen-reply;ok
ct status != seen-reply;ok
ct status {expected, seen-reply, assured, confirmed, dying};ok
+ct status xxx;fail
# SYMBOL("snat", IPS_SRC_NAT)
# SYMBOL("dnat", IPS_DST_NAT)