forked from openvswitch/ovs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
lib: Add helpers for OpenFlow version command line options
Signed-off-by: Simon Horman <[email protected]> [[email protected] renamed some functions and options and revised the documentation] Signed-off-by: Ben Pfaff <[email protected]>
- Loading branch information
Showing
4 changed files
with
97 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#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); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
.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 |