ofp-msgs: Add function ofptype_get_name().
[cascardo/ovs.git] / build-aux / extract-ofp-msgs
index 0ccd64e..b00039d 100755 (executable)
@@ -246,6 +246,7 @@ def extract_ofp_msgs(output_file_name):
         if re.match('enum ofptype', line):
             break
 
+    all_types = []
     while True:
         get_line()
         if re.match(r'\s*/?\*', line) or line.isspace():
@@ -280,6 +281,8 @@ def extract_ofp_msgs(output_file_name):
                       % (raw, all_raws[raw]["ofptype"]))
             all_raws[raw]["ofptype"] = ofptype
 
+        all_types.append(all_raws[raws[0]]["human_name"])
+
     input_file.close()
 
     if n_errors:
@@ -346,6 +349,12 @@ def extract_ofp_msgs(output_file_name):
                               % r["human_name"])
     output.append("};")
 
+    output.append("");
+    output.append("static const char *type_names[] = {");
+    for t in all_types:
+        output.append("    \"%s\"," % t)
+    output.append("};")
+
     if n_errors:
         sys.exit(1)