lib: Add helpers for OpenFlow version command line options
[openvswitch] / lib / ofp-version-opt.h
diff --git a/lib/ofp-version-opt.h b/lib/ofp-version-opt.h
new file mode 100644 (file)
index 0000000..78e3135
--- /dev/null
@@ -0,0 +1,25 @@
+#ifndef OFP_VERSION_H
+#define OFP_VERSION_H 1
+
+#include <openflow/openflow-common.h>
+#include "util.h"
+#include "ofp-util.h"
+
+#define OFP_VERSION_LONG_OPTIONS                                \
+        {"version",     no_argument, NULL, 'V'},                \
+        {"protocols", required_argument, NULL, 'O'}
+
+#define OFP_VERSION_OPTION_HANDLERS                             \
+        case 'V':                                               \
+            ovs_print_version(OFP10_VERSION, OFP13_VERSION);    \
+            exit(EXIT_SUCCESS);                                 \
+                                                                \
+        case 'O':                                               \
+            set_allowed_ofp_versions(optarg);                   \
+            break;
+
+uint32_t get_allowed_ofp_versions(void);
+void set_allowed_ofp_versions(const char *string);
+void ofp_version_usage(void);
+
+#endif