X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=lib%2Fofp-version-opt.c;fp=lib%2Fofp-version-opt.c;h=1801e9f78453aeefc2a9632c2308e4372b39d891;hb=020c93874e22c1c7492c30fe76a8e496571ede13;hp=0000000000000000000000000000000000000000;hpb=2e1ae2005ed347d2dfebd23fff40c54a1a2a6716;p=openvswitch diff --git a/lib/ofp-version-opt.c b/lib/ofp-version-opt.c new file mode 100644 index 00000000..1801e9f7 --- /dev/null +++ b/lib/ofp-version-opt.c @@ -0,0 +1,36 @@ +#include +#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); +}