ASN1 Private Constructor
Sean Hinde
sean.hinde@REDACTED
Wed Apr 7 23:49:12 CEST 2004
Perfect, Thank you.
I just completed a horrible handraulic decoder which I can now happily
throw away and replace with a nice clean asn.1 source file :-)
Cheers,
Sean
On 7 Apr 2004, at 22:18, Kenneth Lundin wrote:
> Hi,
>
>
>
> You use IMPLICIT TAGS to get a private tag without an universal tag
> for a SEQUENCE.
>
>
>
> Example
>
>
>
> S DEFINITIONS IMPLICIT TAGS::=
>
> BEGIN
>
> S ::= [PRIVATE 1 ] SEQUENCE {
>
> a INTEGER,
>
> b BOOLEAN
>
> }
>
>
>
>
>
> END
>
>
>
> Note!, another way than the IMPLICIT TAGS as default on all tags
> defined in the module is to define
>
> The type S like this (in a module with any tagdefault).
>
>
>
> S::= [PRIVATE 1] IMPLICIT SEQUENCE { ….
>
>
>
> 6> asn1ct:compile("S").
>
> Erlang ASN.1 version "1.4.2" compiling "S.asn"
>
> Compiler Options: []
>
> --{generated,"S.asn1db"}--
>
> --{generated,"S.hrl"}--
>
> --{generated,"S.erl"}--
>
> ok
>
>
>
>
>
> …
>
> 9> 'S':encode('S',{'S',1,true}).
>
> {ok,[225,6,2,1,1,1,1,255]}
>
>
>
> 225 = Tag E1, (actually the tag is CONSTRUCTED,PRIVATE,TAGVALUE=1)
>
> 6 = length
>
> 2 = Tag UNIVERSAL 2 -> INTEGER
>
> 1 = length
>
> 1= Integervalue
>
> 1= Tag UNIVERSAL 1 -> BOOLEAN
>
> 1= length
>
> 255 = Boolean value which means ‘TRUE’
>
>
>
> /Kenneth Lundin
>
>
>
>
More information about the erlang-questions
mailing list