ofp-util: Add function to encode OFPT_SET_ASYNC messages.
[cascardo/ovs.git] / lib / ofp-util.h
index 89f3d95..1c359b3 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015 Nicira, Inc.
+ * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016 Nicira, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -140,22 +140,6 @@ enum ofputil_protocol {
                        OFPUTIL_P_ANY_OXM)
 };
 
-    /* Valid value of mask for asynchronous messages. */
-#define MAXIMUM_MASK_PACKET_IN ((1 << OFPR_N_REASONS) - 1)
-
-#define MAXIMUM_MASK_FLOW_REMOVED ((1 << OVS_OFPRR_NONE) - 1)
-
-#define MAXIMUM_MASK_PORT_STATUS ((1 << OFPPR_N_REASONS) - 1)
-
-#define MAXIMUM_MASK_ROLE_STATUS ((1 << OFPCRR_N_REASONS) - 1)
-
-#define MINIMUM_MASK_TABLE_STATUS (1 << OFPTR_VACANCY_DOWN)
-
-#define MAXIMUM_MASK_TABLE_STATUS ((1 << OFPTR_N_REASONS) - \
-                                   MINIMUM_MASK_TABLE_STATUS)
-
-#define MAXIMUM_MASK_REQUESTFORWARD ((1 << OFPRFR_N_REASONS) - 1)
-
 /* Protocols to use for flow dumps, from most to least preferred. */
 extern enum ofputil_protocol ofputil_flow_dump_protocols[];
 extern size_t ofputil_n_flow_dump_protocols;
@@ -1315,23 +1299,38 @@ enum ofperr ofputil_decode_tlv_table_reply(const struct ofp_header *,
 void ofputil_uninit_tlv_table(struct ovs_list *mappings);
 
 enum ofputil_async_msg_type {
+    /* Standard asynchronous messages. */
     OAM_PACKET_IN,              /* OFPT_PACKET_IN or NXT_PACKET_IN. */
     OAM_PORT_STATUS,            /* OFPT_PORT_STATUS. */
     OAM_FLOW_REMOVED,           /* OFPT_FLOW_REMOVED or NXT_FLOW_REMOVED. */
     OAM_ROLE_STATUS,            /* OFPT_ROLE_STATUS. */
     OAM_TABLE_STATUS,           /* OFPT_TABLE_STATUS. */
     OAM_REQUESTFORWARD,         /* OFPT_REQUESTFORWARD. */
+
+    /* Extension asynchronous messages (none yet--coming soon!). */
+#define OAM_EXTENSIONS 0        /* Bitmap of all extensions. */
+
     OAM_N_TYPES
 };
+const char *ofputil_async_msg_type_to_string(enum ofputil_async_msg_type);
+
+struct ofputil_async_cfg {
+    uint32_t master[OAM_N_TYPES];
+    uint32_t slave[OAM_N_TYPES];
+};
+#define OFPUTIL_ASYNC_CFG_INIT (struct ofputil_async_cfg) { .master[0] = 0 }
 
 enum ofperr ofputil_decode_set_async_config(const struct ofp_header *,
-                                            uint32_t master[OAM_N_TYPES],
-                                            uint32_t slave[OAM_N_TYPES],
-                                            bool loose);
+                                            bool loose,
+                                            const struct ofputil_async_cfg *,
+                                            struct ofputil_async_cfg *);
+
+struct ofpbuf *ofputil_encode_get_async_reply(
+    const struct ofp_header *, const struct ofputil_async_cfg *);
+struct ofpbuf *ofputil_encode_set_async_config(
+    const struct ofputil_async_cfg *, uint32_t oams, enum ofp_version);
 
-struct ofpbuf *ofputil_encode_get_async_config(const struct ofp_header *,
-                                               uint32_t master[OAM_N_TYPES],
-                                               uint32_t slave[OAM_N_TYPES]);
+struct ofputil_async_cfg ofputil_async_cfg_default(enum ofp_version);
 
 struct ofputil_requestforward {
     ovs_be32 xid;