diff options
author | Stig Bjørlykke <stig@bjorlykke.org> | 2007-09-04 21:46:41 +0000 |
---|---|---|
committer | Stig Bjørlykke <stig@bjorlykke.org> | 2007-09-04 21:46:41 +0000 |
commit | 6e948358486a265c3ce7f5438159e5a622305543 (patch) | |
tree | 48b15e5b32d1e9042c61f105d0aae93d36a057c4 /epan/dissectors/packet-dop.c | |
parent | b3521c5975cd4fe04b3be3b354e8769daf3f5d7c (diff) |
Rewrote handling of parameters to get rid of "funky" oid strings.
Added expert info for unknown binding-parameters.
svn path=/trunk/; revision=22786
Diffstat (limited to 'epan/dissectors/packet-dop.c')
-rw-r--r-- | epan/dissectors/packet-dop.c | 91 |
1 files changed, 56 insertions, 35 deletions
diff --git a/epan/dissectors/packet-dop.c b/epan/dissectors/packet-dop.c index bc76091968..4433cab043 100644 --- a/epan/dissectors/packet-dop.c +++ b/epan/dissectors/packet-dop.c @@ -74,7 +74,7 @@ int proto_dop = -1; static struct SESSION_DATA_STRUCTURE* session = NULL; static const char *binding_type = NULL; /* binding_type */ -static int call_dop_oid_callback(char *base_oid, tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, char *col_info); +static int call_dop_oid_callback(char *base_string, tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, char *col_info); /*--- Included file: packet-dop-hf.c ---*/ @@ -274,6 +274,7 @@ static int hf_dop_GrantsAndDenials_denyInvoke = -1; /* Initialize the subtree pointers */ static gint ett_dop = -1; +static gint ett_dop_unknown = -1; /*--- Included file: packet-dop-ett.c ---*/ #line 1 "packet-dop-ett.c" @@ -346,7 +347,10 @@ static gint ett_dop_T_basicLevels = -1; static gint ett_dop_GrantsAndDenials = -1; /*--- End of included file: packet-dop-ett.c ---*/ -#line 76 "packet-dop-template.c" +#line 77 "packet-dop-template.c" + +/* Dissector table */ +static dissector_table_t dop_dissector_table; static void append_oid(packet_info *pinfo, const char *oid) { @@ -723,7 +727,7 @@ static int dissect_dop_EstablishSymmetric(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 108 "dop.cnf" - offset = call_dop_oid_callback("dop.establish.symmetric", tvb, offset, actx->pinfo, tree, "symmetric"); + offset = call_dop_oid_callback("establish.symmetric", tvb, offset, actx->pinfo, tree, "symmetric"); @@ -739,7 +743,7 @@ static int dissect_dop_EstablishRoleAInitiates(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 112 "dop.cnf" - offset = call_dop_oid_callback("dop.establish.rolea", tvb, offset, actx->pinfo, tree, "roleA"); + offset = call_dop_oid_callback("establish.rolea", tvb, offset, actx->pinfo, tree, "roleA"); @@ -755,7 +759,7 @@ static int dissect_dop_EstablishRoleBInitiates(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 116 "dop.cnf" - offset = call_dop_oid_callback("dop.establish.roleb", tvb, offset, actx->pinfo, tree, "roleB"); + offset = call_dop_oid_callback("establish.roleb", tvb, offset, actx->pinfo, tree, "roleB"); @@ -798,7 +802,7 @@ static int dissect_dop_T_agreement(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 144 "dop.cnf" - offset = call_dop_oid_callback("dop.agreement", tvb, offset, actx->pinfo, tree, NULL); + offset = call_dop_oid_callback("agreement", tvb, offset, actx->pinfo, tree, NULL); @@ -1056,7 +1060,7 @@ static int dissect_dop_T_symmetric(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 148 "dop.cnf" - offset = call_dop_oid_callback("dop.establish.symmetric", tvb, offset, actx->pinfo, tree, "symmetric"); + offset = call_dop_oid_callback("establish.symmetric", tvb, offset, actx->pinfo, tree, "symmetric"); @@ -1072,7 +1076,7 @@ static int dissect_dop_T_roleA_replies(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 152 "dop.cnf" - offset = call_dop_oid_callback("dop.establish.rolea", tvb, offset, actx->pinfo, tree, "roleA"); + offset = call_dop_oid_callback("establish.rolea", tvb, offset, actx->pinfo, tree, "roleA"); @@ -1088,7 +1092,7 @@ static int dissect_dop_T_roleB_replies(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 156 "dop.cnf" - offset = call_dop_oid_callback("dop.establish.roleb", tvb, offset, actx->pinfo, tree, "roleB"); + offset = call_dop_oid_callback("establish.roleb", tvb, offset, actx->pinfo, tree, "roleB"); @@ -1168,7 +1172,7 @@ static int dissect_dop_ModifySymmetric(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 120 "dop.cnf" - offset = call_dop_oid_callback("dop.modify.symmetric", tvb, offset, actx->pinfo, tree, "symmetric"); + offset = call_dop_oid_callback("modify.symmetric", tvb, offset, actx->pinfo, tree, "symmetric"); @@ -1184,7 +1188,7 @@ static int dissect_dop_ModifyRoleAInitiates(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 124 "dop.cnf" - offset = call_dop_oid_callback("dop.modify.rolea", tvb, offset, actx->pinfo, tree, "roleA"); + offset = call_dop_oid_callback("modify.rolea", tvb, offset, actx->pinfo, tree, "roleA"); @@ -1200,7 +1204,7 @@ static int dissect_dop_ModifyRoleBInitiates(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 128 "dop.cnf" - offset = call_dop_oid_callback("dop.modify.roleb", tvb, offset, actx->pinfo, tree, "roleB"); + offset = call_dop_oid_callback("modify.roleb", tvb, offset, actx->pinfo, tree, "roleB"); @@ -1243,7 +1247,7 @@ static int dissect_dop_ArgumentNewAgreement(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 168 "dop.cnf" - offset = call_dop_oid_callback("dop.agreement", tvb, offset, actx->pinfo, tree, NULL); + offset = call_dop_oid_callback("agreement", tvb, offset, actx->pinfo, tree, NULL); @@ -1328,7 +1332,7 @@ static int dissect_dop_ResultNewAgreement(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 164 "dop.cnf" - offset = call_dop_oid_callback("dop.agreement", tvb, offset, actx->pinfo, tree, NULL); + offset = call_dop_oid_callback("agreement", tvb, offset, actx->pinfo, tree, NULL); @@ -1409,7 +1413,7 @@ static int dissect_dop_TerminateSymmetric(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 132 "dop.cnf" - offset = call_dop_oid_callback("dop.terminate.symmetric", tvb, offset, actx->pinfo, tree, "symmetric"); + offset = call_dop_oid_callback("terminate.symmetric", tvb, offset, actx->pinfo, tree, "symmetric"); @@ -1425,7 +1429,7 @@ static int dissect_dop_TerminateRoleAInitiates(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 136 "dop.cnf" - offset = call_dop_oid_callback("dop.terminate.rolea", tvb, offset, actx->pinfo, tree, "roleA"); + offset = call_dop_oid_callback("terminate.rolea", tvb, offset, actx->pinfo, tree, "roleA"); @@ -1441,7 +1445,7 @@ static int dissect_dop_TerminateRoleBInitiates(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 140 "dop.cnf" - offset = call_dop_oid_callback("dop.terminate.roleb", tvb, offset, actx->pinfo, tree, "roleB"); + offset = call_dop_oid_callback("terminate.roleb", tvb, offset, actx->pinfo, tree, "roleB"); @@ -1641,7 +1645,7 @@ static int dissect_dop_T_agreementProposal(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 160 "dop.cnf" - offset = call_dop_oid_callback("dop.agreement", tvb, offset, actx->pinfo, tree, NULL); + offset = call_dop_oid_callback("agreement", tvb, offset, actx->pinfo, tree, NULL); @@ -2441,19 +2445,33 @@ static void dissect_ACIItem_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto /*--- End of included file: packet-dop-fn.c ---*/ -#line 88 "packet-dop-template.c" +#line 92 "packet-dop-template.c" static int -call_dop_oid_callback(char *base_oid, tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, char *col_info) +call_dop_oid_callback(char *base_string, tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, char *col_info) { char* binding_param; - binding_param = ep_strdup_printf("%s.%s", base_oid, binding_type ? binding_type : ""); + binding_param = ep_strdup_printf("%s.%s", base_string, binding_type ? binding_type : ""); if (col_info && (check_col(pinfo->cinfo, COL_INFO))) col_append_fstr(pinfo->cinfo, COL_INFO, " %s", col_info); - return call_ber_oid_callback(binding_param, tvb, offset, pinfo, tree); + if (dissector_try_string(dop_dissector_table, binding_param, tvb, pinfo, tree)) { + offset += tvb_length_remaining (tvb, offset); + } 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 parameter %s OID:%s not implemented. Contact Wireshark developers if you want this supported", base_string, binding_type ? binding_type : "<empty>"); + if (item) { + next_tree = proto_item_add_subtree(item, ett_dop_unknown); + } + offset = dissect_unknown_ber(pinfo, tvb, offset, next_tree); + expert_add_info_format(pinfo, item, PI_UNDECODED, PI_WARN, "Unknown binding-parameter"); + } + + return offset; } @@ -3344,12 +3362,13 @@ void proto_register_dop(void) { "", HFILL }}, /*--- End of included file: packet-dop-hfarr.c ---*/ -#line 234 "packet-dop-template.c" +#line 252 "packet-dop-template.c" }; /* List of subtrees */ static gint *ett[] = { &ett_dop, + &ett_dop_unknown, /*--- Included file: packet-dop-ettarr.c ---*/ #line 1 "packet-dop-ettarr.c" @@ -3422,7 +3441,7 @@ void proto_register_dop(void) { &ett_dop_GrantsAndDenials, /*--- End of included file: packet-dop-ettarr.c ---*/ -#line 240 "packet-dop-template.c" +#line 259 "packet-dop-template.c" }; module_t *dop_module; @@ -3432,6 +3451,8 @@ void proto_register_dop(void) { register_dissector("dop", dissect_dop, proto_dop); + dop_dissector_table = register_dissector_table("dop.oid", "DOP OID Dissectors", FT_STRING, BASE_NONE); + /* Register fields and subtrees */ proto_register_field_array(proto_dop, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); @@ -3464,23 +3485,23 @@ void proto_reg_handoff_dop(void) { register_ber_oid_dissector("2.5.12.5", dissect_SupplierInformation_PDU, proto_dop, "id-doa-supplierKnowledge"); register_ber_oid_dissector("2.5.12.6", dissect_ConsumerInformation_PDU, proto_dop, "id-doa-consumerKnowledge"); register_ber_oid_dissector("2.5.12.7", dissect_SupplierAndConsumers_PDU, proto_dop, "id-doa-secondaryShadows"); - register_ber_oid_dissector("dop.agreement.2.5.19.2", dissect_HierarchicalAgreement_PDU, proto_dop, "hierarchical-agreement"); - register_ber_oid_dissector("dop.establish.rolea.2.5.19.2", dissect_SuperiorToSubordinate_PDU, proto_dop, "hierarchical-establish-rolea"); - register_ber_oid_dissector("dop.modify.rolea.2.5.19.2", dissect_SuperiorToSubordinateModification_PDU, proto_dop, "hierarchical-modify-rolea"); - register_ber_oid_dissector("dop.establish.roleb.2.5.19.2", dissect_SubordinateToSuperior_PDU, proto_dop, "hierarchical-establish-roleb"); - register_ber_oid_dissector("dop.modify.roleb.2.5.19.2", dissect_SubordinateToSuperior_PDU, proto_dop, "hierarchical-modify-roleb"); - register_ber_oid_dissector("dop.agreement.2.5.19.3", dissect_NonSpecificHierarchicalAgreement_PDU, proto_dop, "non-specific-hierarchical-agreement"); - register_ber_oid_dissector("dop.establish.rolea.2.5.19.3", dissect_NHOBSuperiorToSubordinate_PDU, proto_dop, "non-specific-hierarchical-establish-rolea"); - register_ber_oid_dissector("dop.modify.rolea.2.5.19.3", dissect_NHOBSuperiorToSubordinate_PDU, proto_dop, "non-specific-hierarchical-modify-rolea"); - register_ber_oid_dissector("dop.establish.roleb.2.5.19.3", dissect_NHOBSubordinateToSuperior_PDU, proto_dop, "non-specific-hierarchical-establish-roleb"); - register_ber_oid_dissector("dop.modify.roleb.2.5.19.3", dissect_NHOBSubordinateToSuperior_PDU, proto_dop, "non-specific-hierarchical-modify-roleb"); + dissector_add_string("dop.oid", "agreement.2.5.19.2", create_dissector_handle(dissect_HierarchicalAgreement_PDU, proto_dop)); + dissector_add_string("dop.oid", "establish.rolea.2.5.19.2", create_dissector_handle(dissect_SuperiorToSubordinate_PDU, proto_dop)); + dissector_add_string("dop.oid", "modify.rolea.2.5.19.2", create_dissector_handle(dissect_SuperiorToSubordinateModification_PDU, proto_dop)); + dissector_add_string("dop.oid", "establish.roleb.2.5.19.2", create_dissector_handle(dissect_SubordinateToSuperior_PDU, proto_dop)); + dissector_add_string("dop.oid", "modify.roleb.2.5.19.2", create_dissector_handle(dissect_SubordinateToSuperior_PDU, proto_dop)); + dissector_add_string("dop.oid", "agreement.2.5.19.3", create_dissector_handle(dissect_NonSpecificHierarchicalAgreement_PDU, proto_dop)); + dissector_add_string("dop.oid", "establish.rolea.2.5.19.3", create_dissector_handle(dissect_NHOBSuperiorToSubordinate_PDU, proto_dop)); + dissector_add_string("dop.oid", "modify.rolea.2.5.19.3", create_dissector_handle(dissect_NHOBSuperiorToSubordinate_PDU, proto_dop)); + dissector_add_string("dop.oid", "establish.roleb.2.5.19.3", create_dissector_handle(dissect_NHOBSubordinateToSuperior_PDU, proto_dop)); + dissector_add_string("dop.oid", "modify.roleb.2.5.19.3", create_dissector_handle(dissect_NHOBSubordinateToSuperior_PDU, proto_dop)); register_ber_oid_dissector("2.5.24.4", dissect_ACIItem_PDU, proto_dop, "id-aca-prescriptiveACI"); register_ber_oid_dissector("2.5.24.5", dissect_ACIItem_PDU, proto_dop, "id-aca-entryACI"); register_ber_oid_dissector("2.5.24.6", dissect_ACIItem_PDU, proto_dop, "id-aca-subentryACI"); /*--- End of included file: packet-dop-dis-tab.c ---*/ -#line 275 "packet-dop-template.c" +#line 296 "packet-dop-template.c" /* APPLICATION CONTEXT */ add_oid_str_name("2.5.3.3", "id-ac-directory-operational-binding-management"); |