More ASN.1...

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

More ASN.1...

Bruce Fitzsimons-2
I have a few more questions about the Erlang ASN.1 compiler/runtime.

Given an H.323 TransportAddress definition (used for addressing
packets'n'stuff, definition below) I can get packets decoded with items such
as:

{ipAddress,
    {'TransportAddress_ipAddress',
        [10,151,33,220],
        2634}},

However there doesn't seem to be any way of decoding/interpreting this
directly, inasmuch as there is no auto-generated record definition
'TransportAddress_ipAddress' (or for any of the other choices). This is
contrary to what I would have expected given that other choices do end up
with records for their sub-sequences (such as, for example, the RasMessage
choice - gives 'GatekeeperRequest' etc).

I feel I must be missing something fundamental. I can of course define a
record for myself, but I thought I should ask the question.

Thanks in advance

/Bruce

H323 ASN.1 definition:

TransportAddress ::= CHOICE
{
 ipAddress SEQUENCE
 {
  ip   OCTET STRING (SIZE(4)),
  port   INTEGER(0..65535)
 },
 ipSourceRoute SEQUENCE
 {
  ip   OCTET STRING (SIZE(4)),
  port   INTEGER(0..65535),
  route   SEQUENCE OF OCTET STRING (SIZE(4)),
  routing   CHOICE
  {
   strict NULL,
   loose NULL,
   ...
  },
  ...
 },
 ipxAddress SEQUENCE
 {
  node  OCTET STRING (SIZE(6)),
  netnum  OCTET STRING (SIZE(4)),
  port  OCTET STRING (SIZE(2))
 },
 ip6Address SEQUENCE
 {
  ip  OCTET STRING (SIZE(16)),
  port  INTEGER(0..65535),
  ...
 },
 netBios   OCTET STRING (SIZE(16)),
 nsap   OCTET STRING (SIZE(1..20)),
 nonStandardAddress NonStandardParameter,
 ...
}




Reply | Threaded
Open this post in threaded view
|

More ASN.1...

Bertil Karlsson-2
You are absolutely right! The asn1 compiler should have generated a
'TransportAddress_ipAddress' record, and so also for each SEQUENCE/SET
that is defined inside a "constructed type" (SEQUENCE, CHOICE, SET,
SEQUENCE OF, SET OF) like in:

MyType ::= CHOICE {
        a SEQUENCE {a INTEGER, b INTEGER}
}

This will result in a record 'MyType_a'.

Due to a bug in the compiler no record is generated for a SEQUENCE in a
CHOICE that has extensionmarks, like in:
MyType2 ::= CHOICE {
        a SEQUENCE {a INTEGER, b INTEGER},
        ...
}
The TransportAddress is a CHOICE with an extension mark.

There will be a fix of this bug in the next release.
Maybe the easiest workaround is to define missing records by hand.

Bruce Fitzsimons wrote:

>
> I have a few more questions about the Erlang ASN.1 compiler/runtime.
>
> Given an H.323 TransportAddress definition (used for addressing
> packets'n'stuff, definition below) I can get packets decoded with items such
> as:
>
> {ipAddress,
>     {'TransportAddress_ipAddress',
>         [10,151,33,220],
>         2634}},
>
> However there doesn't seem to be any way of decoding/interpreting this
> directly, inasmuch as there is no auto-generated record definition
> 'TransportAddress_ipAddress' (or for any of the other choices). This is
> contrary to what I would have expected given that other choices do end up
> with records for their sub-sequences (such as, for example, the RasMessage
> choice - gives 'GatekeeperRequest' etc).
>
> I feel I must be missing something fundamental. I can of course define a
> record for myself, but I thought I should ask the question.
>
> Thanks in advance
>
> /Bruce
>
> H323 ASN.1 definition:
>
> TransportAddress ::= CHOICE
> {
>  ipAddress SEQUENCE
>  {
>   ip   OCTET STRING (SIZE(4)),
>   port   INTEGER(0..65535)
>  },
>  ipSourceRoute SEQUENCE
>  {
>   ip   OCTET STRING (SIZE(4)),
>   port   INTEGER(0..65535),
>   route   SEQUENCE OF OCTET STRING (SIZE(4)),
>   routing   CHOICE
>   {
>    strict NULL,
>    loose NULL,
>    ...
>   },
>   ...
>  },
>  ipxAddress SEQUENCE
>  {
>   node  OCTET STRING (SIZE(6)),
>   netnum  OCTET STRING (SIZE(4)),
>   port  OCTET STRING (SIZE(2))
>  },
>  ip6Address SEQUENCE
>  {
>   ip  OCTET STRING (SIZE(16)),
>   port  INTEGER(0..65535),
>   ...
>  },
>  netBios   OCTET STRING (SIZE(16)),
>  nsap   OCTET STRING (SIZE(1..20)),
>  nonStandardAddress NonStandardParameter,
>  ...
> }

--
/ Bertil Karlsson


Reply | Threaded
Open this post in threaded view
|

More ASN.1...

Bruce Fitzsimons-2
Thanks Bertil, its good to know how it supposed to work. It should be even
easier to do H.323 in the next release.

Thanks again,
Bruce

----- Original Message -----
From: "Bertil Karlsson" <bertil.karlsson>
To: <erlang-questions>
Sent: Tuesday, November 26, 2002 1:27 AM
Subject: Re: More ASN.1...


> You are absolutely right! The asn1 compiler should have generated a
> 'TransportAddress_ipAddress' record, and so also for each SEQUENCE/SET
> that is defined inside a "constructed type" (SEQUENCE, CHOICE, SET,
> SEQUENCE OF, SET OF) like in:
>
> MyType ::= CHOICE {
> a SEQUENCE {a INTEGER, b INTEGER}
> }
>
> This will result in a record 'MyType_a'.
>
> Due to a bug in the compiler no record is generated for a SEQUENCE in a
> CHOICE that has extensionmarks, like in:
> MyType2 ::= CHOICE {
> a SEQUENCE {a INTEGER, b INTEGER},
> ...
> }
> The TransportAddress is a CHOICE with an extension mark.
>
> There will be a fix of this bug in the next release.
> Maybe the easiest workaround is to define missing records by hand.
>
> Bruce Fitzsimons wrote:
> >
> > I have a few more questions about the Erlang ASN.1 compiler/runtime.
> >
> > Given an H.323 TransportAddress definition (used for addressing
> > packets'n'stuff, definition below) I can get packets decoded with items
such

> > as:
> >
> > {ipAddress,
> >     {'TransportAddress_ipAddress',
> >         [10,151,33,220],
> >         2634}},
> >
> > However there doesn't seem to be any way of decoding/interpreting this
> > directly, inasmuch as there is no auto-generated record definition
> > 'TransportAddress_ipAddress' (or for any of the other choices). This is
> > contrary to what I would have expected given that other choices do end
up
> > with records for their sub-sequences (such as, for example, the
RasMessage

> > choice - gives 'GatekeeperRequest' etc).
> >
> > I feel I must be missing something fundamental. I can of course define a
> > record for myself, but I thought I should ask the question.
> >
> > Thanks in advance
> >
> > /Bruce
> >
> > H323 ASN.1 definition:
> >
> > TransportAddress ::= CHOICE
> > {
> >  ipAddress SEQUENCE
> >  {
> >   ip   OCTET STRING (SIZE(4)),
> >   port   INTEGER(0..65535)
> >  },
> >  ipSourceRoute SEQUENCE
> >  {
> >   ip   OCTET STRING (SIZE(4)),
> >   port   INTEGER(0..65535),
> >   route   SEQUENCE OF OCTET STRING (SIZE(4)),
> >   routing   CHOICE
> >   {
> >    strict NULL,
> >    loose NULL,
> >    ...
> >   },
> >   ...
> >  },
> >  ipxAddress SEQUENCE
> >  {
> >   node  OCTET STRING (SIZE(6)),
> >   netnum  OCTET STRING (SIZE(4)),
> >   port  OCTET STRING (SIZE(2))
> >  },
> >  ip6Address SEQUENCE
> >  {
> >   ip  OCTET STRING (SIZE(16)),
> >   port  INTEGER(0..65535),
> >   ...
> >  },
> >  netBios   OCTET STRING (SIZE(16)),
> >  nsap   OCTET STRING (SIZE(1..20)),
> >  nonStandardAddress NonStandardParameter,
> >  ...
> > }
>
> --
> / Bertil Karlsson