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 specific modules and productions.
The basic structure of a configuration file is described in the C/C++ User's Guide. Configuration items that are applicable to Go 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 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. However, if an element is marked <notUsed/> or <notUsedSkip/>, the referenced type is not automatically included; if an element is marked <notUsedDecode/> or <notUsedDecodeSkip>, the referenced type is included for encoding only; if an element is marked <notUsedEncode/>, the referenced type is included for decoding only. |
<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. |
<isPLMNidentity/> | n/a |
This flag identifies the production as a PLMNidentity. Any production so identified will be treated as an OCTET STRING, regardless of how the production might be defined in the ASN.1. |
<typePrefix> </typePrefix> | prefix text | This is used to specify a prefix that will be applied to generated Go type names for this production. This can be used to prevent name clashes if multiple modules are involved in a compilation and they 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. |
<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. |
<notUsedSkip/> | n/a | This is the same as <notUsed/> except that it tells the compiler to generate skip functions when necessary. Skip functions are used for skipping over values of a type during decoding, rather than reporting an error if that type should happen to be encountered in the encoding. |
<notUsedDecode/> | n/a | Similar to the notUsed flag, except that rather than indicating the element is not used at all, it indicates the element is not used for decoding (i.e. it is still used for encoding). This can be useful for reducing the amount of generated code, when used in conjuction with a production level <include/> (which see). It signals that the element's type does not require a decode function for the sake of this element. |
<notUsedDecodeSkip/> | n/a | This is the same as <notUsedDecode/> except that it tells the compiler to generate skip functions when necessary. Skip functions are used for skipping over values of a type during decoding, rather than reporting an error if that type should happen to be encountered in the encoding. |
<notUsedEncode/> | n/a | The encoding complement to <notUsedDecode/> |