From 2f73ac0c8c10c151ffe7529a63dbe7c82ee1c891 Mon Sep 17 00:00:00 2001 From: Michael Mann Date: Tue, 24 Nov 2015 13:34:11 -0500 Subject: Remove support for "old style" dissectors in PER API. Most of it wasn't used in current Wireshark source anyway. Change-Id: If395e4e940adc76a2701d226ba4f7c9b17cb795d Reviewed-on: https://code.wireshark.org/review/12108 Petri-Dish: Michael Mann Tested-by: Petri Dish Buildbot Reviewed-by: Michael Mann --- asn1/h450-ros/h450-ros.cnf | 6 ++--- asn1/h450-ros/packet-h450-ros-template.c | 15 +++++++----- debian/libwireshark0.symbols | 3 --- epan/asn1.h | 1 - epan/dissectors/packet-h450-ros.c | 27 +++++++++++---------- epan/dissectors/packet-per.c | 41 +------------------------------- epan/dissectors/packet-per.h | 3 --- 7 files changed, 28 insertions(+), 68 deletions(-) diff --git a/asn1/h450-ros/h450-ros.cnf b/asn1/h450-ros/h450-ros.cnf index 9915c20117..a403dea6bc 100644 --- a/asn1/h450-ros/h450-ros.cnf +++ b/asn1/h450-ros/h450-ros.cnf @@ -72,7 +72,7 @@ ReturnErrorProblem VAL_PTR = &problem_val Invoke/argument TYPE = FT_BYTES DISPLAY = BASE_NONE #.FN_PARS Invoke/argument -FN_VARIANT = _pdu +FN_VARIANT = _pdu_new TYPE_REF_FN = argument_cb #.END @@ -84,7 +84,7 @@ TYPE_REF_FN = argument_cb ReturnResult/result/result TYPE = FT_BYTES DISPLAY = BASE_NONE #.FN_PARS ReturnResult/result/result -FN_VARIANT = _pdu +FN_VARIANT = _pdu_new TYPE_REF_FN = result_cb #.END @@ -97,7 +97,7 @@ TYPE_REF_FN = result_cb ReturnError/parameter TYPE = FT_BYTES DISPLAY = BASE_NONE #.FN_PARS ReturnError/parameter -FN_VARIANT = _pdu +FN_VARIANT = _pdu_new TYPE_REF_FN = error_cb #.END diff --git a/asn1/h450-ros/packet-h450-ros-template.c b/asn1/h450-ros/packet-h450-ros-template.c index afa743b7c4..fcc841bc27 100644 --- a/asn1/h450-ros/packet-h450-ros-template.c +++ b/asn1/h450-ros/packet-h450-ros-template.c @@ -57,19 +57,22 @@ static gint32 problem_val; static gchar problem_str[64]; static tvbuff_t *arg_next_tvb, *res_next_tvb, *err_next_tvb; -static void -argument_cb(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree _U_) { +static int +argument_cb(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree _U_, void* data _U_) { arg_next_tvb = tvb; + return tvb_captured_length(tvb); } -static void -result_cb(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree _U_) { +static int +result_cb(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree _U_, void* data _U_) { res_next_tvb = tvb; + return tvb_captured_length(tvb); } -static void -error_cb(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree _U_) { +static int +error_cb(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree _U_, void* data _U_) { err_next_tvb = tvb; + return tvb_captured_length(tvb); } #include "packet-h450-ros-fn.c" diff --git a/debian/libwireshark0.symbols b/debian/libwireshark0.symbols index eadc192cac..a9632270be 100644 --- a/debian/libwireshark0.symbols +++ b/debian/libwireshark0.symbols @@ -354,7 +354,6 @@ libwireshark.so.0 libwireshark0 #MINVER# dissect_per_PrintableString@Base 1.9.1 dissect_per_VisibleString@Base 1.9.1 dissect_per_bit_string@Base 1.9.1 - dissect_per_bit_string_containing_pdu@Base 1.9.1 dissect_per_bit_string_containing_pdu_new@Base 1.9.1 dissect_per_boolean@Base 1.9.1 dissect_per_choice@Base 1.9.1 @@ -370,10 +369,8 @@ libwireshark.so.0 libwireshark0 #MINVER# dissect_per_object_identifier@Base 1.9.1 dissect_per_object_identifier_str@Base 1.9.1 dissect_per_octet_string@Base 1.9.1 - dissect_per_octet_string_containing_pdu@Base 1.9.1 dissect_per_octet_string_containing_pdu_new@Base 1.9.1 dissect_per_open_type@Base 1.9.1 - dissect_per_open_type_pdu@Base 1.9.1 dissect_per_open_type_pdu_new@Base 1.9.1 dissect_per_real@Base 1.9.1 dissect_per_relative_oid@Base 1.12.0~rc1 diff --git a/epan/asn1.h b/epan/asn1.h index 919b3076b1..6a48ba50f1 100644 --- a/epan/asn1.h +++ b/epan/asn1.h @@ -35,7 +35,6 @@ typedef enum { typedef enum { CB_ASN1_ENC, - CB_DISSECTOR, CB_NEW_DISSECTOR, CB_DISSECTOR_HANDLE } asn1_cb_variant; diff --git a/epan/dissectors/packet-h450-ros.c b/epan/dissectors/packet-h450-ros.c index 0c160e8891..6954129c74 100644 --- a/epan/dissectors/packet-h450-ros.c +++ b/epan/dissectors/packet-h450-ros.c @@ -103,19 +103,22 @@ static gint32 problem_val; static gchar problem_str[64]; static tvbuff_t *arg_next_tvb, *res_next_tvb, *err_next_tvb; -static void -argument_cb(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree _U_) { +static int +argument_cb(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree _U_, void* data _U_) { arg_next_tvb = tvb; + return tvb_captured_length(tvb); } -static void -result_cb(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree _U_) { +static int +result_cb(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree _U_, void* data _U_) { res_next_tvb = tvb; + return tvb_captured_length(tvb); } -static void -error_cb(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree _U_) { +static int +error_cb(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree _U_, void* data _U_) { err_next_tvb = tvb; + return tvb_captured_length(tvb); } @@ -189,7 +192,7 @@ dissect_h450_ros_T_invokeIdConstrained(tvbuff_t *tvb _U_, int offset _U_, asn1_c static int dissect_h450_ros_InvokeArgument(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { - offset = dissect_per_open_type_pdu(tvb, offset, actx, tree, hf_index, argument_cb); + offset = dissect_per_open_type_pdu_new(tvb, offset, actx, tree, hf_index, argument_cb); return offset; } @@ -258,7 +261,7 @@ dissect_h450_ros_Invoke(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, static int dissect_h450_ros_ResultArgument(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { - offset = dissect_per_open_type_pdu(tvb, offset, actx, tree, hf_index, result_cb); + offset = dissect_per_open_type_pdu_new(tvb, offset, actx, tree, hf_index, result_cb); return offset; } @@ -343,7 +346,7 @@ dissect_h450_ros_ReturnResult(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *act static int dissect_h450_ros_T_parameter(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { - offset = dissect_per_open_type_pdu(tvb, offset, actx, tree, hf_index, error_cb); + offset = dissect_per_open_type_pdu_new(tvb, offset, actx, tree, hf_index, error_cb); return offset; } @@ -582,7 +585,7 @@ dissect_h450_ros_ROS(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, pr /*--- End of included file: packet-h450-ros-fn.c ---*/ -#line 76 "../../asn1/h450-ros/packet-h450-ros-template.c" +#line 79 "../../asn1/h450-ros/packet-h450-ros-template.c" /*--- proto_register_h450_ros -----------------------------------------------*/ void proto_register_h450_ros(void) { @@ -674,7 +677,7 @@ void proto_register_h450_ros(void) { "ReturnErrorProblem", HFILL }}, /*--- End of included file: packet-h450-ros-hfarr.c ---*/ -#line 83 "../../asn1/h450-ros/packet-h450-ros-template.c" +#line 86 "../../asn1/h450-ros/packet-h450-ros-template.c" }; /* List of subtrees */ @@ -692,7 +695,7 @@ void proto_register_h450_ros(void) { &ett_h450_ros_T_problem, /*--- End of included file: packet-h450-ros-ettarr.c ---*/ -#line 88 "../../asn1/h450-ros/packet-h450-ros-template.c" +#line 91 "../../asn1/h450-ros/packet-h450-ros-template.c" }; static ei_register_info ei[] = { diff --git a/epan/dissectors/packet-per.c b/epan/dissectors/packet-per.c index ffc27b5724..d769c24052 100644 --- a/epan/dissectors/packet-per.c +++ b/epan/dissectors/packet-per.c @@ -217,7 +217,7 @@ dissect_per_open_type_internal(tvbuff_t *tvb, guint32 offset, asn1_ctx_t *actx, if (actx->aligned) BYTE_ALIGN_OFFSET(offset); end_offset = offset + type_length * 8; - if ((variant==CB_DISSECTOR)||(variant==CB_NEW_DISSECTOR)) { + if (variant==CB_NEW_DISSECTOR) { val_tvb = new_octet_aligned_subset(tvb, offset, actx, type_length); if (hfi) { if (IS_FT_UINT(hfi->type)||IS_FT_INT(hfi->type)) { @@ -238,9 +238,6 @@ dissect_per_open_type_internal(tvbuff_t *tvb, guint32 offset, asn1_ctx_t *actx, case CB_ASN1_ENC: ((per_type_fn)type_cb)(tvb, offset, actx, tree, hf_index); break; - case CB_DISSECTOR: - ((dissector_t)type_cb)(val_tvb, actx->pinfo, subtree); - break; case CB_NEW_DISSECTOR: ((new_dissector_t)type_cb)(val_tvb, actx->pinfo, subtree, NULL); break; @@ -260,12 +257,6 @@ dissect_per_open_type(tvbuff_t *tvb, guint32 offset, asn1_ctx_t *actx, proto_tre return dissect_per_open_type_internal(tvb, offset, actx, tree, hf_index, (void*)type_cb, CB_ASN1_ENC); } -guint32 -dissect_per_open_type_pdu(tvbuff_t *tvb, guint32 offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index, dissector_t type_cb) -{ - return dissect_per_open_type_internal(tvb, offset, actx, tree, hf_index, (void*)type_cb, CB_DISSECTOR); -} - guint32 dissect_per_open_type_pdu_new(tvbuff_t *tvb, guint32 offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index, new_dissector_t type_cb) { @@ -2210,21 +2201,6 @@ DEBUG_ENTRY("dissect_per_bit_string"); return offset; } -guint32 dissect_per_bit_string_containing_pdu(tvbuff_t *tvb, guint32 offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index, int min_len, int max_len, gboolean has_extension, dissector_t type_cb) -{ - tvbuff_t *val_tvb = NULL; - proto_tree *subtree = tree; - - offset = dissect_per_bit_string(tvb, offset, actx, tree, hf_index, min_len, max_len, has_extension, &val_tvb, NULL); - - if (type_cb && val_tvb) { - subtree = proto_item_add_subtree(actx->created_item, ett_per_containing); - type_cb(val_tvb, actx->pinfo, subtree); - } - - return offset; -} - guint32 dissect_per_bit_string_containing_pdu_new(tvbuff_t *tvb, guint32 offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index, int min_len, int max_len, gboolean has_extension, new_dissector_t type_cb) { tvbuff_t *val_tvb = NULL; @@ -2350,21 +2326,6 @@ DEBUG_ENTRY("dissect_per_octet_string"); return offset; } -guint32 dissect_per_octet_string_containing_pdu(tvbuff_t *tvb, guint32 offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index, int min_len, int max_len, gboolean has_extension, dissector_t type_cb) -{ - tvbuff_t *val_tvb = NULL; - proto_tree *subtree = tree; - - offset = dissect_per_octet_string(tvb, offset, actx, tree, hf_index, min_len, max_len, has_extension, &val_tvb); - - if (type_cb && val_tvb) { - subtree = proto_item_add_subtree(actx->created_item, ett_per_containing); - type_cb(val_tvb, actx->pinfo, subtree); - } - - return offset; -} - guint32 dissect_per_octet_string_containing_pdu_new(tvbuff_t *tvb, guint32 offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index, int min_len, int max_len, gboolean has_extension, new_dissector_t type_cb) { tvbuff_t *val_tvb = NULL; diff --git a/epan/dissectors/packet-per.h b/epan/dissectors/packet-per.h index 806ec1207f..a55c331008 100644 --- a/epan/dissectors/packet-per.h +++ b/epan/dissectors/packet-per.h @@ -109,11 +109,9 @@ WS_DLL_PUBLIC guint32 dissect_per_sequence(tvbuff_t *tvb, guint32 offset, asn1_c WS_DLL_PUBLIC guint32 dissect_per_sequence_eag(tvbuff_t *tvb, guint32 offset, asn1_ctx_t *actx, proto_tree *tree, const per_sequence_t *sequence); WS_DLL_PUBLIC guint32 dissect_per_octet_string(tvbuff_t *tvb, guint32 offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index, int min_len, int max_len, gboolean has_extension, tvbuff_t **value_tvb); -WS_DLL_PUBLIC guint32 dissect_per_octet_string_containing_pdu(tvbuff_t *tvb, guint32 offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index, int min_len, int max_len, gboolean has_extension, dissector_t type_cb); WS_DLL_PUBLIC guint32 dissect_per_octet_string_containing_pdu_new(tvbuff_t *tvb, guint32 offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index, int min_len, int max_len, gboolean has_extension, new_dissector_t type_cb); WS_DLL_PUBLIC guint32 dissect_per_bit_string(tvbuff_t *tvb, guint32 offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index, int min_len, int max_len, gboolean has_extension, tvbuff_t **value_tvb, int *len); -WS_DLL_PUBLIC guint32 dissect_per_bit_string_containing_pdu(tvbuff_t *tvb, guint32 offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index, int min_len, int max_len, gboolean has_extension, dissector_t type_cb); WS_DLL_PUBLIC guint32 dissect_per_bit_string_containing_pdu_new(tvbuff_t *tvb, guint32 offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index, int min_len, int max_len, gboolean has_extension, new_dissector_t type_cb); WS_DLL_PUBLIC guint32 dissect_per_restricted_character_string(tvbuff_t *tvb, guint32 offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index, int min_len, int max_len, gboolean has_extension, const char *alphabet, int alphabet_length, tvbuff_t **value_tvb); @@ -121,7 +119,6 @@ WS_DLL_PUBLIC guint32 dissect_per_restricted_character_string(tvbuff_t *tvb, gui WS_DLL_PUBLIC guint32 dissect_per_enumerated(tvbuff_t *tvb, guint32 offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index, guint32 root_num, guint32 *value, gboolean has_extension, guint32 ext_num, guint32 *value_map); WS_DLL_PUBLIC guint32 dissect_per_open_type(tvbuff_t *tvb, guint32 offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index, per_type_fn type_cb); -WS_DLL_PUBLIC guint32 dissect_per_open_type_pdu(tvbuff_t *tvb, guint32 offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index, dissector_t type_cb); WS_DLL_PUBLIC guint32 dissect_per_open_type_pdu_new(tvbuff_t *tvb, guint32 offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index, new_dissector_t type_cb); WS_DLL_PUBLIC guint32 dissect_per_external_type(tvbuff_t *tvb, guint32 offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index, per_type_fn type_cb); -- cgit v1.2.1