]> git.saurik.com Git - apple/security.git/blob - SecuritySNACCRuntime/asn1specs/asn1module.asn1
Security-54.1.tar.gz
[apple/security.git] / SecuritySNACCRuntime / asn1specs / asn1module.asn1
1 -- file: .../asn1specs/asn1module.asn1
2 --
3 -- This module describes the data structure used to reprsent the
4 -- compiled ASN.1.
5 -- Using ASN.1 for the internal data structure allows writing
6 -- (encoding) to disk for storage (not done yet due to recursive
7 -- refs back to the module)
8 --
9 -- Mike Sample 91/08/29
10 -- Modifed 92/05 MS
11 --
12 -- $Header: /cvs/Darwin/Security/SecuritySNACCRuntime/asn1specs/asn1module.asn1,v 1.1.1.1 2001/05/18 23:14:05 mb Exp $
13 -- $Log: asn1module.asn1,v $
14 -- Revision 1.1.1.1 2001/05/18 23:14:05 mb
15 -- Move from private repository to open source repository
16 --
17 -- Revision 1.1.1.1 1999/03/16 18:05:55 aram
18 -- Originals from SMIME Free Library.
19 --
20 -- Revision 1.3 1995/07/25 20:04:04 rj
21 -- data structures added for idl backend.
22 --
23 -- Revision 1.2 1994/08/28 09:54:16 rj
24 -- comment leader fixed.
25 --
26 -- Revision 1.1 1994/08/28 09:51:11 rj
27 -- first check-in.
28
29 Asn1Module DEFINITIONS IMPLICIT TAGS ::=
30 BEGIN
31
32
33 -- exports everything
34 -- imports nothing
35
36
37 Modules ::= [APPLICATION 0] IMPLICIT SEQUENCE
38 {
39 creationTime INTEGER,
40 modules ModuleList
41 }
42
43 ModuleList ::= SEQUENCE OF Module
44
45
46 Module ::= SEQUENCE
47 {
48 status ENUMERATED { mod-ok(0), mod-not-linked(1), mod-error(2) },
49 modId ModuleId,
50 tagDefault ENUMERATED { explicit-tags(0), implicit-tags(1) },
51 exportStatus ENUMERATED { exports-all(0), exports-nothing(1),
52 exports-some(2) },
53 imports ImportModuleList,
54 typeDefs TypeDefList,
55 valueDefs ValueDefList,
56 hasAnys BOOLEAN,
57
58 asn1SrcFileName MyString,
59 cHdrFileName MyString,
60 cSrcFileName MyString,
61 cxxHdrFileName MyString,
62 cxxSrcFileName MyString,
63
64 dbHdrFileName MyString, -- IBM-ENC
65 dbSrcFileName MyString, -- IBM-ENC
66
67 cxxname MyString, -- META
68
69 idlFileName MyString, -- IDL
70 idlname MyString -- IDL
71 }
72
73
74 ModuleId ::= SEQUENCE
75 {
76 name MyString,
77 oid OBJECT IDENTIFIER OPTIONAL --snacc cTypeName:"OID" isPtr:"TRUE"
78 }
79
80
81 ImportModuleList ::= SEQUENCE OF ImportModule
82
83
84 ImportModule ::= SEQUENCE
85 {
86 modId ModuleId,
87 importElmts ImportElmtList,
88 moduleRef Module, --snacc isEncDec:"FALSE"
89 lineNo INTEGER
90 }
91
92
93 ImportElmtList ::= SEQUENCE OF ImportElmt
94
95
96 ImportElmt ::= SEQUENCE
97 {
98 resolvedRef CHOICE
99 {
100 type [0] TypeDef, -- not encoded
101 value [1] ValueDef -- not encoded
102 } OPTIONAL,
103 name MyString,
104 privateScope BOOLEAN, -- true if from MODNAME.TYPE ref
105 lineNo INTEGER
106 }
107
108 TypeDefList ::= SEQUENCE OF TypeDef
109
110 OidOrInt ::= CHOICE
111 {
112 oid OBJECT IDENTIFIER,
113 intId INTEGER
114 }
115
116 AnyRef ::= SEQUENCE
117 {
118 anyIdName MyString,
119 id OidOrInt
120 }
121
122 AnyRefList ::= SEQUENCE OF AnyRef
123
124 TypeDef ::= SEQUENCE
125 {
126 exported BOOLEAN,
127 recursive BOOLEAN,
128 isPdu BOOLEAN,
129 localRefCount INTEGER,
130 importRefCount INTEGER,
131 tmpRefCount INTEGER,
132 visited BOOLEAN,
133 definedName MyString,
134 type Type,
135 cTypeDefInfo CTDI,
136 cxxTypeDefInfo CxxTDI,
137 attrList AttributeList,
138 refList TypeDefList,
139 anyRefs AnyRefList
140 }
141
142
143 Tag ::= SEQUENCE
144 {
145 tclass INTEGER, -- swap this for the BER_CLASS enum from basetypes.h
146 form INTEGER, -- swap this for the BER_FORM enum
147 code INTEGER,
148 explicit BOOLEAN,
149 valueRef Value
150 }
151
152 Type ::= SEQUENCE
153 {
154 optional BOOLEAN,
155 implicit BOOLEAN,
156 tags TagList,
157 defaultVal [0] IMPLICIT NamedValue OPTIONAL,
158 subtypes [1] Subtype OPTIONAL,
159 basicType [2] BasicType,
160 lineNo INTEGER,
161 cTypeRefInfo CTRI,
162 cxxTypeRefInfo CxxTRI,
163 attrList AttributeList
164 }
165
166 TagList ::= SEQUENCE OF Tag
167
168 AttributeList ::= SEQUENCE OF MyString
169
170 NamedNumberList ::= ValueDefList
171
172
173 -- BasicTypes with NULL need no more info that which type it is
174 -- (this is known from the choice id)
175
176 BasicType ::= CHOICE
177 {
178 unknown [0] IMPLICIT NULL,
179 boolean [1] IMPLICIT NULL,
180 integer [2] IMPLICIT NamedNumberList,
181 bitString [3] IMPLICIT NamedNumberList,
182 octetString [4] IMPLICIT NULL,
183 null [5] IMPLICIT NULL,
184 oid [6] IMPLICIT NULL,
185 real [7] IMPLICIT NULL,
186 enumerated [8] IMPLICIT NamedNumberList,
187 sequence [9] IMPLICIT NamedTypeList,
188 sequenceOf [10] IMPLICIT Type,
189 set [11] IMPLICIT NamedTypeList,
190 setOf [12] IMPLICIT Type,
191 choice [13] IMPLICIT NamedTypeList,
192 selection [14] IMPLICIT SelectionType,
193 componentsOf [15] IMPLICIT Type, -- [Resolved](local/import) type ref
194 any [16] IMPLICIT NULL,
195 anyDefinedBy [17] IMPLICIT AnyDefinedByType,
196 localTypeRef [19] IMPLICIT TypeRef,
197 importTypeRef [20] IMPLICIT TypeRef,
198 macroType [21] MacroType,
199 macroDef [22] IMPLICIT MacroDef --snacc isPtr:"FALSE"
200 }
201
202 MacroDef ::= MyString -- just keep the text for now
203
204 MacroType ::= CHOICE
205 {
206 rosOperation [0] IMPLICIT RosOperationMacroType,
207 rosError [1] IMPLICIT RosErrorMacroType,
208 rosBind [2] IMPLICIT RosBindMacroType,
209 rosUnbind [3] IMPLICIT RosBindMacroType,
210 rosAse [4] IMPLICIT RosAseMacroType,
211 rosAc [5] IMPLICIT RosAcMacroType,
212 mtsasExtension [6] IMPLICIT MtsasExtensionMacroType,
213 mtsasExtensions [7] IMPLICIT MtsasExtensionsMacroType,
214 mtsasExtensionAttribute [8] IMPLICIT MtsasExtensionAttributeMacroType,
215 mtsasToken [9] IMPLICIT MtsasTokenMacroType,
216 mtsasTokenData [10] IMPLICIT MtsasTokenDataMacroType,
217 mtsasSecurityCategory [11] IMPLICIT MtsasSecurityCategoryMacroType,
218 asnObject [12] IMPLICIT AsnObjectMacroType,
219 asnPort [13] IMPLICIT AsnPortMacroType,
220 asnRefine [14] IMPLICIT AsnRefineMacroType,
221 asnAbstractBind [15] IMPLICIT AsnAbstractBindMacroType,
222 asnAbstractUnbind [16] IMPLICIT AsnAbstractBindMacroType,
223 asnAbstractOperation [17] IMPLICIT RosOperationMacroType,
224 asnAbstractError [18] IMPLICIT RosErrorMacroType,
225 afAlgorithm [19] IMPLICIT Type,
226 afEncrypted [20] IMPLICIT Type,
227 afProtected [21] IMPLICIT Type,
228 afSignature [22] IMPLICIT Type,
229 afSigned [23] IMPLICIT Type,
230 snmpObjectType [24] IMPLICIT SnmpObjectTypeMacroType
231 }
232
233
234 AnyDefinedByType ::= SEQUENCE
235 {
236 fieldName MyString, -- name of field that its defined by
237 link NamedType OPTIONAL -- REFERENCE not encoded
238 }
239
240
241 SelectionType ::= SEQUENCE
242 {
243 fieldName MyString, -- name of field in choice
244 typeRef Type, -- [Resolved](local/import) type ref
245 link NamedType OPTIONAL -- REFERENCE not encoded
246 }
247
248 NamedTypeList ::= SEQUENCE OF NamedType
249
250 NamedType ::= SEQUENCE
251 {
252 fieldName MyString, -- may be empty or NULL str
253 type Type
254 }
255
256
257 TypeRef ::= SEQUENCE
258 {
259 typeName MyString,
260 moduleName MyString, -- used for "modname.type" refs(may be null)
261 module Module, --snacc isEncDec:"FALSE"
262 link TypeDef --snacc isEncDec:"FALSE"
263 }
264
265
266
267 RosOperationMacroType ::= SEQUENCE
268 {
269 arguments NamedType,
270 result NamedType,
271 errors [0] IMPLICIT TypeOrValueList OPTIONAL,
272 linkedOps [1] IMPLICIT TypeOrValueList OPTIONAL
273 }
274
275 ValueList ::= SEQUENCE OF Value
276
277 TypeOrValueList ::= SEQUENCE OF TypeOrValue
278
279 TypeOrValue ::= CHOICE
280 {
281 type [0] IMPLICIT Type,
282 value [1] IMPLICIT Value
283 }
284
285 OidList ::= SEQUENCE OF OBJECT IDENTIFIER
286
287
288 RosErrorMacroType ::= SEQUENCE
289 {
290 parameter NamedType
291 }
292
293 RosBindMacroType ::= SEQUENCE
294 {
295 argument NamedType,
296 result NamedType,
297 error NamedType
298 }
299
300
301 RosAseMacroType ::= SEQUENCE
302 {
303 operations ValueList,
304 consumerInvokes ValueList,
305 supplierInvokes ValueList
306 }
307
308 RosAcMacroType ::= SEQUENCE
309 {
310 nonRoElements ValueList,
311 bindMacroType Type,
312 unbindMacroType Type,
313 remoteOperations Value,
314 operationsOf ValueList,
315 initiatorConsumerOf ValueList,
316 responderConsumerOf ValueList,
317 abstractSyntaxes OidList
318 }
319
320
321 MtsasExtensionMacroType ::= SEQUENCE
322 {
323 elmtType [0] IMPLICIT NamedType OPTIONAL,
324 defaultValue [1] IMPLICIT Value OPTIONAL,
325 criticalForSubmission [2] IMPLICIT BOOLEAN OPTIONAL,
326 criticalForTransfer [3] IMPLICIT BOOLEAN OPTIONAL,
327 criticalForDelivery [4] IMPLICIT BOOLEAN OPTIONAL
328 }
329
330
331 MtsasExtensionsMacroType ::= SEQUENCE
332 {
333 extensions ValueList
334 }
335
336 MtsasExtensionAttributeMacroType ::= SEQUENCE
337 {
338 type Type OPTIONAL
339 }
340
341 MtsasTokenMacroType ::= SEQUENCE
342 {
343 type Type OPTIONAL
344 }
345
346 MtsasTokenDataMacroType ::= SEQUENCE
347 {
348 type Type OPTIONAL
349 }
350
351 MtsasSecurityCategoryMacroType ::= SEQUENCE
352 {
353 type Type OPTIONAL
354 }
355
356 AsnObjectMacroType ::= SEQUENCE
357 {
358 ports AsnPortList OPTIONAL
359 }
360
361 AsnPortList ::= SEQUENCE OF AsnPort
362
363 AsnPort ::= SEQUENCE
364 {
365 portValue Value,
366 portType ENUMERATED
367 {
368 consumer-port(0),
369 supplier-port(1),
370 symmetric-port(2)
371 }
372 }
373
374
375 AsnPortMacroType ::= SEQUENCE
376 {
377 abstractOps [0] IMPLICIT TypeOrValueList OPTIONAL,
378 consumerInvokes [1] IMPLICIT TypeOrValueList OPTIONAL,
379 supplierInvokes [2] IMPLICIT TypeOrValueList OPTIONAL
380 }
381
382
383 AsnRefineMacroType ::= INTEGER
384
385 AsnAbstractBindMacroType ::= SEQUENCE
386 {
387 ports [0] IMPLICIT AsnPortList OPTIONAL,
388 type [1] IMPLICIT Type OPTIONAL
389 }
390
391
392 SnmpObjectTypeMacroType ::= SEQUENCE
393 {
394 syntax Type,
395 access ENUMERATED
396 { snmp-read-only(0), snmp-read-write(1),
397 snmp-write-only(2), snmp-not-accessible(3)},
398 status ENUMERATED
399 { snmp-mandatory(0), snmp-optional(1),
400 snmp-obsolete(2), snmp-deprecated(3)},
401 description [0] IMPLICIT Value OPTIONAL,
402 reference [1] IMPLICIT Value OPTIONAL,
403 index [2] IMPLICIT TypeOrValueList OPTIONAL,
404 defVal [3] IMPLICIT Value OPTIONAL
405 }
406
407
408 Subtype ::= CHOICE
409 {
410 single [0] SubtypeValue,
411 and [1] IMPLICIT SubtypeList,
412 or [2] IMPLICIT SubtypeList,
413 not [3] Subtype
414 }
415
416 SubtypeList ::= SEQUENCE OF Subtype
417
418 SubtypeValue ::= CHOICE
419 {
420 singleValue [0] IMPLICIT Value,
421 contained [1] IMPLICIT Type,
422 valueRange [2] IMPLICIT ValueRangeSubtype,
423 permittedAlphabet [3] Subtype, -- only valuerange or singleval
424 sizeConstraint [4] Subtype, -- only single value ints or val range
425 innerSubtype [5] IMPLICIT InnerSubtype
426 }
427
428
429 ValueRangeSubtype ::= SEQUENCE
430 {
431 lowerEndInclusive BOOLEAN,
432 upperEndInclusive BOOLEAN,
433 lowerEndValue Value,
434 upperEndValue Value
435 }
436
437
438 InnerSubtype ::= SEQUENCE
439 {
440 constraintType ENUMERATED { full-ct(0), partial-ct(1), single-ct(2) },
441 constraints ConstraintList
442 }
443
444 ConstraintList ::= SEQUENCE OF Constraint
445
446 Constraint ::= SEQUENCE
447 {
448 fieldRef MyString, -- not used if in single-ct, may be null
449 presenceConstraint ENUMERATED
450 {
451 present-ct(0),
452 absent-ct(1),
453 empty-ct(2),
454 optional-ct(3)
455 },
456 valueConstraints Subtype
457 }
458
459
460 ValueDefList ::= SEQUENCE OF ValueDef
461
462
463 ValueDef ::= SEQUENCE
464 {
465 exported BOOLEAN,
466 definedName MyString,
467 value Value
468 }
469
470 Value ::= SEQUENCE
471 {
472 type Type OPTIONAL,
473 valueType INTEGER, -- holds one of choiceId's def'd for BasicType
474 basicValue BasicValue,
475 lineNo INTEGER
476 }
477
478 BasicValue ::= CHOICE
479 {
480 unknown [0] IMPLICIT NULL,
481 empty [1] IMPLICIT NULL,
482 integer [2] IMPLICIT INTEGER,
483 specialInteger [3] IMPLICIT SpecialIntegerValue,
484 longInteger [4] IMPLICIT INTEGER, -- put LONG before INTGEGER
485 boolean [5] IMPLICIT BOOLEAN,
486 real [6] IMPLICIT REAL,
487 specialReal [7] IMPLICIT SpecialRealValue,
488 asciiText [8] IMPLICIT OCTET STRING,
489 asciiHex [9] IMPLICIT OCTET STRING,
490 asciiBitString [10] IMPLICIT OCTET STRING,
491 oid [11] IMPLICIT OBJECT IDENTIFIER,
492 linkedOid [12] IMPLICIT OBJECT IDENTIFIER, --snacc cTypeName:"OID"
493 berValue [13] IMPLICIT OCTET STRING,
494 perValue [14] IMPLICIT OCTET STRING,
495 namedValue [15] IMPLICIT NamedValue,
496 null [16] IMPLICIT NULL,
497 localValueRef [17] IMPLICIT ValueRef,
498 importValueRef [18] IMPLICIT ValueRef,
499 valueNotation [19] IMPLICIT OCTET STRING
500 }
501
502
503
504 SpecialIntegerValue ::= ENUMERATED { min-int(0), max-int(1) }
505 SpecialRealValue ::= ENUMERATED { minus-infinity-real(0), plus-infinity-real(1) }
506
507
508 ValueRef ::= SEQUENCE
509 {
510 valueName MyString,
511 moduleName MyString, -- used for "modname.value" refs (may be null)
512 link ValueDef, --snacc isEncDec:"FALSE"
513 module Module --snacc isEncDec:"FALSE"
514 }
515
516 NamedValue ::= SEQUENCE
517 {
518 fieldName MyString, -- may be null
519 value Value
520 }
521
522 NamedValueList ::= SEQUENCE OF NamedValue
523
524 CTypeId ::= ENUMERATED { c-choice(0), c-list(1), c-any(2), c-anydefinedby(3),
525 c-lib(4), c-struct(5), c-typeref(6), c-no-type(7),
526 c-typedef(8) }
527
528 -- C Type Def Info - info used for routine naming
529 -- and referencing from other types
530 CTDI ::= SEQUENCE
531 {
532 asn1TypeId INTEGER, --snacc cTypeName:"enum BasicTypeChoiceId"
533 cTypeId CTypeId,
534 cTypeName MyString,
535 isPdu BOOLEAN,
536 isEncDec BOOLEAN, -- if false, no routines are gen
537 -- and not included in encodings
538 isPtrForTypeDef BOOLEAN,
539 isPtrForTypeRef BOOLEAN,
540 isPtrInChoice BOOLEAN,
541 isPtrForOpt BOOLEAN,
542
543 -- defines these names, used by references
544 optTestRoutineName MyString, -- routine/macro to check whether
545 -- opt type is present
546 defaultFieldName MyString, -- base for generating field names
547
548 printRoutineName MyString,
549 encodeRoutineName MyString,
550 decodeRoutineName MyString,
551 freeRoutineName MyString,
552
553 genPrintRoutine BOOLEAN,
554 genEncodeRoutine BOOLEAN,
555 genDecodeRoutine BOOLEAN,
556 genFreeRoutine BOOLEAN,
557 genTypeDef BOOLEAN
558 }
559
560
561 --
562 -- CTRI (C Type Ref Info) is used for generating C typedefinitions
563 -- from the ASN.1 types info
564 CTRI ::= SEQUENCE
565 {
566 cTypeId CTypeId,
567 cFieldName MyString,
568 cTypeName MyString,
569 isPtr BOOLEAN,
570 -- isEndCType BOOLEAN, false for struct/union def --
571 cNamedElmts CNamedElmts OPTIONAL, -- for C_LIB bits/int/enums
572 choiceIdValue INTEGER, -- enum value of this c field
573 choiceIdSymbol MyString, -- this fields sym in choiceId enum
574 choiceIdEnumName MyString,
575 choiceIdEnumFieldName MyString,
576 optTestRoutineName MyString, -- these names are gained from refd type def
577 printRoutineName MyString, -- or are over-ridden snacc attribute comment
578 encodeRoutineName MyString,
579 decodeRoutineName MyString,
580 freeRoutineName MyString,
581 isEncDec BOOLEAN -- whether part of enc value
582 }
583
584 CNamedElmts ::= SEQUENCE OF CNamedElmt
585
586 CNamedElmt ::= SEQUENCE
587 {
588 name MyString,
589 value INTEGER
590 }
591
592
593 CxxTDI ::= SEQUENCE
594 {
595 asn1TypeId INTEGER, --snacc cTypeName:"enum BasicTypeChoiceId"
596 className MyString,
597 isPdu BOOLEAN,
598 isEnc BOOLEAN,
599 isPtrForTypeDef BOOLEAN,
600 isPtrForOpt BOOLEAN,
601 isPtrInChoice BOOLEAN,
602 isPtrInSetAndSeq BOOLEAN,
603 isPtrInList BOOLEAN,
604 optTestRoutineName MyString,
605 defaultFieldName MyString -- base for generating field names
606 }
607
608
609
610 CxxTRI ::= SEQUENCE
611 {
612 isEnc BOOLEAN,
613 className MyString,
614 fieldName MyString,
615 isPtr BOOLEAN,
616 namedElmts CNamedElmts,
617 choiceIdSymbol MyString,
618 choiceIdValue INTEGER,
619 optTestRoutineName MyString
620 }
621
622 IDLTDI ::= SEQUENCE
623 {
624 asn1TypeId INTEGER, --snacc cTypeName:"enum BasicTypeChoiceId"
625 typeName MyString,
626 isPdu BOOLEAN,
627 isEnc BOOLEAN,
628 isPtrForTypeDef BOOLEAN,
629 isPtrForOpt BOOLEAN,
630 isPtrInChoice BOOLEAN,
631 isPtrInSetAndSeq BOOLEAN,
632 isPtrInList BOOLEAN,
633 optTestRoutineName MyString,
634 defaultFieldName MyString -- base for generating field names
635 }
636
637 IDLTRI ::= SEQUENCE
638 {
639 isEnc BOOLEAN,
640 typeName MyString,
641 fieldName MyString,
642 isPtr BOOLEAN,
643 namedElmts CNamedElmts,
644 choiceIdSymbol MyString,
645 choiceIdValue INTEGER,
646 optTestRoutineName MyString
647 }
648
649 -- use snacc compiler directives to overide the builtin types.
650 --
651 -- All strings used in module data struct are null terminated so
652 -- can just use a char*
653 -- Note the snacc comments before the PrintableString
654 -- bind with the MyString TypeDef and the ones after PrintableString
655 -- bind with the PrintableString Type ref.
656
657
658 MyString ::= --snacc isPtrForTypeDef:"FALSE"
659 --snacc isPtrForTypeRef:"FALSE"
660 --snacc isPtrInChoice:"FALSE"
661 --snacc isPtrForOpt:"FALSE"
662 --snacc optTestRoutineName:"MYSTRING_NON_NULL"
663 --snacc genPrintRoutine:"FALSE"
664 --snacc genEncodeRoutine:"FALSE"
665 --snacc genDecodeRoutine:"FALSE"
666 --snacc genFreeRoutine:"FALSE"
667 --snacc printRoutineName:"printMyString"
668 --snacc encodeRoutineName:"EncMyString"
669 --snacc decodeRoutineName:"DecMyString"
670 --snacc freeRoutineName:"FreeMyString"
671 PrintableString --snacc cTypeName:"char*"
672
673 END