On Wed, 28 November 2001, "Bujji krishna R B" wrote:

> 
> Hello,
>        I have a doubt regarding the  PER encoding of Information Object
> Values.
> 
> 
> FUNCTION ::= CLASS {
> 
>       &ArgumentType,
>       &ResultType DEFAULT NULL,
>       &Errors ERROR NULL,
>       &Code INTEGER UNIQUE -- ERROR should be &code
> }
> 
> The Above definition of FUNCTION is from the ASN.1 book by Olivier
> Dubission.
> 
> funct1  FUNCTION ::= {
>       &ArgumentType SEQUENCE {a INTEGER, b INTEGER},
>       &ResultType INTEGER,
>       &Code 1
> }
> 
> funct2 FUNCTION ::= {
>       &ArgumentType CHOICE {a INTEGER, b INTEGER},
>       &ResultType INTEGER,
>       &Code 2
> }
> 
> MyFunction{FUNCTION:funct } ::= SEQUENCE { -- ERROR should be Funct
>       opcode FUNCTION.&Code({funct}),
>       argument FUNCTION.&ArgumentType({funct} {@Opcode})
> }
> 
> 
> Is it true that argument field in MyFunction is encoded as an OpenType (ie)
> Length encoding followed by the encoding of either SEQUENCE or INTEGER
> depending on Opcode.

Yes, MyFunction is an open type.

> 
> So Can I rewrite MyFunction as follows
> 
> MyFunction ::= SEQUENCE {
>       opcode INTEGER,
>       argument OCTET STRING
> }
>

No, I certainly hope not!

Assuming an object-set,

Funct FUNCTION ::= {func1 | func2}

you could re-write two specific instances of MyFunction,

MyFunction-1 ::= SEQUENCE {
  code  INTEGER(1),
  argument SEQUENCE { a INTEGER, b INTEGER }
}

and

MyFunction-2 ::= SEQUENCE {
  code  INTEGER(2),
  argument CHOICE { a INTEGER, b INTEGER }
}

I assume that the compiler will be smart enough to encode such values according to 
these re-written types no matter what encoding rules are chosen.

Ladies and Gentlemen of the jury?

Patrick
 
> 
> Thanks
> krishna


Find the best deals on the web at AltaVista Shopping!
http://www.shopping.altavista.com

Reply via email to