]> git.saurik.com Git - apple/security.git/blob - SecuritySNACCRuntime/asn1specs/tbl.asn1
Security-54.1.tar.gz
[apple/security.git] / SecuritySNACCRuntime / asn1specs / tbl.asn1
1 -- .../asn1specs/tbl.asn1
2 --
3 -- TBL types describe ASN.1 data structures.
4 -- These can be used in generic, interpretive encoders/decoders.
5 -- Interpretive decoders are typically slower, but don't eat memory
6 -- with type-specific encoding and decoding code.
7 -- The tbl types can also be sent over the network
8 -- and allow dynamic re-configuration of encoders/decoders.
9 --
10 -- To understand how this type table structure is used
11 -- look in:
12 -- 1. .../compiler/core/gen-tbls.c
13 -- this will show you how various things are generated
14 -- from the big parse tree (asn1module.asn1).
15 -- Pay particular attention to the typeDefId use
16 --
17 -- 2. look in .../c-lib/makefile for an example of how you can
18 -- modify the tbl.h file generated from this module to suit
19 -- your own needs.
20 --
21 -- 3. look in .../tbl-tools/ptbl/pasn1.c to see how the
22 -- TBL data struct relates to the original ASN.1
23 --
24 --
25 --
26 -- Mike Sample, April 11, 1992
27 -- Mods MS Feb 7/93
28 --
29 -- $Header: /cvs/Darwin/Security/SecuritySNACCRuntime/asn1specs/tbl.asn1,v 1.1.1.1 2001/05/18 23:14:05 mb Exp $
30 -- $Log: tbl.asn1,v $
31 -- Revision 1.1.1.1 2001/05/18 23:14:05 mb
32 -- Move from private repository to open source repository
33 --
34 -- Revision 1.1.1.1 1999/03/16 18:05:56 aram
35 -- Originals from SMIME Free Library.
36 --
37 -- Revision 1.5 1997/06/19 09:17:13 wan
38 -- Added isPdu flag to tables. Added value range checks during parsing.
39 --
40 -- Revision 1.4 1997/05/07 15:18:33 wan
41 -- Added (limited) size constraints, bitstring and enumeration names to tables
42 --
43 -- Revision 1.3 1995/07/25 19:56:00 rj
44 -- introductory comments adjusted to match changed file names.
45 --
46 -- changed `_' to `-' in file names.
47 --
48 -- Revision 1.2 1994/08/28 09:54:18 rj
49 -- comment leader fixed.
50 --
51 -- Revision 1.1 1994/08/28 09:51:14 rj
52 -- first check-in.
53
54 TBL DEFINITIONS ::=
55 BEGIN
56
57
58 -- imports nothing
59 -- exports nothing
60
61 TBL ::= --snacc isPdu:"TRUE" -- SEQUENCE
62 {
63 totalNumModules INTEGER, -- these totals can help allocation
64 totalNumTypeDefs INTEGER, -- when decoding (ie use arrays)
65 totalNumTypes INTEGER,
66 totalNumTags INTEGER,
67 totalNumStrings INTEGER,
68 totalLenStrings INTEGER,
69 modules SEQUENCE OF TBLModule
70 }
71
72 TBLModule ::= SEQUENCE
73 {
74 name [0] IMPLICIT PrintableString,
75 id [1] IMPLICIT OBJECT IDENTIFIER OPTIONAL,
76 isUseful [2] IMPLICIT BOOLEAN, -- true if useful types module
77 typeDefs [3] IMPLICIT SEQUENCE OF TBLTypeDef
78 }
79
80 --
81 -- The typedefId is just an integer that uniquely identifies
82 -- each TBLTypeDef (type references use these as "pointers").
83 -- The typeDefId's in each module will have consecutive type ids.
84 -- The first typedef in a module will have the lowest Id and the
85 -- last typedef will have the highest. Thus if the first typedef
86 -- in a module has the id of 12 and the last typedef in that module
87 -- has the id of 27, the module contains the typdefs in the range
88 -- 12..27 (inclusive). This can be used to re-compute the
89 -- IMPORT information for modules in a type table.
90 --
91 -- (The LoadTBL routine hides this integer/ptr crap from the user
92 -- by adding real pointers to the tbl.h data structures where useful.
93 -- When loading, the typeDefIds are converted into these real ptrs)
94 --
95 TBLTypeDef ::= SEQUENCE
96 {
97 typeDefId TBLTypeDefId,
98 typeName PrintableString, -- OPTIONAL, I have forgotten why this is opt!
99 -- I can see no good reason for it
100 type TBLType,
101 isPdu NULL OPTIONAL
102 }
103
104 TBLType ::= SEQUENCE
105 {
106 typeId [0] IMPLICIT TBLTypeId,
107 optional [1] IMPLICIT BOOLEAN,
108 tagList [2] IMPLICIT SEQUENCE OF TBLTag OPTIONAL,
109 content [3] TBLTypeContent,
110 fieldName [4] IMPLICIT PrintableString OPTIONAL,
111 constraint[5] IMPLICIT TBLRange OPTIONAL,
112 values [6] IMPLICIT TBLNamedNumberList OPTIONAL
113 }
114
115 TBLRange ::= SEQUENCE
116 {
117 from [0] IMPLICIT INTEGER,
118 to [1] IMPLICIT INTEGER
119 }
120
121 TBLNamedNumberList ::= SEQUENCE OF TBLNamedNumber
122
123 TBLNamedNumber ::= SEQUENCE
124 {
125 name [0] IMPLICIT PrintableString,
126 value [1] IMPLICIT INTEGER
127 }
128
129 TBLTypeContent ::= CHOICE
130 {
131 primType [0] IMPLICIT NULL,
132 elmts [1] IMPLICIT SEQUENCE OF TBLType,
133 typeRef [2] IMPLICIT TBLTypeRef
134 }
135
136 TBLTypeRef ::= SEQUENCE
137 {
138 typeDef TBLTypeDefId,
139 implicit BOOLEAN
140 }
141
142 TBLTypeId ::= ENUMERATED
143 {
144 tbl-boolean (0),
145 tbl-integer (1),
146 tbl-bitstring (2),
147 tbl-octetstring (3),
148 tbl-null (4),
149 tbl-oid (5),
150 tbl-real (6),
151 tbl-enumerated (7),
152 tbl-sequence (8),
153 tbl-set (9),
154 tbl-sequenceof (10),
155 tbl-setof (11),
156 tbl-choice (12),
157 tbl-typeref (13)
158 }
159
160 TBLTypeDefId ::= INTEGER
161
162 TBLTag ::= SEQUENCE
163 {
164 tclass TBLTagClass,
165 code INTEGER (0..MAX)
166 }
167
168 TBLTagClass ::= ENUMERATED { universal (0), application (1),
169 context (2), private (3) }
170
171 END