openflow: Minor changes
- Remove unneeded/undefined forward declarations; - Create/use some extended value-strings; - Do some whitespace changes. Change-Id: I7961864f0e404e141d2887584751116011f8d941 Reviewed-on: https://code.wireshark.org/review/5490 Reviewed-by: Bill Meier <wmeier@newsguy.com>
This commit is contained in:
parent
20153980eb
commit
e2132f9b15
|
@ -32,7 +32,6 @@
|
|||
#include <epan/expert.h>
|
||||
|
||||
void proto_register_openflow_v1(void);
|
||||
void proto_reg_handoff_openflow_v1(void);
|
||||
|
||||
static dissector_handle_t eth_withoutfcs_handle;
|
||||
|
||||
|
@ -191,8 +190,6 @@ static const value_string openflow_version_values[] = {
|
|||
|
||||
|
||||
static const value_string openflow_1_0_type_values[] = {
|
||||
/* Immutable messages. */
|
||||
|
||||
/* Immutable messages. */
|
||||
{ 0, "OFPT_HELLO" }, /* Symmetric message */
|
||||
{ 1, "OFPT_ERROR" }, /* Symmetric message */
|
||||
|
@ -224,7 +221,7 @@ static const value_string openflow_1_0_type_values[] = {
|
|||
{ 21, "OFPT_QUEUE_GET_CONFIG_REPLY" }, /* Controller/switch message */
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
static value_string_ext openflow_1_0_type_values_ext = VALUE_STRING_EXT_INIT(openflow_1_0_type_values);
|
||||
|
||||
#define OFPC_FLOW_STATS 1<<0 /* Flow statistics. */
|
||||
#define OFPC_TABLE_STATS 1<<1 /* Table statistics. */
|
||||
|
@ -715,7 +712,7 @@ dissect_openflow_v1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *d
|
|||
type = tvb_get_guint8(tvb, 1);
|
||||
|
||||
col_append_fstr(pinfo->cinfo, COL_INFO, "Type: %s",
|
||||
val_to_str_const(type, openflow_1_0_type_values, "Unknown message type"));
|
||||
val_to_str_ext_const(type, &openflow_1_0_type_values_ext, "Unknown message type"));
|
||||
|
||||
/* Stop the Ethernet frame from overwriting the columns */
|
||||
if((type == OFPT_1_0_PACKET_IN) || (type == OFPT_1_0_PACKET_OUT)){
|
||||
|
@ -804,7 +801,7 @@ proto_register_openflow_v1(void)
|
|||
},
|
||||
{ &hf_openflow_1_0_type,
|
||||
{ "Type", "openflow_1_0.type",
|
||||
FT_UINT8, BASE_DEC, VALS(openflow_1_0_type_values), 0x0,
|
||||
FT_UINT8, BASE_DEC | BASE_EXT_STRING, &openflow_1_0_type_values_ext, 0x0,
|
||||
NULL, HFILL }
|
||||
},
|
||||
{ &hf_openflow_xid,
|
||||
|
|
|
@ -27,13 +27,12 @@
|
|||
#include "config.h"
|
||||
|
||||
#include <glib.h>
|
||||
#include <epan/packet.h>
|
||||
#include <epan/etypes.h>
|
||||
#include <epan/expert.h>
|
||||
#include <epan/ipproto.h>
|
||||
#include <epan/packet.h>
|
||||
|
||||
void proto_register_openflow_v4(void);
|
||||
void proto_reg_handoff_openflow_v4(void);
|
||||
|
||||
static dissector_handle_t eth_withoutfcs_handle;
|
||||
|
||||
|
@ -795,6 +794,7 @@ static const value_string openflow_v4_type_values[] = {
|
|||
{ OFPT_METER_MOD, "OFPT_METER_MOD" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
static value_string_ext openflow_v4_type_values_ext = VALUE_STRING_EXT_INIT(openflow_v4_type_values);
|
||||
|
||||
static int
|
||||
dissect_openflow_header_v4(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, guint16 length _U_)
|
||||
|
@ -946,6 +946,7 @@ static const value_string openflow_v4_oxm_basic_field_values[] = {
|
|||
{ 39, "OFPXMT_OFB_IPV6_EXTHDR" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
static value_string_ext openflow_v4_oxm_basic_field_values_ext = VALUE_STRING_EXT_INIT(openflow_v4_oxm_basic_field_values);
|
||||
|
||||
#define OXM_FIELD_MASK 0xfe
|
||||
#define OXM_FIELD_OFFSET 1
|
||||
|
@ -4557,7 +4558,7 @@ dissect_openflow_v4(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *d
|
|||
length = tvb_get_ntohs(tvb, 2);
|
||||
|
||||
col_append_fstr(pinfo->cinfo, COL_INFO, "Type: %s",
|
||||
val_to_str_const(type, openflow_v4_type_values, "Unknown message type"));
|
||||
val_to_str_ext_const(type, &openflow_v4_type_values_ext, "Unknown message type"));
|
||||
|
||||
/* Create display subtree for the protocol */
|
||||
ti = proto_tree_add_item(tree, proto_openflow_v4, tvb, 0, -1, ENC_NA);
|
||||
|
@ -4676,7 +4677,7 @@ proto_register_openflow_v4(void)
|
|||
},
|
||||
{ &hf_openflow_v4_type,
|
||||
{ "Type", "openflow_v4.type",
|
||||
FT_UINT8, BASE_DEC, VALS(openflow_v4_type_values), 0x0,
|
||||
FT_UINT8, BASE_DEC | BASE_EXT_STRING, &openflow_v4_type_values_ext, 0x0,
|
||||
NULL, HFILL }
|
||||
},
|
||||
{ &hf_openflow_v4_xid,
|
||||
|
@ -4701,7 +4702,7 @@ proto_register_openflow_v4(void)
|
|||
},
|
||||
{ &hf_openflow_v4_oxm_field_basic,
|
||||
{ "Field", "openflow_v4.oxm.field",
|
||||
FT_UINT8, BASE_DEC, VALS(openflow_v4_oxm_basic_field_values), 0x0,
|
||||
FT_UINT8, BASE_DEC | BASE_EXT_STRING, &openflow_v4_oxm_basic_field_values_ext, 0x0,
|
||||
NULL, HFILL }
|
||||
},
|
||||
{ &hf_openflow_v4_oxm_hm,
|
||||
|
|
|
@ -27,13 +27,12 @@
|
|||
#include "config.h"
|
||||
|
||||
#include <glib.h>
|
||||
#include <epan/packet.h>
|
||||
#include <epan/etypes.h>
|
||||
#include <epan/expert.h>
|
||||
#include <epan/ipproto.h>
|
||||
#include <epan/packet.h>
|
||||
|
||||
void proto_register_openflow_v5(void);
|
||||
void proto_reg_handoff_openflow_v5(void);
|
||||
|
||||
static dissector_handle_t eth_withoutfcs_handle;
|
||||
|
||||
|
@ -947,6 +946,7 @@ static const value_string openflow_v5_type_values[] = {
|
|||
{ OFPT_BUNDLE_ADD_MESSAGE, "OFPT_BUNDLE_ADD_MESSAGE" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
static value_string_ext openflow_v5_type_values_ext = VALUE_STRING_EXT_INIT(openflow_v5_type_values);
|
||||
|
||||
static int
|
||||
dissect_openflow_header_v5(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, guint16 length _U_)
|
||||
|
@ -1100,6 +1100,7 @@ static const value_string openflow_v5_oxm_basic_field_values[] = {
|
|||
{ 41, "OFPXMT_OFB_PBB_UCA" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
static value_string_ext openflow_v5_oxm_basic_field_values_ext = VALUE_STRING_EXT_INIT(openflow_v5_oxm_basic_field_values);
|
||||
|
||||
#define OXM_FIELD_MASK 0xfe
|
||||
#define OXM_FIELD_OFFSET 1
|
||||
|
@ -5948,7 +5949,7 @@ dissect_openflow_v5(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *d
|
|||
type = tvb_get_guint8(tvb, 1);
|
||||
|
||||
col_append_fstr(pinfo->cinfo, COL_INFO, "Type: %s",
|
||||
val_to_str_const(type, openflow_v5_type_values, "Unknown message type"));
|
||||
val_to_str_ext_const(type, &openflow_v5_type_values_ext, "Unknown message type"));
|
||||
|
||||
ti = proto_tree_add_item(tree, proto_openflow_v5, tvb, 0, -1, ENC_NA);
|
||||
openflow_tree = proto_item_add_subtree(ti, ett_openflow_v5);
|
||||
|
@ -5974,7 +5975,7 @@ proto_register_openflow_v5(void)
|
|||
},
|
||||
{ &hf_openflow_v5_type,
|
||||
{ "Type", "openflow_v5.type",
|
||||
FT_UINT8, BASE_DEC, VALS(openflow_v5_type_values), 0x0,
|
||||
FT_UINT8, BASE_DEC | BASE_EXT_STRING, &openflow_v5_type_values_ext, 0x0,
|
||||
NULL, HFILL }
|
||||
},
|
||||
{ &hf_openflow_v5_xid,
|
||||
|
@ -5999,7 +6000,7 @@ proto_register_openflow_v5(void)
|
|||
},
|
||||
{ &hf_openflow_v5_oxm_field_basic,
|
||||
{ "Field", "openflow_v5.oxm.field",
|
||||
FT_UINT8, BASE_DEC, VALS(openflow_v5_oxm_basic_field_values), 0x0,
|
||||
FT_UINT8, BASE_DEC | BASE_EXT_STRING, &openflow_v5_oxm_basic_field_values_ext, 0x0,
|
||||
NULL, HFILL }
|
||||
},
|
||||
{ &hf_openflow_v5_oxm_hm,
|
||||
|
|
Loading…
Reference in New Issue