Home
ASN.1 Compiler Version 6.0 XML Schema Translator User`s Manual
Contents
1. SegofUTF8 SEQUENCE OF myString UTF8String Generated XSD code lt xsd complexType name SeqOfuTF8 gt lt xsd sequence maxOccurs unbounded gt lt xsd element name myString type xsd string gt lt xsd sequence gt lt xsd complexType gt Sized SEQUENCE OF SET OF The SEQUENCE OF type may contain a size constraint If this is the case the XSD minOccurs and maxOccurs facets are used to constrain the value to the given size ASN 1 production TypeName SEQUENCE SIZE lower upper OF ElementType Generated XSD code ASNIC V5 8 24 lt xsd complexType name TypeName gt lt xsd sequence minOccurs lower maxOccurs upper gt lt xsd element name element type ElementType gt lt xsd sequence gt lt xsd complexType gt This mapping is for the complex case For the simple case i e XSD list case the XSD minLength and or maxLength facets are used to constraint the length lt xsd simpleType name TypeName gt lt xsd restriction gt lt xsd simpleType gt lt xsd list itemType ElementType gt lt xsd simpleType gt lt xsd minLength value lower gt lt xsd maxLength value upper gt lt xsd restriction gt lt xsd simpleType gt CHOICE The ASN 1 CHOICE type is used to specify a list of alternative elements from which a single element can be selected This type is mapped to the XSD choice complex type The mappin
2. lt xsd appinfo gt lt xsd annotation gt equivalent XSD type mapping for ASNIType lt xsd complexType gt Tagging in the definition above is optional If present it is equal to either the keyword EXPLICIT or IMPLICIT The default value is EXPLICIT A default value for all types in a module can also be specified in the ASN 1 module header The tag s form constructed or primitive is not specified in the mapping above This is because this can be determined by an application that is encoding or decoding a message of the given type EXTERNAL and EmbeddedPDV Type The EXTERNAL and EmbeddedPDV types are built in ASN 1 types that make it possible to transfer a value of a different encoding type within an ASN 1 message These are constructed types built into the ASN 1 standard An XSD representation of each of these types is available in the asn xsd library The ASN1C compiler generates a reference to the types in the library when it encounters a reference to one of these types ASN 1 production TypeName EXTERNAL ASNIC V5 8 27 Generated XSD code lt xsd complexType name TypeName gt lt xsd complexContent gt lt xsd extension base asnl EXT ERNAL gt lt xsd complexContent gt lt xsd complexType gt ASN 1 production TypeName EMBEDDED PDV Generated XSD code lt xsd complexType name TypeName gt lt xsd complexContent gt lt xsd e
3. XML schema mapping 14 CHOICE type XML schema mapping 25 command line options 5 compat command line option 6 compiler running 3 35 config 6 36 D DEFAULT keyword in SEQUENCE 20 depends 6 directory generated files 6 searching for IMPORT items 6 E Embedded PDV type XML schema mapping 27 ASNIC V6 0 ENUMERATED type XML schema mapping 16 E XER 35 extension elements in CHOICE 25 extension elements in SEQUENCE 20 EXTERNAL type XML schema mapping 27 G GeneralizedTime 15 GeneralizedTime type XML schema mapping 15 generated XML schema source code 9 35 H hexBinary 14 I I command line option 6 36 integer for holding bit number 18 INTEGER type XML schema mapping 10 ITU X 680 ASN 1 sstandard 5 L list command line option 6 M macro ROSE OPERATION 5 mapping XSD to ASN 1 35 minInclusive maxInclusive facets 11 minLength maxLength facets 11 14 15 minOccurs maxOccurs facets 20 23 N non native attributes 12 16 NULL type XML schema mapping 18 O o command line option 6 36 OBJECT IDENTIFIER type XML schema mapping 18 OCTET STRING type XML schema mapping 14 octet for holding bit string contents 18 Open type XML schema mapping 26 OPTIONAL keyword in SEQUENCE 20 osxsdlib xsd 11 P parse errors finding by generating a listing 6 pattern constraint 15 pattern facet 15 permitted alphabet 15 R REAL type XML schema mapping 19 RELATIVE OID type XML schema mapping 18
4. This type is asn1 BitString and has the following definition lt xsd simpleType name BitString gt lt xsd restriction base xsd token gt lt xsd pattern value 0 1 0 gt lt xsd restriction gt lt xsd simpleType gt The ASN 1 BIT STRING type is converted into a reference to this custom type as follows ASN 1 production TypeName BIT STRING Generated XSD code lt xsd simpleType name TypeName gt lt xsd restriction base asnl BitString gt lt xsd simpleType gt Sized BIT STRING The ASN 1 BIT STRING type may contain a size constraint This is converted into minLength and maxLength facets in the generated XSD definition ASN 1 production ASNIC V5 8 11 TypeName BIT STRING SIZE lower upper Generated XSD code lt xsd simpleType name TypeName gt lt xsd restriction base asnl BitString gt lt xsd minLength value lower gt lt xsd maxLength value upper gt lt xsd restriction gt lt xsd simpleType gt BIT STRING with Named Bits A bit string with named bits is handled differently than a normal bit string This is because the primary use of named bits it to define a bit map of selected bit items For this reason a list of enumerated items is used for the type This allows the names of the bits to be specified in an XML instance of the type The type also contains application information in the form of an annotation that allows an application to map the item
5. ROSE OPERATION macro 5 S schema bindings file 36 namespace attribute 37 bindings element 36 schemaBindings element 37 sourceFile element 37 SEQUENCE OF type XML schema mapping 22 SEQUENCE type extension elements 20 XML schema mapping 19 SET OF type XML schema mapping 22 SET type XML schema mapping 22 standard ITU X 680 5 T tables 6 29 Tagged type XML schema mapping 26 targetns 7 type definition SEQUENCEsequence 30 TYPE IDENTIFIER 26 U UTCTime 15 UTCTime type XML schema mapping 15 V version 5 x compatible code generating 6 ASNIC V6 0 W warnings 7 36 X X 694 35 37 XML schema mapping Big Integer 10 BIT STRING 11 BOOLEAN 9 Character String 14 CHOICE 25 Embedded PDV 27 ENUMERATED 16 EXTERNAL 27 GeneralizedTime 15 INTEGER 10 NULL 18 OBJECT IDENTIFIER 18 OCTET STRING 14 Open Type 26 REAL 19 RELATIVE OID 18 SEQUENCE 19 SEQUENCE OF 22 SET 22 SET OF 22 Tagged Type 26 UTCTime 15 xsd 7 XSD schemaLocation attribute 36 xsd2asn1 35 command line options 36 XSD source file specification 36 iii
6. a BER or DER instance of a type the tag information will be required For this reason it is possible to add either non native attributes or an application information annotation appinfo to the generated XSD type describing the ASN 1 tags ASNIC V5 8 26 The annotation carries all of the information an application would need to know to encode a BER or DER message of the given type This includes the tag s class identifier number and how it is applied IMPLICIT or EXPLICIT The type that specifies this information is the asn TagInfo type in the Objective Systems XSD class library For the non native attributes case specified by adding attrs tags or attrs with no qualifiers to the ASNIC command line the mapping of an ASN 1 tagged type to XSD is as follows ASN 1 production TypeName Tagging TagClass TagID ASN1Type Generated XSD code lt xsd complexType name TypeName asnl tag TagClass TagID asnl tagging EXPLICIT gt equivalent XSD type mapping for ASNIType lt xsd complexType gt For the appInfo case specified by adding appinfo tags or appinfo with no qualifiers to the ASNIC command line the mapping is as follows lt xsd complexType name TypeName gt lt xsd annotation gt lt xsd appinfo gt lt asnl TagInfo gt lt asnl TagClass gt TagClass lt asnl TagClass gt lt asnl TagID gt TagID lt asn1 TagID gt lt asnl Tagging gt Tagging lt asnl Tagging gt lt asnl TagInfo gt
7. any additional elements from other namespaces to exist in a message instance without causing a validation or decoding error Note the restriction that the element must be defined in a different namespace This is necessary because if the element existed in the same namespace as other elements the content model would be non deterministic The reason is because a validation program would not be able to determine if the last element is a sequence was a defined element or an extension element If the attrs ext command line option is specified or attrs with no qualifiers the extension element is marked with a non native attribute description For example DfltInt SEQUENCE anlnt INTEGER ER extElm BOOLEAN Generated XSD code lt xsd complexType name DfltInt gt lt xsd sequence gt lt xsd element name anInt type xsd integer gt lt xsd element name extElm minOccurs 0 type xsd boolean asnl description extension element gt lt xsd any namespace other processContents lax minOccurs 0 gt lt xsd sequence gt lt xsd complexType gt In this case the extElm extension element contains the asnl description extension element attribute which allows an application to detect that it is an extension element Also note that all extension elements are marked optional minOccurs 0 whether they are declared to be optional or not That is because an instance of a message
8. attempt to generate code more closely aligned with the given previous release of the compiler lt versionNumber gt is specified as x x for example compat 5 2 config lt filename gt This option is used to specify the name of a file containing configuration information for the source file being parsed A full discussion of the contents of a configuration file is provided in the Compiler Configuration File section depends None This option instructs the compiler to generate a full set of header and source files that contain only the productions in the main file being compiled and items those productions depend on from IMPORT files genTables tables lt filename gt This option is used to generate additional code for the handling of table constraints as defined in the X 682 standard See the Generated Information Object Table Structures section for additional details on the type of code generated to support table constraints I lt directory gt This option is used to specify a directory that the compiler will search for ASN 1 source files for IMPORT items Multiple I qualifiers can be used to specify multiple directories to search list None Generate listing This will dump the source code to the standard output device as it is parsed This can be useful for finding parse errors 0 lt directory gt This option is used to specify the name of a directoryto which all o
9. conforming to an earlier version of the message protocol may not contain these elements ASNIC V5 8 21 SET An ASN 1 SET is a constructed type consisting of a series of element definitions that must appear in any order This is very similar to the XSD all complex type and is therefore mapped to this type The basic mapping is as follows ASN 1 production TypeName SET elementl name elementl type element2 name element2 type Generated XSD code lt xsd complexType name TypeName gt lt xsd all gt lt xsd element name elementl name type elementl type gt lt xsd element name element2 name type element2 name gt lt xsd all gt lt xsd complexType gt The rules for mapping elements with optional and default values to XSD that were described in the SEQUENCE section above are also applicable to the SET type SEQUENCE OF SET OF The ASN 1 SEQUENCE OF or SET OF type is used to specify a repeating collection of a given element type This is similar to an array type in a high level programming language For all practical purposes SEQUENCE OF and SET OF are identical The remainder of this section will refer to the SEQUENCE OF type only It can be assumed that all of the defined mappings apply to the SET OF type as well The way the SEQUENCE OF type is mapped to XSD depends on the type of the referenced element If the type is one of the following ASN 1 primitive types or a type reference that ref
10. there was no direct mapping for an ASN 1 BIT STRING type These custom types can be found in the low level ASN 1 XML schema definitions library at the following URL http www obj sys com v1 0 XMLSchema asn1 xsd The following sections describe the mappings for each of the ASN 1 built in types BOOLEAN ASNIC V5 8 9 The ASN 1 BOOLEAN type is mapped to the XSD boolean built in type ASN 1 production TypeName BOOLEAN Generated XSD code lt xsd simpleType name TypeName gt lt xsd restriction base xsd boolean gt lt xsd simpleType gt INTEGER The ASN 1 INTEGER type is converted into one of several XSD built in types depending on value range constraints on the integer type definition The default conversion if the INTEGER value contains no constraints is to the XSD integer type ASN 1 production TypeName INTEGER Generated XSD code lt xsd simpleType name TypeName gt lt xsd restriction base xsd integer gt lt xsd simpleType gt If the integer has a value range constraint that allows a more restrictive XSD type to be used then that type will be used For example if a range of 0 to 255 inclusive is specified an XSD unsignedByte would be used because it maps exactly to this range The following table shows the range values for each of the INTEGER type mappings Lower Bound Upper Bound XSD Type 128 127 byte 0 255 unsign
11. translation process of going from ASN 1 to XSD described in the previous section is not round trippable with the XSD to ASN 1 process described in this section That is to say one cannot start with an XSD file for example and translate it to ASN 1 using this tool and then translate that file back to XSD and expect the final XSD file to be the same as the original Certain naming conventions that are utilized make this type of round trip conversion process very problematic It is therefore a one way process a user must work either in XSD or ASN 1 and then use the tools to get an equivalent representation in the alternative form Running the XSD to ASN 1 Translation Tool from the Command line The XSD to ASN 1 translation tool is the xsd2asn utility program that can be found in the bin subdirectory of an ASNIC installation To test if the compiler was successfully installed enter xsd2asn1 with no parameters as follows note if you have not updated your PATH variable you will need to enter the full pathname xsd2asnl You should observe the following display or something similar XSD2ASN1 Version 0 2 x Copyright c 2005 Objective Systems Inc All Rights Reserved Usage xsd2asnl lt filename gt options lt filename gt XML schema or WSDL source file name s Multiple filenames may be specified and wildcards are allowed options config lt file gt Specify schema bindings file o lt directory gt Output file director
12. ASN 1 source file name s Multiple filenames may be specified and wildcards are allowed language options e generate C code C generate C cod c generate C code java generate Java code xsd lt filename gt generate XML schema definitions encoding rule options ber generate BER encode decode functions cer generate CER encode decode functions der generate DER encode decode functions per generate PER encode decode functions xer generate XER encode decode functions xml generate XML encode decode functions basic options asnstd lt std gt set standard to be used for parsing ASN 1 source file Possible values x208 x680 mixed default is x680 compact generate compact code compat lt version gt generate code compatible with previous compiler version lt version gt format is x x for example 5 3 config lt file gt specify configuration file depends compile main file and dependent IMPORT items I lt directory gt set import file directory lax do not generate constraint checks in code ASNIC V5 8 3 list nodecode noencode noIndefLen noOpenExt notypes o lt directory gt pdu lt type gt print lt filename gt generate listing do not generate decode functions do not generat ncode functions do not generate indefinite length tests do not generate open extension elements do not generate type definition
13. CE anIntINTEGER OPTIONAL will cause the following XSD complex type to be generated lt xsd complexType name OptInt gt lt xsd sequence gt lt xsd element name anInt type xsd integer minOccurs 0 gt lt xsd sequence gt lt xsd complexType gt DEFAULT keyword The DEFAULT keyword allows a default value to be specified for elements within the SEQUENCE XSD contains a default facet that can be used to map elements with this keyword For example the following ASN 1 SEQUENCE type DfltInt SEQUENCE anIntINTEGER DEFAULT 1 will cause the following XSD complex type to be generated lt xsd complexType name DfltInt gt lt xsd sequence gt lt xsd element name anInt type xsd integer default 1 gt lt xsd sequence gt lt xsd complexType gt Note that in XSD default values can only be specified for simple primitive types ASN 1 allows for the specification of default values on complex constructed types as well If an ASN 1 type is encountered that contains a complex default value the value is dropped in the conversion to XSD Extension Elements ASNIC V5 8 20 If the SEQUENCE type is extensible i e contains an ellipses marker a special element will be inserted to allow unknown elements to be validated This special element is as follows lt xsd any namespace other processContents lax gt This element declaration allows
14. COL IES gt lt xsd appinfo gt lt xsd annotation gt lt xsd element name C_ID type C_ID gt lt xsd element name ConfigurationGenID type ConfigurationGenID gt lt xsd element name SetupRqstFDD type SetupRqstFDD gt lt xsd any namespace other processContents lax minOccurs 0 gt lt xsd choice gt lt xsd complexType gt ASNIC V5 8 33 ASNIC V5 8 34 XML Schema to ASN 1 Conversion The version 5 8 release of ASNIC contains a separate command line utility program that translates an XML Schema Definitions XSD source file into an equivalent ASN 1 source file This conversion process is based on the ITU T X 694 standard which specifies a mapping from XSD to ASN 1 The mapping specified in the standard consists of two parts 1 A mapping of XSD elements types and attributes to equivalent ASN 1 items and 2 The addition of extended XER E XER annotations to allow the ASN 1 source file to act as a stand alone schema for use in both XML and ASN 1 applications The ASNIC translation process supports only the first item at this time The main goal of the translation process is to get the XML schema into a form that allows the generation of efficient binary encoders decoders that utilize the ASN 1 encoding rules Option 1 supports this goal by creating an ASN 1 file that can be used with any ASN 1 compiler product or tool that supports standard ASN 1 syntax It should also be noted that the
15. ENCE OF definition This makes it possible to control the name of the element used in the generated XSD definition The mapping for this case is as follows ASN 1 production TypeName SEQUENCE OF elementName ElementTyp Generated XSD code lt xsd complexType name TypeName gt lt xsd sequence maxOccurs unbounded gt lt xsd element name elementName type ElementType gt lt xsd sequence gt lt xsd complexType gt Example The following shows the mapping fora SEQUENCE OF INTEGER Since INTEGER is one of the simple types listed above an XSD list type is used ASNIC V5 8 23 ASN 1 production SeqOflInt SEQUENCE OF INTEGER Generated XSD code lt xsd complexType name SeqOfInt gt lt xsd list itemType xsd integer gt lt xsd complexType gt The following shows the mapping for a SEQUENCE OF UTF8String Since UTFS8String is not one of the simple types listed above an XSD sequence type is used ASN 1 production SeqOfUTF8 SEQUENCE OF UTF8String Generated XSD code lt xsd complexType name SeqOfuTF8 gt lt xsd sequence maxOccurs unbounded gt lt xsd element name element type xsd string gt lt xsd sequence gt lt xsd complexType gt Note that the element name is the hard coded name element To change the element name the ASN 1 form that allows an element name could be used ASN 1 production
16. ce file must be provided The source file specification can be a full pathname or only what is necessary to qualify the file If directory information is not provided the user s current default directory is assumed Ifa file extension is not provided the default extension asn is appended to the name Multiple source filenames may be specified on the command line to compile a set of files The wildcard characters and are also allowed in source filenames for example the command asn1c asn will compile all ASN 1 files in the current working directory The source file s must contain ASN 1 productions that define ASN 1 types and or value specifications This file must strictly adhere to the syntax specified in ASN 1 standard ITU X 680 The asnstd x208 command line option should be used to parse files based on the 1990 ASN 1 standard x 208 or that contain references to ROSE macro specifications The following table lists all of the command line options related to ASN 1 to XSD translation Options for code generation for other computer languages are doucmented in the respective language user guide documents Option Argument Description appInfo tags This option instructs the compiler to generate an lt appinfo gt section within enum the generated XSD file that contains additional ASN 1 specific ext information This includes information about tags enumerated types or extension types The argument is optional i
17. d simpleType gt The pattern enforces the rule in the X 680 standard that the first arc value of an OID must be between 0 and 2 the second arc must be between 0 and 39 and the remaining arcs can be any number The ASN 1 OBJECT IDENTIFIER type is converted into a reference to this custom type as follows ASN 1 production TypeName OBJECT IDENTIFIER Generated XSD code lt xsd simpleType name TypeName gt lt xsd restriction base asnl ObjectIdentifier gt lt xsd simpleType gt RELATIVE OID There is no built in XSD type that corresponds to the ASN 1 RELATIVE OID type For this reason a custom type was created in the Objective Systems XSD run time library asn1 xsd to model this type This type is asn RelativeOID and has the following definition lt xsd simpleType name RelativeOID gt lt xsd restriction base xsd token gt lt xsd pattern value d d gt lt xsd restriction gt lt xsd simpleType gt ASNIC V5 8 18 This is similar to the OBJECT IDENTIFIER type discussed in the previous section except in this case the pattern is simpler The arc numbers in a RELATIVE OID are not restricted in any way hence the simpler pattern The ASN 1 RELATIVE OID type is converted into a reference to this custom type as follows ASN 1 production TypeName RELATIVE OID Generated XSD code lt xsd simpleType name TypeName gt lt xsd restriction base asnl Relati
18. e converted to XML Schema and ASN 1 values are converted to XML ASN 1 value sets which are essentially a set of constraints get converted to facets in XML Schema Mapping of Top Level Constructs An ASN 1 module name is mapped to an XML schema namespace ASN 1 IMPORT statements are mapped to XSD import statements The ASN 1 EXPORT statement does not have a corresponding construct in XSD The general form of the XSD namespace and import statements would be as follows lt xml version 1 0 gt lt xsd schema xmlns xsd http www w3 org 2001 XMLSchema targetNamespace URL ModuleName lt following line would be added for imported module namespace gt xmlns ImportedModuleName importURL ImportedModuleName elementFormDefault qualified gt lt xsd import namespace importURL ImportedModuleName schemaLocation ImportedModuleName xsd gt In this definition the items in italics would be replaced with text from the ASN 1 specification being converted or a configuration file The ModuleName and ImportedModuleName items would come from the ASN 1 specification The URL and importURL items would be configuration parameters Mapping of ASN 1 Types Each ASN 1 type is mapped to a corresponding XSD type Some ASN 1 types have a natural mapping to an XSD type for example an ASN 1 BOOLEAN type maps to an xsd boolean type In other cases custom types were needed because a natural mapping did not exist within XSD for example
19. eFieldRef TableConstraint element2 name FixedTypeFieldRef TableConstraint key element3 name TypeFieldRef TableConstraint key Any combination of fixed type and type fields can be contained within the type definition Generated XSD code lt xsd complexType name TypeName gt lt xsd sequence gt lt xsd element name elemlName type FieldlType gt lt xsd element name elem2Name type Field2Type gt lt xsd element name elem3Name type TypeName elem3Name OpenType gt lt xsd sequence gt lt xsd complexType gt lt xsd complexType name TypeName elem3Name OpenType gt lt xsd choice gt lt this is the annotation for the info object set gt lt xsd appinfo gt lt ClassName gt lt object attributes declarations gt lt ClassName gt lt xsd appinfo gt lt xsd annotation gt lt these are all of the various message alternatives name and type defined within the info object set 0 lt xsd element name TypeName type TypeName gt type is possible gt lt xsd any namespace other processContents lax minOccurs 0 gt lt xsd choice gt lt xsd complexType gt In this case the fixed type field types are obtained directly from the class definition The type field is a reference to the generated open type field The generated open type container type contains all of the information on the set of messages that is allowed t
20. edByte 32768 32767 short 0 65535 unsignedShort 2147483648 2147483647 integer 0 4294967295 unsignedInt 9223372036854775808 9223372036854775807 long 0 18446744073709551615 unsignedLong Ranges beyond long or unsignedLong will cause the integer value to be treated as a big integer This will map to an xsd string type An integer can also be specified to be a big integer using the ASNIC lt isBigInteger gt configuration file setting ASNIC V5 8 10 If constraints are present on the INTEGER type that are not exactly equal to the lower and upper bounds specified above then xsd minInclusive and xsd maxInclusive facets will be added to the XSD type mapping For example the mapping of I INTEGER 0 10 would be done as follows 1 The most restrictive type would first be chosen based on the constraints In this case xsd byte would be used because it appears first on the list above 2 Then the xsd minInclusive and xsd maxInclusive facets would be added to further restrict the type This would result in the following mapping lt xsd simpleType name 1 gt lt xsd restriction base xsd byte gt lt xsd minInclusive value 0 gt lt xsd maxInclusive value 10 gt lt xsd restriction gt lt xsd simpleType gt BIT STRING There is no built in XSD type that corresponds to the ASN 1 BIT STRING type For this reason a custom type was created in the ASN2XSD run time library asn xsd to model this type
21. erences one of these types e BOOLEAN e INTEGER e ENUMERATED e REAL The mapping is to the XSD list type This is a list of space separated identifiers The syntax is as follows ASN 1 production TypeName SEQUENCE OF ElementType ASNIC V5 8 22 Generated XSD code lt xsd simpleType name TypeName gt lt xsd list itemType ElementType gt lt xsd simpleType gt This will be referred to as the simple case from this point forward If the element type is any other type than those listed above the ASN 1 type is mapped to an XSD sequence complex type that contains a single element of the element type The generated XSD type also contains the maxOccurs and possibly the minOccurs facet to specify the array bounds The general mapping of an unbounded SEQUENCE OF type i e one with no size constraint to XSD is as follows ASN 1 production TypeName SEQUENCE OF ElementType Generated XSD code lt xsd complexType name TypeName gt lt xsd sequence maxOccurs unbounded gt lt xsd element name element type ElementType gt lt xsd sequence gt lt xsd complexType gt In this definition the element name is the hard coded value element The element type is the equivalent XSD type for the ASN 1 element type As of the 2002 version of the ASN 1 standards it is now possible to include an element identifier name before the element type name in a SEQU
22. f no argument is given information is generated for all of these items It is also possible to specify multiple items by using a comma separated list for example appInfo tags enum ASNIC V5 8 5 asnstd x208 x680 mixed This option instructs the compiler to parse ASN 1 syntax conforming to the specified standard x680 the default refers to modern ASN 1 as specified in the ITU T X 680 X 690 series of standards x208 refers to the now deprecated X 208 and X 209 standards This syntax allowed the ANY construct as well as unnamed fields in SEQUENCE SET and CHOICE constructs This option also allows for parsing and generation of code for ROSE OPERATION and ERROR macros and SNMP OBJECT TYPE macros The mixed option is used to specify a source file that contains modules with both X 208 and X 680 based syntax attrs tags enum ext This option instructs the compiler to generate non native attributes for elements within the generated XSD file that contain additional ASN 1 specific information This includes information about tags enumerated types or extension types The argument is optional if no argument is given information is generated for all of these items It is also possible to specify multiple items by using a comma separated list for example appInfo tags enum compat lt versionNumber gt Generate code compatible with an older version of the compiler The compiler will
23. f the generated files will be written ASNIC V5 8 pdu lt typeName gt Designate given type name to be a Protocol Definition Unit PDU type This will cause a C control class to be generated for the given type By default PDU types are determined to be types that are not referenced by any other types within a module This option allows that behavior to be overridden The wildcard character may be specified for lt typeName gt to indicate that all productions within an ASN 1 module should be treated as PDU types targetns lt URI gt Specify URI for target namespace to be added to the generated XSD code If this option is omitted no target namespace declaration is added warnings None Output information on compiler generated warnings xsd lt filename gt This option instructs the compiler to generate an equivalent XML Schema Definition XSD for each of the ASN 1 productions in the ASN 1 source file The definitions are written to the given filename or to lt modulename gt xsd if the filename argument is not provided ASNIC V5 8 ASNIC V5 8 ASN 1 to XML Schema Conversion The ASNIC compiler contains the capability of generating corresponding XML Schema type definitions from ASN 1 types This capability is also present in a free online tool ASN2XSD that may be accessed via the following URL http www obj sys com asn2xsdform shtml ASN 1 types ar
24. fields within a CLASS definition that results in an ASN 1 to XSD mapping are type fields and fixed type value fields These are translated to attributes with type xsd string Only simple value types are supported i e those that have a direct mapping to a string in this mapping Fields of any other type for example object set fields are ignored As an example the mapping of a common 3GPP ASN 1 CLASS would be as follows ASN 1 definition NBAP PROTOCOL IES CLASS amp id ProtocolIE ID UNIQUE criticality Criticality amp Value amp presence Presence WITH SYNTAX ID amp id CRITICALITY amp criticality TYPE amp Value PRESENCE amp presence ASNIC V5 8 29 Generated XSD code lt xsd complexType name NBAP PROTOCOL IES gt lt xsd sequence minOccurs 0 maxOccurs unbounded gt lt xsd element name object gt lt xsd complexType gt lt xsd attribute name id type xsd string gt lt xsd attribute name criticality type xsd string gt lt xsd attribute name type type xsd string gt lt xsd attribute name presence type xsd string gt lt xsd complexType gt lt xsd element gt lt xsd sequence gt lt xsd complexType gt In this definition the following fields are fixed type value fields id criticality and presence Value is a type field the attribute name type is always used for type fields All were translated to attributes with
25. g gt lt xsd minLength value lower gt lt xsd maxLength value upper gt lt xsd restriction gt lt xsd simpleType gt ASN 1 character string types may also contain permitted alphabet or pattern constraints These are converted into pattern facets in the generated XSD definition ASN 1 production TypeName ASN1CharStringType FROM charSet or TypeName ASN1CharStringType PATTERN pattern Generated XSD code lt xsd simpleType name TypeName gt lt xsd restriction base xsd string gt lt xsd pattern value pattern gt lt xsd restriction gt lt xsd simpleType gt In this case the permitted alphabet character set charSet is converted into a corresponding pattern for use in the generated XML schema definition Time String Types The ASN 1 GeneralizedTime and UTCTime types are mapped to the XSD dateTime type ASN 1 production TypeName ASN1TimeStringType in this definition ASN TimeStringType would be replaced with either GeneralizedTime or UTCTime ASNIC V5 8 15 Generated XSD code lt xsd simpleType name TypeName gt lt xsd restriction base xsd dateTime gt lt xsd simpleType gt ENUMERATED The ASN 1 ENUMERATED type is converted into an XSD token type with enumeration items The enumeration items correspond to the enumerated identifiers in the type If the attrs enum command line option is specified and the enumerated items contain numbers i e do not f
26. g is as follows ASN 1 production TypeName CHOICE elementl name elementl type element2 name element2 type Generated XSD code lt xsd complexType name TypeName gt lt xsd choice gt lt xsd element name elementl name type elementl type gt lt xsd element name element2 name type element2 name gt lt xsd choice gt lt xsd complexType gt typedef struct This is similar to the SEQUENCE and SET cases described above The only difference is that xsd choice is used instead of xsd sequence or xsd all The CHOICE type cannot have elements marked as optional OPTIONAL or elements that contain default values DEFAULT as was the case for SEQUENCE and SET If the CHOICE type is extensible i e contains an ellipses marker a special element will be inserted to allow an unknown alternative to be validated This element is as follows ASNIC V5 8 25 lt xsd any namespace other processContents lax gt This element declaration allows any additional elements from other namespaces to exist in a message instance without causing a validation or decoding error Note the restriction that the element must be defined in a different namespace This is necessary because if the element existed in the same namespace as other elements the content model would be non deterministic The reason is because a validation program would not be able to determine if the choice alternative element is a defined e
27. gs gt element in a schema bindings file This element contains a mandatory version attribute that specifies the verion of the schema binding language in use For this version of XSD2ASN1 the only supported version is 1 0 Therefore the outer level of the schema bindings file will always look like this lt bindings version 1 0 gt specific binding lt bindings gt ASNIC V5 8 lements her 36 The only element supported below the lt bindings gt level is the lt schemaBindings gt element This allows the association of configuration items with a specific schema The schema is specified using the namespace attribute which identifies the schema using its target namespace The actual location of an include or import file can then be specified using the binding file lt sourceFile gt element The content of this element is the full or relative pathname to the schema file on a local computer access to a web URI is not supported at this time As an example suppose a schema contained the following import directive lt xsd import namespace http example com ImportElement schemaLocation almportElement xsd gt It is possible to specify a different path for the almportElement xsd file if it did not reside in the current working directory using a schema binding file Assume it was located in the c importSchemas directory The binding file would be as follows lt bindings version 1 0 gt lt schemaBi
28. id C ID is an ASN 1 value defined as follows id C ID ProtocolIE ID 33 The generated XSD annotation for this declaration is as follows lt xsd annotation gt lt xsd appinfo gt lt NBAP PROTOCOL IES gt lt object id id C ITD type C_ID criticality reject presence mandatory gt lt object id 43 type ConfigurationGenID criticality reject presence mandatory gt lt object id 36 type SetupRqstFDD criticality ignore presence mandatory gt lt NBAP_ PROTOCOL IES gt lt xsd appinfo gt lt xsd annotation gt Use of Mappings in Type Definitions ASN 1 type definitions can be created that reference class fields and that are constrained by objects defined within an Information Object Set The XSD mapping for these types contain normal element declarations for fixed type value fields and special open type elements for type fields The special open type elements will reference a generated complexType with a name in the following format lt Parent Type Assignment Name gt _ lt Open Type Element Name gt _OpenType The Information Object and Information Object Set definitions related to this type will be added as an annotation in the format described earlier The generated type will be a choice between all of the different alternatives that make up the Information Object Set The basic mapping is as follows ASN 1 Definition ASNIC V5 8 31 TypeName SEQUENCE elementl name FixedTyp
29. in the inner complexType Information Object and Information Object Set ASN 1 Information Object and Information Object Set definitions are used in table constraint specifications within ASN 1 types for automatic encoding decoding of open type fields A mapping is done of an Information Object Set declaration to XSD application information appinfo within generated types that reference the constraints The basic mapping is as follows ASN 1 Information Object Set definition InfoObjectSetName ClassName InfoObject declarations Generated XSD code lt xsd annotation gt lt xsd appinfo gt lt ClassName gt lt object InfoObject attribute declarations gt lt ClassName gt lt xsd appinfo gt lt xsd annotation gt The Information Object attribute declarations would be concrete instances of the attributes defined within the Class type A separate row would be generated for each Information Object defined within the Information Object Set specification For example the following is an Information Object Set specification using the NBAP PROTOCOL IES class defined above CommonSetupRequests NBAP PROTOCOL IES ASNIC V5 8 30 ID id C ID CRITICALITY reject TYPE STD PRESENCE mandatory ID 46 CRITICALITY reject TYPE ConfigurationGenID PRESENCE mandatory ID 36 CRITICALITY ignore TYPE SetupRqstFDD PRESENCE mandatory In this example
30. lement or an extension element Open Type An Open Type as defined in the X 680 standard is specified as a reference to a Type Field in an Information Object Class The most common form of this is when the Type field in the built in TYPE IDENTIFIER class is referenced as follows TYPE IDENTIFIER Type A reference to an Open Type within a SEQUENCE or CHOICE construct is converted into an XSD any element type Note that the conversion is only done if the element is in one of these constructs An open type declaration on its own has no equivalent XSD type and is therefore ignored An example showing how an open type might be referenced in a SEQUENCE type and the corresponding conversion to XSD is as follows SeqwithOpenType SEQUENCE anOpenType TYPE IDENTIFIER amp Type Generated XSD type lt xsd complexType name SeqWithOpenType gt lt xsd sequence gt lt xsd any gt lt xsd sequence gt lt xsd complexType gt In this case any valid XML instance can be used in the type Note that the ASN 1 element name anOpenType is ignored Tagged Type In ASN 1 it is possible to create new custom types using ASN 1 tag values as identifiers These identifiers are built into BER or DER encoded messages In general these tags have no meaning in an XSD representation of an ASN 1 type that is used to create or validate XML markup However if the schema definition is to be used to generate
31. ndings namespace http example com ImportElement gt lt sourceFile gt c importSchemas almportElement xsd lt sourceFile gt lt schemaBindings gt lt bindings gt XSD to ASN 1 Information Item Mappings All XSD to ASN 1 information item mappings are as specified in the ITU T X 694 standard a free copy of which is available at the following URL http www itu int ITU T studygroups com17 languages X694pdf The only non standardized item is the module name used for the generated ASN 1 module XSD2ASN1 assigns module name as follows 1 It will attempt to use the last delimitted item at the far right in the target namespace declaration For example if the target namespace URI is http foo bar Bar will be used as the module name note the first letter was capitialized as per X 694 naming rules 2 If the target namespace is not in a standard URI format or if the last delimitted name contains special chanracters or is very long then the name of the original XSD source file is used ASNIC V5 8 37 ASNIC V5 8 38 Index A all 36 appInfo 5 appinfo enum 13 16 ASN 1 CLASS 29 ASN 1 Information Object 30 asnl bitno 12 description attribute 21 NULL 18 Objectldentifier 18 RelativeOID 18 TagInfo 27 value attribute 16 asnstd 6 attrs 6 attrs enum 12 16 attrs ext 21 attrs tags 27 B BIT STRING type XML schema mapping 11 BOOLEAN type XML schema mapping 9 C Character string type
32. o occupy the open type field An example showing all of this using the NBAP protocol is as follows ASNIC V5 8 32 The definition of an NBAP Protocol Information Element Field is as follows ProtocolIE Field SEQUENCE id NBAP PROTOCOL IES amp id CommonSetupRequests criticality NBAP PROTOCOL IES amp criticality CommonSetupRequests id value NBAP PROTOCOL IES amp Value CommonSetupRequests id This type allows any of the messages defined in the CommonSetupRequests information object set to be populated in the Value field The id and criticality must match that ofthe defined message The XSD definitions that are generated from this are as follows lt xsd complexType name ProtocolIE Field gt lt xsd sequence gt lt xsd element name id type ProtocolIE ID gt lt xsd element name criticality type Criticality gt lt xsd element name value type ProtocolIE Field OpenType gt lt xsd sequence gt lt xsd complexType gt lt xsd complexType name ProtocolIE Field value OpenType gt lt xsd choice gt lt xsd annotation gt lt xsd appinfo gt lt NBAP_ PROTOCOL IES gt lt object id id C ID type C_ID criticality reject presence mandatory gt lt object id 43 type ConfigurationGenID criticality reject presence mandatory gt lt object id 36 type SetupRqstFDD criticality ignore presence mandatory gt lt NBA P PROTO
33. objective SYSTEMS INC ASNIC ASN 1 Compiler Version 6 0 XML Schema Translator User s Manual Objective Systems Inc October 2006 The software described in this document is furnished under a license agreement and may be used only in accordance with the terms of this agreement Copyright Notice Copyright O 1997 2006 Objective Systems Inc All Rights Reserved This document may be distributed in any form electronic or otherwise provided that it is distributed in its entirety and that the copyright and this notice are included Author s Contact Information Comments suggestions and inquiries regarding ASN1C may be submitted via electronic mail to info obj sys com CHANGE HISTORY Date Author Version Description 10 15 2006 ED 6 0 Initial version TABLE OF CONTENTS Overview of ASN 1 XSD Translati0M o oooo o o 0 Using the Compilers sn A AR eee tes ies ee ee eed RUNNING ASNIC FROM THE COMMAND LINE 00 00 eee ete te ene ene eens 3 ASN 1 to XML Schema Conversion 00 c ccc ccccccc cece cc cccececee eed D MAPPING OF TOP LEVEL CONSTRUCTS 0 cece ccc enn enn e eens 9 MAPPING OF ASN 1 TYPES 0 cece ce tent ence btn n eee t beeen cane 9 BOOLEAN ci A REDS EA EGR ERLE OE BAS Eg SOE linie 9 INTEGER posue 122 28 2 she in BE Og GEER VRS da ed eee 10 BIL STRIN Ges IS N Toa dae tal la ete saat in
34. ollow the standards sequence then an asn value attribute is added to the type to allow an application to map the enumerated identifiers to numbers If an asn value attribute is not present then an application can safely assume that the enumerated identifiers are in sequential order starting at zero ASN 1 production TypeName ENUMERATED idl vall id2 val2 etc Generated XSD code lt xsd simpleType name TypeName gt lt xsd restriction base xsd token gt lt xsd enumeration name id1 asnl value vall gt lt xsd enumeration name id2 asnl value val2 gt lt xsd restriction gt lt xsd simpleType gt The asn1 value attributes added to the enumeration items above are an example of non native attributes These are attributes that are not defined within the XML Schema standard but that may be added to provide additional information about an element contained within the schema Conformant XML schema processors should ignore these attributes They are only added to the generated code if the attrs enum option is added to the ASN1C command line or attrs option with no qualifiers It is also possible to generate an application information appinfo section within the generated schema containing information on the enumerated values This is done using the appinfo enum option or appinfo with no qualifiers The generated code with lt appinfo gt would be as follows lt xsd simpleT
35. on gt lt xsd appinfo gt lt asnl NamedBitInfo gt lt asnl NamedBit name b1 bitNumber n1 gt lt asnl NamedBit name b2 bitNumber n2 gt lt asnl NamedBitInfo gt lt xsd appinfo gt lt xsd annotation gt lt xsd union memberTypes asnl BitString gt lt xsd list gt lt xsd simpleType gt lt xsd restriction base xsd token gt lt xsd enumeration value b1 gt lt xsd enumeration value b2 gt lt xsd restriction gt lt xsd simpleType gt lt xsd list gt lt xsd union gt lt xsd simpleType gt The lt appinfo gt section will not be generated if the bits are sequentially numbered starting at zero Example The following ASN 1 BIT STRING type ColorSet BIT STRING blue 1 green 3 red 5 maps to the following XSD type when attrs is specified on the command line lt xsd simpleType name ColorSet gt lt xsd union memberTypes asnl BitString gt lt xsd list gt lt xsd simpleType gt lt xsd restriction base xsd token gt lt xsd enumeration value blue asnl bitno 1 gt lt xsd enumeration value green asnl bitno 3 gt lt xsd enumeration value red asnl bitno 5 gt lt xsd restriction gt lt xsd simpleType gt lt xsd list gt lt xsd union gt lt xsd simpleType gt ASNIC V5 8 13 If attrs is omitted the generated type will not contain the asn bitno attributes OCTET STRING The ASN 1 OCTET STRING type is converted into the XSD hexBinary type ASN 1 prod
36. ories to search 0 lt directory gt This option is used to specify the name of a directory to which all of the generated files will be written warnings None Output information on compiler generated warnings XML Schema Binding File The schema bindings file is an XML file that allows customizations of certain aspects of the XSD to ASN 1 translation process It is different from command line switches in that it provides a way to associate configuration items with specific XSD information items within a schema or set of schemas For this release of XSD2ASN1 the only useful configuration item that can be specified is the location of individual source files for schemas included using the lt xsd include gt and lt xsd import gt declarations These declarations allow a schemaLocation attribute to be specified but this attribute does not necessarily have to contain a full path to the referenced file it is described in the standard as only providing a hint for a schema processor to help in locating the file Since third party schemas cannot always be editied by developers the schema binding file provides a mechanism to bind the file location information to the schema without requiring edits to the original schema At the outer level of the schema binding file is a lt bindings gt element This is a container element that holds all of the binding elements for specific schemas There can be one and only one lt bindin
37. r list of java files generate get set methods and protected member vars generate build script generate comparison functions C namespace prefix C namespace name output C code to module name dirs generate lt modulename gt mk for list of C files generate code to invoke SAX like event handlers generate stream based encode decode functions generate table constraint functions do strict checking of table constraint conformance prtToStr lt filename gt ASNIC V5 8 generate print to string functions C C prtToStrm lt filename gt generate print to stream functions C C genTest lt filename gt generate sample test functions reader generate sample reader program writer generate sample writer program compare lt filename gt generate comparison functions C C copy lt filename gt generate copy functions C C maxcfiles generate separate file for each function C C XSD options appinfo lt items gt generate appInfo for ASN 1 items lt items gt can be tags enum and or ext ex appinfo tags enum ext default generate non native attributes for lt items gt all if lt items gt not given attrs lt items gt lt items gt is same as for appinfo targetns lt namespace gt Specify target namespace lt namespace gt is namespace URI if not given no target namespace declaration is added To use the compiler at a minimum an ASN 1 sour
38. ranslates an Abstract Syntax Notation 1 ASN 1 source file into computer language source files that allow ASN 1 data to be encoded decoded This release of ASNIC contains facilities to translate ASN 1 source specifications to an equivalent representation in World Wide Web Consortium W3C XML Schema Definition language XSD A utility program is also provided to do the reverse translation from XSD to ASN 1 as specified in the ITU T X 694 standard This is the xsd2asn executable program located in the installation bin subdirectory This program is described in the XML Schema to ASN 1 Conversion section ASNIC V6 0 1 ASNIC V5 8 Using the Compiler Running ASNIC from the Command line The ASNIC compiler distribution contains a command line compiler executable as well as a graphical user interface GUI wizard Windows version only that can aid in the specification of compiler options This section describes how to run the command line version Information on the GUI wizard can be found in the ASNIC C C Users Guide To test if the compiler was successfully installed enter asn1c with no parameters as follows note if you have not updated your PATH variable you will need to enter the full pathname asnlc You should observe the following display or something similar ASNIC Compiler Version 5 8x Copyright c 1997 2005 Objective Systems Inc All Rights Reserved Usage asnlc lt filename gt lt options gt lt filename gt
39. s set output file directory designate lt type gt to be a Protocol Data Unit PDU lt type gt may be to select all type definitions shortnames trace uniquenames warnings C C options hfile lt filename gt cfile lt filename gt genBitMacros genlnit genFree genMake maxlines lt num gt oh lt directory gt static w32 Java options pkgpfx lt text gt pkgname lt text gt dirs genjsources getset genbuild compare C options nspfx lt text gt namespace lt text gt dirs gencssources pro options events stream tables strict generate print functions reduce the length of compiler generated names add trace diag msgs to generated cod resolve name clashes by generating unique names output compiler warning messages C or C header h filename default is lt ASN 1 Module Name gt h C or C source c or cpp filename default is lt ASN 1 Module Name gt c generate named bit set clear test macros generate initialization functions for all types generate memory free functions for all types generate makefile to build generated cod set limit of number of lines per source file default value is 50000 set output directory for header files generate static elements not pointers generate code for Windows O S default GNU Java package prefix Java package name output Java code to module name dirs generate lt modulename gt mk fo
40. s specified in a list to binary bits in a bitmap The formal mapping of an ASN 1 BIT STRING with named bits to XSD is as follows ASN 1 production TypeName BIT STRING b1 n1 b2 n2 Generated XSD code lt xsd simpleType name TypeName gt lt xsd union memberTypes asnl BitString gt lt xsd list gt lt xsd simpleType gt lt xsd restriction base xsd token gt lt xsd enumeration value b1 asnl bitno n1 gt lt xsd enumeration value b2 asnl bitno n2 gt lt xsd restriction gt lt xsd simpleType gt lt xsd list gt lt xsd union gt lt xsd simpleType gt The asn1 bitno attributes added to the enumeration items above are an example of non native attributes These are attributes that are not defined within the XML Schema standard but that may be added to provide additional information about an element contained within the schema Conformant XML schema processors should ignore these attributes They are only added to the generated code if the attrs enum option is added to the ASN1C command line or attrs option with no qualifiers ASNIC V5 8 12 It is also possible to generate an application information appinfo section within the generated schema containing information on the named bit numbers This is done using the appinfo enum option or appinfo with no qualifiers The generated code with lt appinfo gt would be as follows lt xsd simpleType name TypeName gt lt xsd annotati
41. t cause a validation error This is accomplished by adding a union with an xsd token type to the generated type definition ASN 1 production TypeName ENUMERATED idl vall id2 val2 etc Generated XSD code lt xsd simpleType name TypeName gt lt xsd union memberTypes xsd token gt lt xsd simpleType gt lt xsd restriction base xsd token gt lt xsd enumeration name id1 asnl value vall gt lt xsd enumeration name id2 asnl value val2 gt lt xsd restriction gt lt xsd simpleType gt lt xsd union gt lt xsd simpleType gt ASNIC V5 8 17 NULL There is no built in XSD type that corresponds to the ASN 1 NULL type For this reason a custom type was created in the Objective Systems XSD run time library asn xsd to model this type This type is asn1 NULL and has the follow ing definition lt complexType name NULL final all gt This is a non extendable empty complex type OBJECT IDENTIFIER There is no built in XSD type that corresponds to the ASN 1 OBJECT IDENTIFIER type For this reason a custom type was created in the Objective Systems XSD run time library asn1 xsd to model this type This type is asn1 Objectldentifier and has the following definition lt xsd simpleType name ObjectIdentifier gt lt xsd restriction base xsd token gt lt xsd pattern value 0 2 1 3 0 9 d gt lt xsd restriction gt lt xs
42. te Dede dade ye Se ee ee 11 OCBELSERING 2 ndha Eiaa A a A As 14 Character String Types 00 nee nent nett teens 14 TIMES TIRE Types er iph ok Said een ech is 15 ENUMERATED ernannten ae oe A TR REE 16 NUEE tae edo 18 OBJECT IDENTIFIER cire A A di Bee das 18 RELA RIVE OID Wi A Wie BR ae ERDE ad ci dos 18 READ ded ton ih eit aceon the yt hoe eth ox ae taeda Cede yr lyme thar edu deka ad 19 SEQUENCE ioe sn Ah e Ne Bere AG ad lees ed en 19 PSY I Aa ee ee ee ee er en 22 SEQUENCE OF SET IOP a ica tae Ne Sota ea EE aa a Vat Ge eek Bed 22 CHOICE ste eae A nt A A A Cate ental tel Seg e thd Grane ee eae a tush hee 25 Open Type sn AAA ee ee A AE re ee 26 Tagged Type inn AAA A A en Bes De er A SE 26 EXTERNAL and EmbeddedPDV Type ooooocooccocccccn ttt nee eens 27 MAPPING OF ASN 1 INFORMATION OBJECTS 0oocoocccccccccnccr eee nee ene ene 29 CEA SS a ee BES Bla tha Br espe ue hae gt yk A IES 29 Information Object and Information Object Set 0600 ccc ens 30 Use of Mappings in Type Definitions 2 0 0 tenet tenes 31 XML Schema to ASN 1 Conversion cc ccc cece reece cece cece vecesees JD RUNNING THE XSD TO ASN 1 TRANSLATION TOOL FROM THE COMMAND LINE 35 XML SCHEMA BINDING FILE cee eee nee ee eee eee ene eees 36 XSD TO ASN 1 INFORMATION ITEM MAPPINGS 0 0 0 eee eee nes 37 Index oid ios ed Ca rl Sy ee Be Waele Va A is ASNIC XSD v6 0 Overview of ASN 1 XSD Translation The ASNIC code generation tool t
43. uction TypeName OCTET STRING Generated XSD code lt xsd simpleType name TypeName gt lt xsd restriction base xsd hexBinary gt lt xsd simpleType gt Sized OCTET STRING The ASN 1 OCTET STRING type may contain a size constraint This is converted into minLength and maxLength facets in the generated XSD definition ASN 1 production TypeName OCTET STRING SIZE lower upper Generated XSD code lt xsd simpleType name TypeName gt lt xsd restriction base hexBinary gt lt xsd minLength value lower gt lt xsd maxLength value upper gt lt xsd restriction gt lt xsd simpleType gt Character String Types All ASN 1 character string useful types 145String VisibleString etc are mapped to the XSD string type ASN 1 production TypeName ASN1CharStringType in this definition ASN CharStringType would be replaced with one of the ASN 1 Character String types such as VisibleString Generated XSD code lt xsd simpleType name TypeName gt lt xsd restriction base xsd string gt ASNIC V5 8 14 lt xsd simpleType gt ASN 1 character string types may contain a size constraint This is converted into minLength and maxLength facets in the generated XSD definition ASN 1 production TypeName ASN1CharStringType SIZE lower upper E Generated XSD code lt xsd simpleType name TypeName gt lt xsd restriction base xsd strin
44. ve0ID gt lt xsd simpleType gt REAL The ASN 1 REAL type is mapped to the XSD double built in type ASN 1 production TypeName REAL Generated XSD code lt xsd simpleType name TypeName gt lt xsd restriction base xsd double gt lt xsd simpleType gt SEQUENCE An ASN 1 SEQUENCE is a constructed type consisting of a series of element definitions that must appear in the specified order This is very similar to the XSD sequence complex type and is therefore mapped to this type The basic mapping is as follows ASN 1 production TypeName SEQUENCE elementl name elementl type element2 name element2 type Generated XSD code lt xsd complexType name TypeName gt lt xsd sequence gt lt xsd element name elementl name type elementl type gt lt xsd element name element2 name type element2 name gt ASNIC V5 8 19 lt xsd sequence gt lt xsd complexType gt OPTIONAL keyword Elements within a sequence can be declared to be optional using the OPTIONAL keyword This indicates that the element is not required in the encoded message XSD contains the minOccurs facet that can be used to model this behavior Setting minOccurs equal to zero is the equivalent to declaring an element to be optional because this indicates the element can appear zero to one times in the definition For example the following ASN 1 SEQUENCE type OptInt SEQUEN
45. xtension base asnl lt xsd complexContent gt lt xsd complexType gt ASNIC V5 8 EmbeddedPDV gt 28 Mapping of ASN 1 Information Objects The ITU T ASN 1 X 681 and X 682 standards specify a table driven approach for the assignment of constrained values to open types within a specification These constraints are known as table constraints and utilize Open Type Class Information Object and ObjectSet definitions A mapping is presented below for definitions of this type This mapping will be generated by the ASNIC compiler or ASN2XSD translation tool if the tables option is specified CLASS An ASN 1 CLASS is used to define the structure of Information Objects and Information Object Sets An Information Object Set is similar in structure to a relational table in that it is a collection of rows that define the set of messages that may be used in a constrained open type field For this reason CLASS is modeled as an unbounded collection of the fields defined within the CLASS definition The basic mapping is as follows ASN 1 definition ClassName CLASS Class field definitions Generated XSD code lt xsd complexType name ClassName gt lt xsd sequence minOccurs 0 maxOccurs unbounded gt lt xsd element name object gt lt xsd complexType gt attribute mappings for class fields lt xsd complexType gt lt xsd element gt lt xsd sequence gt lt xsd complexType gt The only types of
46. y I lt directory gt Import file directory all Compile all dependent files warnings Output compiler warning messages ASNIC V5 8 35 The XSD source file specification can be a full pathname or only what is necessary to qualify the file If directory information is not provided the user s current default directory is assumed Multiple source filenames may be specified on the command line to compile a set of files The wildcard characters and are also allowed in source filenames for example the command xsd2asn1 xsd will translate all XSD files in the current working directory to ASN 1 The following table lists all of the command line options supported in this version of the tool Option Argument Description all None This option is used to specify that all dependent files should be translated to ASN 1 as well as the main file being compiled This includes all files included using XSD lt include gt and lt import gt directives config lt filename gt This option is used to specify the name of a file containing configuration information for the source file s being parsed A full discussion of the contents of a configuration file is provided in the XML Schema Binding File section I lt directory gt This option is used to specify a directory that the compiler will search for ASN 1 source files for IMPORT items Multiple I qualifiers can be used to specify multiple direct
47. ype name TypeName gt lt xsd annotation gt lt xsd appinfo gt lt asnl EnumInfo gt lt asnl EnumItem name id1 value val1 gt lt asnl EnumItem name id2 value val2 gt lt asnl EnumInfo gt lt xsd appinfo gt lt xsd annotation gt lt xsd restriction base xsd token gt ASNIC V5 8 16 lt xsd enumeration name id1 gt lt xsd enumeration name id2 gt lt xsd restriction gt lt xsd simpleType gt Example The following ASN 1 enumerated type Colors ENUMERATED blue 1 green 3 red 5 maps to the following XSD type when attrs is specified on the command line lt xsd simpleType name Colors gt lt xsd restriction base xsd token gt lt xsd enumeration name blue asnl value 1 gt lt xsd enumeration name green asnl value 3 gt lt xsd enumeration name red asnl value 5 gt lt xsd restriction gt lt xsd simpleType gt Note that if the attrs command line option was not specified or if the identifiers in the enumerated type did not contain numbers i e if the type was ENUMERATED blue green red then the asn1 value attributes would not be added to the code above Extensible ENUMERATED An ENUMERATED type may include an extensibility marker to indicate that enumerated items not defined in the current set may be added at a later time The generated XSD type in this case must allow items outside of the base set to no
Download Pdf Manuals
Related Search
Related Contents
GI 350 DSPG GI 420 DSPG GI 510 DSPG Installation/Care/Use Manual Manual de Instalación/Cuidado Savo I-5606-S/ASC SIVACON 8PS - Installieren mit System BD2 - Service SunGrabber Installation Manual AN022 Getting Started with the KXTE9 User manual DEHACO AXO NEBULISER Lire le Manuel - EASYLABEL Europa - Hidrosense Copyright © All rights reserved.
Failed to retrieve file