]> git.saurik.com Git - apple/security.git/blame - SecuritySNACCRuntime/c++-examples/any/README
Security-54.1.7.tar.gz
[apple/security.git] / SecuritySNACCRuntime / c++-examples / any / README
CommitLineData
bac41a7b
A
1(RCS control information is at the end of this file.)
2
3
4C++ ANY example README
5---------------------
6
7This example shows how the snacc compiler handles the ANY DEFINED BY
8type in C++. ANY types (not ANY DEFINED BY) require modifications
9to the generated code. Type "make" to build this example.
10
11This directory should have the following 4 files in it:
12
13 README
14 example.C
15 genber.C
16 makefile
17
18There are 3 programs generated by the makefile:
19
20 genber - builds a BER value of the AnyTestType and writes it
21 to a file called "att.ber"
22
23 def - takes file name of an AnyTestType BER value. Decodes the
24 file and re-encodes it to stdout. Uses definite
25 lengths for constructed values.
26
27 indef - takes file name of an AnyTestType BER value. Decodes the
28 file and re-encodes it to stdout. Uses indefinite
29 lengths for constructed values.
30
31
32These files use the code generated by snacc from the
33snacc/asn1specs/any.asn1 file. (see the makefile)
34
35Look at genber.C to see how values can be built and printed.
36
37Look at the generated code in any_test.C and any_test.h to see how the
38any hash table is built.
39
40
41try the following commands in your c-shell:
42
43%1 genber # generate the att.ber file
44%2 indef att.ber > tmp.ber # decode att.ber an re-encode into tmp.ber
45%3 def tmp.ber > tmp2.ber # decode tmp.ber an re-encode into tmp2.ber
46%4 diff att.ber tmp2.ber # compare .ber files (should be the same)
47
48When you are finished with the example type "make clean" to remove
49the binaries and generated code.
50
51
52
53Things To Note
54--------------
55
56Snacc ASN.1 comment commands
57
58In the snacc/asn1specs/any.asn1 file, the AnyTestType has a special
59"--snacc" ASN.1 comment after ::= to give snacc some extra information
60about the AnyTestType.
61
62AnyTestType ::= --snacc isPdu:"TRUE" -- SEQUENCE { ... etc. ... }
63
64The "isPdu" flag only affects the generated C code, not C++. Each
65C++ type gets PDU methods by default.
66
67
68SNMP OBJECT-TYPE Macro
69
70The SNMP OBJECT-TYPE macro is used to define the id value to type
71mapping for ANY DEFINED BY types. The macro has been modified to
72accept both INTEGERs and OBJECT IDENTIFIERs as id values (see
73snacc/asn1specs/any.asn1). This macro can be used with other
74protocols to define the id to type mapping.
75
76Two hash tables are used to hold the id to type mappings. One for
77INTEGER to type mappings and the other for OBJECT IDENTIFIER to type
78mappings. The hash tables are automatically initialized in each
79module that has OBJECT-TYPE macros. In C the hash table must be
80explicitly initialized.
81
82#-------------------------------------------------------------------------------
a66d0d4a 83# $Header: /cvs/root/Security/SecuritySNACCRuntime/c++-examples/any/Attic/README,v 1.1.1.1 2001/05/18 23:14:05 mb Exp $
bac41a7b
A
84# $Log: README,v $
85# Revision 1.1.1.1 2001/05/18 23:14:05 mb
86# Move from private repository to open source repository
87#
88# Revision 1.1.1.1 1999/03/16 18:05:57 aram
89# Originals from SMIME Free Library.
90#
91# Revision 1.2 1997/02/16 20:25:26 rj
92# check-in of a few cosmetic changes
93#
94# Revision 1.1 1994/08/31 08:47:59 rj
95# first check-in. for a list of changes to the snacc-1.1 distribution please refer to the ChangeLog.
96#