aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2017-10-29 12:38:41 -0400
committerAnders Broman <a.broman58@gmail.com>2017-10-29 19:55:24 +0000
commit765a67b68af28a6dbbb5c79d350896efbaa7adf4 (patch)
tree27bd048e6c8b7ae15f1105d4c57b1e1a44f6d140 /epan/dissectors
parent1e8e9a807fd18c070489988c03e4ae5b4701667a (diff)
"Hardcode" the port types used by Export PDU functionality
The "internal" port type has been serialized by export PDU functionality and nettrace_3gpp_32_423 wiretap. To better support "endpoint" functionality the port types will be removed/updated and that changes the implicit values from the port_type enum. Take a snapshot of the current port_type values and use those specific values when reading/writing export PDU data and provide conversion functions that can be modified when port_types are removed. Do the same for nettrace_3gpp_32_423 wiretap. Change-Id: I770bd0cab22e84f3cf49032fc86c5927bf85263f Reviewed-on: https://code.wireshark.org/review/24169 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan/dissectors')
-rw-r--r--epan/dissectors/packet-exported_pdu.c73
1 files changed, 69 insertions, 4 deletions
diff --git a/epan/dissectors/packet-exported_pdu.c b/epan/dissectors/packet-exported_pdu.c
index 319cfdd967..47fcd8ee21 100644
--- a/epan/dissectors/packet-exported_pdu.c
+++ b/epan/dissectors/packet-exported_pdu.c
@@ -110,6 +110,72 @@ static const value_string exported_pdu_tag_vals[] = {
{ 0, NULL }
};
+static const value_string exported_pdu_port_type_vals[] = {
+ { OLD_PT_NONE, "NONE" },
+ { OLD_PT_SCTP, "SCTP" },
+ { OLD_PT_TCP, "TCP" },
+ { OLD_PT_UDP, "UDP" },
+ { OLD_PT_DCCP, "DCCP" },
+ { OLD_PT_IPX, "IPX" },
+ { OLD_PT_NCP, "NCP" },
+ { OLD_PT_EXCHG, "FC EXCHG" },
+ { OLD_PT_DDP, "DDP" },
+ { OLD_PT_SBCCS, "FICON SBCCS" },
+ { OLD_PT_IDP, "IDP" },
+ { OLD_PT_TIPC, "TIPC" },
+ { OLD_PT_USB, "USB" },
+ { OLD_PT_I2C, "I2C" },
+ { OLD_PT_IBQP, "IBQP" },
+ { OLD_PT_BLUETOOTH,"BLUETOOTH" },
+ { OLD_PT_TDMOP, "TDMOP" },
+
+ { 0, NULL }
+};
+
+static port_type exp_pdu_old_to_new_port_type(guint type)
+{
+ switch (type)
+ {
+ case OLD_PT_NONE:
+ return PT_NONE;
+ case OLD_PT_SCTP:
+ return PT_SCTP;
+ case OLD_PT_TCP:
+ return PT_TCP;
+ case OLD_PT_UDP:
+ return PT_UDP;
+ case OLD_PT_DCCP:
+ return PT_DCCP;
+ case OLD_PT_IPX:
+ return PT_IPX;
+ case OLD_PT_NCP:
+ return PT_NCP;
+ case OLD_PT_EXCHG:
+ return PT_EXCHG;
+ case OLD_PT_DDP:
+ return PT_DDP;
+ case OLD_PT_SBCCS:
+ return PT_SBCCS;
+ case OLD_PT_IDP:
+ return PT_IDP;
+ case OLD_PT_TIPC:
+ return PT_TIPC;
+ case OLD_PT_USB:
+ return PT_USB;
+ case OLD_PT_I2C:
+ return PT_I2C;
+ case OLD_PT_IBQP:
+ return PT_IBQP;
+ case OLD_PT_BLUETOOTH:
+ return PT_BLUETOOTH;
+ case OLD_PT_TDMOP:
+ return PT_TDMOP;
+ }
+
+ DISSECTOR_ASSERT(FALSE);
+ return PT_NONE;
+}
+
/* Code to actually dissect the packets */
static int
dissect_exported_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
@@ -201,9 +267,8 @@ dissect_exported_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void*
copy_address_shallow(&pinfo->dst, &pinfo->net_dst);
break;
case EXP_PDU_TAG_PORT_TYPE:
- pinfo->ptype = (port_type)tvb_get_ntohl(tvb, offset);
- proto_tree_add_uint_format_value(tag_tree, hf_exported_pdu_port_type, tvb, offset, 4, pinfo->ptype,
- "%s (%u)", port_type_to_str(pinfo->ptype), pinfo->ptype);
+ pinfo->ptype = exp_pdu_old_to_new_port_type(tvb_get_ntohl(tvb, offset));
+ proto_tree_add_item(tag_tree, hf_exported_pdu_port_type, tvb, offset, 4, ENC_BIG_ENDIAN);
break;
case EXP_PDU_TAG_SRC_PORT:
proto_tree_add_item(tag_tree, hf_exported_pdu_src_port, tvb, offset, 4, ENC_BIG_ENDIAN);
@@ -380,7 +445,7 @@ proto_register_exported_pdu(void)
},
{ &hf_exported_pdu_port_type,
{ "Port Type", "exported_pdu.port_type",
- FT_UINT32, BASE_DEC, NULL, 0,
+ FT_UINT32, BASE_DEC, VALS(exported_pdu_port_type_vals), 0,
NULL, HFILL }
},
{ &hf_exported_pdu_src_port,