Wireshark-dev: Re: [Wireshark-dev] Asn1 question
From: "Anders Broman" <a.broman@xxxxxxxxx>
Date: Fri, 1 Jun 2007 21:58:57 +0200
Title: Asn1 question

Hi,

I’m unsure, it looks like a bigger job as well and I don’t have any CS2 – CS4 traces.

Is there an interest in updating the inap dissector to CS4?

Regards

Anders


Från: wireshark-dev-bounces@xxxxxxxxxxxxx [mailto:wireshark-dev-bounces@xxxxxxxxxxxxx] För Kukosa, Tomas
Skickat: den 1 juni 2007 09:18
Till: Anders Broman (AL/EAB); Developer support list for Wireshark
Ämne: Re: [Wireshark-dev] Asn1 question

 

Hi,

 

BTW I have found that it is not optional in later specifications (Capability Set 2-4)

 

If I undestand it well later Capbility Sets are supersets of previous ones, i.e. it would be enough to implement CS-4 (Q.1248.x).

Am I right?

 

Regards,

  Tomas

 

 


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