SNACC(1) | General Commands Manual | SNACC(1) |
snacc - ASN.1 to C, C++ or type table Compiler
snacc [-h] [-P] [-t] [-e] [-d] [-p] [-f]
[-c | -C | -idl | -T <table output file>]
[-u <useful types ASN.1 file>]
[-mf <max file name len>]
[-l <neg number>]
[-meta] [-tcl <module.type>]
[-novolat]
<ASN.1 file list>
Snacc (Sample Neufeld Asn.1 to C/C++ Compiler) generates C or C++ source code for BER encode and decode routines as well as print and free routines for each type in the given ASN.1 modules. Alternatively, snacc can produce type tables that can be used for table based/interpreted encoding and decoding. The type table based methods tend to be slower than their C or C++ counterparts but they usually use less memory (table size vs. C/C++ object code).
Most of the 1990 ASN.1 features are parsed although some do not affect the generated code. Fairly rigourous error checking is performed on the ASN.1 source; any errors detected will be reported (printed to stderr).
Each file in the ASN.1 file list should contain a complete ASN.1 module. ASN.1 modules that use the IMPORTS feature must be compiled together (specify all necessary modules in the ASN.1 file list). The generated source files will include each module's header file in the command line order. This makes it important to order the modules from least dependent to most dependent on the command line to avoid type ordering problems. Currently, snacc assumes that each ASN.1 file given on the command line depends on all of the others on the command line. No attempt is made to only include the header files from modules referenced in the import list for that module.
If the target language is C, snacc will generate a .h and .c file for each specified ASN.1 module. If the target language is C++, snacc will generate a .h and .C file for each module. The generated file names will be derived from the module names.
If none of the -t, -v, -e, -d, -p, or -f options are given on the command line, snacc assumes that all of them are in effect. They do not affect type table generation.
Snacc has problems with the following case:
Foo ::= SEQUENCE {
id IdType,
val ANY DEFINED BY id } IdType ::= CHOICE {
a INTEGER,
b OBJECT IDENTIFIER }
The hashing code used for handling ANY DEFINED BY id to type mappings will encounter problems if the hash table goes more than four levels deep (I think this is unlikely). To fix this just add linear chaining at fourth level.
Please send bug reports or comments to Robert Joop <rj@rainbow.in-berlin.de>. See the documentation about reporting bugs and (lack of) support.
Copyright (c) 1993 Mike Sample and the University of British
Columbia
Copyright (c) 1994 1995 Robert Joop and GMD Fokus.
Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies.
Permission is granted to copy and distribute modified versions of this manual under the conditions for verbatim copying, provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one.
The snacc compiler is released under the GNU General Public License. The runtime libraries are no longer under the GNU Library General Public License. The generated code is yours.
Snacc was written by Mike Sample at the University of British Columbia (UBC). He used it as a tool to do encoding/decoding performance research.
It was augmented by Robert Joop at GMD Fokus with the help of some of its project partners.
This work was made possible by grants from the Canadian Institute for Telecommunications Research (CITR) and Natural Sciences and Engineering Research Council of Canada (NSERC).
11 July 1993 |