You cannot create dynamic length fields as you are doing here. But if you are using BER encoding, they are not necessary because the length is built into the encoded string. So
> numColumns Length, -- [Line 23] > columnNames SEQUENCE SIZE(numColumns) OF String -- [Line 24] can be replaced with: > columnNames SEQUENCE OF String and you will be able to determine the length and contents from the encoded data. Regards, Ed Day Objective Systems, Inc. Tel: +1 (484) 875-3020 Fax: +1 (484) 875-2913 Toll-free: (877) 307-6855 (USA only) mailto:[EMAIL PROTECTED] http://www.obj-sys.com ----- Original Message ----- From: "Sven Oliver Moll" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, August 30, 2002 12:12 PM Subject: [ASN.1] Need help in ASN.1 definition > Hello! > > For my diploma thesis I need to specify a rather simple format for > replicating data from one SQL Server to another. I want to write the > definition in ASN.1. Right now I got this far: > > IMEX DEFINITIONS ::= > BEGIN > > > DataStream ::= SEQUENCE > { > streamHeader OCTET STRING("SOM1"), > tableDump SEQUENCE OF TableDump DEFAULT {}, > StreamEnd > } > > TableDump ::= SEQUENCE > { > header TableHeader, > data SEQUENCE OF TableData DEFAULT {} > } > > TableHeader ::= SEQUENCE > { > identifier INTEGER(2..4), > tablename String, > numColumns Length, -- [Line 23] > columnNames SEQUENCE SIZE(numColumns) OF String -- [Line 24] > } > > TableData ::= SEQUENCE > { > idenitfier INTEGER(1), > columnData SEQUENCE SIZE(numColumns) OF String -- [Line 30] > } > > String ::= SEQUENCE > { > numChars Length, -- [Line 35] > data OCTET STRING (SIZE(numChars)) -- [Line 36] > } > > Length ::= INTEGER(0..2147483647) > > StreamEnd ::= INTEGER(0) > > > END > > > Checking it with snacc I get the errors: > line 24: ERROR - value "numberColumns" is referenced but not defined or > imported. > line 30: ERROR - value "numberColumns" is referenced but not defined or > imported. > line 36: ERROR - value "numChars" is referenced but not defined or imported. > > How do I reference > - numChars from line 36 to line 35 > and > - numColumns from line 30 and line 24 to line 23 > ? > > The other problem I have is the following: > even if I get numChars for the String referenced, to seperate the NULL value > from the empty String I increment numChars with 1 if it's not a NULL value. > How do I get _that_ in SIZE clause of data? > > > Greetings from Germany & winke: o/~ > SvOlli > -- > _______ > ( /\ | > __)v\/lli a.k.a. | Bring the beat back! > Sven Oliver Moll | -- The KLF, "Justified & Ancient" > >
