Remove all global variables in P1 dissector. Bug 8515 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8515)

Added a "subtree context" structure to asn1_ctx_t. This should allow other ASN.1 dissector global variables to be replaced when only used for transferring data between fields in a subtree.

svn path=/trunk/; revision=50208
This commit is contained in:
Michael Mann 2013-06-28 12:43:29 +00:00
parent c29fb44886
commit 9009944d51
9 changed files with 773 additions and 771 deletions

View File

@ -534,55 +534,55 @@ MessageToken B "2.6.1.7.36" "id-hat-forwarded-token"
#.FN_BODY ExtensionField/value
const char *name;
if(extension_id != -1) {
proto_item_append_text(tree, " (%%s)", val_to_str(extension_id, p1_StandardExtension_vals, "standard-extension %%d"));
if (dissector_try_uint(p1_extension_dissector_table, extension_id, tvb, actx->pinfo, tree)) {
if(actx->external.indirect_ref_present) {
proto_item_append_text(tree, " (%%s)", val_to_str(actx->external.indirect_reference, p1_StandardExtension_vals, "standard-extension %%d"));
if (dissector_try_uint(p1_extension_dissector_table, actx->external.indirect_reference, tvb, actx->pinfo, tree)) {
offset = tvb_length(tvb);
} else {
proto_item *item = NULL;
proto_tree *next_tree = NULL;
item = proto_tree_add_text(tree, tvb, 0, tvb_length_remaining(tvb, offset),
"Dissector for standard-extension %%d not implemented. Contact Wireshark developers if you want this supported", extension_id);
"Dissector for standard-extension %%d not implemented. Contact Wireshark developers if you want this supported", actx->external.indirect_reference);
next_tree = proto_item_add_subtree(item, ett_p1_unknown_standard_extension);
offset = dissect_unknown_ber(actx->pinfo, tvb, offset, next_tree);
expert_add_info(actx->pinfo, item, &ei_p1_unknown_standard_extension);
}
} else if (object_identifier_id) {
offset = call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree);
name = oid_resolved_from_string(object_identifier_id);
proto_item_append_text(tree, " (%%s)", name ? name : object_identifier_id);
} else if (actx->external.direct_ref_present) {
offset = call_ber_oid_callback(actx->external.direct_reference, tvb, offset, actx->pinfo, tree);
name = oid_resolved_from_string(actx->external.direct_reference);
proto_item_append_text(tree, " (%%s)", name ? name : actx->external.direct_reference);
}
#.FN_PARS SecurityCategoryIdentifier
FN_VARIANT = _str VAL_PTR = &object_identifier_id
FN_VARIANT = _str VAL_PTR = &actx->external.direct_reference
#.FN_BODY SecurityCategoryValue
const char *name;
if (object_identifier_id) {
offset = call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree);
name = oid_resolved_from_string(object_identifier_id);
proto_item_append_text(tree, " (%%s)", name ? name : object_identifier_id);
if (actx->external.direct_reference) {
offset = call_ber_oid_callback(actx->external.direct_reference, tvb, offset, actx->pinfo, tree);
name = oid_resolved_from_string(actx->external.direct_reference);
proto_item_append_text(tree, " (%%s)", name ? name : actx->external.direct_reference);
} else {
offset = dissect_unknown_ber(actx->pinfo, tvb, offset, tree);
}
#.FN_PARS ExtensionAttributeType
VAL_PTR = &extension_id
VAL_PTR = &actx->external.indirect_reference
#.FN_BODY ExtensionAttribute/extension-attribute-value
proto_item_append_text(tree, " (%%s)", val_to_str(extension_id, p1_ExtensionAttributeType_vals, "extension-attribute-type %%d"));
if (dissector_try_uint(p1_extension_attribute_dissector_table, extension_id, tvb, actx->pinfo, tree)) {
proto_item_append_text(tree, " (%%s)", val_to_str(actx->external.indirect_reference, p1_ExtensionAttributeType_vals, "extension-attribute-type %%d"));
if (dissector_try_uint(p1_extension_attribute_dissector_table, actx->external.indirect_reference, tvb, actx->pinfo, tree)) {
offset =tvb_length(tvb);
} else {
proto_item *item = NULL;
proto_tree *next_tree = NULL;
item = proto_tree_add_text(tree, tvb, 0, tvb_length_remaining(tvb, offset),
"Dissector for extension-attribute-type %%d not implemented. Contact Wireshark developers if you want this supported", extension_id);
"Dissector for extension-attribute-type %%d not implemented. Contact Wireshark developers if you want this supported", actx->external.indirect_reference);
next_tree = proto_item_add_subtree(item, ett_p1_unknown_extension_attribute_type);
offset = dissect_unknown_ber(actx->pinfo, tvb, offset, next_tree);
expert_add_info(actx->pinfo, item, &ei_p1_unknown_extension_attribute_type);
@ -593,106 +593,117 @@ MessageToken B "2.6.1.7.36" "id-hat-forwarded-token"
/*XXX not implemented yet */
#.FN_BODY CountryName
if(doing_address)
g_strlcat(oraddress, "/C=", MAX_ORA_STR_LEN);
%(DEFAULT_BODY)s
#.FN_BODY AdministrationDomainName
if(doing_address)
g_strlcat(oraddress, "/A=", MAX_ORA_STR_LEN);
%(DEFAULT_BODY)s
#.FN_PARS StandardExtension
VAL_PTR = &extension_id
#.FN_BODY ExtensionType/private-extension FN_VARIANT = _str VAL_PTR = &object_identifier_id
do_address("/C=", NULL, actx);
%(DEFAULT_BODY)s
extension_id = -1;
#.FN_BODY AdministrationDomainName
do_address("/A=", NULL, actx);
%(DEFAULT_BODY)s
#.FN_PARS StandardExtension VAL_PTR = &actx->external.indirect_reference
#.FN_BODY StandardExtension
actx->external.indirect_ref_present = TRUE;
actx->external.direct_ref_present = FALSE;
%(DEFAULT_BODY)s
#.FN_BODY ExtensionType/private-extension FN_VARIANT = _str VAL_PTR = &actx->external.direct_reference
actx->external.indirect_ref_present = FALSE;
actx->external.direct_reference = NULL;
%(DEFAULT_BODY)s
actx->external.direct_ref_present = (actx->external.direct_reference != NULL) ? TRUE : FALSE;
#.FN_PARS ExtendedContentType
FN_VARIANT = _str VAL_PTR = &content_type_id
FN_VARIANT = _str VAL_PTR = &ctx->content_type_id
#.FN_BODY ExtendedContentType
const char *name = NULL;
p1_address_ctx_t* ctx;
if (actx->subtree.tree_ctx == NULL)
actx->subtree.tree_ctx = ep_new0(p1_address_ctx_t);
ctx = (p1_address_ctx_t*)actx->subtree.tree_ctx;
%(DEFAULT_BODY)s
if(content_type_id) {
name = oid_resolved_from_string(content_type_id);
if(ctx->content_type_id) {
name = oid_resolved_from_string(ctx->content_type_id);
if(!name) name = content_type_id;
if(!name) name = ctx->content_type_id;
proto_item_append_text(tree, " (%%s)", name);
proto_item_append_text(tree, " (%%s)", name);
}
#.FN_PARS BuiltInContentType/_untag VAL_PTR = &ict
#.FN_BODY BuiltInContentType/_untag
static guint32 ict = -1;
static guint32 ict = -1;
p1_address_ctx_t* ctx;
if (actx->subtree.tree_ctx == NULL)
actx->subtree.tree_ctx = ep_new0(p1_address_ctx_t);
ctx = (p1_address_ctx_t*)actx->subtree.tree_ctx;
%(DEFAULT_BODY)s
/* convert integer content type to oid for dispatch when the content is found */
switch(ict) {
/* convert integer content type to oid for dispatch when the content is found */
switch(ict) {
case 2:
content_type_id = wmem_strdup(wmem_packet_scope(), "2.6.1.10.0");
break;
ctx->content_type_id = wmem_strdup(wmem_packet_scope(), "2.6.1.10.0");
break;
case 22:
content_type_id = wmem_strdup(wmem_packet_scope(), "2.6.1.10.1");
break;
ctx->content_type_id = wmem_strdup(wmem_packet_scope(), "2.6.1.10.1");
break;
default:
content_type_id = NULL;
break;
ctx->content_type_id = NULL;
break;
}
#.FN_BODY Content
tvbuff_t *next_tvb;
tvbuff_t *next_tvb;
p1_address_ctx_t* ctx = (p1_address_ctx_t*)actx->subtree.tree_ctx;
/* we can do this now constructed octet strings are supported */
offset = dissect_ber_octet_string(FALSE, actx, tree, tvb, offset, hf_index, &next_tvb);
proto_item_set_text(actx->created_item, "content (%%u bytes)", tvb_length (next_tvb));
/* we can do this now constructed octet strings are supported */
offset = dissect_ber_octet_string(FALSE, actx, tree, tvb, offset, hf_index, &next_tvb);
proto_item_set_text(actx->created_item, "content (%%u bytes)", tvb_length (next_tvb));
if (next_tvb) {
if (content_type_id) {
(void) call_ber_oid_callback(content_type_id, next_tvb, 0, actx->pinfo, top_tree ? top_tree : tree);
} else if (report_unknown_content_type) {
proto_item *item = NULL;
proto_tree *next_tree = NULL;
if (next_tvb) {
if (ctx->content_type_id) {
(void) call_ber_oid_callback(ctx->content_type_id, next_tvb, 0, actx->pinfo, actx->subtree.top_tree ? actx->subtree.top_tree : tree);
} else if (ctx && ctx->report_unknown_content_type) {
proto_item *item = NULL;
proto_tree *next_tree = NULL;
item = proto_tree_add_text(top_tree ? top_tree : tree, next_tvb, 0, tvb_length_remaining(tvb, offset), "P1 Unknown Content (unknown built-in content-type)");
expert_add_info(actx->pinfo, item, &ei_p1_unknown_built_in_content_type);
if (item) {
next_tree=proto_item_add_subtree(item, ett_p1_content_unknown);
}
dissect_unknown_ber(actx->pinfo, next_tvb, 0, next_tree);
} else {
proto_item_append_text (actx->created_item, " (unknown content-type)");
}
}
item = proto_tree_add_text(actx->subtree.top_tree ? actx->subtree.top_tree : tree, next_tvb, 0, tvb_length_remaining(tvb, offset), "P1 Unknown Content (unknown built-in content-type)");
expert_add_info(actx->pinfo, item, &ei_p1_unknown_built_in_content_type);
if (item) {
next_tree=proto_item_add_subtree(item, ett_p1_content_unknown);
}
dissect_unknown_ber(actx->pinfo, next_tvb, 0, next_tree);
} else {
proto_item_append_text (actx->created_item, " (unknown content-type)");
}
}
#.FN_PARS MTAName
VAL_PTR = &mtaname
#.FN_BODY MTAName
tvbuff_t *mtaname = NULL;
p1_address_ctx_t* ctx = (p1_address_ctx_t*)actx->subtree.tree_ctx;
%(DEFAULT_BODY)s
if(doing_address) {
proto_item_append_text(address_item, " %%s", tvb_format_text(mtaname, 0, tvb_length(mtaname)));
if (ctx && ctx->do_address) {
proto_item_append_text(actx->subtree.tree, " %%s", tvb_format_text(mtaname, 0, tvb_length(mtaname)));
} else {
if (mtaname) {
col_append_fstr(actx->pinfo->cinfo, COL_INFO, " %%s", tvb_format_text(mtaname, 0, tvb_length(mtaname)));
}
if (mtaname) {
col_append_fstr(actx->pinfo->cinfo, COL_INFO, " %%s", tvb_format_text(mtaname, 0, tvb_length(mtaname)));
}
}
#.FN_PARS X121Address
@ -703,11 +714,7 @@ MessageToken B "2.6.1.7.36" "id-hat-forwarded-token"
%(DEFAULT_BODY)s
if(doing_address && string) {
g_strlcat(oraddress, "/X121=", MAX_ORA_STR_LEN);
g_strlcat(oraddress, tvb_format_text(string, 0, tvb_length(string)), MAX_ORA_STR_LEN);
}
do_address("/PX121=", string, actx);
#.FN_PARS TerminalIdentifier
VAL_PTR=&string
@ -717,22 +724,17 @@ MessageToken B "2.6.1.7.36" "id-hat-forwarded-token"
%(DEFAULT_BODY)s
if(doing_address && string) {
g_strlcat(oraddress, "/UA-ID=", MAX_ORA_STR_LEN);
g_strlcat(oraddress, tvb_format_text(string, 0, tvb_length(string)), MAX_ORA_STR_LEN);
}
do_address("/UA-ID=", string, actx);
#.FN_BODY PrivateDomainName
if(doing_address)
g_strlcat(oraddress, "/P=", MAX_ORA_STR_LEN);
do_address("/P=", NULL, actx);
%(DEFAULT_BODY)s
#.FN_BODY PrivateDomainIdentifier
if(doing_address)
g_strlcat(oraddress, "/P=", MAX_ORA_STR_LEN);
do_address("/P=", NULL, actx);
%(DEFAULT_BODY)s
@ -744,10 +746,7 @@ MessageToken B "2.6.1.7.36" "id-hat-forwarded-token"
%(DEFAULT_BODY)s
if(doing_address && string) {
g_strlcat(oraddress, "/O=", MAX_ORA_STR_LEN);
g_strlcat(oraddress, tvb_format_text(string, 0, tvb_length(string)), MAX_ORA_STR_LEN);
}
do_address("/O=", string, actx);
#.FN_PARS TeletexOrganizationName
VAL_PTR=&string
@ -757,10 +756,7 @@ MessageToken B "2.6.1.7.36" "id-hat-forwarded-token"
%(DEFAULT_BODY)s
if(doing_address && string) {
g_strlcat(oraddress, "/O=", MAX_ORA_STR_LEN);
g_strlcat(oraddress, tvb_format_text(string, 0, tvb_length(string)), MAX_ORA_STR_LEN);
}
do_address("/O=", string, actx);
#.FN_PARS OrganizationalUnitName
VAL_PTR=&string
@ -768,12 +764,7 @@ MessageToken B "2.6.1.7.36" "id-hat-forwarded-token"
#.FN_BODY OrganizationalUnitName
tvbuff_t *string = NULL;
%(DEFAULT_BODY)s
if(doing_address && string) {
g_strlcat(oraddress, "/OU=", MAX_ORA_STR_LEN);
g_strlcat(oraddress, tvb_format_text(string, 0, tvb_length(string)), MAX_ORA_STR_LEN);
}
do_address("/OU=", string, actx);
#.FN_PARS TeletexOrganizationalUnitName
VAL_PTR=&string
@ -783,10 +774,7 @@ MessageToken B "2.6.1.7.36" "id-hat-forwarded-token"
%(DEFAULT_BODY)s
if(doing_address && string) {
g_strlcat(oraddress, "/OU=", MAX_ORA_STR_LEN);
g_strlcat(oraddress, tvb_format_text(string, 0, tvb_length(string)), MAX_ORA_STR_LEN);
}
do_address("/OU=", string, actx);
#.FN_PARS CommonName
VAL_PTR=&string
@ -796,10 +784,7 @@ MessageToken B "2.6.1.7.36" "id-hat-forwarded-token"
%(DEFAULT_BODY)s
if(doing_address && string) {
g_strlcat(oraddress, "/CN=", MAX_ORA_STR_LEN);
g_strlcat(oraddress, tvb_format_text(string, 0, tvb_length(string)), MAX_ORA_STR_LEN);
}
do_address("/CN=", string, actx);
#.FN_PARS TeletexCommonName
VAL_PTR=&string
@ -809,106 +794,91 @@ MessageToken B "2.6.1.7.36" "id-hat-forwarded-token"
%(DEFAULT_BODY)s
if(doing_address && string) {
g_strlcat(oraddress, "/CN=", MAX_ORA_STR_LEN);
g_strlcat(oraddress, tvb_format_text(string, 0, tvb_length(string)), MAX_ORA_STR_LEN);
}
do_address("/CN=", string, actx);
#.FN_BODY CountryName/_untag/iso-3166-alpha2-code VAL_PTR=&nstring
tvbuff_t *nstring = NULL;
%(DEFAULT_BODY)s
if(doing_address && nstring)
g_strlcat(oraddress, tvb_format_text(nstring, 0, tvb_length(nstring)), MAX_ORA_STR_LEN);
do_address(NULL, nstring, actx);
#.FN_BODY AdministrationDomainName/_untag/printable VAL_PTR=&nstring
tvbuff_t *nstring = NULL;
%(DEFAULT_BODY)s
if(doing_address && nstring)
g_strlcat(oraddress, tvb_format_text(nstring, 0, tvb_length(nstring)), MAX_ORA_STR_LEN);
do_address(NULL, nstring, actx);
#.FN_BODY PrivateDomainName/printable VAL_PTR=&nstring
tvbuff_t *nstring = NULL;
%(DEFAULT_BODY)s
if(doing_address && nstring)
g_strlcat(oraddress, tvb_format_text(nstring, 0, tvb_length(nstring)), MAX_ORA_STR_LEN);
do_address(NULL, nstring, actx);
#.FN_BODY PrivateDomainIdentifier/printable VAL_PTR=&nstring
tvbuff_t *nstring = NULL;
%(DEFAULT_BODY)s
if(doing_address && nstring)
g_strlcat(oraddress, tvb_format_text(nstring, 0, tvb_length(nstring)), MAX_ORA_STR_LEN);
do_address(NULL, nstring, actx);
#.FN_BODY PhysicalDeliveryCountryName/iso-3166-alpha2-code VAL_PTR=&nstring
tvbuff_t *nstring = NULL;
%(DEFAULT_BODY)s
if(doing_address && nstring)
g_strlcat(oraddress, tvb_format_text(nstring, 0, tvb_length(nstring)), MAX_ORA_STR_LEN);
do_address(NULL, nstring, actx);
#.FN_BODY UserAddress/x121/x121-address VAL_PTR=&nstring
tvbuff_t *nstring = NULL;
%(DEFAULT_BODY)s
if(doing_address && nstring)
g_strlcat(oraddress, tvb_format_text(nstring, 0, tvb_length(nstring)), MAX_ORA_STR_LEN);
do_address(NULL, nstring, actx);
#.FN_BODY CountryName/_untag/x121-dcc-code VAL_PTR=&nstring
tvbuff_t *nstring = NULL;
%(DEFAULT_BODY)s
if(doing_address && nstring)
g_strlcat(oraddress, tvb_format_text(nstring, 0, tvb_length(nstring)), MAX_ORA_STR_LEN);
do_address(NULL, nstring, actx);
#.FN_BODY AdministrationDomainName/_untag/numeric VAL_PTR=&nstring
tvbuff_t *nstring = NULL;
%(DEFAULT_BODY)s
if(doing_address && nstring)
g_strlcat(oraddress, tvb_format_text(nstring, 0, tvb_length(nstring)), MAX_ORA_STR_LEN);
do_address(NULL, nstring, actx);
#.FN_BODY PrivateDomainName/numeric VAL_PTR=&nstring
tvbuff_t *nstring = NULL;
%(DEFAULT_BODY)s
if(doing_address && nstring)
g_strlcat(oraddress, tvb_format_text(nstring, 0, tvb_length(nstring)), MAX_ORA_STR_LEN);
do_address(NULL, nstring, actx);
#.FN_BODY PrivateDomainIdentifier/numeric VAL_PTR=&nstring
tvbuff_t *nstring = NULL;
%(DEFAULT_BODY)s
if(doing_address && nstring)
g_strlcat(oraddress, tvb_format_text(nstring, 0, tvb_length(nstring)), MAX_ORA_STR_LEN);
do_address(NULL, nstring, actx);
#.FN_BODY PhysicalDeliveryCountryName/x121-dcc-code VAL_PTR=&nstring
tvbuff_t *nstring = NULL;
%(DEFAULT_BODY)s
if(doing_address && nstring)
g_strlcat(oraddress, tvb_format_text(nstring, 0, tvb_length(nstring)), MAX_ORA_STR_LEN);
do_address(NULL, nstring, actx);
#.FN_BODY PostalCode/numeric-code VAL_PTR=&nstring
tvbuff_t *nstring = NULL;
%(DEFAULT_BODY)s
if(doing_address && nstring)
g_strlcat(oraddress, tvb_format_text(nstring, 0, tvb_length(nstring)), MAX_ORA_STR_LEN);
do_address(NULL, nstring, actx);
#.FN_BODY TeletexDomainDefinedAttribute/type VAL_PTR=&tstring
@ -916,29 +886,17 @@ MessageToken B "2.6.1.7.36" "id-hat-forwarded-token"
%(DEFAULT_BODY)s
if(doing_address && tstring) {
g_strlcat(oraddress, "/DD.", MAX_ORA_STR_LEN);
g_strlcat(oraddress, tvb_format_text(tstring, 0, tvb_length(tstring)), MAX_ORA_STR_LEN);
g_strlcat(ddatype, tvb_format_text(tstring, 0, tvb_length(tstring)), MAX_ORA_STR_LEN);
}
do_address_str("/DD.", tstring, actx);
#.FN_BODY TeletexDomainDefinedAttribute/value VAL_PTR=&tstring
tvbuff_t *tstring = NULL;
%(DEFAULT_BODY)s
if(doing_address && tstring) {
g_strlcat(oraddress, "=", MAX_ORA_STR_LEN);
g_strlcat(oraddress, tvb_format_text(tstring, 0, tvb_length(tstring)), MAX_ORA_STR_LEN);
if (*ddatype) {
proto_item_append_text (tree, " (%%s=%%s)", ddatype, tvb_format_text(tstring, 0, tvb_length(tstring)));
}
}
do_address_str_tree("=", tstring, actx, tree);
#.FN_BODY TeletexDomainDefinedAttribute
ddatype = (char *)wmem_alloc(wmem_packet_scope(), MAX_ORA_STR_LEN); ddatype[0] = '\0';
actx->value_ptr = ep_strbuf_new("");
%(DEFAULT_BODY)s
@ -947,154 +905,140 @@ MessageToken B "2.6.1.7.36" "id-hat-forwarded-token"
%(DEFAULT_BODY)s
if(doing_address && pstring) {
g_strlcat(oraddress, "/S=", MAX_ORA_STR_LEN);
g_strlcat(oraddress, tvb_format_text(pstring, 0, tvb_length(pstring)), MAX_ORA_STR_LEN);
}
do_address("/S=", pstring, actx);
#.FN_BODY PersonalName/given-name VAL_PTR=&pstring
tvbuff_t *pstring = NULL;
%(DEFAULT_BODY)s
if(doing_address && pstring) {
g_strlcat(oraddress, "/G=", MAX_ORA_STR_LEN);
g_strlcat(oraddress, tvb_format_text(pstring, 0, tvb_length(pstring)), MAX_ORA_STR_LEN);
}
do_address("/G=", pstring, actx);
#.FN_BODY PersonalName/initials VAL_PTR=&pstring
tvbuff_t *pstring = NULL;
%(DEFAULT_BODY)s
if(doing_address && pstring) {
g_strlcat(oraddress, "/I=", MAX_ORA_STR_LEN);
g_strlcat(oraddress, tvb_format_text(pstring, 0, tvb_length(pstring)), MAX_ORA_STR_LEN);
}
do_address("/I=", pstring, actx);
#.FN_BODY PersonalName/generation-qualifier VAL_PTR=&pstring
tvbuff_t *pstring = NULL;
%(DEFAULT_BODY)s
if(doing_address && pstring) {
g_strlcat(oraddress, "/Q=", MAX_ORA_STR_LEN);
g_strlcat(oraddress, tvb_format_text(pstring, 0, tvb_length(pstring)), MAX_ORA_STR_LEN);
}
do_address("/Q=", pstring, actx);
#.FN_BODY TeletexPersonalName/surname VAL_PTR=&tstring
tvbuff_t *tstring = NULL;
%(DEFAULT_BODY)s
if(doing_address && tstring) {
g_strlcat(oraddress, "/S=", MAX_ORA_STR_LEN);
g_strlcat(oraddress, tvb_format_text(tstring, 0, tvb_length(tstring)), MAX_ORA_STR_LEN);
}
do_address("/S=", tstring, actx);
#.FN_BODY TeletexPersonalName/given-name VAL_PTR=&tstring
tvbuff_t *tstring = NULL;
%(DEFAULT_BODY)s
if(doing_address && tstring) {
g_strlcat(oraddress, "/G=", MAX_ORA_STR_LEN);
g_strlcat(oraddress, tvb_format_text(tstring, 0, tvb_length(tstring)), MAX_ORA_STR_LEN);
}
do_address("/G=", tstring, actx);
#.FN_BODY TeletexPersonalName/initials VAL_PTR=&tstring
tvbuff_t *tstring = NULL;
%(DEFAULT_BODY)s
if(doing_address && tstring) {
g_strlcat(oraddress, "/I=", MAX_ORA_STR_LEN);
g_strlcat(oraddress, tvb_format_text(tstring, 0, tvb_length(tstring)), MAX_ORA_STR_LEN);
}
do_address("/I=", tstring, actx);
#.FN_BODY TeletexPersonalName/generation-qualifier VAL_PTR=&tstring
tvbuff_t *tstring = NULL;
%(DEFAULT_BODY)s
if(doing_address && tstring) {
g_strlcat(oraddress, "/Q=", MAX_ORA_STR_LEN);
g_strlcat(oraddress, tvb_format_text(tstring, 0, tvb_length(tstring)), MAX_ORA_STR_LEN);
}
do_address("/Q=", tstring, actx);
#.FN_BODY BuiltInDomainDefinedAttribute/type VAL_PTR=&pstring
tvbuff_t *pstring = NULL;
%(DEFAULT_BODY)s
if(doing_address && pstring) {
g_strlcat(oraddress, "/DD.", MAX_ORA_STR_LEN);
g_strlcat(oraddress, tvb_format_text(pstring, 0, tvb_length(pstring)), MAX_ORA_STR_LEN);
g_strlcat(ddatype, tvb_format_text(pstring, 0, tvb_length(pstring)), MAX_ORA_STR_LEN);
}
do_address_str("/DD.", pstring, actx);
#.FN_BODY BuiltInDomainDefinedAttribute/value VAL_PTR=&pstring
tvbuff_t *pstring = NULL;
%(DEFAULT_BODY)s
if(doing_address && pstring) {
g_strlcat(oraddress, "=", MAX_ORA_STR_LEN);
g_strlcat(oraddress, tvb_format_text(pstring, 0, tvb_length(pstring)), MAX_ORA_STR_LEN);
if (*ddatype) {
proto_item_append_text (tree, " (%%s=%%s)", ddatype, tvb_format_text(pstring, 0, tvb_length(pstring)));
}
}
do_address_str_tree("=", pstring, actx, tree);
#.FN_BODY BuiltInDomainDefinedAttribute
ddatype = (char *)wmem_alloc(wmem_packet_scope(), MAX_ORA_STR_LEN); ddatype[0] = '\0';
actx->value_ptr = ep_strbuf_new("");
%(DEFAULT_BODY)s
#.FN_BODY ORAddress
oraddress = (char *)wmem_alloc(wmem_packet_scope(), MAX_ORA_STR_LEN); oraddress[0] = '\0';
doing_address = TRUE;
address_item = NULL;
p1_address_ctx_t* ctx;
if (actx->subtree.tree_ctx == NULL) {
actx->subtree.tree_ctx = ep_new0(p1_address_ctx_t);
}
ctx = (p1_address_ctx_t*)actx->subtree.tree_ctx;
ctx->oraddress = ep_strbuf_new("");
actx->subtree.tree = NULL;
set_do_address(actx, TRUE);
%(DEFAULT_BODY)s
if(*oraddress && address_item)
proto_item_append_text(address_item, " %%s/", oraddress);
if (ctx->oraddress && (ctx->oraddress->len > 0) && actx->subtree.tree)
proto_item_append_text(actx->subtree.tree, " (%%s/)", ctx->oraddress->str);
doing_address = FALSE;
set_do_address(actx, FALSE);
#.FN_BODY ORName
oraddress = (char *)wmem_alloc(wmem_packet_scope(), MAX_ORA_STR_LEN); oraddress[0] = '\0';
address_item = NULL;
doing_address = TRUE;
p1_address_ctx_t* ctx;
if (actx->subtree.tree_ctx == NULL) {
actx->subtree.tree_ctx = ep_new0(p1_address_ctx_t);
}
ctx = (p1_address_ctx_t*)actx->subtree.tree_ctx;
ctx->oraddress = ep_strbuf_new("");
actx->subtree.tree = NULL;
set_do_address(actx, TRUE);
%(DEFAULT_BODY)s
if(*oraddress && address_item)
proto_item_append_text(address_item, " (%%s/)", oraddress);
doing_address = FALSE;
if (ctx->oraddress && (ctx->oraddress->len > 0) && actx->subtree.tree)
proto_item_append_text(actx->subtree.tree, " (%%s/)", ctx->oraddress->str);
set_do_address(actx, FALSE);
#.FN_BODY MessageIdentifier
address_item = NULL;
actx->subtree.tree = NULL;
%(DEFAULT_BODY)s
#.FN_BODY GlobalDomainIdentifier
oraddress = (char *)wmem_alloc(wmem_packet_scope(), MAX_ORA_STR_LEN); oraddress[0] = '\0';
address_item = tree;
p1_address_ctx_t* ctx;
if (actx->subtree.tree_ctx == NULL) {
actx->subtree.tree_ctx = ep_new0(p1_address_ctx_t);
}
ctx = (p1_address_ctx_t*)actx->subtree.tree_ctx;
ctx->oraddress = ep_strbuf_new("");
actx->subtree.tree = tree;
%(DEFAULT_BODY)s
if(*oraddress) {
proto_item_append_text(address_item, " (%%s/", oraddress);
if (ctx->oraddress && (ctx->oraddress->len > 0)) {
proto_item_append_text(actx->subtree.tree, " (%%s/", ctx->oraddress->str);
if(doing_subjectid) {
col_append_fstr(actx->pinfo->cinfo, COL_INFO, " (%%s/", oraddress);
if (hf_index == hf_p1_subject_identifier) {
col_append_fstr(actx->pinfo->cinfo, COL_INFO, " (%%s/", ctx->oraddress->str);
}
}
@ -1104,79 +1048,72 @@ MessageToken B "2.6.1.7.36" "id-hat-forwarded-token"
#.FN_BODY LocalIdentifier
tvbuff_t *id = NULL;
%(DEFAULT_BODY)s
if(id) {
if(doing_address)
proto_item_append_text(address_item, " $ %%s)", tvb_format_text(id, 0, tvb_length(id)));
p1_address_ctx_t* ctx = (p1_address_ctx_t*)actx->subtree.tree_ctx;
if(doing_subjectid)
col_append_fstr(actx->pinfo->cinfo, COL_INFO, " $ %%s)", tvb_format_text(id, 0, tvb_length(id)));
%(DEFAULT_BODY)s
if(id) {
if (ctx && ctx->do_address)
proto_item_append_text(actx->subtree.tree, " $ %%s)", tvb_format_text(id, 0, tvb_length(id)));
if (hf_index == hf_p1_subject_identifier)
col_append_fstr(actx->pinfo->cinfo, COL_INFO, " $ %%s)", tvb_format_text(id, 0, tvb_length(id)));
}
#.FN_BODY MTSIdentifier
doing_address = TRUE;
if(hf_index == hf_p1_subject_identifier)
doing_subjectid = TRUE;
set_do_address(actx, TRUE);
%(DEFAULT_BODY)s
doing_address = FALSE;
if(hf_index == hf_p1_subject_identifier)
doing_subjectid = FALSE;
set_do_address(actx, FALSE);
#.FN_BODY MTANameAndOptionalGDI
doing_address = TRUE;
set_do_address(actx, TRUE);
%(DEFAULT_BODY)s
doing_address = FALSE;
set_do_address(actx, FALSE);
proto_item_append_text(tree, ")");
#.FN_BODY BuiltInStandardAttributes
address_item = tree;
actx->subtree.tree = tree;
%(DEFAULT_BODY)s
#.FN_BODY TraceInformationElement
doing_address = TRUE;
set_do_address(actx, TRUE);
%(DEFAULT_BODY)s
doing_address = FALSE;
set_do_address(actx, FALSE);
#.FN_BODY InternalTraceInformationElement
doing_address = TRUE;
set_do_address(actx, TRUE);
%(DEFAULT_BODY)s
doing_address = FALSE;
set_do_address(actx, FALSE);
#.FN_BODY DomainSuppliedInformation
doing_address = FALSE;
set_do_address(actx, FALSE);
%(DEFAULT_BODY)s
doing_address = TRUE;
set_do_address(actx, TRUE);
proto_item_append_text(tree, ")");
#.FN_BODY MTASuppliedInformation
doing_address = FALSE;
set_do_address(actx, FALSE);
%(DEFAULT_BODY)s
doing_address = TRUE;
set_do_address(actx, TRUE);
proto_item_append_text(tree, ")");
#.FN_PARS Time
@ -1184,11 +1121,12 @@ MessageToken B "2.6.1.7.36" "id-hat-forwarded-token"
#.FN_BODY Time
tvbuff_t *arrival = NULL;
p1_address_ctx_t* ctx = (p1_address_ctx_t*)actx->subtree.tree_ctx;
%(DEFAULT_BODY)s
if(arrival && doing_address)
proto_item_append_text(address_item, " %%s", tvb_format_text(arrival, 0, tvb_length(arrival)));
if(arrival && ctx && ctx->do_address)
proto_item_append_text(actx->subtree.tree, " %%s", tvb_format_text(arrival, 0, tvb_length(arrival)));
#.FN_PARS RoutingAction
VAL_PTR = &action
@ -1198,7 +1136,7 @@ MessageToken B "2.6.1.7.36" "id-hat-forwarded-token"
%(DEFAULT_BODY)s
proto_item_append_text(address_item, " %%s", val_to_str(action, p1_RoutingAction_vals, "action(%%d)"));
proto_item_append_text(actx->subtree.tree, " %%s", val_to_str(action, p1_RoutingAction_vals, "action(%%d)"));
#.FN_PARS MTABindError
VAL_PTR=&error
@ -1210,12 +1148,12 @@ MessageToken B "2.6.1.7.36" "id-hat-forwarded-token"
col_append_fstr(actx->pinfo->cinfo, COL_INFO, " (%%s)", val_to_str(error, p1_MTABindError_vals, "error(%%d)"));
#.FN_PARS TokenTypeIdentifier
FN_VARIANT = _str VAL_PTR = &object_identifier_id
FN_VARIANT = _str VAL_PTR = &actx->external.direct_reference
#.FN_BODY TokenTypeData
if(object_identifier_id)
call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree);
if(actx->external.direct_reference)
call_ber_oid_callback(actx->external.direct_reference, tvb, offset, actx->pinfo, tree);
#.FN_PARS Credentials
VAL_PTR = &credentials
@ -1230,19 +1168,19 @@ MessageToken B "2.6.1.7.36" "id-hat-forwarded-token"
}
#.FN_PARS TokenDataType
VAL_PTR = &extension_id
VAL_PTR = &actx->external.indirect_reference
#.FN_BODY TokenData/value
proto_item_append_text(tree, " (%%s)", val_to_str(extension_id, p1_TokenDataType_vals, "tokendata-type %%d"));
if (dissector_try_uint(p1_tokendata_dissector_table, extension_id, tvb, actx->pinfo, tree)) {
proto_item_append_text(tree, " (%%s)", val_to_str(actx->external.indirect_reference, p1_TokenDataType_vals, "tokendata-type %%d"));
if (dissector_try_uint(p1_tokendata_dissector_table, actx->external.indirect_reference, tvb, actx->pinfo, tree)) {
offset = tvb_length(tvb);
} else {
proto_item *item = NULL;
proto_tree *next_tree = NULL;
item = proto_tree_add_text(tree, tvb, 0, tvb_length_remaining(tvb, offset),
"Dissector for tokendata-type %%d not implemented. Contact Wireshark developers if you want this supported", extension_id);
"Dissector for tokendata-type %%d not implemented. Contact Wireshark developers if you want this supported", actx->external.indirect_reference);
next_tree = proto_item_add_subtree(item, ett_p1_unknown_tokendata_type);
offset = dissect_unknown_ber(actx->pinfo, tvb, offset, next_tree);
expert_add_info(actx->pinfo, item, &ei_p1_unknown_tokendata_type);
@ -1283,29 +1221,29 @@ MessageToken B "2.6.1.7.36" "id-hat-forwarded-token"
#.FN_BODY ReportType
gint report = -1;
%(DEFAULT_BODY)s
%(DEFAULT_BODY)s
if( (report!=-1) && p1_ReportType_vals[report].strptr ){
if( (report!=-1) && p1_ReportType_vals[report].strptr ){
col_append_fstr(actx->pinfo->cinfo, COL_INFO, " %%s", p1_ReportType_vals[report].strptr);
}
#.FN_BODY MessageSubmissionArgument
p1_initialize_content_globals(tree, TRUE);
%(DEFAULT_BODY)s
p1_initialize_content_globals(NULL, FALSE);
p1_initialize_content_globals(actx, tree, TRUE);
%(DEFAULT_BODY)s
p1_initialize_content_globals(actx, NULL, FALSE);
#.FN_BODY MessageDeliveryArgument
p1_initialize_content_globals(tree, TRUE);
%(DEFAULT_BODY)s
p1_initialize_content_globals(NULL, FALSE);
p1_initialize_content_globals(actx, tree, TRUE);
%(DEFAULT_BODY)s
p1_initialize_content_globals(actx, NULL, FALSE);
#.FN_BODY ReportDeliveryArgument
p1_initialize_content_globals(tree, TRUE);
%(DEFAULT_BODY)s
p1_initialize_content_globals(NULL, FALSE);
p1_initialize_content_globals(actx, tree, TRUE);
%(DEFAULT_BODY)s
p1_initialize_content_globals(actx, NULL, FALSE);
#.FN_HDR MTSBindResult
/* TODO: there may be other entry points where this global should be initialized... */
address_item = NULL;
/* TODO: there may be other entry points where this global should be initialized... */
actx->subtree.tree = NULL;
#.END

View File

@ -58,21 +58,6 @@ static void prefs_register_p1(void); /* forward declaration for use in preferenc
static int proto_p1 = -1;
static int proto_p3 = -1;
static struct SESSION_DATA_STRUCTURE* session = NULL;
static int extension_id = -1; /* integer extension id */
static const char *object_identifier_id = NULL; /* extensions identifier */
static const char *content_type_id = NULL; /* content type identifier */
static gboolean report_unknown_content_type = FALSE;
#define MAX_ORA_STR_LEN 256
static char *oraddress = NULL;
static char *ddatype = NULL;
static gboolean doing_address=FALSE;
static gboolean doing_subjectid=FALSE;
static proto_item *address_item = NULL;
static proto_tree *top_tree=NULL;
static int hf_p1_MTS_APDU_PDU = -1;
static int hf_p1_MTABindArgument_PDU = -1;
static int hf_p1_MTABindResult_PDU = -1;
@ -103,6 +88,65 @@ static dissector_table_t p1_tokendata_dissector_table;
#include "packet-p1-table.c" /* operation and error codes */
typedef struct p1_address_ctx {
gboolean do_address;
const char *content_type_id;
gboolean report_unknown_content_type;
emem_strbuf_t* oraddress;
} p1_address_ctx_t;
static void set_do_address(asn1_ctx_t* actx, gboolean do_address)
{
p1_address_ctx_t* ctx;
if (actx->subtree.tree_ctx == NULL) {
actx->subtree.tree_ctx = ep_new0(p1_address_ctx_t);
}
ctx = (p1_address_ctx_t*)actx->subtree.tree_ctx;
ctx->do_address = do_address;
}
static void do_address(const char* address, tvbuff_t* tvb_string, asn1_ctx_t* actx)
{
p1_address_ctx_t* ctx = (p1_address_ctx_t*)actx->subtree.tree_ctx;
if (ctx && ctx->do_address) {
if (address) {
ep_strbuf_append(ctx->oraddress, address);
}
if (tvb_string) {
ep_strbuf_append(ctx->oraddress, tvb_format_text(tvb_string, 0, tvb_length(tvb_string)));
}
}
}
static void do_address_str(const char* address, tvbuff_t* tvb_string, asn1_ctx_t* actx)
{
emem_strbuf_t *ddatype = (emem_strbuf_t *)actx->value_ptr;
p1_address_ctx_t* ctx = (p1_address_ctx_t*)actx->subtree.tree_ctx;
do_address(address, tvb_string, actx);
if (ctx && ctx->do_address && ddatype && tvb_string)
ep_strbuf_append(ddatype, tvb_format_text(tvb_string, 0, tvb_length(tvb_string)));
}
static void do_address_str_tree(const char* address, tvbuff_t* tvb_string, asn1_ctx_t* actx, proto_tree* tree)
{
emem_strbuf_t *ddatype = (emem_strbuf_t *)actx->value_ptr;
p1_address_ctx_t* ctx = (p1_address_ctx_t*)actx->subtree.tree_ctx;
do_address(address, tvb_string, actx);
if (ctx && ctx->do_address && tvb_string && ddatype) {
if (ddatype->len > 0) {
proto_item_append_text (tree, " (%%s=%%s)", ddatype->str, tvb_format_text(tvb_string, 0, tvb_length(tvb_string)));
}
}
}
#include "packet-p1-fn.c"
#include "packet-p1-table11.c" /* operation argument/result dissectors */
@ -118,17 +162,34 @@ static const ros_info_t p3_ros_info = {
p3_err_tab
};
void p1_initialize_content_globals (proto_tree *tree, gboolean report_unknown_cont_type)
void p1_initialize_content_globals (asn1_ctx_t* actx, proto_tree *tree, gboolean report_unknown_cont_type)
{
top_tree = tree;
content_type_id = NULL;
report_unknown_content_type = report_unknown_cont_type;
address_item = NULL;
p1_address_ctx_t* ctx;
if (actx->subtree.tree_ctx == NULL) {
actx->subtree.tree_ctx = ep_new0(p1_address_ctx_t);
}
ctx = (p1_address_ctx_t*)actx->subtree.tree_ctx;
actx->subtree.top_tree = tree;
actx->external.direct_reference = NULL;
ctx->content_type_id = NULL;
ctx->report_unknown_content_type = report_unknown_cont_type;
}
char* p1_get_last_oraddress (void)
{
return oraddress;
char* p1_get_last_oraddress (asn1_ctx_t* actx)
{
p1_address_ctx_t* ctx;
if ((actx == NULL) || (actx->subtree.tree_ctx == NULL))
return "";
ctx = (p1_address_ctx_t*)actx->subtree.tree_ctx;
if (ctx->oraddress->len <= 0)
return "";
return ctx->oraddress->str;
}
/*
@ -143,7 +204,7 @@ dissect_p1_mts_apdu (tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
/* save parent_tree so subdissectors can create new top nodes */
p1_initialize_content_globals (parent_tree, TRUE);
p1_initialize_content_globals (&asn1_ctx, parent_tree, TRUE);
if(parent_tree){
item = proto_tree_add_item(parent_tree, proto_p1, tvb, 0, -1, ENC_NA);
@ -154,7 +215,7 @@ dissect_p1_mts_apdu (tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
col_set_str(pinfo->cinfo, COL_INFO, "Transfer");
dissect_p1_MTS_APDU (FALSE, tvb, 0, &asn1_ctx, tree, hf_p1_MTS_APDU_PDU);
p1_initialize_content_globals (NULL, FALSE);
p1_initialize_content_globals (&asn1_ctx, NULL, FALSE);
}
/*
@ -167,6 +228,7 @@ dissect_p1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
int old_offset;
proto_item *item=NULL;
proto_tree *tree=NULL;
struct SESSION_DATA_STRUCTURE* session;
int (*p1_dissector)(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_, proto_tree *tree, int hf_index _U_) = NULL;
const char *p1_op_name;
int hf_p1_index = -1;
@ -174,7 +236,7 @@ dissect_p1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
/* save parent_tree so subdissectors can create new top nodes */
p1_initialize_content_globals (parent_tree, TRUE);
p1_initialize_content_globals (&asn1_ctx, parent_tree, TRUE);
/* do we have operation information from the ROS dissector? */
if( !pinfo->private_data ){
@ -182,17 +244,17 @@ dissect_p1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
proto_tree_add_text(parent_tree, tvb, offset, -1,
"Internal error: can't get operation information from ROS dissector.");
}
return ;
} else {
session = ( (struct SESSION_DATA_STRUCTURE*)(pinfo->private_data) );
return;
}
session = ( (struct SESSION_DATA_STRUCTURE*)(pinfo->private_data) );
if(parent_tree){
item = proto_tree_add_item(parent_tree, proto_p1, tvb, 0, -1, ENC_NA);
tree = proto_item_add_subtree(item, ett_p1);
}
col_set_str(pinfo->cinfo, COL_PROTOCOL, "P1");
col_clear(pinfo->cinfo, COL_INFO);
col_clear(pinfo->cinfo, COL_INFO);
switch(session->ros_op & ROS_OP_MASK) {
case (ROS_OP_BIND | ROS_OP_ARGUMENT): /* BindInvoke */
@ -230,7 +292,7 @@ dissect_p1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
break;
}
}
p1_initialize_content_globals (NULL, FALSE);
p1_initialize_content_globals (&asn1_ctx, NULL, FALSE);
}
@ -240,7 +302,7 @@ void proto_register_p1(void) {
/* List of fields */
static hf_register_info hf[] =
{
/* "Created by defining PDU in .cnf */
/* "Created by defining PDU in .cnf */
{ &hf_p1_MTABindArgument_PDU,
{ "MTABindArgument", "p1.MTABindArgument",
FT_UINT32, BASE_DEC, VALS(p1_MTABindArgument_vals), 0,

View File

@ -28,8 +28,8 @@
#include "packet-p1-val.h"
void p1_initialize_content_globals (proto_tree *tree, gboolean report_unknown_cont_type);
char* p1_get_last_oraddress(void);
void p1_initialize_content_globals (asn1_ctx_t* actx, proto_tree *tree, gboolean report_unknown_cont_type);
char* p1_get_last_oraddress(asn1_ctx_t* actx);
void dissect_p1_mts_apdu (tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree);
#include "packet-p1-exp.h"

View File

@ -302,45 +302,45 @@ ProtectedChangeCredentials B "2.6.4.9.4" "id-ext-protected-change-credentials"
RTSE-apdus B "2.6.0.2.10""id-as-ms-rtse"
#.FN_PARS AttributeType FN_VARIANT = _str VAL_PTR = &object_identifier_id
#.FN_PARS AttributeType FN_VARIANT = _str VAL_PTR = &actx->external.direct_reference
#.FN_BODY Attribute/attribute-values/_item
if(object_identifier_id)
call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree);
if(actx->external.direct_reference)
call_ber_oid_callback(actx->external.direct_reference, tvb, offset, actx->pinfo, tree);
#.FN_BODY AttributeValueAssertion/attribute-value
if(object_identifier_id)
call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree);
if(actx->external.direct_reference)
call_ber_oid_callback(actx->external.direct_reference, tvb, offset, actx->pinfo, tree);
#.FN_BODY FilterItem/substrings/strings/_item/initial
if(object_identifier_id)
call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree);
if(actx->external.direct_reference)
call_ber_oid_callback(actx->external.direct_reference, tvb, offset, actx->pinfo, tree);
#.FN_BODY FilterItem/substrings/strings/_item/any
if(object_identifier_id)
call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree);
if(actx->external.direct_reference)
call_ber_oid_callback(actx->external.direct_reference, tvb, offset, actx->pinfo, tree);
#.FN_BODY FilterItem/substrings/strings/_item/final
if(object_identifier_id)
call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree);
if(actx->external.direct_reference)
call_ber_oid_callback(actx->external.direct_reference, tvb, offset, actx->pinfo, tree);
#.FN_BODY MatchingRuleAssertion/match-value
if(object_identifier_id)
call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree);
if(actx->external.direct_reference)
call_ber_oid_callback(actx->external.direct_reference, tvb, offset, actx->pinfo, tree);
#.FN_BODY Summary/present/_item/value
if(object_identifier_id)
call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree);
if(actx->external.direct_reference)
call_ber_oid_callback(actx->external.direct_reference, tvb, offset, actx->pinfo, tree);
#.FN_BODY OrderedAttribute/attribute-values/_item/value
if(object_identifier_id)
call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree);
if(actx->external.direct_reference)
call_ber_oid_callback(actx->external.direct_reference, tvb, offset, actx->pinfo, tree);
#.FN_PARS AutoActionType FN_VARIANT = _str VAL_PTR = &object_identifier_id
#.FN_PARS AutoActionType FN_VARIANT = _str VAL_PTR = &actx->external.direct_reference
#.FN_BODY AutoActionRegistration/registration-parameter
if(object_identifier_id)
call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree);
if(actx->external.direct_reference)
call_ber_oid_callback(actx->external.direct_reference, tvb, offset, actx->pinfo, tree);
#.FN_BODY AutoActionError/error-code
@ -349,7 +349,7 @@ RTSE-apdus B "2.6.0.2.10""id-as-ms-rtse"
#.FN_BODY RegistrationTypes/extended-registrations/_item
/* XXX: Is this really the best way to do this? */
offset = dissect_ber_object_identifier_str(implicit_tag, actx, tree, tvb, offset, hf_index, &object_identifier_id);
offset = dissect_ber_object_identifier_str(implicit_tag, actx, tree, tvb, offset, hf_index, &actx->external.direct_reference);
#.FN_BODY RTABapdu/userdataAB
offset = dissect_unknown_ber(actx->pinfo, tvb, offset, tree);
@ -357,12 +357,12 @@ RTSE-apdus B "2.6.0.2.10""id-as-ms-rtse"
#.END
#.FN_BODY AutoActionError/error-parameter
if(object_identifier_id)
call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree);
if(actx->external.direct_reference)
call_ber_oid_callback(actx->external.direct_reference, tvb, offset, actx->pinfo, tree);
#.FN_BODY PAR-attribute-error/problems/_item/value
if(object_identifier_id)
call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree);
if(actx->external.direct_reference)
call_ber_oid_callback(actx->external.direct_reference, tvb, offset, actx->pinfo, tree);
#.FN_BODY MSBindArgument/initiator-name
@ -370,7 +370,7 @@ RTSE-apdus B "2.6.0.2.10""id-as-ms-rtse"
%(DEFAULT_BODY)s
if ((ora = p1_get_last_oraddress())) {
if ((ora = p1_get_last_oraddress(actx))) {
col_append_fstr(actx->pinfo->cinfo, COL_INFO, " (initiator=%%s)", ora);
}
@ -397,16 +397,16 @@ RTSE-apdus B "2.6.0.2.10""id-as-ms-rtse"
col_append_fstr(actx->pinfo->cinfo, COL_INFO, " (count=%%d)", count);
#.FN_BODY MSMessageSubmissionArgument
p1_initialize_content_globals (tree, TRUE);
p1_initialize_content_globals (actx, tree, TRUE);
%(DEFAULT_BODY)s
p1_initialize_content_globals (NULL, FALSE);
p1_initialize_content_globals (actx, NULL, FALSE);
#.FN_BODY EntryInformation
p1_initialize_content_globals (NULL, FALSE);
p1_initialize_content_globals (actx, NULL, FALSE);
%(DEFAULT_BODY)s
p1_initialize_content_globals (NULL, FALSE);
p1_initialize_content_globals (actx, NULL, FALSE);
#.FN_BODY EntryModification
p1_initialize_content_globals (NULL, FALSE);
p1_initialize_content_globals (actx, NULL, FALSE);
%(DEFAULT_BODY)s
p1_initialize_content_globals (NULL, FALSE);
p1_initialize_content_globals (actx, NULL, FALSE);

View File

@ -45,7 +45,6 @@
static guint global_p7_tcp_port = 102;
static dissector_handle_t tpkt_handle;
static const char *object_identifier_id = NULL; /* attribute identifier */
static int seqno = 0;
static void prefs_register_p7(void); /* forward declaration for use in preferences registration */

View File

@ -110,6 +110,11 @@ typedef struct _asn1_ctx_t {
} per;
} u;
} external;
struct {
proto_tree *tree;
proto_tree *top_tree;
void* tree_ctx;
} subtree;
struct {
int hf_index;
gboolean data_value_descr_present;

File diff suppressed because it is too large Load Diff

View File

@ -174,8 +174,8 @@
/*--- End of included file: packet-p1-val.h ---*/
#line 30 "../../asn1/p1/packet-p1-template.h"
void p1_initialize_content_globals (proto_tree *tree, gboolean report_unknown_cont_type);
char* p1_get_last_oraddress(void);
void p1_initialize_content_globals (asn1_ctx_t* actx, proto_tree *tree, gboolean report_unknown_cont_type);
char* p1_get_last_oraddress(asn1_ctx_t* actx);
void dissect_p1_mts_apdu (tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree);
/*--- Included file: packet-p1-exp.h ---*/

View File

@ -53,7 +53,6 @@
static guint global_p7_tcp_port = 102;
static dissector_handle_t tpkt_handle;
static const char *object_identifier_id = NULL; /* attribute identifier */
static int seqno = 0;
static void prefs_register_p7(void); /* forward declaration for use in preferences registration */
@ -121,7 +120,7 @@ static int proto_p7 = -1;
#define ub_ua_restrictions 16
/*--- End of included file: packet-p7-val.h ---*/
#line 58 "../../asn1/p7/packet-p7-template.c"
#line 57 "../../asn1/p7/packet-p7-template.c"
/*--- Included file: packet-p7-hf.c ---*/
@ -493,7 +492,7 @@ static int hf_p7_T_entry_class_problem_entry_class_not_subscribed = -1;
static int hf_p7_T_entry_class_problem_inappropriate_entry_class = -1;
/*--- End of included file: packet-p7-hf.c ---*/
#line 60 "../../asn1/p7/packet-p7-template.c"
#line 59 "../../asn1/p7/packet-p7-template.c"
/* Initialize the subtree pointers */
static gint ett_p7 = -1;
@ -635,7 +634,7 @@ static gint ett_p7_RTSE_apdus = -1;
static gint ett_p7_RTABapdu = -1;
/*--- End of included file: packet-p7-ett.c ---*/
#line 64 "../../asn1/p7/packet-p7-template.c"
#line 63 "../../asn1/p7/packet-p7-template.c"
/*--- Included file: packet-p7-table.c ---*/
@ -678,7 +677,7 @@ static const value_string p7_err_code_string_vals[] = {
/*--- End of included file: packet-p7-table.c ---*/
#line 66 "../../asn1/p7/packet-p7-template.c"
#line 65 "../../asn1/p7/packet-p7-template.c"
/*--- Included file: packet-p7-fn.c ---*/
@ -694,7 +693,7 @@ static int dissect_p7_Filter(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int o
static int
dissect_p7_AttributeType(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
offset = dissect_ber_object_identifier_str(implicit_tag, actx, tree, tvb, offset, hf_index, &object_identifier_id);
offset = dissect_ber_object_identifier_str(implicit_tag, actx, tree, tvb, offset, hf_index, &actx->external.direct_reference);
return offset;
}
@ -703,8 +702,8 @@ dissect_p7_AttributeType(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offse
static int
dissect_p7_AttributeItem(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
if(object_identifier_id)
call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree);
if(actx->external.direct_reference)
call_ber_oid_callback(actx->external.direct_reference, tvb, offset, actx->pinfo, tree);
return offset;
@ -742,7 +741,7 @@ dissect_p7_Attribute(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U
static int
dissect_p7_AutoActionType(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
offset = dissect_ber_object_identifier_str(implicit_tag, actx, tree, tvb, offset, hf_index, &object_identifier_id);
offset = dissect_ber_object_identifier_str(implicit_tag, actx, tree, tvb, offset, hf_index, &actx->external.direct_reference);
return offset;
}
@ -761,8 +760,8 @@ dissect_p7_INTEGER_1_ub_per_auto_action(gboolean implicit_tag _U_, tvbuff_t *tvb
static int
dissect_p7_T_registration_parameter(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
if(object_identifier_id)
call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree);
if(actx->external.direct_reference)
call_ber_oid_callback(actx->external.direct_reference, tvb, offset, actx->pinfo, tree);
@ -800,8 +799,8 @@ dissect_p7_T_error_code(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset
static int
dissect_p7_T_error_parameter(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
if(object_identifier_id)
call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree);
if(actx->external.direct_reference)
call_ber_oid_callback(actx->external.direct_reference, tvb, offset, actx->pinfo, tree);
return offset;
@ -947,7 +946,7 @@ dissect_p7_T_initiator_name(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int of
offset = dissect_p1_ORAddressAndOrDirectoryName(implicit_tag, tvb, offset, actx, tree, hf_index);
if ((ora = p1_get_last_oraddress())) {
if ((ora = p1_get_last_oraddress(actx))) {
col_append_fstr(actx->pinfo->cinfo, COL_INFO, " (initiator=%s)", ora);
}
@ -1406,8 +1405,8 @@ dissect_p7_Range(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, a
static int
dissect_p7_T_attribute_value(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
if(object_identifier_id)
call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree);
if(actx->external.direct_reference)
call_ber_oid_callback(actx->external.direct_reference, tvb, offset, actx->pinfo, tree);
return offset;
@ -1432,8 +1431,8 @@ dissect_p7_AttributeValueAssertion(gboolean implicit_tag _U_, tvbuff_t *tvb _U_,
static int
dissect_p7_T_initial(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
if(object_identifier_id)
call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree);
if(actx->external.direct_reference)
call_ber_oid_callback(actx->external.direct_reference, tvb, offset, actx->pinfo, tree);
return offset;
@ -1443,8 +1442,8 @@ dissect_p7_T_initial(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U
static int
dissect_p7_T_any(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
if(object_identifier_id)
call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree);
if(actx->external.direct_reference)
call_ber_oid_callback(actx->external.direct_reference, tvb, offset, actx->pinfo, tree);
return offset;
@ -1454,8 +1453,8 @@ dissect_p7_T_any(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, a
static int
dissect_p7_T_final(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
if(object_identifier_id)
call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree);
if(actx->external.direct_reference)
call_ber_oid_callback(actx->external.direct_reference, tvb, offset, actx->pinfo, tree);
return offset;
@ -1517,8 +1516,8 @@ dissect_p7_T_substrings(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset
static int
dissect_p7_T_match_value(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
if(object_identifier_id)
call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree);
if(actx->external.direct_reference)
call_ber_oid_callback(actx->external.direct_reference, tvb, offset, actx->pinfo, tree);
return offset;
@ -1756,11 +1755,11 @@ static const ber_sequence_t EntryInformation_sequence[] = {
static int
dissect_p7_EntryInformation(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
p1_initialize_content_globals (NULL, FALSE);
p1_initialize_content_globals (actx, NULL, FALSE);
offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
EntryInformation_sequence, hf_index, ett_p7_EntryInformation);
p1_initialize_content_globals (NULL, FALSE);
p1_initialize_content_globals (actx, NULL, FALSE);
return offset;
@ -1886,8 +1885,8 @@ dissect_p7_Span(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, as
static int
dissect_p7_SummaryPresentItemValue(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
if(object_identifier_id)
call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree);
if(actx->external.direct_reference)
call_ber_oid_callback(actx->external.direct_reference, tvb, offset, actx->pinfo, tree);
return offset;
@ -2372,7 +2371,7 @@ dissect_p7_T_registrations(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int off
static int
dissect_p7_T_extended_registrations_item(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
/* XXX: Is this really the best way to do this? */
offset = dissect_ber_object_identifier_str(implicit_tag, actx, tree, tvb, offset, hf_index, &object_identifier_id);
offset = dissect_ber_object_identifier_str(implicit_tag, actx, tree, tvb, offset, hf_index, &actx->external.direct_reference);
return offset;
@ -2602,8 +2601,8 @@ dissect_p7_T_entries(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U
static int
dissect_p7_OrderedAttributeValue(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
if(object_identifier_id)
call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree);
if(actx->external.direct_reference)
call_ber_oid_callback(actx->external.direct_reference, tvb, offset, actx->pinfo, tree);
return offset;
@ -2687,11 +2686,11 @@ static const ber_sequence_t EntryModification_set[] = {
static int
dissect_p7_EntryModification(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
p1_initialize_content_globals (NULL, FALSE);
p1_initialize_content_globals (actx, NULL, FALSE);
offset = dissect_ber_set(implicit_tag, actx, tree, tvb, offset,
EntryModification_set, hf_index, ett_p7_EntryModification);
p1_initialize_content_globals (NULL, FALSE);
p1_initialize_content_globals (actx, NULL, FALSE);
return offset;
}
@ -2751,11 +2750,11 @@ static const ber_sequence_t MSMessageSubmissionArgument_sequence[] = {
static int
dissect_p7_MSMessageSubmissionArgument(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
p1_initialize_content_globals (tree, TRUE);
p1_initialize_content_globals (actx, tree, TRUE);
offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
MSMessageSubmissionArgument_sequence, hf_index, ett_p7_MSMessageSubmissionArgument);
p1_initialize_content_globals (NULL, FALSE);
p1_initialize_content_globals (actx, NULL, FALSE);
return offset;
@ -2892,8 +2891,8 @@ dissect_p7_AttributeProblem(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int of
static int
dissect_p7_T_attr_value(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
if(object_identifier_id)
call_ber_oid_callback(object_identifier_id, tvb, offset, actx->pinfo, tree);
if(actx->external.direct_reference)
call_ber_oid_callback(actx->external.direct_reference, tvb, offset, actx->pinfo, tree);
@ -4081,7 +4080,7 @@ static void dissect_RTSE_apdus_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, pr
/*--- End of included file: packet-p7-fn.c ---*/
#line 68 "../../asn1/p7/packet-p7-template.c"
#line 67 "../../asn1/p7/packet-p7-template.c"
/*--- Included file: packet-p7-table11.c ---*/
@ -4113,7 +4112,7 @@ static const ros_opr_t p7_opr_tab[] = {
/*--- End of included file: packet-p7-table11.c ---*/
#line 70 "../../asn1/p7/packet-p7-template.c"
#line 69 "../../asn1/p7/packet-p7-template.c"
/*--- Included file: packet-p7-table21.c ---*/
#line 1 "../../asn1/p7/packet-p7-table21.c"
@ -4152,7 +4151,7 @@ static const ros_err_t p7_err_tab[] = {
/*--- End of included file: packet-p7-table21.c ---*/
#line 71 "../../asn1/p7/packet-p7-template.c"
#line 70 "../../asn1/p7/packet-p7-template.c"
static const ros_info_t p7_ros_info = {
"P7",
@ -5632,7 +5631,7 @@ void proto_register_p7(void) {
NULL, HFILL }},
/*--- End of included file: packet-p7-hfarr.c ---*/
#line 90 "../../asn1/p7/packet-p7-template.c"
#line 89 "../../asn1/p7/packet-p7-template.c"
};
/* List of subtrees */
@ -5776,7 +5775,7 @@ void proto_register_p7(void) {
&ett_p7_RTABapdu,
/*--- End of included file: packet-p7-ettarr.c ---*/
#line 96 "../../asn1/p7/packet-p7-template.c"
#line 95 "../../asn1/p7/packet-p7-template.c"
};
module_t *p7_module;
@ -5835,7 +5834,7 @@ void proto_reg_handoff_p7(void) {
/*--- End of included file: packet-p7-dis-tab.c ---*/
#line 122 "../../asn1/p7/packet-p7-template.c"
#line 121 "../../asn1/p7/packet-p7-template.c"
/* APPLICATION CONTEXT */