+/* lengths (fixed or minimal) of particular protocol structures */
+#define OF_SWITCH_CONFIG_LEN 12
+#define OF_PHY_PORT_LEN 48
+#define OF_SWITCH_FEATURES_LEN 32
+#define OF_PORT_STATUS_LEN 64
+#define OF_PORT_MOD_LEN 32
+#define OF_PACKET_IN_LEN 20
+#define OF_ACTION_OUTPUT_LEN 8
+#define OF_ACTION_VLAN_VID_LEN 8
+#define OF_ACTION_VLAN_PCP_LEN 8
+#define OF_ACTION_DL_ADDR_LEN 16
+#define OF_ACTION_NW_ADDR_LEN 8
+#define OF_ACTION_TP_PORT_LEN 8
+#define OF_ACTION_NW_TOS_LEN 8
+#define OF_ACTION_VENDOR_HEADER_LEN 8
+#define OF_ACTION_HEADER_LEN 8
+#define OF_PACKET_OUT_LEN 16
+#define OF_MATCH_LEN 40
+#define OF_FLOW_MOD_LEN 72
+#define OF_FLOW_REMOVED_LEN 88
+#define OF_ERROR_MSG_LEN 12
+#define OF_STATS_REQUEST_LEN 12
+#define OF_STATS_REPLY_LEN 12
+#define OF_DESC_STATS_LEN 1056
+#define OF_FLOW_STATS_REQUEST_LEN 44
+#define OF_FLOW_STATS_LEN 88
+#define OF_AGGREGATE_STATS_REQUEST_LEN 44
+#define OF_AGGREGATE_STATS_REPLY_LEN 24
+#define OF_TABLE_STATS_LEN 64
+#define OF_PORT_STATS_REQUEST_LEN 8
+#define OF_PORT_STATS_LEN 104
+#define OF_VENDOR_HEADER_LEN 12
+#define OF_QUEUE_PROP_HEADER_LEN 8
+#define OF_QUEUE_PROP_MIN_RATE_LEN 16
+#define OF_PACKET_QUEUE_LEN 8
+#define OF_QUEUE_GET_CONFIG_REQUEST_LEN 12
+#define OF_QUEUE_GET_CONFIG_REPLY_LEN 16
+#define OF_ACTION_ENQUEUE_LEN 16
+#define OF_QUEUE_STATS_REQUEST_LEN 8
+#define OF_QUEUE_STATS_LEN 32
+
+/* miscellaneous constants from [OF10] */
+#define OFP_MAX_TABLE_NAME_LEN 32
+#define OFP_MAX_PORT_NAME_LEN 16
+#define DESC_STR_LEN 256
+#define SERIAL_NUM_LEN 32
+#define OFP_VLAN_NONE 0xffff
+
+/* vendor extensions */
+#define BSN_SET_IP_MASK 0
+#define BSN_GET_IP_MASK_REQUEST 1
+#define BSN_GET_IP_MASK_REPLY 2
+#define BSN_SET_MIRRORING 3
+#define BSN_GET_MIRRORING_REQUEST 4
+#define BSN_GET_MIRRORING_REPLY 5
+#define BSN_SHELL_COMMAND 6
+#define BSN_SHELL_OUTPUT 7
+#define BSN_SHELL_STATUS 8
+#define BSN_GET_INTERFACES_REQUEST 9
+#define BSN_GET_INTERFACES_REPLY 10
+#define BSN_SET_PKTIN_SUPPRESSION_REQUEST 11
+#define BSN_SET_L2_TABLE_REQUEST 12
+#define BSN_GET_L2_TABLE_REQUEST 13
+#define BSN_GET_L2_TABLE_REPLY 14
+#define BSN_VIRTUAL_PORT_CREATE_REQUEST 15
+#define BSN_VIRTUAL_PORT_CREATE_REPLY 16
+#define BSN_VIRTUAL_PORT_REMOVE_REQUEST 17
+#define BSN_BW_ENABLE_SET_REQUEST 18
+#define BSN_BW_ENABLE_GET_REQUEST 19
+#define BSN_BW_ENABLE_GET_REPLY 20
+#define BSN_BW_CLEAR_DATA_REQUEST 21
+#define BSN_BW_CLEAR_DATA_REPLY 22
+#define BSN_BW_ENABLE_SET_REPLY 23
+#define BSN_SET_L2_TABLE_REPLY 24
+#define BSN_SET_PKTIN_SUPPRESSION_REPLY 25
+#define BSN_VIRTUAL_PORT_REMOVE_REPLY 26
+#define BSN_HYBRID_GET_REQUEST 27
+#define BSN_HYBRID_GET_REPLY 28
+ /* 29 */
+ /* 30 */
+#define BSN_PDU_TX_REQUEST 31
+#define BSN_PDU_TX_REPLY 32
+#define BSN_PDU_RX_REQUEST 33
+#define BSN_PDU_RX_REPLY 34
+#define BSN_PDU_RX_TIMEOUT 35
+
+static const struct tok bsn_subtype_str[] = {
+ { BSN_SET_IP_MASK, "SET_IP_MASK" },
+ { BSN_GET_IP_MASK_REQUEST, "GET_IP_MASK_REQUEST" },
+ { BSN_GET_IP_MASK_REPLY, "GET_IP_MASK_REPLY" },
+ { BSN_SET_MIRRORING, "SET_MIRRORING" },
+ { BSN_GET_MIRRORING_REQUEST, "GET_MIRRORING_REQUEST" },
+ { BSN_GET_MIRRORING_REPLY, "GET_MIRRORING_REPLY" },
+ { BSN_SHELL_COMMAND, "SHELL_COMMAND" },
+ { BSN_SHELL_OUTPUT, "SHELL_OUTPUT" },
+ { BSN_SHELL_STATUS, "SHELL_STATUS" },
+ { BSN_GET_INTERFACES_REQUEST, "GET_INTERFACES_REQUEST" },
+ { BSN_GET_INTERFACES_REPLY, "GET_INTERFACES_REPLY" },
+ { BSN_SET_PKTIN_SUPPRESSION_REQUEST, "SET_PKTIN_SUPPRESSION_REQUEST" },
+ { BSN_SET_L2_TABLE_REQUEST, "SET_L2_TABLE_REQUEST" },
+ { BSN_GET_L2_TABLE_REQUEST, "GET_L2_TABLE_REQUEST" },
+ { BSN_GET_L2_TABLE_REPLY, "GET_L2_TABLE_REPLY" },
+ { BSN_VIRTUAL_PORT_CREATE_REQUEST, "VIRTUAL_PORT_CREATE_REQUEST" },
+ { BSN_VIRTUAL_PORT_CREATE_REPLY, "VIRTUAL_PORT_CREATE_REPLY" },
+ { BSN_VIRTUAL_PORT_REMOVE_REQUEST, "VIRTUAL_PORT_REMOVE_REQUEST" },
+ { BSN_BW_ENABLE_SET_REQUEST, "BW_ENABLE_SET_REQUEST" },
+ { BSN_BW_ENABLE_GET_REQUEST, "BW_ENABLE_GET_REQUEST" },
+ { BSN_BW_ENABLE_GET_REPLY, "BW_ENABLE_GET_REPLY" },
+ { BSN_BW_CLEAR_DATA_REQUEST, "BW_CLEAR_DATA_REQUEST" },
+ { BSN_BW_CLEAR_DATA_REPLY, "BW_CLEAR_DATA_REPLY" },
+ { BSN_BW_ENABLE_SET_REPLY, "BW_ENABLE_SET_REPLY" },
+ { BSN_SET_L2_TABLE_REPLY, "SET_L2_TABLE_REPLY" },
+ { BSN_SET_PKTIN_SUPPRESSION_REPLY, "SET_PKTIN_SUPPRESSION_REPLY" },
+ { BSN_VIRTUAL_PORT_REMOVE_REPLY, "VIRTUAL_PORT_REMOVE_REPLY" },
+ { BSN_HYBRID_GET_REQUEST, "HYBRID_GET_REQUEST" },
+ { BSN_HYBRID_GET_REPLY, "HYBRID_GET_REPLY" },
+ { BSN_PDU_TX_REQUEST, "PDU_TX_REQUEST" },
+ { BSN_PDU_TX_REPLY, "PDU_TX_REPLY" },
+ { BSN_PDU_RX_REQUEST, "PDU_RX_REQUEST" },
+ { BSN_PDU_RX_REPLY, "PDU_RX_REPLY" },
+ { BSN_PDU_RX_TIMEOUT, "PDU_RX_TIMEOUT" },
+ { 0, NULL }
+};
+
+#define BSN_ACTION_MIRROR 1
+#define BSN_ACTION_SET_TUNNEL_DST 2
+ /* 3 */
+#define BSN_ACTION_CHECKSUM 4
+
+static const struct tok bsn_action_subtype_str[] = {
+ { BSN_ACTION_MIRROR, "MIRROR" },
+ { BSN_ACTION_SET_TUNNEL_DST, "SET_TUNNEL_DST" },
+ { BSN_ACTION_CHECKSUM, "CHECKSUM" },
+ { 0, NULL }
+};
+
+static const struct tok bsn_mirror_copy_stage_str[] = {
+ { 0, "INGRESS" },
+ { 1, "EGRESS" },
+ { 0, NULL },
+};
+
+static const struct tok bsn_onoff_str[] = {
+ { 0, "OFF" },
+ { 1, "ON" },
+ { 0, NULL },
+};