TOP

ASN.1/C++ Compiler -compat Flags Reference

Applies to: ASN.1/C++ v7.3-7.3.1

-compat allowBadDEFAULTValues

Starting with version 6.2, the ASN.1 Compiler reports an error message when a DEFAULT value exceeds the SIZE constraints on its DEFAULT field. Previously, the compiler silently truncated the size-constrained DEFAULT value that was too long, and issued a warning message. As a result, the DER/CER/COER encoder did not encode the value if it was equal to the truncated version of the DEFAULT value. The -compat allowBadDEFAULTValues compiler flag provides compatibility with previous versions.

↩-compat flags index


-compat externIntConst

Earlier versions of the ASN.1/C++ Compiler always generated extern const variables for all named values in the ASN.1 file, such as named numbers for INTEGER types and named bits for BIT STRING types. The generated header file contained only declarations of the variables; the variables were defined and initialized in the generated .cpp file. As of version 6.0.0, when the generated constant is an integer or enumerated type, such as

  • ASN.1 INTEGER type value references, unless the ASN1.HugeInteger or OSS.HUGE compiler directive is applied to the type
  • ASN.1 ENUMERATED type value references
  • named numbers in INTEGER types
  • named bits in BIT STRING types

the compiler generates the full definition in the header file. The generated constants can now be used as case labels in a switch statement. The -compat externIntConst compiler option restores the old behavior.

↩-compat flags index


-compat genericOpenTypes

Earlier versions of the ASN.1/C++ Compiler always used the OssOpen class to represent open types. Starting with version 6.0.0, the compiler uses a different representation for open types with table constraints applied: compiler-generated classes derived from the OssConstrainedOpenType runtime class. The -compat genericOpenTypes compiler option restores the old behavior. This compatibility option is equivalent to the -useGenericOpenTypes compiler option.

↩-compat flags index


-compat oldTypesFromInnerSubtypeWithContentConstraints

Instructs the compiler to use the same name specified with the TYPENAME directive for the generated representations of both the base type and the type created after using contents constraints within an inner subtype constraint.

↩-compat flags index


-compat UTF8StringasBMPString

Earlier versions of the ASN.1/C++ Compiler used the OssBMPString class to represent the UTF8String ASN.1 type. As of version 4.0.0, the compiler uses the more suitable OssString class. The -compat UTF8StringasBMPString compiler option restores the old behavior.

↩-compat flags index


-compat v2.0
-compat v2.0.0

Provides compatibility with version 2.0.0 of the ASN.1/C++ Compiler.

The v2.0 (v2.0.0) flag is equivalent to specifying the following -compat options: externIntConst, genericOpenTypes, UTF8StringasBMPString, v4.3FalseExtendedConstraintEncoding, v4.3TableConstraintForExtensibleObjectSets, v4.3reservedWords, and v4.3NoEnumSharing.

↩-compat flags index


-compat v3.0
-compat v3.0.0

Provides compatibility with version 3.0.0 of the ASN.1/C++ Compiler.

The v3.0 (v3.0.0) flag is equivalent to specifying the -compat v2.0 option.

↩-compat flags index


-compat v3.1
-compat v3.1.0

Provides compatibility with version 3.1.0 of the ASN.1/C++ Compiler.

The v3.1 (v3.1.0) flag is equivalent to specifying the -compat v2.0 option.

↩-compat flags index


-compat v3.1.1

Provides compatibility with version 3.1.1 of the ASN.1/C++ Compiler.

The v3.1.1 flag is equivalent to specifying the -compat v2.0 option.

↩-compat flags index


-compat v3.1.2

Provides compatibility with version 3.1.2 of the ASN.1/C++ Compiler.

The v3.1.2 flag is equivalent to specifying the -compat v2.0 option.

↩-compat flags index


-compat v3.1.3

Provides compatibility with version 3.1.3 of the ASN.1/C++ Compiler.

The v3.1.3 flag is equivalent to specifying the -compat v2.0 option.

↩-compat flags index


-compat v4.0
-compat v4.0.0

Provides compatibility with version 4.0.0 of the ASN.1/C++ Compiler.

The v4.0 (v4.0.0) flag is equivalent to specifying the following -compat options: externIntConst, genericOpenTypes, v4.3FalseExtendedConstraintEncoding, v4.3TableConstraintForExtensibleObjectSets, v4.3reservedWords, and v4.3NoEnumSharing.

↩-compat flags index


-compat v4.0.1

Provides compatibility with version 4.0.1 of the ASN.1/C++ Compiler.

The v4.0.1 flag is equivalent to specifying the -compat v4.0 option.

↩-compat flags index


-compat v4.0.2

Provides compatibility with version 4.0.2 of the ASN.1/C++ Compiler.

The v4.0.2 flag is equivalent to specifying the -compat v4.0 option.

↩-compat flags index


-compat v4.1
-compat v4.1.0

Provides compatibility with version 4.1.0 of the ASN.1/C++ Compiler.

The v4.1 (v4.1.0) flag is equivalent to specifying the -compat v4.0 option.

↩-compat flags index


-compat v4.2
-compat v4.2.0

Provides compatibility with version 4.2.0 of the ASN.1/C++ Compiler.

The v4.2 (v4.2.0) flag is equivalent to specifying the -compat v4.0 option.

↩-compat flags index


-compat v4.2.1

Provides compatibility with version 4.2.1 of the ASN.1/C++ Compiler.

The v4.2.1 flag is equivalent to specifying the -compat v4.0 option.

↩-compat flags index


-compat v4.3
-compat v4.3.0

Provides compatibility with version 4.3.0 of the ASN.1/C++ Compiler.

The v4.3 (v4.3.0) flag is equivalent to specifying the -compat v4.0 option.

↩-compat flags index


-compat v4.3.1

Provides compatibility with version 4.3.1 of the ASN.1/C++ Compiler.

The v4.3.1 flag is equivalent to specifying the -compat externIntConst, -compat genericOpenTypes, -compat v4.3reservedWords, and -compat v4.3NoEnumSharing options.

↩-compat flags index


-compat v4.3.2

Provides compatibility with version 4.3.2 of the ASN.1/C++ Compiler.

The v4.3.2 flag is equivalent to specifying the -compat externIntConst, -compat genericOpenTypes, -compat v4.3reservedWords, and -compat v4.3NoEnumSharing options.

↩-compat flags index


-compat v4.3.3

Provides compatibility with version 4.3.3 of the ASN.1/C++ Compiler.

The v4.3.3 flag is equivalent to specifying the -compat externIntConst, -compat genericOpenTypes, -compat v4.3reservedWords, and -compat v4.3NoEnumSharing options.

↩-compat flags index


-compat v4.3FalseExtendedConstraintEncoding

Prior to version 4.3.1, the OSS PER runtime mishandled extensible SIZE constraints with no upper bound and extensible single value constraints on SEQUENCE OF, SET OF, OCTET STRING, and BIT STRING, for example,

SEQUENCE ({0}, ..., {1,2,3}) OF INTEGER

As a result, the PER encoder produced an invalid encoding that the PER decoder failed to decode or incorrectly decoded. As of version 4.3.1, the OSS ASN.1/C++ Compiler and the OSS PER runtime correctly handle such specifications.

The -compat v4.3FalseExtendedConstraintEncoding option disables the this behavior and provides compatibility with versions prior to 4.3.1.

↩-compat flags index


-compat v4.3TableConstraintForExtensibleObjectSets

Prior to version 4.3.1, the OSS Constraint Checker mishandled table and component relation constraint violations for extensible object sets. Starting with version 4.3.1, the OSS ASN.1/C++ Compiler and Runtime support ITU-T Rec. X.681 Annex E.2, in that a constraint violation error is reported when table or component relation constraints are not satisfied for an extensible object set and any of the following conditions is true:

  • The value of a UNIQUE field is found in the object set.
  • The STRICT_CONSTRAINT_CHECKING runtime flag is specified.
  • The OSS_AUTO_ENCODE_WITHOUT_CHECKING_CONSTRAINT encoder flag is not specified.

The -compat v4.3TableConstraintForExtensibleObjectSets option disables this behavior and provides compatibility with versions prior to 4.3.1.

↩-compat flags index


-compat v4.3reservedWords

Prior to version 5.0, the ASN.1/C++ Compiler generated the names "SID" and "small" without mangling, when present in the ASN.1 specification. This led to name conflicts with identifiers in system headers on MS Windows platforms. Starting with 5.0, the compiler mangles these names in generated code.

The -compat v4.3reservedWords option restores the previous behavior.

↩-compat flags index


-compat v4.3NoEnumSharing

Normally, the ASN.1/C++ Compiler searches the input specification for types that have identical C++ representations. When found, the compiler generates only one C++ class and several typedefs: one for each ASN.1 type. Prior to version 5.0, the compiler sometimes failed to recognize constructed types as identical when they contained ENUMERATED components. This bug was fixed in version 5.0.

The -compat v4.3NoEnumSharing option restores the old (pre-5.0) class-sharing behavior.

↩-compat flags index


-compat v5.0
-compat v5.0.0

Provides compatibility with version 5.0.0 of the ASN.1/C++ Compiler.

The v5.0 (v5.0.0) flag is equivalent to the -compat externIntConst and -compat genericOpenTypes options.

↩-compat flags index


-compat v5.0reservedWords

Prior to version 6.0, the ASN.1 Compiler generated the names "floor" and "send" without mangling, when present in the ASN.1 specification. This led to name conflicts with identifiers in system headers on MS Windows platforms. Starting with 6.0, the compiler mangles these names in generated code.

The -compat v5.0reservedWords option can be used to disable these changes, providing compatibility with versions earlier than 6.0.

Example

ASN.1

M DEFINITIONS ::= BEGIN
    TEN ::= ENUMERATED {send(1), floor(2)}
END
With -compat v5.0reservedWords Without -compat v5.0reservedWords
enum TEN {
    send = 1,
    floor = 2
};
enum TEN {
    TEN_send = 1,
    TEN_floor = 2
};

-compat v6.0
-compat v6.0.0

The v6.0 (v6.0.0) flag is the same as specifying no compatibility options. It exists for forward compatibility with future versions of the ASN.1/C++ Compiler.

↩-compat flags index


-compat v6.0Sharing

Normally, the ASN.1/C++ Compiler searches the input specification for types that have identical C++ representations. When found, the compiler generates only one C++ class and several typedefs: one for each ASN.1 type. Prior to version 6.0, the compiler sometimes failed to recognize constructed types as identical when they contained recursive definition loop components. This bug was fixed in version 6.1.

The -compat v6.0Sharing option restores the old (pre-6.0) class-sharing behavior.

↩-compat flags index


-compat v6.0valueTruncation

Prior to version 6.1, the ASN.1/C++ Compiler generated the value of a SEQUENCE OF or SET OF type with an extensible size constraint without truncation. Starting with 6.1, the compiler truncates such values to satisfy the size constraints applied to the type, unless the -allow BadValues command line option is in effect.

The -compat v6.0valueTruncation option can be used to disable these changes, providing compatibility with versions earlier than 6.1.

Example

ASN.1

M DEFINITIONS AUTOMATIC TAGS ::= BEGIN
    A ::= SEQUENCE (SIZE (1..2, ...)) OF INTEGER
    val A ::= {1, 2, 3}
END
Compiled with -compat v6.0valueTruncation Compiled without -compat v6.0valueTruncation
static struct A _v0[] = {
    {&_v0[1], 1},
    {&_v0[2], 2},
    {NULL, 3}
};
A val = _v0;
static struct A _v0[] = {
    {&_v0[1], 1},
    {NULL, 2}
};
A val = _v0;

↩-compat flags index


-compat v6.5.0

Provides compatibility with version 6.5.0 of the ASN.1/C++ compiler.

The -compat v6.5.0 flag is equivalent to the -compat v6.5NamesConflictingWithNicknames flag.

↩-compat flags index


-compat v6.5NamesConflictingWithNickname

Prior to version 6.6, the ASN.1 compiler could skip disambiguation of global names generated for #define constants or for ENUMERATED type elements within very large ASN.1 syntaxes when those names conflicted with user-defined names specified using the ASN1.Nickname directive. The generated header file sometimes included duplicate global definitions that caused compilation errors.

The -compat v6.5NamesConflictingWithNicknames option restores the previous behavior, which, in many cases, generates syntactically correct header files that provide compatibility with pre-6.6 versions.

The -compat v6.5NamesConflictingWithNicknames flag is equivalent to the -compat 6.5.0 flag.

↩-compat flags index


-compat v6.6.0

Provides compatibility with version 6.6.0 of the ASN.1 compiler. The -compat v6.6.0 flag is the equivalent of the -compat v6.6PdusForReferencedTypesOfRemovedFields and -compat v6.6DefineNamesForTypesFromInnerWithContentConstraints options.

↩-compat flags index


-compat v6.6DefineNamesForTypesFromInnerWithContentConstraints

Instructs the compiler to mangle the global define names with the same values that are generated for similar fields within artificial types created after using contents constraints within an inner subtype constraint.

↩-compat flags index


-compat v6.6PdusForReferencedTypesOfRemovedFields

Previously, application of the ASN1.Remove directive to a SET/SEQUENCE field or a CHOICE alternative could make the referenced type a PDU, unexpectedly increasing the size of the generated TOED codefile, especially if the OSS.ENCODEONLY/OSS.DECODEONLY directive was applied to the enclosing PDU. As a workaround, the global --<OSS.NOPDU>-- directive could be used along with OSS.PDU directives applied to all the required PDU types.

As of version 6.7, the compiler no longer treats a named ASN.1 type as a PDU type if it is referenced only by fields removed by the ASN.Remove compiler directive.

The -compat v6.6PdusForReferencedTypesOfRemovedFields flag restores the old compiler behavior.

↩-compat flags index


-compat v6.7ContentsConstraintsWithRecursiveTypeInsideConstrainedBy

To restore the behavior of the ASN.1 compiler prior to version 7.0, this standalone flag instructs the ASN.1 compiler to not generate PDU classess for types derived from contents constraints that include a user-defined constraint applied to a recursively defined type.

↩-compat flags index


-compat v6.7DataCallback

Prior to version 7.0, the compiler generated calls to DataCallback methods from the PER decoder so that the offset and length parameters were set to zero and the flag parameter was set to OSS_ENCODING_UNDEFINED. Also, when the calls were generated from the BER/DER/OER decoder, the offset and length parameters were measured in bytes instead of bits.

The v7.7DataCallback flag restores the previous behavior.

↩-compat flags index


-compat v6.7JsonEncodeRestrictedCharStringUsingNonHexForm

Starting with version 7.0, the JSON encoders/decoders handle TeletexString, T61String, VideotexString, GraphicString, and GeneralString (also ObjectDescriptor) types as if they are octet strings (that is, in hex format), in accordance with X.697 clause 38.

Previously, the JER encoders/decoders violated this requirement and processed such types as JSON strings.

The v6.7JsonEncodeRestrictedCharStringUsingNonHexForm compiler compat flag restores the old behavior.

↩-compat flags index


-compat v7.0.0

Provides compatibility with version 7.0.0 of the ASN.1 compiler.

↩-compat flags index


-compat v7.0.1ImportedWithSuccessorForwardedReferences

The -compat v7.0.1ImportedWithSuccessorForwardedReferences flag restores the behavior of ASN.1 compiler versions prior to v7.0.1 and instructs the ASN.1 compiler to not report errors or warnings for some unresolved forwarded references imported using WITH SUCCESSORS. Note that this behavior might cause an error or, in some cases, constraints (for example, contents constraints) specified inside inner subtype constraints applied to a parameterized type whose right-hand side type includes an instance of another parameterized type can be ignored.

↩-compat flags index


-compat v7.1ArtificialPDUsForRecursivesTypes

This standalone flag restores pre-7.1 version compiler behavior and instructs the ASN.1 compiler to create new artificial PDUs for complex recursive types that are defined with CONSTRAINED BY inside parameterized types.

The v7.1ArtificialPDUsForRecursivesTypes compat flag was added in version 7.1.0.2.

↩-compat flags index


-compat v7.1ContentsConstraintInsideOpenTypeValue

The -compat v7.1ContentsConstraintInsideOpenTypeValue flag Restores pre-7.1 version compiler behavior and instructs the ASN.1 compiler to create a new artificial PDU for a type with contents constraints inside an open type value even when a matching type exists in the information object set specified in the component relation constraint.

The v7.1ContentsConstraintInsideOpenTypeValue compat flag was added in version 7.1.0.2.

↩-compat flags index


-compat v7.1FieldNamesAndGlobalPrefix

Restores the behavior of ASN.1 compiler versions prior to version 7.1 and instructs the ASN.1 compiler to generate truncated field names that match one of the reserved names when the OSS.DefineName directive is applied to the parent's field marked with OPTIONAL and the -prefix option is specified.

Example

--<OSS.DefineName Mod.Type.password "password">-- 
Mod DEFINITIONS  AUTOMATIC TAGS ::= BEGIN
Type ::=  SEQUENCE {
        password        CHOICE {
        switch   OCTET STRING
        } OPTIONAL
     }
END

When the v7.1FieldNamesAndGlobalPrefix compat flag is not used, the following code is generated:

public:
    enum Id {
        unselected,
        password_switch_chosen = 1
    };
    typedef OssString password_switch;
  ...
    password_switch *get_password_switch();
    const password_switch *get_password_switch() const;
    void set_password_switch(const password_switch &);

When the -compat v7.1FieldNamesAndGlobalPrefix flag is used, the code below is generated. Notice that the "password_switch" field name is truncated to "ssword_switch":

    enum Id {
        unselected,
        ssword_switch_chosen = 1
    };
    typedef OssString ssword_switch;
 ...
    ssword_switch *get_ssword_switch();
    const ssword_switch *get_ssword_switch() const;
    void set_ssword_switch(const ssword_switch &);

↩-compat flags index


-compat v7.1ForwardedNonParamReferencesImportedWithSuccessors

This standalone flag restores pre-7.1 version compiler behavior and instructs the ASN.1 compiler to skip some forwarded non-parameterized references that are defined later, are imported using WITH SUCCESSORS, and included inside actual parameters with inner subtype constraints in instances of parameterized types. This behavior might cause warnings in relaxed mode or errors in non-relaxed mode.

The v7.1ForwardedNonParamReferencesImportedWithSuccessors compat flag was added in version 7.1.0.2.

↩-compat flags index


-compat v7.2.0

Provides compatibility with version 7.2.0 of the ASN.1 compiler. This flag is equivalent to the following -compat options: v7.2TypesFromConstrainedBy and v7.2PdusForTypesFromDEFAULTInsideInfoObjClass.

↩-compat flags index


-compat v7.2PdusForTypesFromDEFAULTInsideInfoObjClass

Restores the behavior of ASN.1 compiler versions prior to version 7.2 and instructs the ASN.1 compiler to disambiguate conflicting PDU names with an additional module name for types used in a DEFAULT syntax applied to VariableTypeFields inside information object classes.

↩-compat flags index


-compat v7.2TypesFromConstrainedBy

Restores the behavior of ASN.1 compiler versions prior to version 7.2 and instructs the ASN.1 compiler to generate names that were generated by previous versions of the ASN.1 compiler for types defined in a CONSTRAINED BY syntax. Note that the v7.2TypesFromConstrainedBy flag could restore an unexpected circular reference error for some syntaxes.

↩-compat flags index


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.