]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Filter: instruction names
authorJan Maria Matejka <mq@ucw.cz>
Mon, 30 Apr 2018 10:49:22 +0000 (12:49 +0200)
committerJan Maria Matejka <mq@ucw.cz>
Tue, 29 May 2018 09:53:51 +0000 (11:53 +0200)
filter/f-util.c
filter/filter.h

index 68aecd738f6f35ed3f1fc1210b9432886cad9fef..6170760b0769559c68f182381d57fa562ead1d5a 100644 (file)
@@ -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)
 {
index bc330aba261b95136ba4cd31f8183876ca82eacf..694bdfd74654e315d301ef7cb58088d531013d42 100644 (file)
@@ -78,6 +78,7 @@ enum f_instruction_code {
   c,
 FI__LIST
 #undef F
+  FI__MAX,
 } PACKED;
 
 struct f_inst {                /* Instruction */