From 1e60d63c8c6882c8c0bdb00cf6df594e1bb6fccf Mon Sep 17 00:00:00 2001 From: Michael Mann Date: Sat, 19 Mar 2016 20:33:14 -0400 Subject: Create call_data_dissector() to call data dissector. This saves many dissectors the need to find the data dissector and store a handle to it. There were also some that were finding it, but not using it. For others this was the only reason for their handoff function, so it could be eliminated. Change-Id: I5d3f951ee1daa3d30c060d21bd12bbc881a8027b Reviewed-on: https://code.wireshark.org/review/14530 Petri-Dish: Michael Mann Reviewed-by: Michael Mann --- epan/dissectors/packet-gmrp.c | 32 ++++++++------------------------ 1 file changed, 8 insertions(+), 24 deletions(-) (limited to 'epan/dissectors/packet-gmrp.c') diff --git a/epan/dissectors/packet-gmrp.c b/epan/dissectors/packet-gmrp.c index 60f20f30c0..092908e1b4 100644 --- a/epan/dissectors/packet-gmrp.c +++ b/epan/dissectors/packet-gmrp.c @@ -31,7 +31,6 @@ #include void proto_register_gmrp(void); -void proto_reg_handoff_gmrp(void); /* Initialize the protocol and registered fields */ static int proto_gmrp = -1; @@ -52,8 +51,6 @@ static gint ett_gmrp_attribute_list = -1; static expert_field ei_gmrp_proto_id = EI_INIT; -static dissector_handle_t data_handle; - /* Constant definitions */ #define GARP_DEFAULT_PROTOCOL_ID 0x0001 #define GARP_END_OF_MARK 0x00 @@ -139,8 +136,7 @@ dissect_gmrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_ if (protocol_id != GARP_DEFAULT_PROTOCOL_ID) { expert_add_info(pinfo, ti, &ei_gmrp_proto_id); - call_dissector(data_handle, - tvb_new_subset_remaining(tvb, GARP_PROTOCOL_ID + 2), + call_data_dissector(tvb_new_subset_remaining(tvb, GARP_PROTOCOL_ID + 2), pinfo, tree); return tvb_captured_length(tvb); } @@ -170,8 +166,7 @@ dissect_gmrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_ } else { - call_dissector(data_handle, - tvb_new_subset_remaining(tvb, offset), + call_data_dissector(tvb_new_subset_remaining(tvb, offset), pinfo, tree); return tvb_captured_length(tvb); } @@ -189,8 +184,7 @@ dissect_gmrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_ /* GMRP supports Group Membership and Service Requirement as attribute types */ if ( (octet != GMRP_ATTRIBUTE_TYPE_GROUP_MEMBERSHIP) && (octet != GMRP_ATTRIBUTE_TYPE_SERVICE_REQUIREMENT) ) { - call_dissector(data_handle, - tvb_new_subset_remaining(tvb, offset), pinfo, + call_data_dissector(tvb_new_subset_remaining(tvb, offset), pinfo, tree); return tvb_captured_length(tvb); } @@ -224,8 +218,7 @@ dissect_gmrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_ } else { - call_dissector(data_handle, - tvb_new_subset_remaining(tvb, offset), + call_data_dissector(tvb_new_subset_remaining(tvb, offset), pinfo, tree); return tvb_captured_length(tvb); } @@ -257,8 +250,7 @@ dissect_gmrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_ case GMRP_EVENT_LEAVEALL: if (octet != GMRP_LENGTH_LEAVEALL) { - call_dissector(data_handle, - tvb_new_subset_remaining(tvb, offset), + call_data_dissector(tvb_new_subset_remaining(tvb, offset), pinfo, tree); return tvb_captured_length(tvb); } @@ -272,8 +264,7 @@ dissect_gmrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_ if ( (octet != GMRP_GROUP_MEMBERSHIP_NON_LEAVEALL) && (octet != GMRP_SERVICE_REQUIREMENT_NON_LEAVEALL) ) { - call_dissector(data_handle, - tvb_new_subset_remaining(tvb, offset), + call_data_dissector(tvb_new_subset_remaining(tvb, offset), pinfo, tree); return tvb_captured_length(tvb); } @@ -301,8 +292,7 @@ dissect_gmrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_ } else { - call_dissector(data_handle, - tvb_new_subset_remaining(tvb, offset), + call_data_dissector(tvb_new_subset_remaining(tvb, offset), pinfo, tree); return tvb_captured_length(tvb); } @@ -310,8 +300,7 @@ dissect_gmrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_ break; default: - call_dissector(data_handle, - tvb_new_subset_remaining(tvb, offset), + call_data_dissector(tvb_new_subset_remaining(tvb, offset), pinfo, tree); return tvb_captured_length(tvb); } @@ -398,11 +387,6 @@ proto_register_gmrp(void) } -void -proto_reg_handoff_gmrp(void){ - data_handle = find_dissector("data"); -} - /* * Editor modelines - http://www.wireshark.org/tools/modelines.html * -- cgit v1.2.3