]>
Commit | Line | Data |
---|---|---|
020c9387 | 1 | #include <config.h> |
3e8a2ad1 | 2 | #include "openvswitch/dynamic-string.h" |
f4248336 | 3 | #include "openvswitch/ofp-util.h" |
020c9387 | 4 | #include "ofp-version-opt.h" |
728a8b14 | 5 | #include "ovs-thread.h" |
020c9387 SH |
6 | |
7 | static uint32_t allowed_versions = 0; | |
8 | ||
9 | uint32_t | |
10 | get_allowed_ofp_versions(void) | |
11 | { | |
12 | return allowed_versions ? allowed_versions : OFPUTIL_DEFAULT_VERSIONS; | |
13 | } | |
14 | ||
15 | void | |
16 | set_allowed_ofp_versions(const char *string) | |
17 | { | |
728a8b14 | 18 | assert_single_threaded(); |
020c9387 SH |
19 | allowed_versions = ofputil_versions_from_string(string); |
20 | } | |
21 | ||
37923ac7 BP |
22 | void |
23 | mask_allowed_ofp_versions(uint32_t bitmap) | |
24 | { | |
728a8b14 | 25 | assert_single_threaded(); |
37923ac7 BP |
26 | allowed_versions &= bitmap; |
27 | } | |
28 | ||
db5076ee JR |
29 | void |
30 | add_allowed_ofp_versions(uint32_t bitmap) | |
31 | { | |
32 | assert_single_threaded(); | |
33 | allowed_versions |= bitmap; | |
34 | } | |
35 | ||
020c9387 SH |
36 | void |
37 | ofp_version_usage(void) | |
38 | { | |
39 | struct ds msg = DS_EMPTY_INITIALIZER; | |
40 | ||
41 | ofputil_format_version_bitmap_names(&msg, OFPUTIL_DEFAULT_VERSIONS); | |
42 | printf( | |
1f14e055 | 43 | "\nOpenFlow version options:\n" |
020c9387 | 44 | " -V, --version display version information\n" |
1f14e055 | 45 | " -O, --protocols set allowed OpenFlow versions\n" |
020c9387 SH |
46 | " (default: %s)\n", |
47 | ds_cstr(&msg)); | |
48 | ds_destroy(&msg); | |
49 | } |