Before you start compiling your applications using the OSS ASN.1 command-line compiler or ASN.1 Studio, it's important to understand the following topics:
Compiler command-line options begin with a dash ("-"). Options are not case-sensitive and you can use mixed case; however, the specified name must be different from the name of the option. Note that if two command-line options contradict each other (for example, if -headerFile and -noHeaderFile are both present), the compiler will use the last option specified.
NOTE: Starting with version 9.0, by default, the OSS ASN.1 compiler generates TOED files instead of SOED files. The following command lines are equivalent:
The examples below show alternative ways to invoke the compiler:
In this example, the second invocation assumes the default file extension .asn and uses an abbreviated form of the command-line option.
In this example, the first invocation creates an output listing filename input2.lst after compiling the contents of input1.asn and input2.asn. By default, output filenames are derived from the last input filename. The second invocation creates an output listing filenamed myFile.lst after compiling the contents of input1.asn and input2.asn. Note that the last command-line option, myFile, does not start with a dash ("-") because it is the operand of the -listingFile option which precedes it.
Certain keywords accept operands; however, keyword operands cannot start with a dash.
When you specify input filenames on the command line, consider the following:
With ASN.1 Studio you can easily check any ASN.1 syntax, create, edit, and view ASN.1 messages using its intuitive user interface.
You can generate C code from the input ASN.1 syntax and add your own code that implements your application business logic. Then you can export your ASN.1 Studio project to an ASN.1 compiler command-line file, a Visual Studio project, a makefile, or a shell script.
For a detailed description about how to work with ASN.1 Studio, see the Welcome page that appears when ASN.1 Studio is launched. The page includes links for easy access to the most frequently used ASN.1 Studio Help pages, sample projects, project management operations, and to various online resources.
The following restrictions apply to the ASN.1 input:
The maximum number of bytes in a line of an ASN.1 input file is 4096.
The maximum number of bytes in an input item (an identifier, a type, value, or module reference, a bstring, a cstring or a hstring) is 1024.
To enable support for INTEGERs that have a maximum size of 4096 bytes, you must use the ASN1.HugeInteger or OSS.HUGE directive. Depending on the platform, the size of an INTEGER is 2, 4, or 8 bytes.
The OSS ASN.1 compiler interprets MAX or MIN in a constraint on an INTEGER type as the maximum or minimum value of an int in C for the target platform, which is a 4-byte integer on most machines. To extend an integer into an 8-byte integer range, specify the actual values in the constraint rather than using MAX or MIN. For example:
A ::= INTEGER (0..MAX) -- this will become an unsigned int B ::= INTEGER (MIN..30) -- this will become an int C ::= INTEGER (-1..3422147483647) -- this will become a long long
Although the ASN.1 compiler supports the syntax of open ended value range constraint on REAL types, the runtime libraries will not enforce open ended value range constraints using the less than sign ("<") on REAL types. The less than sign is ignored.
To enable support for open ended constraints, use the EXCEPT clause. For example:
A ::= REAL (0<..MAX) B ::= REAL (100 <..< 1000)
A ::= REAL ((0..MAX) EXCEPT 0) B ::= REAL ((100 <..< 1000) EXCEPT (100 | 1000))
ASN.1 Value Notation encoding rules (AVN) are currently supported by the TOED runtime only. The -avn compiler option is not compatible with the -soed option.
This documentation applies to the OSS® ASN.1 Tools for C release 11.1 and later.
Copyright © 2022 OSS Nokalva, Inc. All rights reserved.
No part of this publication may be reproduced, stored in a retrieval system, or transmitted in any form or by any means electronic, mechanical, photocopying, recording or otherwise, without the prior permission of OSS Nokalva, Inc.
Every distributed copy of the OSS® ASN.1 Tools for C is associated with a specific license and related unique license number. That license determines, among other things, what functions of the OSS ASN.1 Tools for C are available to you.