Wireshark-dev: Re: [Wireshark-dev] Asn1 question
From: Anders Broman (AL/EAB) [mailto:anders.broman@xxxxxxxxxxxx]
Sent: Thursday, May 31, 2007 1:24 PM
To: Kukosa, Tomas
Subject: Asn1 question
Hi,
In inap the
following asn1 is used:
EXTENSION ::= CLASS
{
&id
ExtensionType UNIQUE,
&Type OPTIONAL,
&absent &Type OPTIONAL,
&criticality Criticality DEFAULT
ignored
}
WITH SYNTAX {
[EXTENSION-SYNTAX
&Type
[IF ABSENT
&absent]]
[CRITICALITY
&criticality]
IDENTIFIED BY
&id
}
ExtensionType ::= INTEGER(0..MAX)
Criticality ::= ENUMERATED {ignored(0), abort(1)}
ExtensionField{EXTENSION:ChosenFrom} ::= SEQUENCE
{
type
EXTENSION.&id({ChosenFrom}),
criticality Criticality DEFAULT ignored,
value [1]
EXTENSION.&Type({ChosenFrom}{@type})
}
In the current inap.asn this is translated to:
Extensions ::= SEQUENCE SIZE (1..10) OF
SEQUENCE
{
type INTEGER,
criticality ENUMERATED {
ignore (0),
abort (1)} DEFAULT ignore ,
value [1] IMPLICIT OCTET STRING
}
Asn2wrs translates it to:
static const ber_sequence_t
Extensions_item_sequence[] = {
{
&hf_inap_type ,
BER_CLASS_UNI, BER_UNI_TAG_INTEGER, BER_FLAGS_NOOWNTAG, dissect_inap_INTEGER
},
{
&hf_inap_criticality , BER_CLASS_UNI,
BER_UNI_TAG_ENUMERATED, BER_FLAGS_OPTIONAL|BER_FLAGS_NOOWNTAG,
dissect_inap_T_criticality },
{
&hf_inap_value ,
BER_CLASS_CON, 1, BER_FLAGS_IMPLTAG, dissect_inap_OCTET_STRING },
{ NULL, 0, 0, 0, NULL }
};
static int
dissect_inap_Extensions_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_) {
offset = dissect_ber_sequence(implicit_tag,
actx, tree, tvb, offset,
Extensions_item_sequence, hf_index, ett_inap_Extensions_item);
return offset;
}
static const ber_sequence_t Extensions_sequence_of[1]
= {
{ &hf_inap_Extensions_item,
BER_CLASS_UNI, BER_UNI_TAG_SEQUENCE, BER_FLAGS_NOOWNTAG,
dissect_inap_Extensions_item },
};
static int
dissect_inap_Extensions(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_sequence_of(implicit_tag,
actx, tree, tvb, offset,
Extensions_sequence_of, hf_index, ett_inap_Extensions);
return offset;
}
Which looks OK but I'm wondering about the OPTIONAL in the original statements does that mean that that value should be OPTIONAL?
Regards
Anders
- Follow-Ups:
- Re: [Wireshark-dev] Asn1 question
- From: Anders Broman
- Re: [Wireshark-dev] Asn1 question
- Prev by Date: Re: [Wireshark-dev] help needed in tracking down a bug in SSL dissector
- Next by Date: Re: [Wireshark-dev] Parallel Redundancy Protocol (PRP) dissector
- Previous by thread: Re: [Wireshark-dev] help needed in tracking down a bug in SSL dissector
- Next by thread: Re: [Wireshark-dev] Asn1 question
- Index(es):