]>
Commit | Line | Data |
---|---|---|
bac41a7b A |
1 | (RCS control information is at the end of this file.) |
2 | ||
3 | ||
4 | Table encoder/decoder example README - MS 93 | |
5 | ------------------------------------ | |
6 | ||
7 | This directory contains an example that shows: | |
8 | ||
9 | 1. the process of creating and using tables. | |
10 | 2. examples of decoding, printing, and encoding. | |
11 | ||
12 | ||
13 | To dive right in just type "make" in this directory. That will | |
14 | create the "example" executable (you should have previously installed | |
15 | the snacc and mkchdr progs and the table library). | |
16 | ||
17 | Then type: | |
18 | ||
19 | make check | |
20 | ||
21 | and see what happens. Look in example.c and makefile to see how things | |
22 | work. | |
23 | ||
24 | ||
25 | ||
26 | Questions and Answers | |
27 | --------------------- | |
28 | ||
29 | Q. What is a table? (also refered to a type table or type tree) | |
30 | ||
31 | A. A table is simply a data structure that holds a description of | |
32 | the types from an ASN.1 module. This table can then be used | |
33 | by a number of "generic" routines to do ASN.1 related (BER | |
34 | encoding/decoding) or other useful things such as printing | |
35 | values, freeing values and whatever else you can dream up. | |
36 | ||
37 | ||
38 | Q. How do I create a table from my ASN.1 source files? | |
39 | ||
40 | A. Run snacc with the -T option, e.g.: | |
41 | ||
42 | snacc -T mytbls.tt myMod1.asn1 myMod2.asn1 | |
43 | ||
44 | the above command will create the "mytbls.tt" file that | |
45 | holds the descriptions of the ASN.1 types in the "myMod1.asn1" | |
46 | and "myMod2.asn1" files. (look in the makefile in this directory) | |
47 | ||
48 | ||
49 | Q. Why is there only a C interface to tables? | |
50 | ||
51 | A. Time. Tables drivers create/read/free these types | |
52 | without having seen a typedef for them. The C implementation | |
53 | uses some assumptions about how structures etc. are allocated | |
54 | and accessed. With C++ this is much more difficult. It can | |
55 | be done but required more time than I had. | |
56 | ||
57 | ||
58 | Q. Ok, tables sound great, what's the catch? | |
59 | ||
60 | A. Well, | |
61 | ||
62 | 1. table driven encoding and decoding is something like | |
63 | 4 times slower than the C or C++ version. | |
64 | (but tables are *way* smaller than the .o's for the compiled approach) | |
65 | 2. the ANY DEFINED BY stuff is not supported at all. | |
66 | 3. subtype information is not included in the tables (time crunch again) | |
67 | (PER encoders/decoders will need the subtype info) | |
68 | 4. Values from the ASN.1 source are not included in the table. | |
69 | ||
70 | If you have the time and skills, you can fix 2, 3 and 4. 1 is harder. | |
71 | ||
72 | ||
73 | ||
74 | Q. Tell me more. | |
75 | ||
76 | A. Look at the manual. (in .../doc/) | |
77 | ||
78 | #------------------------------------------------------------------------------- | |
a66d0d4a | 79 | # $Header: /cvs/root/Security/SecuritySNACCRuntime/tbl-example/Attic/README,v 1.1.1.1 2001/05/18 23:14:10 mb Exp $ |
bac41a7b A |
80 | # $Log: README,v $ |
81 | # Revision 1.1.1.1 2001/05/18 23:14:10 mb | |
82 | # Move from private repository to open source repository | |
83 | # | |
84 | # Revision 1.1.1.1 1999/03/16 18:06:54 aram | |
85 | # Originals from SMIME Free Library. | |
86 | # | |
87 | # Revision 1.1 1997/02/15 19:33:24 rj | |
88 | # first check-in | |
89 | # |