Hi Anders, you can try to use:
#.FN_BODY OrigTransactionID/_untag VAL_PTR = parameter_tvb ... which should modify type inside tag. BTW When you would like to introduce ASN.1 context for BER too, please do not create new one bur use common one for all ASN.1 encodings. Regards, Tomas -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Anders Broman Sent: Monday, April 30, 2007 12:36 PM To: [email protected] Subject: [Wireshark-dev] asn2wrs problem when value needed from tagged type Hi, There is a problem with the tagged type if a value needs to be returned from it. As the following example from TCAP: #.FN_BODY OrigTransactionID VAL_PTR = parameter_tvb tvbuff_t *parameter_tvb; guint8 len, i; proto_item *tid_item; proto_tree *subtree; tid_item = proto_tree_add_text(tree, tvb, offset, -1, "Source Transaction ID"); subtree = proto_item_add_subtree(tid_item, ett_otid); %(DEFAULT_BODY)s The generated code will be: static int dissect_tcap_OCTET_STRING_SIZE_1_4(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_octet_string(implicit_tag, pinfo, tree, tvb, offset, hf_index, NULL); return offset; } static int dissect_tcap_OrigTransactionID(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, int hf_index _U_) { #line 159 "tcap.cnf" tvbuff_t *parameter_tvb; guint8 len, i; proto_item *tid_item; proto_tree *subtree; tid_item = proto_tree_add_text(tree, tvb, offset, -1, "Source Transaction ID"); subtree = proto_item_add_subtree(tid_item, ett_otid); offset = dissect_ber_tagged_type(implicit_tag, pinfo, tree, tvb, offset, hf_index, BER_CLASS_APP, 8, TRUE, dissect_tcap_OCTET_STRING_SIZE_1_4); I think this can be solved by using typedef struct _asn1_ber_ctx_t { proto_item *created_item; void *value_ptr; void *private_data; } asn1_ber_ctx_t; In packet-ber.c similar to packet-per.c if the code above could be changed to something like the code Below only for the tagged type as a start as there is a lot of changes needed otherwise. Regards Anders static int dissect_tcap_OCTET_STRING_SIZE_1_4(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ber_ctx_t *actx, packet_info *pinfo _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_ber_octet_string(implicit_tag, pinfo, tree, tvb, offset, hf_index, actx->value_ptr); return offset; } static int dissect_tcap_OrigTransactionID(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, int hf_index _U_) { #line 159 "tcap.cnf" tvbuff_t *parameter_tvb; guint8 len, i; proto_item *tid_item; proto_tree *subtree; tid_item = proto_tree_add_text(tree, tvb, offset, -1, "Source Transaction ID"); subtree = proto_item_add_subtree(tid_item, ett_otid); offset = dissect_ber_tagged_type(implicit_tag, pinfo, tree, tvb, offset, actx hf_index, BER_CLASS_APP, 8, TRUE, dissect_tcap_OCTET_STRING_SIZE_1_4); _______________________________________________ Wireshark-dev mailing list [email protected] http://www.wireshark.org/mailman/listinfo/wireshark-dev _______________________________________________ Wireshark-dev mailing list [email protected] http://www.wireshark.org/mailman/listinfo/wireshark-dev
