| 1 |
snacc ASN.1 Compiler Release 1.1 - (updated Jul 93) |
| 2 |
----------------------------------------------------- |
| 3 |
|
| 4 |
This package provides the C/yacc/lex source code for snacc, an ASN.1 |
| 5 |
to C or C++ compiler. Snacc is short for "Sample Neufeld Asn.1 to C |
| 6 |
Compiler" and ASN.1 stands for Abstract Syntax Notation One (CCITT |
| 7 |
X.208/ ISO 8824). See the COPYRIGHT file for copyright information. |
| 8 |
|
| 9 |
|
| 10 |
What It Does |
| 11 |
------------ |
| 12 |
|
| 13 |
Given an ASN.1 source file(s) snacc can produce: |
| 14 |
|
| 15 |
1. C routines for BER encoding, decoding, printing and freeing. |
| 16 |
2. C++ routines for BER encoding, decoding, and printing. |
| 17 |
3. A type table that can be used with C driver routines |
| 18 |
for BER encoding, decoding, printing and freeing. |
| 19 |
4. if you are really lucky, a core dump! :) |
| 20 |
|
| 21 |
Snacc produces reasonably efficient C or C++ routines and data |
| 22 |
structures to support BER encoding and decoding values of the given |
| 23 |
ASN.1 data structures. Printing routines for the decoded values are |
| 24 |
also generated. For C only, hierarchical freeing routines are |
| 25 |
generated (but are not recommended for efficiency reasons). |
| 26 |
|
| 27 |
When using the C or C++ (not table) options, snacc creates the |
| 28 |
following C files for each ASN.1 source file (module): |
| 29 |
|
| 30 |
1. .h file for the C/C++ translation of the ASN.1 data |
| 31 |
structure and prototypes for the generated routines. |
| 32 |
|
| 33 |
2. .c/.C file for the C/C++ encode, decode, print and free |
| 34 |
routines. |
| 35 |
|
| 36 |
When using the table option, snacc produces a type table file |
| 37 |
(a BER encoding) that can later be loaded at runtime by the |
| 38 |
table driven encoding and decoding routines. |
| 39 |
|
| 40 |
See the latex or PostScript version of the documentation in the |
| 41 |
snacc/doc directory for indepth information on this tool. For a quick |
| 42 |
introduction, look at the examples in snacc/c_examples, |
| 43 |
snacc/c++_examples and snacc/tbl_example. |
| 44 |
|
| 45 |
|
| 46 |
Features of ASN.1 Supported |
| 47 |
--------------------------- |
| 48 |
|
| 49 |
- parses ASN.1 '90 (subtype notation etc.) |
| 50 |
- macro definitions do not generate syntax errors but are |
| 51 |
are not processed. (retained as string) |
| 52 |
- value notation is parsed and for OBJECT IDENTIFIERs, INTEGERs |
| 53 |
and BOOLEANS (any other value in { }'s is currently kept as a string) |
| 54 |
- handles multiple ASN.1 module compiling/linking (IMPORTS/EXPORTS) |
| 55 |
- some X.400 and SNMP macros are parsed |
| 56 |
- supports ";" separted type or value definitions in the ASN.1 source. |
| 57 |
This is useful when dealing with some macros that introduce parsing |
| 58 |
problems. Does not require the ";"'s though. |
| 59 |
- ANY DEFINED BY types are handled using the SNMP OBJECT-TYPE |
| 60 |
macro to define the identifier to type mapping. |
| 61 |
|
| 62 |
|
| 63 |
Bugs are still quite likely even though this is the second release of |
| 64 |
snacc. if you find any or have other comments please email: |
| 65 |
[email protected] |
| 66 |
|
| 67 |
|
| 68 |
To Install It |
| 69 |
------------- |
| 70 |
|
| 71 |
By default, the snacc makefile uses GNU bison and GNU flex (instead of |
| 72 |
yacc and lex). If you do not have these installed, see the |
| 73 |
snacc/src/README and snacc/src/makefile. Otherwise, type "make" in |
| 74 |
this directory. Hopefully this will put the snacc binary in the |
| 75 |
snacc/bin directory and build the C runtime library, the table library |
| 76 |
and the table tools. Alternatively, type "make all" to install these |
| 77 |
and the C++ library. |
| 78 |
|
| 79 |
Compiling problems may occurr on different flavours of UNIX but they |
| 80 |
should not be too difficult fix. Likely sources of problems include |
| 81 |
non-standard include files and lex, yacc and cc idiosyncrasies. |
| 82 |
If your yacc croaks with a message about too many productions use |
| 83 |
bison. Same thing with lex -> use flex. Bison and flex are both |
| 84 |
freely available from numerous ftp sites. (even cs.ubc.ca in /mirror2/gnu) |
| 85 |
|
| 86 |
The snacc compiler and the generated code will compile under ANSI and |
| 87 |
non-ANSI C compilers. See the README and the makefile in the |
| 88 |
snacc/src directory for more compiling information. Snacc has been |
| 89 |
successfully installed on Sun SPARCs, HP700s, IBM RS 6000s, MIPS, |
| 90 |
i486/Linux, and many other machines. |
| 91 |
|