Specifies the version of the standard used in the input ASN.1 specification files.
The -1990 option indicates that the ASN.1 specification should contain only syntax that conforms to the 1990 standard. The compiler provides support for the 1990 version of ASN.1, which includes the following:
The compiler flags any syntax that follows a standard newer than 1990.
The -2021 option indicates that the ASN.1 specification should contain only syntax that conforms to a more modern ASN.1 standard than 1990. The compiler provides support for the 2021 version of ASN.1, which includes the addition of WITH SUCCESSORS and WITH DESCENDANTS to the imports clause. The previous 2015 version of ASN.1 is also supported, which includes the following:
By default, before detecting a particular type of notation, the compiler uses neutral mode. After the compiler detects notation particular to ASN.1:1990 or ASN.1:2021, it switches out of neutral mode and enforces conformance to that standard. One disadvantage of using neutral mode is that often, when creating new ASN.1 specifications, the debugging cycle may take longer than usual to complete.
You can use both versions of the ASN.1 standard for the same specification; however, this behavior is not allowed by the X.680 (2021) ISO/IEC 8824-1:2021 standard, and therefore the compiler will generate warnings.
When using ASN.1:2021 syntax, the compiler issues warnings or errors if:
The -1993, -1994, -1997, -2002, -2008, and -2015 compiler options are equivalents of the -2021 option.
This option restores old, incorrect compiler behavior or instructs the compiler to accept incorrect ASN.1 syntax, as specified by the argument. Use with caution and only when absolutely necessary.
The option takes a single argument, but can be specified more than once when multiple compatibility options are used, for example,
asn1 foo.asn -allow BadValues -allow BadSerialFROM
Instructs the ASN.1/C++ compiler to use explicit automatic tagging not only for untagged but also for tagged CHOICE types, open types, and "DummyReference" types, based on the interpretation of clause 31.2.7 c of the X.680 2002 ASN.1 standard.
In the following example, if -allow BadExplicitAutomaticTagging is specified, the compiler uses explicit automatic tagging for the ch field that has the tagged CHOICE type. If -allow BadExplicitAutomaticTagging is not specified, the compiler uses implicit tagging for this field.
B4114 DEFINITIONS AUTOMATIC TAGS ::= BEGIN Seq ::= [65] SEQUENCE { ch Cho } Cho ::= [65] CHOICE { b BOOLEAN } s Seq ::= { ch b : TRUE } END
Instructs the ASN.1 compiler to ignore the EXTENSIBILITY IMPLIED option in the module definition for the following types defined in the module:
Mod DEFINITIONS AUTOMATIC TAGS ::= BEGIN Set ::= SET {a INTEGER, b BOOLEAN} Choice ::= CHOICE {a INTEGER, b BOOLEAN} END ModExt DEFINITIONS AUTOMATIC TAGS EXTENSIBILITY IMPLIED ::= BEGIN SetExt ::= SET {a INTEGER, b BOOLEAN} ChoiceExt ::= CHOICE {a INTEGER, b BOOLEAN} EnumExt ::= ENUMERATED { a(1), b(2)} END
When the -allow BadExtensibilityImplied is specified, the SetExt, ChoiceExt, and EnumExt types are not marked as extensible in the generates code. As a result, their values could be incorrectly encoded using packed encoding rules.
This option is implied by the default -relaxedMode option and instructs the ASN.1 Compiler to continue the current compile when a content error is found in the value notation of restricted character strings (i.e., NumericString, PrintableString, and VisibleString), OBJECT IDENTIFIERs, or extensible types with missing mandatory extension additions.
myPhoneNumber NumericString ::= "(800) 555-1212 EXT-6" myObjectID OBJECT IDENTIFIER ::= {0 26}
This value notation will cause the ASN.1 Compiler to exit with an error message, unless -allow BadValues is specified.
According to the ASN.1 standard, the NumericString type allows only numbers (0-9) and white space in its contents. The OBJECT IDENTIFIER type allows no value larger than 4 for its second node.
The compiler does not truncate BIT STRING, restricted string, or OCTET STRING values defined with extensible size constraints to the sizes defined by those constraints.
To instruct the ASN.1 Compiler to treat the errors as warnings, use the -ignoreError compiler option, which is equivalent to the -allowBadValues compiler option.
This option also instructs the ASN.1 Compiler to issue the A1007W warning message, instead of the A1006E error message in some cases of type-value mismatch in ENUMERATED, SET, SEQUENCE, or CHOICE value assignments. For ENUMERATED types, differences in the named values set are allowed. For SET, SEQUENCE, and CHOICE types, differences in field tags and in the extension marker position are allowed.
For ENUMERATED types, the option allows names from one ENUMERATED type to be used in the value of a different ENUMERATED type, as shown in the following example:
Enum1 ::= ENUMERATED {blue(0), red(1)} Enum2 ::= ENUMERATED {green(3)} var Enum1 ::= green
For SET, SEQUENCE, and CHOICE types, the option allows a difference in the tags of the fields and in the position of the extension marker.
Restores the old ASN.1 Compiler behavior concerning serial application of a permitted alphabet constraint to a type; only the last such constraint is considered when an effective permitted alphabet for the type is calculated.
M DEFINITIONS ::= BEGIN S ::= PrintableString (FROM("ABC")) (FROM("DEF")) END
The compiler normally issues an error for the example because the permitted alphabet is empty. However, if -allow BadSerialFROM is specified no error is issued and the alphabet "DEF" is used for S.
Instructs the ASN.1 Compiler to not report a tag conflict for an untagged extensible CHOICE inside an extensible SEQUENCE.
M DEFINITIONS EXPLICIT TAGS ::= BEGIN S ::= SEQUENCE { a INTEGER, c C OPTIONAL, ..., e BMPString, ... } C ::= CHOICE { c1 [0] INTEGER, c2 [1] IA5String, ... } END
When -allow Bad6.0Extensions is not specified, the compiler issues this error:
"test.asn", line 4 (M): A0554E: Extension marks conflict in type S: extension marker and element 'c' (line 4).
Instructs the ASN.1 compiler to accept information object sets or value sets as actual parameters, even when they have governors that are not compatible with actual parameters of the paramdummy governors included in an instance of a parameterized type. As a result, the generated code could have other problems. For example, the time-optimized code generated by the ASN.1/C++ compiler could fail to C++ compile with the following errors:
error C2065: '_ref_ids0': undeclared identifier error C2099: initializer is not a constant
B4468 DEFINITIONS ::= BEGIN MACAlgorithms ALGORITHM ::= { ... } MessageAuthenticationCodeAlgorithm ::= AlgorithmIdentifier {MAC-ALGORITHM, {MACAlgorithms}} AlgorithmIdentifier {ALGORITHM-TYPE, ALGORITHM-TYPE:AlgorithmSet} ::= SEQUENCE { algorithm ALGORITHM-TYPE.&id({AlgorithmSet}), parameters ALGORITHM-TYPE.&Params({AlgorithmSet}{@algorithm}) } ALGORITHM ::= CLASS { &id OBJECT IDENTIFIER UNIQUE, &Params } MAC-ALGORITHM ::= CLASS { &id OBJECT IDENTIFIER UNIQUE, &Params, &Other OPTIONAL } END
The governor of the information object set, MACAlgorithms, used as the actual parameter in MessageAuthenticationCodeAlgorithm, is ALGORITHM, but it should be MAC-ALGORITHM according to the definition of the parameterized type AlgorithmIdentifier {}. If -allow incompatibleGovernorsForObjectValueSets is not in effect the ASN.1 compiler reports the following errors with the -autoencdec option:
"b4468.asn", line 4 (B4468): A0998E: The governor 'MAC-ALGORITHM' of the dummy parameter 'AlgorithmSet' and the governor of the valueset 'MACAlgorithms' used as the actual parameter in the instance 'MessageAuthenticationCodeAlgorithm' of the parameterized type 'AlgorithmIdentifier' are not compatible. "b4468.asn", line 8 (B4468): A0875E: The ObjectClassFieldType uses the class 'MAC-ALGORITHM' while the information object set of class 'ALGORITHM' is used in the TableConstraint or ComponentRelationConstraint. The same class must be used for both. "b4468.asn", line 9 (B4468): A0875E: The ObjectClassFieldType uses the class 'MAC-ALGORITHM' while the information object set of class 'ALGORITHM' is used in the TableConstraint or ComponentRelationConstraint. The same class must be used for both.
This option is implied by the default -relaxedMode option. It instructs the compiler to accept mixed-case names for some ASN.1 built-in types, provided that types with these names are not already defined in the ASN.1 input.
This option currently supports mixed-case names for these built-in types:
M DEFINITIONS ::= BEGIN Type ::= IA5STRING value Type ::= "abc" END
When -allow MixedCaseForSomeBuiltInTypesNames is specified, the compiler assumes that IA5STRING is the IA5String built-in type.
Restores the old ASN.1 Compiler behavior concerning serial application of a permitted alphabet constraint to a type; only the last such constraint is considered when an effective permitted alphabet for the type is calculated.
When a named bit is larger than the size of a BIT STRING, the ASN.1 Compiler issues an error and stops. This flag causes the compiler to issue a warning instead.
This option is implied by the default -relaxedMode option. It instructs the ASN.1 Compiler to accept ASN.1 names that contain the underscore character ("_") after the initial character.
M DEFINITIONS ::= BEGIN Some_Type ::= INTEGER END
If -allow UnderscoresInAsn1Names is not specified the compiler reports the following errors:
"test.asn", line 2 (M): A1271E: The low line character ('_') is not among the permitted characters for ASN.1 names. Please use the '-allow UnderscoresInAsn1Names' command line option to force the compiler to accept such invalid names. Some_Type ::=INTEGER ^
Instructs the ASN.1 Compiler to accept UNIVERSAL class tags that are normally prohibited. This option is enabled by default in trial versions of the ASN.1 Compiler.
Use UNIVERSAL class tags for
Any other UNIVERSAL tags are rejected.
If you use a UNIVERSAL tag for a CHARACTER STRING or OCTET STRING type, the compiler will redefine the type to a restricted character string type according to its tag number.
M DEFINITIONS IMPLICIT TAGS ::= BEGIN B-ignore ::= [UNIVERSAL 1] IMPLICIT BOOLEAN CS-ignore ::= [UNIVERSAL 29] CHARACTER STRING OS-ignore ::= [UNIVERSAL 4] OCTET STRING GT-ignore ::= [UNIVERSAL 24] GeneralizedTime UTCT-ignore ::= [UNIVERSAL 23] UTCTime U8-ignore ::= [UNIVERSAL 12] UTF8String BMP-ignore ::= [UNIVERSAL 30] BMPString CS-U8 ::= [UNIVERSAL 12] CHARACTER STRING OS-U8 ::= [UNIVERSAL 12] OCTET STRING CS-BMP ::= [UNIVERSAL 30] CHARACTER STRING OS-BMP ::= [UNIVERSAL 30] OCTET STRING END
In this example, the CS-U8 type is treated as a UTF8String. The following warning message is issued:
"test.asn", line 12 (M): A1163W: OSS has relaxed the standards to allow the definition of a type with the tag [UNIVERSAL 12] resulting in 'CHARACTER STRING' to be redefined to 'UTF8String'. This is normally an invalid ASN.1. CS-U8 ::= [UNIVERSAL 12] CHARACTER STRING ^
This option is equivalent to the -allow BadValues compiler option.
Instructs the ASN.1 Compiler to process type and value assignments found outside defined input modules.
Module1 DEFINITIONS ::= BEGIN MyInt ::= INTEGER END ExtraModularType ::= INTEGER Module2 DEFINITIONS ::= BEGIN MyBit ::= INTEGER END
If the -assignments option is not specified, the ASN.1 Compiler issues an error because ExtraModularType is outside of a BEGIN-END ASN.1 module.
The -assignments option is turned off.
Allows automatic encoding and decoding of open types when runtime constraint checking is disabled. Encoding and decoding is faster and more efficient when constraint checking is disabled.
When the -autoEncDec option is not specified, automatic encoding and decoding of open types will not be permitted when constraint checking is turned off (e.g., -noConstraints is specified), even when the AUTOMATIC_ENCDEC runtime flag is specified.
Be sure to set the AUTOMATIC_ENCDEC runtime flag to enable automatic encoding and decoding of open types, even when -autoEncDec is specified on the command-line.
The -autoEncDec option is turned off.
Specifies the encoding rules available at runtime:
Any combination of these options can be specified; all will be available at runtime.
Currently, only the Space-Optimized Encoder/Decoder (SOED) supports CER.
The options have the following precedence: (1) -ber, (2) -per, (3) -der, (4) -uper, (5) -xer, (6) -cxer, (7) -cer, (8) -exer, (9) -oer, (10) -coer, (11) -json, (12) -cper, (13) -cuper, (15) -avn. So, when more than one option is specified, the one that is first in this list is used by default. For example, if you specify -der -per -xer, the PER encoding rules will be used by default, but you can switch to DER and XER at runtime.
When one of these command-line options is specified, the encoding rules available at runtime vary depending on the encoder/decoder library in use. This is summarized in the following table:
-ber | -per | -der | -uper | -xer | -cxer | -cer | -exer | -oer | -coer | -json | -cper | -cuper | -avn | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
SOED | BER | PER UPER |
DER BER |
UPER PER |
XER | XER CXER |
CER BER |
E-XER | OER | COER OER |
JSON | CPER CUPER PER UPER |
CUPER CPER UPER PER |
N/A |
TOED | BER | PER | DER | UPER | XER | CXER | N/A | E-XER | OER | COER | JSON | CPER | CUPER | AVN |
LED | BER | PER UPER |
DER BER |
UPER PER |
XER | XER CXER |
N/A | E-XER | OER | OER COER |
JSON | CPER CUPER PER UPER |
CUPER CPER UPER PER |
N/A |
To switch to a different set of available encoding rules at runtime, simply call the setEncodingRules() method of the OssControl class, for example,
control.setEncodingRules(OSS_DER); /* switch to DER */
When you specify the -xer, -cxer, or -exer option, -debug is also enabled. The -noDebug option along with the -xer, -cxer, or -exer option has no effect.
The -ber option is implied.
Specifies the name of the text-file containing command-line options for the current compile. This option is useful on systems that do not permit long command lines or do not support command-line continuation characters. Options contained in the file are treated as if they were entered on the command line. The file can consist of several lines; the compiler will read all of them.
The following command will compile input.asn using the command-line options included in the tenLinesOfOptions.opt text file:
asn1 input.asn -commandFile tenLinesOfOptions.opt
Command files can contain comments. The "--" characters specify the beginning of a comment. They can be placed anywhere on the line. The comment continues until a subsequent "--" is reached or the line ends.
The -commandFile option is turned off.
Instructs the compiler to generate a compact version of the Time-Optimized Decoder code for fields marked with the OSS.NODECODE directive. Note that when a field marked with the OSS.NODECODE directive is present in the input encoding, an error is reported if the compact version of the decoder is used (however, the error is not reported for open type fields and extension additions because the decoder easily skips these fields).
The -compactNoDecode option cannot be used with the -soed option and imposes the following restriction when using the OSS.NODECODE directive: the directive must be applied either to all fields of an extension group or to none of the fields of an extension group.
The -compactNoDecode option is disabled.
Instructs the compiler to generate header and .cpp files compatible with previous versions of the OSS ASN.1 Compiler.
This option takes a single operand or flag, and can be specified more than once.
asn1cpp foo.asn -compat v3.0 -compat UTF8StringasBMPString
For a list of flags that can be used with the -compat option, see Backward Compatibility.
OSS does not guarantee compatibility between versions of the ASN.1 Tools released more than 10 years apart.
The -constraints option instructs the ASN.1/C++ compiler to generate information for runtime constraint checking and write it into the control table.
The -noConstraints option specifies that no information for runtime constraint checking should be generated and written into the control table; this results in a smaller control table and faster execution.
To disable runtime constraint checking when the -constraints option is present, specify the NOCONSTRAIN encoder or decoder flag.
When neither -constraints nor -noConstraints is explicitly specified, the Time-Optimized Decoder (TOED) checks the encoded size of a size-constrained string to ensure it does not exceed the upper bound, and reports an error if it does. This check is to prevent the allocation of a possibly huge amount of memory for an incorrectly encoded length, without incurring the performance penalty of full constraint checking.
For TOED: -noConstraints
For SOED and LED: -constraints
Instructs the ASN.1 Compiler to generate a control table for the encoder/decoder, and optionally specify the name of the output C++ file. The control table information in the output C++ file is used by the encoder/decoder at runtime.
This option can be followed by an operand to explicitly name the output C++ file. If the operand is absent and the -output option is not used, the name for the output C++ file will be derived from the last command-line input filename with a .cpp suffix appended.
The -controlFile option is implied without an operand.
Enables or disables writing debug information into the C++ file.
When -debug is turned on, the encoder/decoder can produce descriptive messages that include the names of ASN.1 identifiers and Defined Types. The identifier names are used by the ASN.1/C++ runtime routines that print PDU objects and convert ASN.1/C++ objects to and from ASN.1 value notation; without these names, the runtime prints <anonymous> instead.
The -debug option is implied.
Instructs the compiler to generate decoding-only or encoding-only routines for the Time-Optimized Encoder/Decoder.
These options have no effect when you use the Space-Optimized Encoder/Decoder and do not specify -xer or -cxer, since the information generated into the control table is used for both encoding and decoding. However, if you do specify -xer or -cxer, then these options will be effective and can be used to reduce the amount of Space-Optimized library code linked to your final application.
Both encoder and decoder routines are generated.
Instructs the ASN.1 Compiler to generate additional warning messages for protocol designers writing ASN.1 specifications.
Additional warning messages are issued if
The -designerWarnings option is turned off.
Instructs the ASN.1 Compiler not to search the input specification for identical types from which to create shared classes.
Normally, when the same ASN.1 type (or types similar enough to use the same ASN.1/C++ representation class) occurs multiple times in the input specification, the ASN.1/C++ compiler generates one class and several typedef declarations to minimize the generated code size. If -disableSharing is specified, the compiler generates several identical classes instead.
The -disableSharing option is turned off.
Instructs the ASN.1 Compiler to generate multiple Data Type Definitions (DTD) files, one for each PDU.
The names of the DTD files will be the same as the PDU type names, with the .dtd suffix added, unless the OSS.DTD directive specifies a different name. Any name aliasing using the ASN1.Nickname directive affects the generated DTD filename.
The -dtd option is turned off.
Instructs the ASN.1 Compiler to enable partial decoding, in addition to standard decoding.
Encoding is not affected.
Partial decoding is supported only by the TOED runtime. That is, -enablePartialDecode cannot be used together with the -soed option.
When -enablePartialDecode is specified, the <module_name>_Callback class is incorporated into the generated header and code files; other definitions are unaffected.
XER, CXER, E-XER, and JSON do not support partial decoding and cannot be used with the -enablePartialDecode option.
The -enablePartialDecode option is turned off.
Instructs the compiler to redirect all ASN.1 Compiler messages to an error file. This is useful on platforms where you cannot easily redirect stdout and stderr to a file.
If an error is detected on the command line before you specify the -errorFile option, the message is written to stdout instead of the error file. All command-line error messages are written to the error file when -errorFile is the first option on the command line, as shown in the following example:
asn1cpp -errorFile myErrs.err foo.asn
If errorFileName lacks an extension, the .err extension is added. If it has the .asn extension, it is replaced by .err; otherwise, errorFileName keeps the extension you specified.
The -errorFile option is turned off.
Specifies the name of the ASN.1 project. The ASN.1/C++ compiler uses projectExternalName to begin the names of the universal PDU and control object classes generated for the input ASN.1 specification.
asn1cpp -external Bar foo.asn
From this command line, the compiler will generate a universal PDU class named Bar_PDU and a control object class named Bar_Control.
The ASN.1 project name is the same as the last input filename on the command line, without the .asn extension.
Instructs the ASN.1 Compiler to generate a .gen file that captures all directives from the ASN.1 input file as well as the directives for compiler-created names, for example, _setof1.
The optional genDirFileName operand specifies the name of the .gen file. If absent, then the filename defaults to the last input filename on the command line, with a .gen extension rather than .asn.
When the -gendirectives option is used, the compiler does not generate the ASN1.Nickname or OSS.TYPENAME directive for mangled names in internal OSS type definitions, such as ObjectID, External, EmbeddedPDV, ABSTRACT_SYNTAX, and TYPE-IDENTIFIER.
The -genDirectives option is turned off.
Specifies the name of the generated header file that represents the ASN.1 specification in C++.
The optional headerFileName operand explicitly names the output header file. If absent and the -output option is not used, then the filename is the same as the last input filename on the command line, with an .h extension rather than .asn.
Displays a summary of all valid command-line options.
By entering asn1cpp -help you can obtain a summary of valid command-line options:
OSS ASN.1/C++ Compiler Version 7.3 Copyright (C) 2023 OSS Nokalva, Inc. All rights reserved. Compiler parameters: (.D. indicates default) <input> <...input> . one or more ASN.1 input files -cont <ctrlfile> ... generate C++ file into <ctrlfile> -soed ... generate control table for SOED encoder/decoder -toed .D. generate time-optimized encoder/decoder code -notoed ... do not generate time-optimized encoder/decoder code -lean ... generate universal control table for LEAN/SOED encoder/decoder -syntax ... perform syntax checking only -h <headerfile> .D. generate C include file into <headerfile> -output name ... use name for output file names -nooutput ... do not generate output files, same as syntaxonly. -errorfile file ... write all messages to 'file' instead of stdout/stderr -namespace name ... use namespace for generated classes -list <listfile> ... generate an ASN.1 combined listing into 'listfile' -nolist .D. do not generate an ASN.1 combined listing -mod <listfile> ... generate single ASN.1 module listings into 'listfile' -nomod .D. do not generate single ASN.1 module listings -gendir <genfile>... generate list of directives into <genfile> -shortennames ... shorten generated variable names to be 31 bytes max -noshortennames .D. do not shorten generated names -uniquepdu .D. check that pdu id's are unique -nouniquepdu ... do not check that pdu id's are unique -prefix id ... prefix variables with unique id -externalname name . external variable name of encoder/decoder info -constraints .D. check constraints at runtime -restrictedConstraintChecking ... do not ignore the OSS.NoConstrain directive when -constraints is specified -noconstraints ... do not check constraints at runtime -encodeonly ... generate only encoder routines -decodeonly ... generate only decoder routines -test ... generate a program to encode/decode ASN.1 values -notest .D. do not test encoding/decoding of all ASN.1 values -debug .D. issue detailed trace data and error messages -nodebug ... do not issue detailed trace data and error messages to slightly improve CPU performance -warning ... allow warning messages -nowarning ... suppress warning messages -suppress msg# ... suppress a specific message -ignoresuppress ... ignore the SUPPRESS directive (display all messages) -verbose ... display compilation progress messages -noverbose .D. do not display compilation progress messages -pedantic ... rigorously check all modules -nopedantic .D. rigorously check only the root module(s) -relaxedMode .D. automatically select command-line options that result in relaxed compiler behavior, for example, -allowBadValue, -noWarning, etc. -norelaxedMode ... automatically select command-line options that result in strict compiler behavior -informatory ... allow informatory messages -noinformatory ... suppress informatory messages -ignoreError msg# .. ignore a specific error (issue a warning instead) -designerWarnings .. issue additional warnings for protocol designers -compat version# ... disable new features for backward compatibility -allow badcase ... enable badcases for backward compatibility -1990 ... all modules conform to 1990 ASN.1 syntax -per ... generate output file for Aligned PER encoder/decoder -cper ... generate output file for Canonical Aligned PER encoder/decoder -uper ... generate output file for Unaligned PER encoder/decoder -cuper ... generate output file for Canonical Unaligned PER encoder/decoder -ber .D. generate output file for BER encoder/decoder -der ... generate output file for BER & DER encoder/decoder -xer ... generate output file for Basic XER encoder/decoder -cxer ... generate output file for Canonical XER encoder/decoder -cer ... generate output file for BER & CER encoder/decoder -exer ... generate output file for EXTENDED XER encoder/decoder -oer ... generate output file for OER encoder/decoder -coer ... generate output file for Canonical OER encoder/decoder -json ... generate output file for JSON encoder/decoder -jer ... alias to -json -commandfile <file> ... read command line from 'file' -minimize ... generate the smallest possible output files -root ... treat all modules as root modules -keepnames ... generate directives for keeping names -pdusforopentypes... ignore NOPDU directive for opentypes -nopdusforopen ... do not generate PDUs for info objects with -noconstraints -shippable ... generate .h file suitable for shipment -allowbadvalues ... allow generation of bad values -sampleCode <pdus|values> ... generate a sample code to initialize, encode, decode and traverse values of PDU types defined in the input ASN.1 syntax -noSampleCode ... do not generate a sample code -relaySafe ... retain unrecognized extension additions at runtime -norelaySafe .D. do not retain unrecognized extension additions at runtime -maxClassesInFile num#... limits the number of classes generated into one .cpp file -autoencdec ... permit automatic encoding/decoding even if -noconstraint is used -messageFormat <format> ... display error messages in <format>: 'oss', 'emacs' or 'msvc' -xsl ... generate default stylesheet for each PDU -dtd ... generate document type definition file for each PDU -disablesharing ... not try to share classes in generated files -assignments ... process type and value assignments defined outside ASN.1 modules -ignoreIncompleteItems ... ignore incomplete ASN.1 definitions of types and values -ignoreRedefinedAssignments ... ignore redefined ASN.1 definitions of types and values -reservedWords <reserved_words> ... treat words specified in the parameter and separated by commas as reserved words in the generated files that should be always mangled -inline <level> ... inline methods of representation classes -useGenericOpenTypes ... use OssOpen for table-constrained open types -useQualifiedNames <maxPrefixLevel> ... generate context-based names for enumerators, named numbers and bits -enablePartialDecode ... generate time-optimized full and partial decoders -partialDecodeOnly ... generate time-optimized partial decoder only -compactNoDecode ... generate compact time-optimized decoder for fields marked by NODECODE directive -rtoed ... generate redeveloped time-optimized code -multi ... generate integration module for multiple RTOED code files -avn ... generate output file for TOED ASN.1 value notation decoder
You can obtain a synopsis of the command-line syntax by entering asn1cpp with no arguments:
OSS ASN.1/C++ Compiler Version 7.2 Copyright (C) 2022 OSS Nokalva, Inc. All rights reserved. asn1cpp <infile(s)> [-lean | -soed | -toed | -rtoed ] [-per ] [-cper ] [-uper ] [-cuper] [-suppress msg#] [-ber ] [-der ] [-cer ] [-oer ] [-coer ] [-ignoresuppress] [-xer ] [-cxer ] [-exer ] [-json ] [-avn ] [-extern <name>] [-root ] [-debug | -nodebug ] [-compat version#] [-multi ] [-verbose | -noverbose ] [-prefix prfx] [-minimize ] [-warn | -nowarn ] [-messageFormat <format>] [-autoencdec ] [-short | -noshort ] [-designerWarnings] [-1990 | -2021 ] [-unique | -nounique ] [-gen <gendirfile>] [-noout ] [-inform | -noinform ] [-errorfile <errorfile>] [-syntax ] [-pedantic | -nopedantic ] [-cont <ctrlfile>] [-out <name> ] [-relaySafe | -norelaySafe ] [-commandfile <commandfile>] [-keepnames ] [-constrain | -noconstrain ] [-h <headerfile> | -noheader] [-pdusforopen ] [-test | -notest ] [-ignoreError msg#] [-assignments ] [-encodeonly | -decodeonly ] [-namespace <name> ] [-allow badcase ] [-relaxedMode|-norelaxedMode] [-reservedWords <words>] [-inline level# ] [-ignoreRedefinedAssignments] [-ignoreIncompleteItems] [-allowbadvalues] [-mod <modlistingfile>| -nom] [-l <listingfile> | -nol ] [-maxClassesInFile num# ] [-disablesharing ] [-dtd] [-xsl] [-enablePartialDecode ] [-partialDecodeOnly ] [-compactNoDecode ] [-useGenericOpenTypes ] [-useQualifiedNames <maxPrefixLevel> ] [-shippable ] [-restrictedConstraintChecking ] enter "asn1cpp -help" for more information
Command-line help is not displayed when input files are specified.
Instructs the ASN.1/C++ compiler to treat certain error message numbers, specified by errorNumber, as warnings instead. Use this option to generate output files without correcting your ASN.1 specification. However, be aware that the generated values are invalid according to the ASN.1 standard.
The current version of the ASN.1/C++ can ignore only the following message numbers: 49, 73, 76, 77, 305, 319, 365, 811, 832, 1078, 1130, 1162, 1191, 1207, 1211, and 1339.
The -ignoreError option is turned off.
Instructs the ASN.1 Compiler to treat certain errors related to undefined ASN.1 types and values as warnings, and to ignore incomplete ASN.1 definitions that directly or indirectly reference undefined ASN.1 types or values.
When undefined and incomplete ASN.1 items are unused by the application, use this option to generate a header file and a .cpp file without correcting your ASN.1 specification. The compiler will not consider the ASN.1 types that are referenced only by ignored incomplete types as PDUs, unless the global or local PDU directive is applied.
Use the -verbose option along with -ignoreIncompleteItems to see the incomplete items that the compiler ignored.
M DEFINITIONS ::= BEGIN A ::= SEQUENCE { a1 A1, a2 A2, b B1 } A1 ::= INTEGER A2 ::= BOOLEAN B ::= REAL END
In the example above, type reference A references type B1, which is undefined.
ASN.1 compiling without -ignoreIncompleteItems results in these errors:
"test.asn", line 7 (M): A0256W: 'B1' is referenced, but is not defined. "test.asn", line 7 (M): A0052E: 'B1' is not defined. C0043I: 1 error message, 1 warning message and 0 informatory messages issued.
ASN.1 compiling with -ignoreIncompleteItems and -verbose:
"test.asn", line 7 (M): A0256W: 'B1' is referenced, but is not defined. "test.asn", line 4 (M): C1215W: The definition of the type identified by the absolute reference 'M.A' is incomplete and will be ignored. C0285I: Global checking abstract syntax. C0286I: Generating header file. C0287I: Generating control file. C0043I: 0 error messages, 2 warning messages and 5 informatory messages issued.
The generated header file includes:
/* Representation types */ typedef OSS_INT32 A1; typedef ossBoolean A2; typedef double B; /* Specific PDU classes */ class OSS_PUBLIC B_PDU : public ConcretePDU { public: B_PDU(); void set_data(B &); B *get_data() const; protected: OssTypeIndex get_index() const; };
Only one concrete PDU class is generated for type B that is not referenced by any other type in the input ASN.1 specification. Types A1 and A2 are referenced in the ignored, incomplete type A.
The -ignoreIncompleteItems option is implied by the default -relaxedMode option.
Instructs the ASN.1 Compiler to treat some errors caused by incorrectly redefined ASN.1 types and values as warnings, and to ignore all duplicate definitions within the same ASN.1 module.
M DEFINITIONS ::= BEGIN Type ::= INTEGER Type ::= INTEGER END
In the example above, Type is defined twice in the same ASN.1 module, which is normally invalid ASN.1.
ASN.1 compiling without -ignoreRedefinedAssignments results in these errors:
"test.asn", line 3 (M): A0146E: Type 'Type' is illegally redefined. Type ::= INTEGER ^ C0043I: 1 error message, 0 warning messages and 0 informatory messages issued.
ASN.1 compiling with -ignoreRedefinedAssignments:
"sample.asn", line 3 (M): A1270W: 'Type' has already been defined on line 2. Its redefinition is being ignored. C0043I: 0 error messages, 1 warning message and 0 informatory messages issued.
The -ignoreRedefinedAssignments option is implied by the default -relaxedMode option.
Instructs the compiler to ignore any OSS.SUPPRESS directives within an ASN.1 module definition.
All messages identified by the OSS.SUPPRESS directive are suppressed.
Specifies whether the compiler should generate informatory messages.
When either -relaxedMode or -noWarningMessages is specified, the -noInformatoryMessages option is implied.
When either -norelaxedMode or -warningMessages is specified, the -informatoryMessages option is implied.
The order in which -informatoryMessages | -noInformatoryMessages, -warningMessages | -noWarningMessages, and -relaxedMode | -norelaxedMode appear on the command line is important. The rightmost option takes precedence.
The -noInformatoryMessages option is implied via the default -relaxedMode option.
Instructs the compiler to create definitions of some generated class methods inline with the matching class definition in the header file, rather than putting the methods in the generated .cpp file.
The operand specifies which methods will be generated inline:
Virtual methods are never generated inline. Also, a recursive definition of an ASN.1 type could prevent the compiler from inlining the methods of the matching C++ class.
The -inline 0 option (no inlining) is implied.
Creates a .gen file that prevents changes to the generated .h file if the input changes.
If your ASN.1 specification or ASN.1 Compiler version changes, the ASN.1 Compiler could generate different names for the same type, requiring changes to your code. The -keepNames option instructs the ASN.1 Compiler to generate a directive for each input directive and for each name that could change if the input changes. These directives are stored in a .gen file. When the ASN.1 file needs to be recompiled, the .gen file is passed as the first input file on the command line, followed by the files and command-line options previously specified. Even when the input contains explicit identifier changes, the compiler will generate the same names as before.
When -keepNames is specified without -genDirectives, the compiler treats the input as if -genDirectives (specified without the optional genDirFilename) is also present. The name of the .gen file is obtained by changing the suffix of the last input file to .gen, unless -output is specified. This .gen file includes all directives from the ASN.1 input stream and directives for each name that could change in a subsequent run of the ASN.1 Compiler.
Module DEFINITIONS ::= BEGIN Type ::= INTEGER {one(1), two(2), five(5)} S ::= SEQUENCE {flagColor ENUMERATED {red, white, blue}} END
When -keepNames is specified, the compiler generates the following code in the .gen file :
-- Directives artificially generated by the compiler: --<OSS.TYPENAME Module.S.flagColor "_enum1">-- --<OSS.ExtractType Module.S.flagColor>-- -- Directives artificially generated for the names to be kept: --<OSS.TYPENAME Module.Type "Type">-- --<ASN1.Nickname Module.Type.one one>-- --<ASN1.Nickname Module.Type.two two>-- --<ASN1.Nickname Module.Type.five five>-- --<OSS.TYPENAME Module.S "S">-- --<ASN1.Nickname Module.S.flagColor.red red>-- --<ASN1.Nickname Module.S.flagColor.white white>-- --<ASN1.Nickname Module.S.flagColor.blue blue>--
The -keepNames option is turned off.
Instructs the ASN.1 Compiler to generate universal output files compatible with the Space-Optimized Encoder/Decoder (SOED) and the Lean Encoder/Decoder (LED).
Use the -lean option to restore the default behavior of the ASN.1 Compiler prior to version 5.0.
NOTE: The LED library is not included in the OSS ASN.1 Tools; it is an add-on product available for common platforms like Linux, Windows, and Solaris, and may not be available for your embedded system port. If you are interested in LED for your platform, contact OSS Nokalva Sales.
The -lean option is turned off.
Specifies whether the compiler should generate an ASN.1 composite listing of the root module(s), with all macro instances and parameterized items expanded, and all external references resolved.
The optional listingFileName operand explicitly names the output listing file. If absent and -output is not used, then the filename is the same as the last input filename on the command line, with a .lst extension.
If no error conditions are detected in the input, the listing file contains valid ASN.1 that can be used as input for any ASN.1 Compiler.
The -noListingFile option is implied.
Informs the ASN.1/C++ compiler that no more than num# class definitions can be generated in one source file. When this number is exceeded, the ASN.1/C++ compiler will generate another C++ file using the same base name with a sequential suffix added. For example, when processing a file named input.asn, the generated files will be named input.cpp, input1.cpp, input2.cpp, etc.
When the input ASN.1 specification is very large, it is impractical to generate all the C++ code into one .cpp file. Too much time and/or memory is required. Also, some C++ implementations limit the size of the input C++ source file and will reject files that are too large. Use the -maxClassesInFile option to avoid these issues.
Currently, only class methods are distributed into multiple files. The control table or generated TOED code is placed entirely in the last file. Since the TOED code can be huge by itself, it makes no sense to specify -maxClassesInFile with -toed.
The compiler generates all output into a single file.
Sets the format of the error, warning, and informatory messages issued by the ASN.1 Compiler. A mandatory parameter specifies which format scheme is used.
Three format schemes are available:
"filename.asn", line [(moduleName)]: code: messageExample
"msgfmt.asn", line 7 (Module-10): A0217W: The identifier 'address' is missing from the value and is assumed. mySeq Seq ::= {int 5, bool TRUE, "350 5th Avenue"} ^
filename.asn:[moduleName:]line:[position:] code: messageExample
msgfmt.asn:Module-10:7:38: A0217W: The identifier 'address' is missing from the value and is assumed.
filename.asn(line[,position]) : [moduleName:] type code: message.Example
msgfmt.asn(7,38) : Module-10: warning A0217W: The identifier 'address' is missing from the value and is assumed.
Use the format schemes with a parser or compatible text editor to help automatically find the location in the input file where the message was issued.
Automatically selects command-line options that result in a more compact control table.
These options are automatically selected when -minimize is specified:
The -minimize option is turned off.
Instructs the compiler to generate a module listing file that contains information from multiple ASN.1 modules.
The optional listingFileName operand explicitly names the output listing file. If absent and -output is not used, then the filename is the same as the last input filename on the command line, with a .lst extension.
Macro definitions and INSTANCE OF uses are expanded in the module-listing file, but parameterized items are not.
This option is mostly used when diagnosing compiler issues.
The module-listing file could contain invalid ASN.1.
The -noModListingFile option is implied.
Generates an integration module for multiple RTOED code files.
Follow these steps when using the -multi option:
Note that the -multi option can be used only for the RTOED code files.
Instructs the compiler to place all generated code (classes, constants, and functions) into a C++ namespace with the specified name, which is a C++ identifier that the compiler uses as is, without validation. So, if this name is a reserved C++ word, conflicts with an ASN.1/C++ API class name, or is invalid in some other way, then the ASN.1/C++ compiler produces non-compilable C++ code.
The compiler puts all output into the global (unnamed) namespace.
Specifies whether output files should be generated.
The optional outputDirectoryName parameter specifies the directory where output files are generated. The optional outputFileName parameter specifies the prefix of the output filenames. When neither parameter is specified, the prefix of the last .asn input file is used for the output filenames. However, when these parameters are specified, the last node after the last slash is used as the prefix for the output files. So, for example, if xyz/abc is the parameter, then the output filename prefix is abc. If xyz/abc/ is the parameter, then there is no output filename prefix because the node after the last slash is empty; the files are named only with extensions such as .cpp and .h.
The -noOutput option instructs the compiler to suppress all output other than error messages.
asn1cpp foo.asn -output abc
If the abc/ subdirectory already exists under the current working directory, the ASN.1 Compiler places the foo.h and foo.cpp output files there. Otherwise, the ASN.1 Compiler generates the abc.h and abc.cpp output files in the current working directory.
asn1cpp foo -output xyz/abc
If the xyz/ subdirectory does not exist, the ASN.1 Compiler will try to create it. If successful, the compiler generates the abc.h and abc.cpp files into this subdirectory.
The -output option is implied with no parameters.
Instructs the compiler to replace standard decoding with partial decoding. No standard encoding or decoding functions are generated, and constraint checking is disabled (-noConstraints).
Partial decoding is supported only by the TOED runtime. That is, -partialDecodeOnly cannot be used together with the -soed option.
When -partialDecodeOnly is specified, the <module_name>_Callback class is incorporated into the generated header and code files; other definitions are unaffected.
When -xer, -exer, or -cxer is specified, the ASN.1/C++ Compiler ignores -partialDecodeOnly.
XER, CXER, E-XER, and JSON do not support partial decoding and cannot be used with the -partialDecodeOnly option.
The -partialDecodeOnly option is turned off.
Instructs the compiler to treat open types created by the ASN1.DeferDecoding or the OSS.ENCODABLE directive as PDUs, even when the OSS.NOPDU directive is specified.
This option also causes open types created by the use of component relation constraints to be treated as PDUs, even when the OSS.NOPDU directive is specified.
Definition: A protocol data unit (PDU) is any simple or complex data structure that can hold a message for transfer. PDUs can be encoded or decoded as complete units. If a type is a PDU, a handler class is generated for it.
The -pdusForOpenTypes option is turned off.
Instructs the ASN.1 Compiler to thoroughly check the input file syntax.
-pedantic implies the -syntaxOnly option; no .h or .cpp files are generated.
The -pedantic option is turned off.
Specifies one or more characters to prefix all generated names whose scope is global in your C++ program file.
The -prefix option is useful when an application program supports multiple abstract syntaxes and the same typedef, class, or manifest constant name is used in the generated files. By adding a prefix to generated names whose scope is global, the output files can be C++ compiled without a multiple declaration error.
Names are not prefixed.
Automatically selects command-line options that result in relaxed or strict compiler behavior.
When -relaxedMode is specified, these options are automatically enabled:
Some significant warning messages are not suppressed when -relaxedMode is used. Use the -noWarningMessages option to suppress all warnings.
-norelaxedMode cancels the options enabled by -relaxedMode and implies the -warningMessages option.
To enable warning or informatory messages when -relaxedMode is specified, specify -warningMessages or -informatoryMessages after -relaxedMode on the command line.
To disable warning or informatory messages when -norelaxedMode is specified, specify -noWarningMessages or -noInformatoryMessages after -norelaxedMode on the command line.
The -relaxedMode option is turned on.
Specifies relay-safe decoding and re-encoding of messages with extension addition fields.
When -relaySafe is not enabled and the decoder finds an extensible type containing unrecognizable extension addition fields, the decoder ignores them and returns only those fields defined in the control table. The -relaySafe option preserves these unrecognized extension additions for later re-encoding, which is especially useful for H.323-compliant firewalls, routers, packet sniffers, and similar applications.
For example, if a firewall that supports H.323 version 1 receives an H.323 version 2 message with fields that are undefined in version 1, the decoder skips those fields and returns only the version 1 fields to the firewall application. When the firewall decodes and re-encodes the message with a new IP address, the message is re-encoded as a version 1 message because the version 2 fields were skipped during decoding. With relay-safe decoding and encoding, the decoder retains the version 2 fields in the message and the encoder then re-inserts them when the firewall re-encodes the message. The result is a version-2-compliant message with the new IP address, even though the firewall understands only version 1 messages and does not know the content of the version 2 fields.
The relay-safe encoder/decoder behavior is enabled only when the ASN.1/C++ -relaySafe compiler option is specified. If not previously specified, then recompile any source files that reference the ASN.1 Compiler-generated header file with the -relaySafe option. With recompilation, the compiler generates extra methods for every extensible SEQUENCE/SET/CHOICE in the source specification. These methods provide limited access to the unknown extensions in undecoded form, if needed.
The -relaySafe option is turned off.
Instructs the compiler to handle one or more comma-separated keywords as reserved words.
By default, the ASN.1 Compiler applies a disambiguation algorithm to ensure that generated names do not conflict with words that are reserved on most popular platforms, such as the C/C++ compiler keywords double, default, const, and so on. When a conflict is detected, the compiler changes the generated names to resolve it. This process of name disambiguation is called "name mangling". The names are mangled with a prefix derived either from the ASN.1 module where the corresponding ASN.1 item is defined or, if the conflicting name belongs to a component inside another component, from the name of that outer component.
On some platforms, C/C++ compilers have keywords that are not included in the ASN.1 Compiler's default keyword list. Use the -reservedWords option to tell the ASN.1 Compiler to treat these keywords as reserved words.
NOTE: If a user-defined type name is assigned using the Nickname, TYPENAME, or FIELDNAME OSS-specific directives, and it matches the word specified in the -reservedWords option, the directive takes precedence. User-defined type names cannot be changed.
Enum ::= ENUMERATED {send, bind}
ASN.1 compiling the Enum type defined above without using the -reservedWords option generates the following code:
enum Enum { send = 0, bind = 1 };
C/C++ compiling would fail because bind and send are reserved keywords for the Microsoft C/C++ Optimizing Compiler.
ASN.1 compiling with -reservedWords send, bind added to the ASN.1 Compiler command line generates code with non-conflicting names:
enum Enum { Enum_send = 0, Enum_bind = 1 };
The -reservedWords option is turned off.
Instructs the compiler not to ignore the OSS.NoConstrain directive when the explicit -constraints option is present.
When you use -constraints with -restrictedConstraintChecking, the ASN.1 Compiler enables runtime constraint checking for all types except those that have the OSS.NoConstrain directive applied.
NOTE: The -restrictedConstraintChecking option has no effect unless the -constraints option is explicitly specified.
Instructs the ASN.1 Compiler to treat all input modules as root modules.
When you use the -root option, all modules are thoroughly checked, and all unreferenced types in all modules are considered PDUs.
A protocol data unit (PDU) is a message for transfer that contains data defined by an ASN.1 type. PDUs can be encoded/decoded as separate units. For each PDU, the OSS ASN.1 Compiler #defines an identification tag in the header file.
By default, only the last module specified on the command line is treated as a root module.
Instructs the ASN.1 compiler to generate code for the RTOED runtime. In the generated code, all function pointers are constant, so the C++ compiler toolchain can place them in read-only memory. This protects the pointers from being maliciously overwritten.
This option is incompatible with the -soed and -lean ASN.1 compiler options.
Instructs the compiler to generate sample code that shows how to use the generated C++ representations of PDU types defined in the input ASN.1 syntax, to call the encoder and decoder, and to traverse and print the decoded value.
The -noSampleCode option instructs the compiler to suppress sample code generation invoked by the OSS.SampleCode directive in the ASN.1 input file.
The ASN.1 input file can define both PDU types and PDU values. To generate sample code, use the following parameters:
The sample code is created in the samplecode/ directory, which is found in the same location as the generated .h and .cpp files. The sample code is separated into the following six files, where outputname is the prefix of the generated .h and .cpp files:
To customize sample values (CHOICE, SEQUENCE OF, and SET OF) you can use -sampleCode with the OSS.SampleCode directive.
To use -sampleCode, the input ASN.1 file must contain PDUs (or values). Also, make sure the the following options are not selected:
Note that a type is considered a PDU if it is not referenced by any other types, it is not imported, and it is not used in information object sets or as a type in the ContentsConstraint.
Instructs the ASN.1 Compiler to generate a special version of a header file (.h) suitable for distribution in a toolkit.
If you purchased a Toolkit Builder License, your software distribution includes the ossship.h file that you can distribute to your customers, along with .h files generated with the -shippable option.
When you specify the -shippable option, the .cpp file is not generated. The generated .h file will #include the shippable ossship.h file instead of the OSS Nokalva oss.h and asn1.h internal header files. This allows your customers to compile their code without unresolved symbol errors.
NOTE: Even with a Toolkit Builder License, you cannot ship any generated .cpp files or OSS Nokalva internal header files to your customers.
When you specify the -shippable option, the .h file produced can be used only for distribution to your customers.
For information about the ossship.h header file, contact Sales <info@oss.com>.
Specifies whether long variable names should be shortened by the ASN.1 Compiler. This option accommodates the maximum name length requirements that exist in certain C++ compilers.
By default, the -noShortenNames option is implied on most platforms.
Instructs the ASN.1 Compiler to generate output files for use with the Space-Optimized Encoder/Decoder (SOED).
By default, -soed is disabled.
Instructs the compiler to suppress a specific warning or informatory message.
You can specify -suppress more than once on the command line.
messageNumber can be either the complete message identifier, such as A0210W, or only the numeric portion, such as 210.
Instructs the ASN.1 Compiler to perform only a syntax check on the ASN.1 input. This is useful when you do not need to generate a header or C++ file when debugging an abstract syntax.
This option is deprecated.
Instructs the ASN.1 Compiler to generate output files for use with the Time-Optimized Encoder/Decoder (TOED).
The -noToed option instructs the compiler to not generate Time-Optimized Encoder/Decoder code.
By default, the -toed option is implied.
The -uniquePDU option specifies that the tags for all PDUs must be unique, while -noUniquePDU informs the compiler that PDUs can have identical tags.
When the -uniquePDU option is specified and the compiler encounters a duplicate PDU tag, it generates an error message. If -noUniquePDU is enabled, no error or warning message is generated. When neither option is specified, the compiler issues only warning messages.
When the -noUniquePDU option is specified, the OSS ASN.1/C++ compiler does not generate tag-controlled decoder information into the control table. Thus, tag-controlled BER decoding (using encoded tag data to derive the unknown type of a PDU) is not possible. Also, use the Time- or Space- Optimized Encoder/Decoder for tag-controlled BER decoding, as the Lean Encoder/Decoder does not support it.
NOTE: In some ASN.1 specifications, such as the Presentation Layer Protocol (ISO/IEC 8823/ITU-T X.226), PDUs do not have unique tags. In other ASN.1 specifications, such as the Association Control Service Element (ACSE), PDU tags are unique.
The ASN.1/C++ Compiler issues a warning message when it detects duplicate PDU tags.
Instructs the ASN.1 Compiler to generate the OssOpen class wherever an open type occurs in the input specification. This mode is compatible with ASN.1/C++ Compiler versions before 6.0.
Representation of open types with table constraints changed with version 6.0 of the ASN.1/C++ Compiler. See Effect of Table Constraints on Open Types for details.
Instructs the ASN.1 Compiler to add a prefix to:
For nested unnamed types, these qualified names also contain field names that could result in long identifiers. Use the optional maxPrefixLevel operand to shorten such names by limiting the number of nested fields.
This option does not change any user-defined names assigned using the ASN1.Nickname directive.
T ::= SEQUENCE { outerField SEQUENCE { innerField ENUMERATED {en1, en2, en3} } }
The ENUMERATED type in the ASN.1 syntax above is represented by the following C++ enum when compiled without -useQualifiedNames:
enum _enum1 { en1 = 0, en2 = 1, en3 = 2 };
Compiled with -useQualifiedNames produces the following representation:
enum _enum1 { T_outerField_innerField_en1 = 0, T_outerField_innerField_en2 = 1, T_outerField_innerField_en3 = 2 };
Specifying -useQualifiedNames 1 results in the following:
enum _enum1 { innerField_en1 = 0, innerField_en2 = 1, innerField_en3 = 2 };
The -useQualifiedNames option is disabled.
Specifies whether ASN.1 Compiler status messages should be issued.
-verbose instructs the ASN.1 Compiler to issue status messages.
-noVerbose instructs the ASN.1 Compiler to suppress status messages.
The -noVerbose option is enabled.
Specifies whether compiler warning and informatory messages should be generated.
-warningMessages implies the -informatoryMessages option; -noWarningMessages implies the -noInformatoryMessages option.
When -norelaxedMode is used, the -warningMessages option is implied.
The order in which the -warningMessages/-noWarningMessages and -relaxedMode/-norelaxedMode options appear on the command line is important. The rightmost option takes precedence.
The -noWarningMessages option is implied by the default -relaxedMode option. However, some significant warning messages are not suppressed in the default mode. To suppress all warnings, specify the -noWarningMessages option.
Allows you to generate multiple default stylesheet files, one for each PDU.
Normally, separate stylesheets are not produced, even when the XER encoding rules are requested. Instead, you can use your own XML stylesheets or customize those previously generated.
Every stylesheet produced has an .xsl file extension and a filename prefix matching the generated name of its corresponding PDU. You can specify a different filename prefix and extension using the OSS.Stylesheet directive.
To have the encode() method generate a reference for your stylesheet when producing XML output for a PDU, call the setXmlStylesheet() method of the OssControl class before invoking the encoder.
Using the -output or -prefix compiler options or the ASN1.Nickname compiler directive will affect the name of the .xsl file.
When the following ASN.1 syntax, input.asn, is compiled with the -xsl option, the ASN.1 Compiler is instructed to generate the Foo.xsl file. Adding the --<ASN1.Nickname Module.Foo "Bar">-- directive to the input ASN.1 causes the filename to be Bar.xsl instead.
Module DEFINITIONS ::= BEGIN Foo ::= INTEGER END
The -xsl option will process a directory prefix provided by the -output option:
asn1cpp input.asn -xsl -out mydirectory/filename
The compiler will produce .xsl files into the mydirectory directory. However, the .xsl filenames will not be prefixed with the filename parameter: they will match the PDU names.
The -prefix option in combination with the -xsl option affects .xsl files by prefixing their names:
asn1cpp input.asn -xsl -prefix bar
The compiler will produce the barFoo.xsl file.
The ASN.1 Compiler does not generate XML stylesheets.
This documentation applies to release 7.3 and later of the OSS® ASN.1 Tools for C++.
Copyright © 2024 OSS Nokalva, Inc. All rights reserved.
No part of this publication may be reproduced, stored in a retrieval system, or transmitted in any form or by any means electronic, mechanical, photocopying, recording or otherwise, without the prior permission of OSS Nokalva, Inc.
Every distributed copy of the OSS® ASN.1 Tools for C++ is associated with a specific license and related unique license number. That license determines, among other things, what functions of the OSS ASN.1 Tools for C++ are available to you.