[comp.protocols.iso] Declaring bounded arrays of bytes

schmidt@indetech.com (Douglas C. Schmidt) (10/06/90)

Hi,

	I've got a quick ASN.1 question that I hope someone can answer for me.
I'm trying to define a bounded array of OCTETs using ASN.1 syntax and I wonder
if the following is the ``correct'' way to accomplish this:

----------------------------------------
Foo DEFINITIONS ::=
BEGIN
	Version-number ::= SEQUENCE SIZE (5) OF OCTET
END
----------------------------------------

In other words, Version-number defines a type that represents a chunk of space
5 OCTETs in length.  Are there other ways of accomplishing the same thing?

	Thanks,
	
		Doug

-- 
____*_  Douglas C. Schmidt          schmidt@indetech.com
\  / /  Independence Technologies   {sun,sharkey,pacbell}!indetech!schmidt
 \/ /   42705 Lawrence Place        FAX: 415 438-2034
  \/    Fremont, CA 94538           Voice: 415 438-2023

j.onions@computer-science.nottingham.ac.uk (Julian Onions) (10/08/90)

> 	I've got a quick ASN.1 question that I hope someone can answer for me.
> I'm trying to define a bounded array of OCTETs using ASN.1 syntax and I wonde
r
> if the following is the ``correct'' way to accomplish this:
> 
> ----------------------------------------
> Foo DEFINITIONS ::=
> BEGIN
> 	Version-number ::= SEQUENCE SIZE (5) OF OCTET
> END
> ----------------------------------------
Nope

Firstly there is no such thing as OCTET defined in ASN.1 - OCTET
STRING is probably what you meant. In any case, and OCTET STRING is
defined as is a string of characters. This means the corrected above
would be a sequence of 5 strings - each string of arbitrary length. I
think what you want is something more like

	VersionNumber ::= OCTET STRING (SIZE (1..5))
 
This says VersionNumber is an OCTET STRING of between 0 and 6
characters long.

Hope this helps.
Julian.

jpo@computer-science.nottingham.ac.uk (Julian Onions) (10/10/90)

One fixes the array at 5 - the other allows from 1 to 5 elements.

Julian.