From 73fee653de767e0f8ae9637b54ac8d56c7fbb720 Mon Sep 17 00:00:00 2001 From: Anders Broman Date: Fri, 4 Jan 2008 13:39:24 +0000 Subject: Get rid of ber_last_created_item(). (Final?) svn path=/trunk/; revision=24010 --- epan/dissectors/packet-ber.c | 39 ++++++++++++++++----------------------- epan/dissectors/packet-ber.h | 4 ---- epan/dissectors/packet-h248.c | 4 ++-- epan/libwireshark.def | 1 - 4 files changed, 18 insertions(+), 30 deletions(-) (limited to 'epan') diff --git a/epan/dissectors/packet-ber.c b/epan/dissectors/packet-ber.c index b3c1fc9fa7..a76ab49397 100644 --- a/epan/dissectors/packet-ber.c +++ b/epan/dissectors/packet-ber.c @@ -132,8 +132,6 @@ static gboolean decode_unexpected = FALSE; static gchar *decode_as_syntax = NULL; static gchar *ber_filename = NULL; -proto_item *ber_last_created_item=NULL; - static dissector_table_t ber_oid_dissector_table=NULL; static dissector_table_t ber_syntax_dissector_table=NULL; static GHashTable *syntax_table=NULL; @@ -210,11 +208,6 @@ typedef struct _da_data { } da_data; -proto_item *get_ber_last_created_item(void) { - return ber_last_created_item; -} - - void dissect_ber_oid_NULL_callback(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_) { @@ -1008,7 +1001,7 @@ printf("OCTET STRING dissect_ber_octet_string(%s) entered\n",name); end_offset=offset+len; } - actx->created_item=ber_last_created_item = NULL; + actx->created_item = NULL; if (pc) { /* constructed */ @@ -1031,7 +1024,7 @@ printf("OCTET STRING dissect_ber_octet_string(%s) entered\n",name); } if(hf_id >= 0) { it = proto_tree_add_item(tree, hf_id, tvb, offset, length_remaining, FALSE); - actx->created_item=ber_last_created_item = it; + actx->created_item = it; } else { proto_item *pi; @@ -1058,7 +1051,7 @@ int dissect_ber_octet_string_wcb(gboolean implicit_tag, asn1_ctx_t *actx, proto_ offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_id, (func)?&out_tvb:NULL); if (func && out_tvb && (tvb_length(out_tvb)>0)) { if (hf_id >= 0) - tree = proto_item_add_subtree(ber_last_created_item, ett_ber_octet_string); + tree = proto_item_add_subtree(actx->created_item, ett_ber_octet_string); /* TODO Should hf_id2 be pased as last parameter???*/ func(FALSE, out_tvb, 0, actx, tree, -1); } @@ -1072,7 +1065,7 @@ int dissect_ber_old_octet_string_wcb(gboolean implicit_tag, asn1_ctx_t *actx, pr offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_id, (func)?&out_tvb:NULL); if (func && out_tvb && (tvb_length(out_tvb)>0)) { if (hf_id >= 0) - tree = proto_item_add_subtree(ber_last_created_item, ett_ber_octet_string); + tree = proto_item_add_subtree(actx->created_item, ett_ber_octet_string); /* TODO Should hf_id2 be pased as last parameter???*/ func(tree, out_tvb, 0, actx); } @@ -1183,7 +1176,7 @@ printf("INTEGERnew dissect_ber_integer(%s) entered implicit_tag:%d \n",name,impl } } - actx->created_item=ber_last_created_item=NULL; + actx->created_item=NULL; if(hf_id >= 0){ /* */ @@ -1217,7 +1210,7 @@ printf("INTEGERnew dissect_ber_integer(%s) entered implicit_tag:%d \n",name,impl } } } - ber_last_created_item = actx->created_item; + if(value){ *value=val; } @@ -1260,14 +1253,14 @@ dissect_ber_boolean_value(gboolean implicit_tag, asn1_ctx_t *actx, proto_tree *t val=tvb_get_guint8(tvb, offset); offset+=1; - actx->created_item=ber_last_created_item=NULL; + actx->created_item=NULL; if(hf_id >= 0){ hfi = proto_registrar_get_nth(hf_id); if(hfi->type == FT_BOOLEAN) - actx->created_item=ber_last_created_item=proto_tree_add_boolean(tree, hf_id, tvb, offset-1, 1, val); + actx->created_item=proto_tree_add_boolean(tree, hf_id, tvb, offset-1, 1, val); else - actx->created_item=ber_last_created_item=proto_tree_add_uint(tree, hf_id, tvb, offset-1, 1, val?1:0); + actx->created_item=proto_tree_add_uint(tree, hf_id, tvb, offset-1, 1, val?1:0); } if(value){ @@ -3174,7 +3167,7 @@ printf("OBJECT IDENTIFIER dissect_ber_object_identifier(%s) entered\n",name); eoffset=offset+len; } - actx->created_item=ber_last_created_item=NULL; + actx->created_item=NULL; hfi = proto_registrar_get_nth(hf_id); if (hfi->type == FT_OID) { actx->created_item = proto_tree_add_item(tree, hf_id, tvb, offset, len, FALSE); @@ -3191,7 +3184,7 @@ printf("OBJECT IDENTIFIER dissect_ber_object_identifier(%s) entered\n",name); } else { DISSECTOR_ASSERT_NOT_REACHED(); } - ber_last_created_item=actx->created_item; + if (value_tvb) *value_tvb = tvb_new_subset(tvb, offset, len, len); @@ -3749,7 +3742,7 @@ int dissect_ber_bitstring(gboolean implicit_tag, asn1_ctx_t *actx, proto_tree *p end_offset=offset+len; } - actx->created_item=ber_last_created_item = NULL; + actx->created_item = NULL; if(pc) { /* constructed */ @@ -3768,7 +3761,7 @@ int dissect_ber_bitstring(gboolean implicit_tag, asn1_ctx_t *actx, proto_tree *p len--; if( hf_id >= 0) { item = proto_tree_add_item(parent_tree, hf_id, tvb, offset, len, FALSE); - actx->created_item=ber_last_created_item = item; + actx->created_item= item; if(ett_id != -1) { tree = proto_item_add_subtree(item, ett_id); } @@ -3834,7 +3827,7 @@ int dissect_ber_bitstring32(gboolean implicit_tag, asn1_ctx_t *actx, proto_tree offset = dissect_ber_bitstring(implicit_tag, actx, parent_tree, tvb, offset, NULL, hf_id, ett_id, &tmp_tvb); - tree = proto_item_get_subtree(ber_last_created_item); + tree = proto_item_get_subtree(actx->created_item); if(bit_fields && tree && tmp_tvb) { /* tmp_tvb points to the actual bitstring (including any pad bits at the end. * note that this bitstring is not neccessarily always encoded as 4 bytes @@ -3856,7 +3849,7 @@ int dissect_ber_bitstring32(gboolean implicit_tag, asn1_ctx_t *actx, proto_tree if (**bf >= 0) { hfi = proto_registrar_get_nth(**bf); if(val & hfi->bitmask) { - proto_item_append_text(ber_last_created_item, "%s%s", sep, hfi->name); + proto_item_append_text(actx->created_item, "%s%s", sep, hfi->name); sep = ", "; term = TRUE; } @@ -3864,7 +3857,7 @@ int dissect_ber_bitstring32(gboolean implicit_tag, asn1_ctx_t *actx, proto_tree bf++; } if(term) - proto_item_append_text(ber_last_created_item, ")"); + proto_item_append_text(actx->created_item, ")"); } if(out_tvb) diff --git a/epan/dissectors/packet-ber.h b/epan/dissectors/packet-ber.h index 2f782c832c..3e78cd387d 100644 --- a/epan/dissectors/packet-ber.h +++ b/epan/dissectors/packet-ber.h @@ -214,10 +214,6 @@ typedef struct _asn_namedbit { extern int dissect_ber_bitstring(gboolean implicit_tag, asn1_ctx_t *actx, proto_tree *parent_tree, tvbuff_t *tvb, int offset, const asn_namedbit *named_bits, gint hf_id, gint ett_id, tvbuff_t **out_tvb); extern int dissect_ber_bitstring32(gboolean implicit_tag, asn1_ctx_t *actx, proto_tree *parent_tree, tvbuff_t *tvb, int offset, int **bit_fields, gint hf_id, gint ett_id, tvbuff_t **out_tvb); - -extern proto_item *ber_last_created_item; -extern proto_item *get_ber_last_created_item(void); - int call_ber_oid_callback(const char *oid, tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree); void register_ber_oid_dissector_handle(const char *oid, dissector_handle_t dissector, int proto, const char *name); void register_ber_oid_dissector(const char *oid, dissector_t dissector, int proto, const char *name); diff --git a/epan/dissectors/packet-h248.c b/epan/dissectors/packet-h248.c index eb97b11998..925c32e536 100644 --- a/epan/dissectors/packet-h248.c +++ b/epan/dissectors/packet-h248.c @@ -1805,7 +1805,7 @@ static int dissect_h248_T_errorCode(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { #line 241 "h248.cnf" offset = dissect_ber_integer(implicit_tag, actx, tree, tvb, offset, hf_h248_error_code, &error_code); - expert_add_info_format(actx->pinfo, get_ber_last_created_item(), PI_RESPONSE_CODE, PI_WARN, "Errored Command"); + expert_add_info_format(actx->pinfo, actx->created_item, PI_RESPONSE_CODE, PI_WARN, "Errored Command"); if (curr_info.cmd) { gcp_cmd_set_error(curr_info.cmd,error_code); @@ -1911,7 +1911,7 @@ dissect_h248_WildcardField(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int off #line 259 "h248.cnf" tvbuff_t* new_tvb; offset = dissect_ber_octet_string(implicit_tag, actx, tree, tvb, offset, hf_index, &new_tvb); - tree = proto_item_add_subtree(get_ber_last_created_item(),ett_wildcard); + tree = proto_item_add_subtree(actx->created_item,ett_wildcard); proto_tree_add_item(tree,hf_h248_term_wild_type,new_tvb,0,1,FALSE); proto_tree_add_item(tree,hf_h248_term_wild_level,new_tvb,0,1,FALSE); proto_tree_add_item(tree,hf_h248_term_wild_position,new_tvb,0,1,FALSE); diff --git a/epan/libwireshark.def b/epan/libwireshark.def index 92cf4c0e97..2b4ee1e9a0 100644 --- a/epan/libwireshark.def +++ b/epan/libwireshark.def @@ -388,7 +388,6 @@ get_addr_name get_asn1_ctx get_basename get_ber_identifier -get_ber_last_created_item get_ber_length get_CDR_any get_CDR_boolean -- cgit v1.2.3