diff options
author | Ronnie Sahlberg <ronnie_sahlberg@ozemail.com.au> | 2004-10-29 12:11:42 +0000 |
---|---|---|
committer | Ronnie Sahlberg <ronnie_sahlberg@ozemail.com.au> | 2004-10-29 12:11:42 +0000 |
commit | b2160d6d259568a69e411d1e7af689b30a3ea7a7 (patch) | |
tree | 26818d081beb1e352fa062cbeecd1600841aaeb0 /asn1/cms/packet-cms-template.c | |
parent | 076d4710ecb611008ca83c42b422e8ed1745726c (diff) |
update to cms to use workaround to lack of ANY and reducing the template significantly
svn path=/trunk/; revision=12434
Diffstat (limited to 'asn1/cms/packet-cms-template.c')
-rw-r--r-- | asn1/cms/packet-cms-template.c | 123 |
1 files changed, 1 insertions, 122 deletions
diff --git a/asn1/cms/packet-cms-template.c b/asn1/cms/packet-cms-template.c index 600b0b004e..86d478fd14 100644 --- a/asn1/cms/packet-cms-template.c +++ b/asn1/cms/packet-cms-template.c @@ -44,128 +44,17 @@ /* Initialize the protocol and registered fields */ int proto_cms = -1; -static int hf_cms_keyAttr_id = -1; static int hf_cms_ci_contentType = -1; -static int hf_cms_eci_eContentType = -1; #include "packet-cms-hf.c" /* Initialize the subtree pointers */ -static gint ett_cms_ContentInfo = -1; #include "packet-cms-ett.c" -static int dissect_cms_OtherKeyAttribute(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index); - +static char object_identifier_id[64]; /*64 chars should be long enough? */ #include "packet-cms-fn.c" -static char keyAttr_id[64]; /*64 chars should be long enough? */ -static int -dissect_keyAttrId(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) -{ - offset = dissect_ber_object_identifier(FALSE, pinfo, tree, tvb, offset, - hf_cms_keyAttr_id, keyAttr_id); - return offset; -} - -static int -dissect_keyAttr_type(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) -{ - offset=call_ber_oid_callback(keyAttr_id, tvb, offset, pinfo, tree); - - return offset; -} - -static const ber_sequence OtherKeyAttribute_sequence[] = { - { BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_NOOWNTAG, dissect_keyAttrId }, - { BER_CLASS_ANY, 0, 0, dissect_keyAttr_type }, - { 0, 0, 0, NULL } -}; - -static int -dissect_cms_OtherKeyAttribute(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree, int hf_index) { - offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset, - OtherKeyAttribute_sequence, hf_index, ett_cms_OtherKeyAttribute); - - return offset; -} - - - -/* ContentInfo can not yet be handled by the compiler */ -static char ci_contentType[64]; /*64 chars should be long enough? */ -static int -dissect_hf_cms_contentType(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) -{ - offset = dissect_ber_object_identifier(FALSE, pinfo, tree, tvb, offset, - hf_cms_ci_contentType, ci_contentType); - return offset; -} -static int -dissect_hf_cms_contentType_content(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) -{ - offset=call_ber_oid_callback(ci_contentType, tvb, offset, pinfo, tree); - - return offset; -} - -static const ber_sequence ContentInfo_sequence[] = { - { BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_NOOWNTAG, dissect_hf_cms_contentType }, - { BER_CLASS_ANY, 0, 0, dissect_hf_cms_contentType_content }, - { 0, 0, 0, NULL } -}; - -int -dissect_cms_ContentInfo(gboolean implicit_tag, tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, int hf_index) { - offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset, - ContentInfo_sequence, hf_index, ett_cms_ContentInfo); - - return offset; -} - - -/* Do the same thing for EncapsulatedContentInfo */ -static char eci_eContentType[64]; /*64 chars should be long enough? */ -static int -dissect_hf_cms_eContentType(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) -{ - offset = dissect_ber_object_identifier(FALSE, pinfo, tree, tvb, offset, - hf_cms_eci_eContentType, eci_eContentType); - return offset; -} -static int -dissect_hf_cms_eContentType_content(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset) -{ - guint8 class; - gboolean pc, ind; - guint32 tag, len; - int pdu_offset = offset; - - /* XXX Do we care about printing out the octet string? */ - offset = dissect_cms_OCTET_STRING(FALSE, tvb, offset, pinfo, tree, hf_cms_eContent); - - pdu_offset = get_ber_identifier(tvb, pdu_offset, &class, &pc, &tag); - pdu_offset = get_ber_length(tvb, pdu_offset, &len, &ind); - pdu_offset = call_ber_oid_callback(eci_eContentType, tvb, pdu_offset, pinfo, tree); - - return offset; -} - -static const ber_sequence EncapsulatedContentInfo_sequence[] = { - { BER_CLASS_UNI, BER_UNI_TAG_OID, BER_FLAGS_NOOWNTAG, dissect_hf_cms_eContentType }, - { BER_CLASS_CON, 0, BER_FLAGS_OPTIONAL, dissect_hf_cms_eContentType_content }, - { 0, 0, 0, NULL } -}; - -int -dissect_cms_EncapsulatedContentInfo(gboolean implicit_tag, tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, int hf_index) { - offset = dissect_ber_sequence(implicit_tag, pinfo, tree, tvb, offset, - EncapsulatedContentInfo_sequence, hf_index, ett_cms_EncapsulatedContentInfo); - - return offset; -} - - /*--- proto_register_cms ----------------------------------------------*/ void proto_register_cms(void) { @@ -175,21 +64,11 @@ void proto_register_cms(void) { { "contentType", "cms.contentInfo.contentType", FT_STRING, BASE_NONE, NULL, 0, "ContentType", HFILL }}, - { &hf_cms_eci_eContentType, - { "eContentType", "cms.encapContentInfo.eContentType", - FT_STRING, BASE_NONE, NULL, 0, - "EncapsulatedContentType", HFILL }}, - { &hf_cms_keyAttr_id, - { "keyAttr_id", "cms.keyAttr_id", - FT_STRING, BASE_NONE, NULL, 0, - "keyAttr_id", HFILL }}, #include "packet-cms-hfarr.c" }; /* List of subtrees */ static gint *ett[] = { - &ett_cms_ContentInfo, - &ett_cms_EncapsulatedContentInfo, #include "packet-cms-ettarr.c" }; |