summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Maria Matejka <mq@ucw.cz>2018-04-30 12:49:22 +0200
committerJan Maria Matejka <mq@ucw.cz>2018-05-29 11:53:51 +0200
commitcff9e937fd0ed42b88be1deb5e1aa9fe301caabd (patch)
treeb8694808bc47a2ef27626f61692c8e6fcf7f1e29
parent31d6939cde071ab04d1da6b3ff6fb6cd579e164a (diff)
Filter: instruction names
-rw-r--r--filter/f-util.c16
-rw-r--r--filter/filter.h1
2 files changed, 17 insertions, 0 deletions
diff --git a/filter/f-util.c b/filter/f-util.c
index 68aecd73..6170760b 100644
--- a/filter/f-util.c
+++ b/filter/f-util.c
@@ -77,6 +77,22 @@ f_generate_roa_check(struct rtable_config *table, struct f_inst *prefix, struct
return &ret->i;
}
+static const char * const f_instruction_name_str[] = {
+#define F(c,a,b) \
+ [c] = #c,
+FI__LIST
+#undef F
+};
+
+const char *
+f_instruction_name(enum f_instruction_code fi)
+{
+ if (fi < FI__MAX)
+ return f_instruction_name_str[fi];
+ else
+ bug("Got unknown instruction code: %d", fi);
+}
+
char *
filter_name(struct filter *filter)
{
diff --git a/filter/filter.h b/filter/filter.h
index bc330aba..694bdfd7 100644
--- a/filter/filter.h
+++ b/filter/filter.h
@@ -78,6 +78,7 @@ enum f_instruction_code {
c,
FI__LIST
#undef F
+ FI__MAX,
} PACKED;
struct f_inst { /* Instruction */