summaryrefslogtreecommitdiff
path: root/lib/ofp-util.c
diff options
context:
space:
mode:
authorBen Pfaff <blp@nicira.com>2010-12-07 13:22:46 -0800
committerBen Pfaff <blp@nicira.com>2010-12-07 13:22:46 -0800
commit7fa9111326e440a56dff41e0d4571716032a1de7 (patch)
tree2e4ba840e3ed680da7c6a0c993780ee3b9aad9c8 /lib/ofp-util.c
parent00b1c62fe8dc671584841c916040f2effb901552 (diff)
downloadopenvswitch-7fa9111326e440a56dff41e0d4571716032a1de7.tar.gz
ofp-print: Implement printing for OFPUTIL_NXT_FLOW_MOD.
Diffstat (limited to 'lib/ofp-util.c')
-rw-r--r--lib/ofp-util.c40
1 files changed, 37 insertions, 3 deletions
diff --git a/lib/ofp-util.c b/lib/ofp-util.c
index 8cf269a4b..331a8fd5c 100644
--- a/lib/ofp-util.c
+++ b/lib/ofp-util.c
@@ -756,9 +756,43 @@ ofputil_msg_type_code(const struct ofputil_msg_type *type)
return type->code;
}
-/* Converts an OFPT_FLOW_MOD or NXT_FLOW_MOD message 'oh', received when the
- * current flow format was 'flow_format', into an abstract flow_mod in 'fm'.
- * Returns 0 if successful, otherwise an OpenFlow error code.
+/* Flow formats. */
+
+bool
+ofputil_flow_format_is_valid(enum nx_flow_format flow_format)
+{
+ switch (flow_format) {
+ case NXFF_OPENFLOW10:
+ case NXFF_TUN_ID_FROM_COOKIE:
+ case NXFF_NXM:
+ return true;
+ }
+
+ return false;
+}
+
+const char *
+ofputil_flow_format_to_string(enum nx_flow_format flow_format)
+{
+ switch (flow_format) {
+ case NXFF_OPENFLOW10:
+ return "openflow10";
+ case NXFF_TUN_ID_FROM_COOKIE:
+ return "tun_id_from_cookie";
+ case NXFF_NXM:
+ return "nxm";
+ default:
+ NOT_REACHED();
+ }
+}
+
+/* Converts an OFPT_FLOW_MOD or NXT_FLOW_MOD message 'oh' into an abstract
+ * flow_mod in 'fm'. Returns 0 if successful, otherwise an OpenFlow error
+ * code.
+ *
+ * For OFPT_FLOW_MOD messages, 'flow_format' should be the current flow format
+ * at the time when the message was received. Otherwise 'flow_format' is
+ * ignored.
*
* Does not validate the flow_mod actions. */
int