1 -- file: .../asn1specs/asn1module.asn1
3 -- This module describes the data structure used to reprsent the
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)
9 -- Mike Sample 91/08/29
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
17 -- Revision 1.1.1.1 1999/03/16 18:05:55 aram
18 -- Originals from SMIME Free Library.
20 -- Revision 1.3 1995/07/25 20:04:04 rj
21 -- data structures added for idl backend.
23 -- Revision 1.2 1994/08/28 09:54:16 rj
24 -- comment leader fixed.
26 -- Revision 1.1 1994/08/28 09:51:11 rj
29 Asn1Module DEFINITIONS IMPLICIT TAGS ::=
37 Modules ::= [APPLICATION 0] IMPLICIT SEQUENCE
43 ModuleList ::= SEQUENCE OF Module
48 status ENUMERATED { mod-ok(0), mod-not-linked(1), mod-error(2) },
50 tagDefault ENUMERATED { explicit-tags(0), implicit-tags(1) },
51 exportStatus ENUMERATED { exports-all(0), exports-nothing(1),
53 imports ImportModuleList,
55 valueDefs ValueDefList,
58 asn1SrcFileName MyString,
59 cHdrFileName MyString,
60 cSrcFileName MyString,
61 cxxHdrFileName MyString,
62 cxxSrcFileName MyString,
64 dbHdrFileName MyString, -- IBM-ENC
65 dbSrcFileName MyString, -- IBM-ENC
67 cxxname MyString, -- META
69 idlFileName MyString, -- IDL
70 idlname MyString -- IDL
77 oid OBJECT IDENTIFIER OPTIONAL --snacc cTypeName:"OID" isPtr:"TRUE"
81 ImportModuleList ::= SEQUENCE OF ImportModule
84 ImportModule ::= SEQUENCE
87 importElmts ImportElmtList,
88 moduleRef Module, --snacc isEncDec:"FALSE"
93 ImportElmtList ::= SEQUENCE OF ImportElmt
96 ImportElmt ::= SEQUENCE
100 type [0] TypeDef, -- not encoded
101 value [1] ValueDef -- not encoded
104 privateScope BOOLEAN, -- true if from MODNAME.TYPE ref
108 TypeDefList ::= SEQUENCE OF TypeDef
112 oid OBJECT IDENTIFIER,
122 AnyRefList ::= SEQUENCE OF AnyRef
129 localRefCount INTEGER,
130 importRefCount INTEGER,
133 definedName MyString,
136 cxxTypeDefInfo CxxTDI,
137 attrList AttributeList,
145 tclass INTEGER, -- swap this for the BER_CLASS enum from basetypes.h
146 form INTEGER, -- swap this for the BER_FORM enum
157 defaultVal [0] IMPLICIT NamedValue OPTIONAL,
158 subtypes [1] Subtype OPTIONAL,
159 basicType [2] BasicType,
162 cxxTypeRefInfo CxxTRI,
163 attrList AttributeList
166 TagList ::= SEQUENCE OF Tag
168 AttributeList ::= SEQUENCE OF MyString
170 NamedNumberList ::= ValueDefList
173 -- BasicTypes with NULL need no more info that which type it is
174 -- (this is known from the choice id)
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"
202 MacroDef ::= MyString -- just keep the text for now
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
234 AnyDefinedByType ::= SEQUENCE
236 fieldName MyString, -- name of field that its defined by
237 link NamedType OPTIONAL -- REFERENCE not encoded
241 SelectionType ::= SEQUENCE
243 fieldName MyString, -- name of field in choice
244 typeRef Type, -- [Resolved](local/import) type ref
245 link NamedType OPTIONAL -- REFERENCE not encoded
248 NamedTypeList ::= SEQUENCE OF NamedType
250 NamedType ::= SEQUENCE
252 fieldName MyString, -- may be empty or NULL str
260 moduleName MyString, -- used for "modname.type" refs(may be null)
261 module Module, --snacc isEncDec:"FALSE"
262 link TypeDef --snacc isEncDec:"FALSE"
267 RosOperationMacroType ::= SEQUENCE
271 errors [0] IMPLICIT TypeOrValueList OPTIONAL,
272 linkedOps [1] IMPLICIT TypeOrValueList OPTIONAL
275 ValueList ::= SEQUENCE OF Value
277 TypeOrValueList ::= SEQUENCE OF TypeOrValue
279 TypeOrValue ::= CHOICE
281 type [0] IMPLICIT Type,
282 value [1] IMPLICIT Value
285 OidList ::= SEQUENCE OF OBJECT IDENTIFIER
288 RosErrorMacroType ::= SEQUENCE
293 RosBindMacroType ::= SEQUENCE
301 RosAseMacroType ::= SEQUENCE
303 operations ValueList,
304 consumerInvokes ValueList,
305 supplierInvokes ValueList
308 RosAcMacroType ::= SEQUENCE
310 nonRoElements ValueList,
312 unbindMacroType Type,
313 remoteOperations Value,
314 operationsOf ValueList,
315 initiatorConsumerOf ValueList,
316 responderConsumerOf ValueList,
317 abstractSyntaxes OidList
321 MtsasExtensionMacroType ::= SEQUENCE
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
331 MtsasExtensionsMacroType ::= SEQUENCE
336 MtsasExtensionAttributeMacroType ::= SEQUENCE
341 MtsasTokenMacroType ::= SEQUENCE
346 MtsasTokenDataMacroType ::= SEQUENCE
351 MtsasSecurityCategoryMacroType ::= SEQUENCE
356 AsnObjectMacroType ::= SEQUENCE
358 ports AsnPortList OPTIONAL
361 AsnPortList ::= SEQUENCE OF AsnPort
375 AsnPortMacroType ::= SEQUENCE
377 abstractOps [0] IMPLICIT TypeOrValueList OPTIONAL,
378 consumerInvokes [1] IMPLICIT TypeOrValueList OPTIONAL,
379 supplierInvokes [2] IMPLICIT TypeOrValueList OPTIONAL
383 AsnRefineMacroType ::= INTEGER
385 AsnAbstractBindMacroType ::= SEQUENCE
387 ports [0] IMPLICIT AsnPortList OPTIONAL,
388 type [1] IMPLICIT Type OPTIONAL
392 SnmpObjectTypeMacroType ::= SEQUENCE
396 { snmp-read-only(0), snmp-read-write(1),
397 snmp-write-only(2), snmp-not-accessible(3)},
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
410 single [0] SubtypeValue,
411 and [1] IMPLICIT SubtypeList,
412 or [2] IMPLICIT SubtypeList,
416 SubtypeList ::= SEQUENCE OF Subtype
418 SubtypeValue ::= CHOICE
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
429 ValueRangeSubtype ::= SEQUENCE
431 lowerEndInclusive BOOLEAN,
432 upperEndInclusive BOOLEAN,
438 InnerSubtype ::= SEQUENCE
440 constraintType ENUMERATED { full-ct(0), partial-ct(1), single-ct(2) },
441 constraints ConstraintList
444 ConstraintList ::= SEQUENCE OF Constraint
446 Constraint ::= SEQUENCE
448 fieldRef MyString, -- not used if in single-ct, may be null
449 presenceConstraint ENUMERATED
456 valueConstraints Subtype
460 ValueDefList ::= SEQUENCE OF ValueDef
463 ValueDef ::= SEQUENCE
466 definedName MyString,
473 valueType INTEGER, -- holds one of choiceId's def'd for BasicType
474 basicValue BasicValue,
478 BasicValue ::= CHOICE
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
504 SpecialIntegerValue ::= ENUMERATED { min-int(0), max-int(1) }
505 SpecialRealValue ::= ENUMERATED { minus-infinity-real(0), plus-infinity-real(1) }
508 ValueRef ::= SEQUENCE
511 moduleName MyString, -- used for "modname.value" refs (may be null)
512 link ValueDef, --snacc isEncDec:"FALSE"
513 module Module --snacc isEncDec:"FALSE"
516 NamedValue ::= SEQUENCE
518 fieldName MyString, -- may be null
522 NamedValueList ::= SEQUENCE OF NamedValue
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),
528 -- C Type Def Info - info used for routine naming
529 -- and referencing from other types
532 asn1TypeId INTEGER, --snacc cTypeName:"enum BasicTypeChoiceId"
536 isEncDec BOOLEAN, -- if false, no routines are gen
537 -- and not included in encodings
538 isPtrForTypeDef BOOLEAN,
539 isPtrForTypeRef BOOLEAN,
540 isPtrInChoice BOOLEAN,
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
548 printRoutineName MyString,
549 encodeRoutineName MyString,
550 decodeRoutineName MyString,
551 freeRoutineName MyString,
553 genPrintRoutine BOOLEAN,
554 genEncodeRoutine BOOLEAN,
555 genDecodeRoutine BOOLEAN,
556 genFreeRoutine BOOLEAN,
562 -- CTRI (C Type Ref Info) is used for generating C typedefinitions
563 -- from the ASN.1 types info
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
584 CNamedElmts ::= SEQUENCE OF CNamedElmt
586 CNamedElmt ::= SEQUENCE
595 asn1TypeId INTEGER, --snacc cTypeName:"enum BasicTypeChoiceId"
599 isPtrForTypeDef BOOLEAN,
601 isPtrInChoice BOOLEAN,
602 isPtrInSetAndSeq BOOLEAN,
604 optTestRoutineName MyString,
605 defaultFieldName MyString -- base for generating field names
616 namedElmts CNamedElmts,
617 choiceIdSymbol MyString,
618 choiceIdValue INTEGER,
619 optTestRoutineName MyString
624 asn1TypeId INTEGER, --snacc cTypeName:"enum BasicTypeChoiceId"
628 isPtrForTypeDef BOOLEAN,
630 isPtrInChoice BOOLEAN,
631 isPtrInSetAndSeq BOOLEAN,
633 optTestRoutineName MyString,
634 defaultFieldName MyString -- base for generating field names
643 namedElmts CNamedElmts,
644 choiceIdSymbol MyString,
645 choiceIdValue INTEGER,
646 optTestRoutineName MyString
649 -- use snacc compiler directives to overide the builtin types.
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.
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*"