In addition to command line options, a configuration file can be used to specify compiler options. These options can be applied not only globally but also to specificmodules and productions.
The basic structure of a configuration file is described in the C/C++ User's Guide. Configurations items that are applicable to Python code generation are described in the following sections.
Global Level
These attributes can be applied at the global level by including
them within the <asn1config>
section:
Name | Values | Description |
---|---|---|
<includedir></includedir> | <Include directory> | This configuration item is used to specify a directory that will be searched for IMPORT files. It is equivalent to the -I command-line option. |
Module Level
These attributes can be applied at the module level by including them within a <module> section:
Name | Values | Description |
---|---|---|
<name> </name> |
module name | This attribute identifies the module to which this section applies. Either this or the <oid> element/attribute is required. |
<oid> | module OID (object identifier) | This attribute provides for an alternate form of module identification for the case when module name is not unique. For example, a given ASN.1 module may have multiple versions. A unique version of the module can be identified using the OID value. |
<include types="names" values="names"/> | ASN.1 type or values names are specified as an attribute list |
This item allows a list of ASN.1 types and/or values to be included in the generated code. By default, the compiler generates code for all types and values within a specification. This allows the user to reduce the size of the generated code base by selecting only a subset of the types/values in a specification for compilation. Note that if a type or value is included that has dependent types or values (for example, the element types in a SEQUENCE, SET, or CHOICE), all of the dependent types will be automatically included as well. |
<exclude types="names" values="names"/> | ASN.1 type or values names are specified as an attribute list | This item allows a list of ASN.1 types and/or values to be excluded from the generated code. By default, the compiler generates code for all types and values within a specification. This is generally not as useful as the include directive because most types in a specification are referenced by other types. If an attempt is made to exclude a type or value referenced by another item, the directive will be ignored. |
<sourceFile> |
source file name | Indicates the given module is contained within the given ASN.1 source file. This is used on IMPORTs to instruct the compiler where to look for imported definitions. |
<valuePrefix> </valuePrefix> | prefix text | This is used to specify a prefix that will be applied to all generated value constants within a module. This can be used to prevent name clashes if multiple modules are involved that use a common name for two or more different value declarations. |
Production Level
These attributes can be applied at the production level by including them within a <production> section:
Name | Values | Description |
---|---|---|
<name> |
production name | This attribute identifies the production (type) to which this section applies. The name may also be specified as an attribute. In either case, it is required. |
<isTBCDString/> | n/a | This item is used to indicate that this production is to be encoded and decoded as a telephony binary coded string (TBCD). This is type is not part of the ASN.1 standards but is a widely used encoding format in telephony applications. |
<typePrefix> </typePrefix> | prefix text | This is used to specify a prefix that will be applied to all generated Python class names. This can be used to prevent name clashes if multiple modules are involved in a compilation and they all contain common names. |
Element Level
These attributes can be applied at the element level by including them within an <element> section:
Name | Values | Description |
---|---|---|
<name> |
element name | This element identifies the element within a SEQUENCE, SET, or CHOICE construct to which this section applies. It may also be specified as an attribute. In either case, it is required. |
<isOpenType/> |
n/a | This flag variable specifies that this element will be decoded as an open type (i.e. skipped). Refer to the section on deferred decoding and partial decoding for further information. Note that this variable can only be used with BER, CER, or DER encoding rules. |
<notUsed/> | n/a | This flag variable specifies that this element will not be used at all in the generated code. It can only be applied to optional elements within a SEQUENCE or SET, or to elements within a CHOICE. Its purpose is for production of more compact code by allowing users to configure out items that are of no interest to them. |
<skip/> |
n/a | This flag variable specifies that this element will be skipped during decoding. Refer to the section on deferred decoding and partial decoding for further information. Note that this variable can only be used with BER, CER, or DER encoding rules. |