lib/ofp-util.c \
lib/ofp-util.def \
lib/ofp-util.h \
+ lib/ofp-version-opt.h \
+ lib/ofp-version-opt.c \
lib/ofpbuf.c \
lib/ofpbuf.h \
lib/ovsdb-data.c \
lib/daemon-syn.man \
lib/leak-checker.man \
lib/memory-unixctl.man \
+ lib/ofp-version.man \
lib/ovs.tmac \
lib/ssl-bootstrap.man \
lib/ssl-bootstrap-syn.man \
--- /dev/null
+#include <config.h>
+#include "ofp-util.h"
+#include "ofp-version-opt.h"
+#include "vlog.h"
+#include "dynamic-string.h"
+
+VLOG_DEFINE_THIS_MODULE(ofp_version);
+
+static uint32_t allowed_versions = 0;
+
+uint32_t
+get_allowed_ofp_versions(void)
+{
+ return allowed_versions ? allowed_versions : OFPUTIL_DEFAULT_VERSIONS;
+}
+
+void
+set_allowed_ofp_versions(const char *string)
+{
+ allowed_versions = ofputil_versions_from_string(string);
+}
+
+void
+ofp_version_usage(void)
+{
+ struct ds msg = DS_EMPTY_INITIALIZER;
+
+ ofputil_format_version_bitmap_names(&msg, OFPUTIL_DEFAULT_VERSIONS);
+ printf(
+ "\nOpen Flow Version options:\n"
+ " -V, --version display version information\n"
+ " --allowed-ofp-versions list of allowed Open Flow versions\n"
+ " (default: %s)\n",
+ ds_cstr(&msg));
+ ds_destroy(&msg);
+}
--- /dev/null
+#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
--- /dev/null
+.de IQ
+. br
+. ns
+. IP "\\$1"
+..
+.IP "\fB\-O \fR[\fIversion\fR[\fB,\fIversion\fR]...]\fR"
+.IQ "\fB\-\-protocols=\fR[\fIversion\fR[\fB,\fIversion\fR]...]\fR"
+Sets the OpenFlow protocol versions that are allowed when establishing
+an OpenFlow session.
+.
+.IP
+The following versions are considered to be ready for general use.
+These protocol versions are enabled by default:
+.
+.RS
+.IP \(bu
+\fBOpenFlow10\fR, for OpenFlow 1.0.
+.RE
+.
+.IP
+Support for the following protocol versions is provided for testing
+and development purposes. They are not enabled by default:
+.
+.RS
+.IP \(bu
+\fBOpenFlow11\fR, for OpenFlow 1.1.
+.
+.IP \(bu
+\fBOpenFlow12\fR, for OpenFlow 1.2.
+.
+.IP \(bu
+\fBOpenFlow13\fR, for OpenFlow 1.3.
+.RE