This section lists the compat flags and provides a thorough description of their function.
Starting with version 8.2, the ASN.1 compiler no longer generates incorrect directives. The addBadDirForInstancesOfParamRef compat flag restores the previous behavior and instructs the compiler to generate incorrect directives in .gen files with the -gen option and to keep options for shared instances of parameterized types for which additional typedefs are created. Note that these .gen files cannot be used to preserve names from the original ASN.1 syntax.
ASN.1 | .h |
---|---|
M DEFINITIONS AUTOMATIC TAGS ::= BEGIN T1 ::= SET { a P1 {BIT STRING} OPTIONAL} T2 ::= SET OF P1 {BIT STRING} P1 {PT} ::= SET OF PT END |
typedef struct T1 { unsigned char bit_mask; # define a_present 0x80 struct P1 *a; /* optional; set in bit_mask a_present if present */ } T1; typedef struct T2 { struct T2 *next; struct P1 *value; } *T2; typedef struct P1 { struct P1 *next; struct { unsigned int length; /* number of significant bits */ unsigned char *value; } value; } *P1; |
.gen without -compat addBadDirForInstancesOfParamRef | .gen with -compat addBadDirForInstancesOfParamRef |
---|---|
-- Directives artificially generated by the compiler: --<OSS.TYPENAME M.P1 "P1">-- --<OSS.ExtractType M.P1>-- -- Directives artificially generated for the names to be kept: --<OSS.TYPENAME M.T1 "T1">-- --<OSS.DefineName M.T1.a "a">-- --<OSS.TYPENAME M.T2 "T2">-- |
-- Directives artificially generated by the compiler: --<OSS.TYPENAME M.T2.* "P1">-- --<OSS.ExtractType M.T2.*>-- --<OSS.ExtractType M.P1>-- --<OSS.UseThis M.P1 M.T2.*>-- -- Directives artificially generated for the names to be kept: --<OSS.TYPENAME M.T1 "T1">-- --<OSS.DefineName M.T1.a "a">-- --<OSS.TYPENAME M.T2 "T2">-- |
The generated structures are changed when this .gen file is used with the .asn file:
typedef struct _bit1 { unsigned int length; /* number of significant bits */ unsigned char *value; } _bit1; typedef struct M_P1 { struct M_P1 *next; _bit1 value; } *M_P1; typedef struct T1 { unsigned char bit_mask; # define a_present 0x80 struct M_P1 *a; /* optional; set in bit_mask a_present if present */ } T1; typedef M_P1 P1; typedef struct T2 { struct T2 *next; struct M_P1 *value; } *T2;
Starting with version 10.2, the ASN.1 compiler reports an error message when the DEFAULT value exceeds the SIZE constraints applied on the 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 allowBadDEFAULTValues compiler compat flag provides compatibility with previous versions.
Starting with version 10.2, the ASN.1 compiler ignores OSS.LINKED and OSS.DLINKED directives when they are applied to string types (character strings, BIT STRINGs, OCTET STRINGs).
Previously, an OSS.LINKED compiler directive could be applied to string types for compatibility with very early ASN.1/C releases, although this feature hasn't been documented.
The allowLinkedDirectivesForStringTypes compiler compat flag provides compatibility with previous versions.
Starting with version 10.2, the compiler issues an error if a named bit exceeds the BIT STRING size. Previously, if a named bit exceeded the BIT STRING size, the compiler issued a warning.
The -allow namedBitThatExceedsConstraint flag can be used to restore the previous behavior.
Starting with version 5.0, all structures receive names when the -C++ command-line option is specified. The -compat allowUnnamed flag instructs the compiler to generate unnamed nested C structures even when the -C++ command-line option is present.
ASN.1:
A ::= SEQUENCE { b SEQUENCE OF SEQUENCE { c INTEGER } }
Representation with -compat allowUnnamed | Representation without -compat allowUnnamed |
---|---|
typedef struct A { struct _seqof1 { struct _seqof1 *next; struct { int c; } value; } *b; } A; |
typedef struct A { struct _seqof1 { struct _seqof1 *next; struct _seq1 { int c; } value; } *b; } A; |
Prior to version 10.2, the OSS TOED/SOED BER decoder ignored the PDU number passed to determine it from the encoding, even when the number was not zero.
Starting with version 10.2, if the passed number is zero, the OSS ASN.1 compiler and the OSS runtime can determine the actual PDU number from the encoding.
The -compat autoDetectPDUnumber option disables the behavior introduced in version 10.2 and provides compatibility with previous versions.
Starting with version 8.0.1/8.1, the compiler no longer generates an incorrect 1994 representation for EXTERNAL types with contents constraints within a multiple type constraint, which prevented the BER decoder from correctly decoding BER encodings produced according to the X.690 specification. The -bad1994ExternalWithContentsConstr standalone compat flag restores the previous behavior. This compat flag is not part of any version compat flags.
ASN.1:
A ::= EXTERNAL ( WITH COMPONENTS {data-value (CONTAINING INTEGER)} )
Representation with -compat bad1994ExternalWithContentsConstr | Representation without -compat bad1994ExternalWithContentsConstr |
---|---|
typedef struct A { struct _choice1 { unsigned short choice; # define syntaxes_chosen 1 # define syntax_chosen 2 # define presentation_context_id_chosen 3 # define context_negotiation_chosen 4 # define transfer_syntax_chosen 5 # define fixed_chosen 6 union { struct _seq1 { ObjectID abstract; ObjectID transfer; } syntaxes; /* to choose, set choice to syntaxes_chosen */ ObjectID syntax; /* to choose, set choice to * syntax_chosen */ int presentation_context_id; /* to choose, set * choice to * presentation_context_id_chosen */ struct _seq2 { int presentation_context_id; ObjectID transfer_syntax; } context_negotiation; /* to choose, set choice to * context_negotiation_chosen */ ObjectID transfer_syntax; /* to choose, set choice * to transfer_syntax_chosen */ Nulltype fixed; /* to choose, set choice to * fixed_chosen */ } u; } identification; char *data_value_descriptor; /* NULL for not present */ struct _seq3 { /* ContentsConstraint is applied to data_value */ struct { unsigned int length; unsigned char *value; } encoded; A_integer *decoded; } data_value; } A; |
typedef struct A { unsigned char bit_mask; # define direct_reference_present 0x80 # define indirect_reference_present 0x40 ObjectID direct_reference; /* optional; set in bit_mask * direct_reference_present if * present */ int indirect_reference; /* optional; set in bit_mask * indirect_reference_present * if present */ char *data_value_descriptor; /* NULL for not present */ struct _choice1 { unsigned short choice; # define single_ASN1_type_chosen 1 # define octet_aligned_chosen 2 # define arbitrary_chosen 3 union { OpenType single_ASN1_type; /* to choose, set choice * to single_ASN1_type_chosen */ struct External_octet_aligned { /* ContentsConstraint is applied to octet_aligned */ struct { unsigned int length; unsigned char *value; } encoded; A_integer *decoded; } octet_aligned; /* to choose, set choice to * octet_aligned_chosen */ struct External_arbitrary { unsigned int length; /* number of significant * bits */ unsigned char *value; } arbitrary; /* to choose, set choice to arbitrary *_chosen */ } u; } encoding; } A; |
The -compat bad1994ExternalWithContentsConstr flag also instructs the compiler to allow the 8.0.0 representation of the single-ASN1-type field from the EXTERNAL type with an additional typedef to be generated in helper mode.
ASN.1:
B ::= EXTERNAL
With -helperNames and -compat bad1994ExternalWithContentsConstr | With -helperNames and without -compat bad1994ExternalWithContentsConstr |
---|---|
typedef struct External { unsigned char bit_mask; # define indirect_reference_present 0x80 struct _OID *direct_reference; /* NULL for not present */ int indirect_reference; /* optional; set in bit_mask * indirect_reference_present * if present */ char *data_value_descriptor; /* NULL for not present */ struct External_encoding *encoding; } External; typedef struct External_encoding { unsigned short choice; # define single_ASN1_type_chosen 1 # define octet_aligned_chosen 2 # define arbitrary_chosen 3 union { OpenType *single_ASN1_type; /* to choose, set choice to * single_ASN1_type_chosen */ External_octet_aligned *octet_aligned; /* to choose, set * choice to octet_aligned_chosen */ External_arbitrary *arbitrary; /* to choose, set choice to * arbitrary_chosen */ } u; } External_encoding; |
typedef struct External_encoding { unsigned short choice; # define single_ASN1_type_chosen 1 # define octet_aligned_chosen 2 # define arbitrary_chosen 3 union { OpenType *single_ASN1_type; /* to choose, set choice to * single_ASN1_type_chosen */ External_octet_aligned *octet_aligned; /* to choose, set * choice to octet_aligned_chosen */ External_arbitrary *arbitrary; /* to choose, set choice to * arbitrary_chosen */ } u; } External_encoding; |
A type that uses a COMPONENTS OF statement contains fields which inherit directives applied to the fields in the original type. Sometimes code is incorrectly generated due to naming directives that affect the generated names and could result in name conflicts, as shown in the following example.
The T2.f1 field inherits the FIELDNAME directive applied to T1.f1, the generated output contains two definitions of the T1_f1_present bitmask bit:
ASN.1 | .h |
---|---|
M DEFINITIONS ::= BEGIN T1 ::= [0] SET { f1 INTEGER OPTIONAL } T2 ::= [1] SET { f0 BOOLEAN OPTIONAL, COMPONENTS OF T1 } END --<OSS.PDU M.T1>-- --<OSS.FIELDNAME M.T1.f1 "T1_f1">-- |
typedef struct T1 { unsigned char bit_mask; # define T1_f1_present 0x80 int T1_f1; /* optional; set in bit_mask T1_f1_present if * present */ } T1; typedef struct T2 { unsigned char bit_mask; # define f0_present 0x80 # define T1_f1_present 0x40 ossBoolean f0; /* optional; set in bit_mask f0_present if present */ int T1_f1; /* optional; set in bit_mask T1_f1_present if * present */ |
Starting with version 8.3.0, the ASN.1/C compiler generates separate define names when the define values differ, as shown below. The compat flag badDefineNamesForComponentsOfFields restores the previous compiler behavior.
typedef struct T1 { unsigned char bit_mask; # define T1_f1_present 0x80 int T1_f1; /* optional; set in bit_mask T1_f1_present if * present */ } T1; typedef struct T2 { unsigned char bit_mask; # define f0_present 0x80 # define T2_T1_f1_present 0x40 ossBoolean f0; /* optional; set in bit_mask f0_present if present */ int T1_f1; /* optional; set in bit_mask T2_T1_f1_present if * present */ } T2;
When you use combinations of names and directives in the ASN.1 syntax, the compiler may generate duplicate names for values and definitions of ENUMERATED types, as shown in the following example.
The value rrc_uea0 and the preprocessor definition from the generated code have the same name:
ASN.1 | .h |
---|---|
TEST DEFINITIONS ::= BEGIN Enum ::= ENUMERATED { rrc-uea0 } BitStr ::= BIT STRING { rrc-uea0(2) } Ch ::= CHOICE { alt1 INTEGER, notUsed NULL } END --<ASN1.Nickname TEST.Enum.rrc-uea0 rrc_uea0>-- --<OSS.DefineName TEST.Ch.notUsed "rrc_PenaltyTime_ECN0_notUsed">-- |
typedef enum Enum { rrc_uea0 = 0 } Enum; typedef struct BitStr { unsigned short length; /* number of significant bits */ unsigned char *value; } BitStr; #define rrc_uea0 0x20 #define rrc_uea0_byte 0 |
Starting with version 8.3, the ASN.1/C compiler generates a separate define name for the named bit BitStr.rrc-uea0. The badConflictingEnumeratedNames compat flag restores the previous compiler behavior.
typedef struct BitStr { unsigned short length; /* number of significant bits */ unsigned char *value; } BitStr; #define BitStr_rrc_uea0 0x20 #define BitStr_rrc_uea0_byte 0
Starting with version 4.0, the names for the octet_aligned and arbitrary C structs located in the EXTERNAL type are no longer prefixed with an underscore. They are renamed External_octet_aligned and External_arbitrary. The -compat badExternalPrefix flag restores the previous behavior.
ASN.1:
MyExtern ::= EXTERNAL
Representation with -compat badExternalPrefix | Representation without -compat badExternalPrefix |
---|---|
typedef struct External { . . . . struct _octet1 {. . . .} octet_aligned; struct _bit1 {. . . .} arbitrary; . . . . } External; typedef External MyExtern; |
typedef struct External { . . . . struct External_octet_aligned {. . . .} octet_aligned; struct External_arbitrary {. . . .} arbitrary; . . . . } External; typedef External MyExtern; |
Starting with version 4.0, the compiler no longer allows the global OSS.SHORT, OSS.INT, and OSS.LONG compiler directives to affect the length and count fields of compiler-generated structures. The -compat badLengthDirectives flag restores the previous behavior.
ASN.1:
--<OSS.SHORT>-- Module DEFINITIONS ::= BEGIN MyOctString ::= OCTET STRING END
Representation with -compat badLengthDirectives | Representation starting without -compat badLengthDirectives |
---|---|
typedef struct MyOctString { unsigned short length; unsigned char *value; } MyOctString; |
typedef struct MyOctString { unsigned int length; unsigned char *value; } MyOctString; |
Starting with version 4.1, the ASN.1 compiler no longer attempts to disambiguate certain names which are not required. Therefore, the last set of #defines does not have its identifiers prefixed with the declared name of the type. The -compat badNameConflicts flag restores the previous behavior. For example, if multiple identical NamedBitLists are defined for different types, the sets of #defines for the bits in the NamedBitList will have the identifiers prefixed with the type name of the declared BIT STRING.
ASN.1:
Module DEFINITIONS ::= BEGIN Name17 ::= [17] BIT STRING { serena(0), melissa(20), ansara(40) } name17 Name17 ::= { serena, ansara } Name18 ::= [18] BIT STRING { serena(0), melissa(20), ansara(40) } name18 Name18 ::= { serena, ansara } Name21 ::= [21] BIT STRING { serena(5), melissa(10), ansara(30) } name21 Name21 ::= { serena , ansara } END
With -compat v4.2.0 and -compat badNameConflicts | Without -compat badNameConflicts and with -compat v4.2.0 |
---|---|
typedef unsigned char Name17[6]; #define Name17_serena 0x80 #define Name17_serena_byte 0 #define Name17_melissa 0x08 #define Name17_melissa_byte 2 #define Name17_ansara 0x80 #define Name17_ansara_byte 5 typedef unsigned char Name18[6]; #define Name18_serena 0x80 #define Name18_serena_byte 0 #define Name18_melissa 0x08 #define Name18_melissa_byte 2 #define Name18_ansara 0x80 #define Name18_ansara_byte 5 typedef unsigned int Name21; #define Name21_serena 0x04000000 #define Name21_melissa 0x00200000 #define Name21_ansara 0x00000002 extern Name17 name17; extern Name18 name18; extern Name21 name21; |
typedef unsigned char Name17[6]; #define Name17_serena 0x80 #define Name17_serena_byte 0 #define Name17_melissa 0x08 #define Name17_melissa_byte 2 #define Name17_ansara 0x80 #define Name17_ansara_byte 5 typedef unsigned char Name18[6]; #define Name18_serena 0x80 #define Name18_serena_byte 0 #define Name18_melissa 0x08 #define Name18_melissa_byte 2 #define Name18_ansara 0x80 #define Name18_ansara_byte 5 typedef unsigned int Name21; #define serena 0x04000000 #define melissa 0x00200000 #define ansara 0x00000002 extern Name17 name17; extern Name18 name18; extern Name21 name21; |
ASN.1:
Mod DEFINITIONS ::= BEGIN Name ::= BIT STRING { serena(0), melissa(50)} melissa-byte INTEGER ::= 110 END
With -compat badNameConflicts but without -compat v4.2.0 | Without -compat badNameConflicts and without -compat v4.2.0 |
---|---|
#define serena 0x80 #define serena_byte 0 #define Name_melissa 0x20 #define Name_melissa_byte 6 extern int melissa_byte_1; |
#define serena 0x80 #define serena_byte 0 #define Name_melissa 0x20 #define Name_melissa_byte 6 extern int melissa_byte; |
Starting with version 8.1, the ASN.1 compiler no longer generates additional pointers for structures with helper names derived from ASN.1 types with contents constraints within inner subtypes. The previous behavior was not consistent with other generated structures in helper mode. The badPointerTypesWithNestedContConstr compat flag, which is a part of the v8.1.0 version compat flag, restores the previous structures for types with nested contents constraints.
ASN.1:
V ::= SEQUENCE OF OCTET STRING A ::= SEQUENCE { a1 V (WITH COMPONENT (CONTAINING INTEGER )) }
With -compat bad1994ExternalWithContentsConstr | Without -compat bad1994ExternalWithContentsConstr |
---|---|
typedef struct _OctStr { unsigned int length; unsigned char *value; } _OctStr; typedef int A_integer; typedef struct A_a1_seq { /* ContentsConstraint is applied to A_a1_seq */ _OctStr encoded; A_integer *decoded; } *A_a1_seq; typedef struct A_a1 { struct A_a1_node *head; struct A_a1_node *tail; unsigned int count; } *A_a1; typedef struct A_a1_node { struct A_a1_node *next; struct A_a1_node *prev; struct A_a1_seq *value; } A_a1_node; typedef struct A { struct A_a1 *a1; } A; |
typedef struct _OctStr { unsigned int length; unsigned char *value; } _OctStr; typedef struct A { struct A_a1 *a1; } A; typedef int A_integer; typedef struct A_a1_seq { /* ContentsConstraint is applied to A_a1_seq */ _OctStr encoded; A_integer *decoded; } *A_a1_seq; typedef struct A_a1 { struct A_a1_node *head; struct A_a1_node *tail; unsigned int count; } A_a1; typedef struct A_a1_node { struct A_a1_node *next; struct A_a1_node *prev; struct A_a1_seq *value; } A_a1_node; |
Starting with version 5.0.8, the ASN.1 compiler no longer generates the base type's name instead of the tagged type's name when the base type itself is also a tagged type, for tagged types with the OSS.POINTER directive. The names for all tagged types are now generated in the header file. The -compat badRefNames restores the previous behavior.
ASN.1:
Mod DEFINITIONS ::= BEGIN ProtocolIdentifier ::= A A ::= SET OF INTEGER Alerting-UUIE ::= SEQUENCE { protocolIdentifier ProtocolIdentifier --<POINTER>-- } END
With -compat badRefNames | Without -compat badRefNames |
---|---|
typedef struct Alerting_UUIE { struct A **protocolIdentifier; } Alerting_UUIE; |
typedef struct Alerting_UUIE { struct ProtocolIdentifier *protocolIdentifier; } Alerting_UUIE; |
Starting with version 5.0.4, the ASN.1 compiler no longer incorrectly handles a global OSS.POINTER directive applied to SET OF, SEQUENCE OF, and OBJECT IDENTIFIER types when it appears after other global directives (OSS.UNBOUNDED, OSS.ARRAY, OSS.LINKED, and DLINKED). In previous versions, the compiler ignored the effect of the latter directives when OSS.POINTER was not specified before. The -compat badSetOfOidWithPointer flag restores the previous behavior.
ASN.1:
--<OSS.ARRAY OBJECT IDENTIFIER>-- --<OSS.POINTER OBJECT IDENTIFIER>-- Module DEFINITIONS ::= BEGIN O ::= OBJECT IDENTIFIER END
With -compat badSetOfOidWithPointer | Without -compat badSetOfOidWithPointer |
---|---|
typedef struct ObjectID { unsigned short length; unsigned char *value; } *ObjectID; typedef struct ObjectID *O; |
typedef struct ObjectID { unsigned short count; unsigned short value[1]; } *ObjectID; typedef struct ObjectID *O; |
Starting with version 8.5.0, the ASN.1 compiler no longer incorrectly shares types when only one of the types has an OSS.InlineType directive. The -compat badSharingForTypesWithInlineTypeDir option is a stand-alone flag that restores the previous behavior.
ASN.1:
--<OSS.InlineType M.T2.list.*>-- --<OSS.InlineType M.T1.list.*>-- --<OSS.UseThis M.T1.list M.T2.list>-- M DEFINITIONS AUTOMATIC TAGS ::= BEGIN T1 ::= SEQUENCE { list SEQUENCE OF CHOICE { f INTEGER } } T2 ::= SEQUENCE { list SEQUENCE OF CHOICE { f INTEGER } } END
Without -compat badSharingForTypesWithInlineTypeDir | With -compat badSharingForTypesWithInlineTypeDir |
---|---|
The compiler prints the following warnings: "test.asn", line 3 (M): C0567W: The OSS.UseThis directive was not applied to type 'M.T1.list' because its C representation differs from those of type 'M.T2.list'. C0492I: There are unused standard directives. Specify the -gendirectives command line option, then look at all lines containing "WARNING:" in the generated .gen file. typedef struct T1 { struct _seqof1 { struct _seqof1 *next; struct { unsigned short choice; # define f_chosen 1 union { int f; /* to choose, set choice to f_chosen */ } u; } value; } *list; } T1; typedef struct T2 { struct _seqof2 { struct _seqof2 *next; struct { unsigned short choice; # define f_chosen 1 union { int f; /* to choose, set choice to f_chosen */ } u; } value; } *list; } T2; |
typedef struct ObjectID { unsigned short count; unsigned short value[1]; } *ObjectID; typedef struct ObjectID *O; |
Starting with version 5.0, the ASN.1 compiler no longer generates additional typedefs in the header file for names specified with an OSS.TYPENAME directive applied to fields defined with tagged types which have an OSS.ExtractType directive. The -compat badTypedefsForUserNames flag restores the previous behavior.
ASN.1:
--<OSS.ExtractType Mod.Type1.nested>-- Mod DEFINITIONS ::= BEGIN Type1 ::= SET { nested SetOfInt --<TYPENAME "MyIntSet">-- } SetOfInt ::= SET OF INTEGER END
With -compat badTypedefsForUserNames | Without -compat badTypedefsForUserNames |
---|---|
typedef struct SetOfInt *MyIntSet; typedef struct Type1 { struct SetOfInt *nested; } Type1; typedef struct SetOfInt { struct SetOfInt *next; int value; } *SetOfInt; |
typedef struct Type1 { struct SetOfInt *nested; } Type1; typedef struct SetOfInt { struct SetOfInt *next; int value; } *SetOfInt; |
Starting with version 5.1, the ASN.1 compiler no longer accepts (without issuing a warning message) OSS.TYPENAME to be applied to referenced components within structured types. Although OSS.TYPENAME does not affect the name of the specified component, it might cause invalid information to be generated into the header file. Also, a warning message is issued when this directive is detected. The -compat badTYPENAMEdirectives flag restores the previous behavior.
ASN.1:
--<OSS.TYPENAME Mod.Alerting-UUIE.tokens.* "NewClearToken">-- Mod DEFINITIONS AUTOMATIC TAGS ::= BEGIN ClearToken ::= INTEGER Alerting-UUIE ::= SEQUENCE { tokens SEQUENCE OF ClearToken OPTIONAL } END
The header file representation with and without the -compat badTYPENAMEdirectives flag is the same.
Starting with version 8.6, the ASN.1 compiler no longer incorrectly generates an unbounded representation with an unsigned short length field for BIT STRING types with NamedBits, if the maximum value of the named bits is less than USHORT_MAX. The ASN.1 compiler will generate an unsigned int length field for these types. The -compat badUnboundedBitStringsWithNamedBits flag restores the previous behavior.
ASN.1:
Mod DEFINITIONS ::= BEGIN B ::= BIT STRING {bit(20)} END
Without -compat badUnboundedBitStringsWithNamedBits (release 8.6.0 or later) | With -compat badUnboundedBitStringsWithNamedBits (release 8.6.0 or later) |
---|---|
typedef struct B { unsigned int length; /* number of significant bits */ unsigned char *value; } B; #define bit 0x08 #define bit_byte 2 |
typedef struct B { unsigned short length; /* number of significant bits */ unsigned char *value; } B; #define bit 0x08 #define bit_byte 2 |
Prior to version 4.0, the ASN.1 compiler prefixed internal names (such as the value field in UNBOUNDED structures) with an underscore when a user-defined name was the same as these internal names. Starting with version 4.0, these internal names are no longer prefixed with an underscore when a user-defined variable has a name that is the same as an internal name (e.g., count, next, length, prev, value, etc.)
The -compat badUnderscorePrefix option disables this behavior and provides compatibility with previous versions.
ASN.1:
Module DEFINITIONS ::= BEGIN YourOctStr ::= OCTET STRING MyOctStr ::= OCTET STRING value MyOctStr ::= 'FF'H length INTEGER ::= 10 END
With -compat badUnderscorePrefix | Without -compat badUnderscorePrefix |
---|---|
typedef struct YourOctStr { unsigned int _length; unsigned char *_value; } YourOctStr; typedef struct MyOctStr { unsigned int _length; unsigned char *_value; } MyOctStr; extern MyOctStr value; extern int length; |
typedef struct YourOctStr { unsigned int length; unsigned char *value; } YourOctStr; typedef struct MyOctStr { unsigned int length; unsigned char *value; } MyOctStr; extern MyOctStr value; extern int length; |
Starting with version 4.1, ambiguous value references are prefixed with the name of their containing module. The -compat badValuePrefix flag restores the previous behavior and instructs the compiler to add the _# prefix to ambiguous value references.
ASN.1:
--<OSS.ROOT>-- Mod1 DEFINITIONS ::= BEGIN A ::= INTEGER a A ::= 20 END Mod2 DEFINITIONS ::= BEGIN A ::= INTEGER a A ::= 21 END
With -compat badValuePrefix | Without -compat badValuePrefix |
---|---|
typedef int Mod1_A; typedef int Mod2_A; extern Mod1_A a_1; extern Mod2_A a_2; |
typedef int Mod1_A; typedef int Mod2_A; extern Mod1_A Mod1_a; extern Mod2_A Mod2_a; |
Starting with version 7.0, the default representation of UTF8String for the LED runtime is the UNBOUNDED representation (ossCharString), which facilitates switching between SOED or TOED and LED library. The -compat BMPleanUTF8String flag restores the previous behavior and instructs the compiler to use ossBMPString as the default representation of UTF8String for the LED runtime.
ASN.1:
X1 DEFINITIONS ::= BEGIN U ::= UTF8String END
Without compat flag for release 7.0 or later (only with -lean) | With compat flag for release 7.0 or later (-lean -compat BMPleanUTF8String) |
---|---|
typedef ossCharString U; |
typedef ossBMPString U; |
Starting with version 5.3.0, the ASN.1 compiler allocates six bytes for each character in the UTF8String. The -compat charUTF8String flag restores the previous behavior and instructs the compiler to generate a character string consisting of one-byte characters to represent the UTF8String type with a size constraint. Note that this behavior might cause errors when using multiple byte character strings.
ASN.1:
Mod1 DEFINITIONS ::= BEGIN U ::= UTF8String (SIZE(10)) END
With -compat charUTF8String | Without -compat charUTF8String |
---|---|
typedef char U[11]; |
typedef unsigned char U[61]; |
Starting with version 5.0, the ossDecode() function no longer modifies the address and length of the input buffer. The -compat decoderUpdatesInputAddress flag restores the previous behavior, which may be useful in decoding multiple concatenated PDUs from a single buffer.
The -compat decoderUpdatesInputAddress flag does not change the representation of the input ASN.1 syntax in the header file.
Starting with version 5.0, the ASN.1 compiler generates a bitmask only for non-pointer elements. The -compat extensionWithMask flag restores the previous behavior and instructs the compiler to generate a bitmask for all elements placed after the extensibility marker ("..."), even if the element is represented by a pointer.
ASN.1:
Module DEFINITIONS ::= BEGIN A ::= SEQUENCE { field1 INTEGER, field2 BOOLEAN, ... , field3 REAL --<POINTER>-- } END
With -compat extensionWithMask | Without -compat extensionWithMask |
---|---|
typedef struct A { unsigned char bit_mask; # define field3_present 0x80 int field1; ossBoolean field2; double *field3; /* extension #1; set in bit_mask * field3_present present */ } A; |
typedef struct A { int field1; ossBoolean field2; double *field3; /* extension #1; NULL for not present */ } A; |
Starting with version 4.2, the ASN.1 compiler generates a double pointer ("**") to represent a circular reference to a SEQUENCE OF or SET OF type which has a size constraint and employs the LINKED representation (due to a global OSS.LINKED directive). The compiler will generate a single pointer for this type. The -compat extraLinkedSETOFPointer flag restores the previous behavior.
ASN.1:
--<OSS.LINKED SET OF>-- Circle DEFINITIONS --<PDU>-- ::= BEGIN Circ ::= SET (SIZE(10)) OF SEQUENCE {b Circ} END
With -compat extraLinkedSETOFPointer | Without -compat extraLinkedSETOFPointer |
---|---|
typedef struct Circ { struct Circ *next; struct { struct Circ **b; } value; } *Circ; |
typedef struct Circ { struct Circ *next; struct { struct Circ *b; } value; } *Circ; |
Starting with version 4.2, the ASN.1 compiler no longer shortens names for certain types when this is not required. The -compat extraNameShortening flag restores the previous behavior.
Starting with version 4.2, the ASN.1 compiler no longer generates a fixed-length array for character strings, SEQUENCE OF, and SET OF types with extensible size constraints. These types are represented using the UNBOUNDED representation. The -compat extSizeNotUnbounded flag restores the previous behavior.
NOTE: Starting with version 6.0, this flag affects the behavior of the ASN.1/C compiler only if the compat 5.4.0stringrepresentations flag is present.
ASN.1:
Module DEFINITIONS ::= BEGIN String1 ::= PrintableString (SIZE(12, ...)) END
With -compat extSizeNotUnbounded | Without -compat extSizeNotUnbounded (the representation is UNBOUNDED) |
---|---|
typedef char String1[13]; |
typedef struct String1 { unsigned short length; char *value; } String1; |
Starting with version 9.0, the ASN.1 compiler generates an intermediate typedef to decrease the nesting level of generated inline structures. The -compat generateInlineDeeplyNestedTypes flag restores the previous behavior and instructs the compiler to generate a C-type definition for deeply nested ASN.1 types. Note that this cannot be compiled by the Microsoft Visual C/C++ compiler, because the nesting level of inline structures exceeds 15, which is the C compiler implementation limit.
ASN.1:
M DEFINITIONS ::= BEGIN S ::= SEQUENCE { f1 SEQUENCE { f2 SEQUENCE { f3 SEQUENCE { f4 SEQUENCE { f5 SET { f6 SEQUENCE { f7 SET { f8 SEQUENCE { f9 SET { f10 SEQUENCE { f11 SET { f12 SEQUENCE { f13 SET { f14 SEQUENCE { f15 SET { i INTEGER } } } } } } } } } } } } } } } } END
With -compat generateInlineDeeplyNestedTypes | Without -compat generateInlineDeeplyNestedTypes |
---|---|
typedef struct S { struct { struct { struct { struct { struct { struct { struct { struct { struct { struct { struct { struct { struct { struct { struct { int i; } f15; } f14; } f13; } f12; } f11; } f10; } f9; } f8; } f7; } f6; } f5; } f4; } f3; } f2; } f1; } S; |
typedef struct _seq1 { struct { struct { struct { struct { struct { int i; } f15; } f14; } f13; } f12; } f11; } _seq1; typedef struct S { struct { struct { struct { struct { struct { struct { struct { struct { struct { _seq1 f10; } f9; } f8; } f7; } f6; } f5; } f4; } f3; } f2; } f1; } S; |
Starting with version 8.0.1/8.1, the ASN.1 compiler no longer ignores constraints applied to the fields within 1994 EXTERNAL type with multiple type constraint. The runtime can identify values that violate these constraints and the ASN.1 compiler adds names to nested generated structures if value constraints are present. The -compat ignore1994ExternalConstr flag restores the previous behavior and instructs the compiler to generate the unnamed structure for the encoding field within the EXTERNAL type.
ASN.1:
A ::= EXTERNAL ( WITH COMPONENTS { identification (WITH COMPONENTS { presentation-context-id PRESENT}), data-value-descriptor ABSENT, data-value (CONTAINING INTEGER ) } ) a A ::= {identification syntax : {1 2 3}, data-value CONTAINING 64}
With -compat ignore1994ExternalConstr | The structure generated for the field encoding gets _choice1 name without -compat ignore1994ExternalConstr |
---|---|
typedef struct A { unsigned char bit_mask; # define direct_reference_present 0x80 # define indirect_reference_present 0x40 ObjectID direct_reference; /* optional; set in bit_mask * direct_reference_present if * present */ int indirect_reference; /* optional; set in bit_mask * indirect_reference_present * if present */ char *data_value_descriptor; /* NULL for not present */ struct { unsigned short choice; # define single_ASN1_type_chosen 1 # define octet_aligned_chosen 2 # define arbitrary_chosen 3 union { OpenType single_ASN1_type; /* to choose, set choice * to single_ASN1_type_chosen */ struct External_octet_aligned { /* ContentsConstraint is applied to octet_aligned */ struct { unsigned int length; unsigned char *value; } encoded; A_integer *decoded; } octet_aligned; /* to choose, set choice to * octet_aligned_chosen */ struct External_arbitrary { unsigned int length; /* number of significant * bits */ unsigned char *value; } arbitrary; /* to choose, set choice to arbitrary *_chosen */ } u; } encoding; } A; |
typedef struct A { unsigned char bit_mask; # define direct_reference_present 0x80 # define indirect_reference_present 0x40 ObjectID direct_reference; /* optional; set in bit_mask * direct_reference_present if * present */ int indirect_reference; /* optional; set in bit_mask * indirect_reference_present * if present */ char *data_value_descriptor; /* NULL for not present */ struct _choice1 { unsigned short choice; # define single_ASN1_type_chosen 1 # define octet_aligned_chosen 2 # define arbitrary_chosen 3 union { OpenType single_ASN1_type; /* to choose, set choice * to single_ASN1_type_chosen */ struct External_octet_aligned { /* ContentsConstraint is applied to octet_aligned */ struct { unsigned int length; unsigned char *value; } encoded; A_integer *decoded; } octet_aligned; /* to choose, set choice to * octet_aligned_chosen */ struct External_arbitrary { unsigned int length; /* number of significant * bits */ unsigned char *value; } arbitrary; /* to choose, set choice to arbitrary *_chosen */ } u; } encoding; } A; |
NOTE: When you use the files generated with the -compat ignore1994ExternalConstr flag in your application, the following runtime error will not be generated:
E0065S: Absence constraint violated; check field 'direct-reference' (type: OBJECT IDENTIFIER) of PDU #2 'A'.
Starting with version 8.4, the ASN.1 compiler no longer ignores an InlineType directive applied to a type nested within a shared one. The -compat ignoreInlineTypeDirForSharedTypes flag restores the previous behavior.
ASN.1:
--<OSS.InlineType M.T2.list.*>-- M DEFINITIONS AUTOMATIC TAGS ::= BEGIN T1 ::= SEQUENCE { list SEQUENCE OF CHOICE { f INTEGER } } T2 ::= SEQUENCE { list SEQUENCE OF CHOICE { f INTEGER } } END
With -compat ignoreInlineTypeDirForSharedTypes | Without -compat ignoreInlineTypeDirForSharedTypes |
---|---|
typedef struct _choice1 { unsigned short choice; # define f_chosen 1 union { int f; /* to choose, set choice to f_chosen */ } u; } _choice1; typedef struct _seqof1 { struct _seqof1 *next; _choice1 value; } *_seqof1; typedef struct T1 { struct _seqof1 *list; } T1; typedef struct T2 { struct _seqof1 *list; } T2; |
typedef struct _choice1 { unsigned short choice; # define f_chosen 1 union { int f; /* to choose, set choice to f_chosen */ } u; } _choice1; typedef struct T1 { struct _seqof1 { struct _seqof1 *next; _choice1 value; } *list; } T1; typedef struct T2 { struct _seqof2 { struct _seqof2 *next; struct { unsigned short choice; # define f_chosen 1 union { int f; /* to choose, set choice to f_chosen */ } u; } value; } *list; } T2; |
Starting with version 7.0, the ASN.1 compiler no longer disambiguates names generated for a #define constant or for ENUMERATED type elements when an ASN1.Nickname directive that contains a different name (not conflicted) is applied to one of the disputed names. Previously, the other name (to which the ASN1.Nickname was not applied) was mangled despite the absence of a conflict. The -compat ignoreNicknamesInConflictResolution flag restores the previous behavior.
ASN.1:
--<ASN1.Nickname M.FirstEnum.one is_one>-- --<ASN1.Nickname M.BtStr.first first_bit>-- M DEFINITIONS ::= BEGIN FirstEnum ::= ENUMERATED {one} SecondEnum ::= ENUMERATED {one} BtStr ::= BIT STRING {first(0)} Int ::= INTEGER {first(100)} END
With -compat ignoreNicknamesInConflictResolution | Without -compat ignoreNicknamesInConflictResolution |
---|---|
typedef enum FirstEnum { is_one = 0 } FirstEnum; typedef enum SecondEnum { SecondEnum_one = 0 } SecondEnum; typedef struct BtStr { unsigned short length; /* number of significant bits */ unsigned char *value; } BtStr; #define first_bit 0x80 #define first_bit_byte 0 typedef int Int; #define Int_first 100 |
typedef enum FirstEnum { is_one = 0 } FirstEnum; typedef enum SecondEnum { one = 0 } SecondEnum; typedef struct BtStr { unsigned short length; /* number of significant bits */ unsigned char *value; } BtStr; #define first_bit 0x80 #define first_bit_byte 0 typedef int Int; #define first 100 |
Starting with version 8.5, the ASN.1 compiler supports the POINTER directive for the Lean encoder/decoder. The -compat ignorePointerDirForLean flag restores the previous behavior.
ASN.1:
B1835 DEFINITIONS ::= BEGIN S ::= SEQUENCE { f INTEGER --<POINTER>-- } END
S type representation with -compat ignorePointerDirForLean -lean | S type representation with -lean |
---|---|
typedef struct S { OSS_INT32 f; } S; |
typedef struct S { OSS_INT32 *f; } S; |
Note that the f field is generated with a non-pointered type and the ASN.1 compiler issues a warning message, as in previous versions of the ASN.1 compiler. The f field type is a pointer to OSS_INT32.
C0541W: Directive POINTER is not supported and will be ignored. S ::= SEQUENCE { f INTEGER --<POINTER>-- }
Starting with version 8.4, the structures generated for ASN.1 types, such as CHARACTER STRING, EMBEDDED PDV and EXTERNAL are prefixed when the -helperNames and -prefix ASN.1 compiler options are present. The -compat ignorePrefixForSpecialStructures flag restores the previous behavior.
ASN.1:
ASN1SPEC1 DEFINITIONS ::= BEGIN PDU1 ::= SEQUENCE { character-string CHARACTER STRING } END
With -prefix Spec1_-compat ignorePrefixForSpecialStructures | With -prefix Spec1_ without -compat ignorePrefixForSpecialStructures |
---|---|
typedef struct UnrestrictedChar_negotiation { int presentation_context_id; struct Spec1__OID *transfer_syntax; } UnrestrictedChar_negotiation; |
typedef struct Spec1_UnrestrictedChar_negotiation { int presentation_context_id; struct Spec1__OID *transfer_syntax; } Spec1_UnrestrictedChar_negotiation; |
Starting with version 6.1.4, the ASN.1 compiler no longer generates an implicit type definition for the CHOICE, SET OF, and SEQUENCE OF types that are elements of SET OF or SEQUENCE OF types in an ARRAY representation. These element types have their own typedefs. The -compat implicitTypeInArray flag restores the previous behavior.
ASN.1:
Mod DEFINITIONS ::= BEGIN SeqOfChoice ::= [0] SEQUENCE --<ARRAY>-- OF CHOICE { i INTEGER, s IA5String } SeqOfSet ::= [1] SEQUENCE --<ARRAY>-- OF SET OF INTEGER END
With -compat implicitTypeInArray | Without -compat implicitTypeInArray |
---|---|
typedef struct SeqOfChoice { unsigned int count; struct { unsigned short choice; # define i_chosen 1 # define s_chosen 2 union { int i; /* to choose, set choice to i_chosen */ char *s; /* to choose, set choice to s_chosen */ } u; } value[1]; /* first element of the array */ } *SeqOfChoice; typedef struct SeqOfSet { unsigned int count; struct _setof1 { struct _setof1 *next; int value; } *value[1]; /* first element of the array */ } *SeqOfSet; |
typedef struct _choice1 { unsigned short choice; # define i_chosen 1 # define s_chosen 2 union { int i; /* to choose, set choice to i_chosen */ char *s; /* to choose, set choice to s_chosen */ } u; } _choice1; typedef struct SeqOfChoice { unsigned int count; _choice1 value[1]; /* first element of the array */ } *SeqOfChoice; typedef struct _setof1 { struct _setof1 *next; int value; } *_setof1; typedef struct SeqOfSet { unsigned int count; struct _setof1 *value[1]; /* first element of the array */ } *SeqOfSet; |
Starting with version 3.6, the ASN.1 compiler no longer initializes C enum variables with INTEGERs. These variables are initialized with enumerators. You can use the -compat intEnums flag to restore the previous behavior or to restrict the scope of generated typedefs for enumeration values.
ASN.1:
Level ::= ENUMERATED {low(0), medium(1), high(2)} empty Level ::= low
Shared Representation and Declaration | Initialization prior to version 3.6 | Initialization starting with version 3.6 |
---|---|---|
typedef enum Level { low = 0, medium = 1, high = 2 } Level; extern Level empty; |
Level empty = 0; |
Level empty = low; |
Alias: -compat 2
Starting with version 4.2, the ASN.1 compiler no longer generates multiple constraint-checking functions for multiple CONSTRAINED BY clauses (even when multiple CONSTRAINED BY clauses referred to the same type). Now, a single constraint-checking function is generated for a particular type, even if the type is defined with more than one CONSTRAINED BY clause. The -compat multipleUserFunctions flag restores the previous behavior.
ASN.1:
Module DEFINITIONS ::= BEGIN SpecialNum ::= INTEGER (CONSTRAINED BY {-- must be a prime number--}) (CONSTRAINED BY {-- must be in the Fibonacci series --}) END
With -compat multipleUserFunctions | Without -compat multipleUserFunctions |
---|---|
typedef int SpecialNum; /* must be a prime number*/ /* must be in the Fibonacci */ /* series */ /* SpecialNum_fn is user-defined constraint function for ASN.1 item * Module.SpecialNum */ extern int DLL_ENTRY SpecialNum_fn(struct ossGlobal *, SpecialNum *, void **); /* SpecialNum_fn1 is user-defined constraint function for ASN.1 item * Module.SpecialNum */ extern int DLL_ENTRY SpecialNum_fn1(struct ossGlobal *,SpecialNum *, void **); |
typedef int SpecialNum; /* must be a prime number*/ /* must be in the Fibonacci */ /* series */ /* SpecialNum_fn is user-defined constraint function for ASN.1 item * Module.SpecialNum */ extern int DLL_ENTRY SpecialNum_fn(struct ossGlobal *, SpecialNum *, void **); |
NOTE: Starting with version 5.0, user-defined constraint-checking functions are generated only if the -userConstraints compiler option is specified.
Starting with version 4.0, all CHOICE types get typedefs when the -C++ option is specified, nested structures are pulled out and made into typedefs, and the _union tag is added to the union containing the elements of the CHOICE. The -compat nestUnions flag restores the previous behavior which does not force the ASN.1 compiler to generate a typedef for CHOICE types when the -C++ option is specified. In addition, any structs nested inside a CHOICE type will be generated inside the structure where they were nested, instead of being pulled out and typedefined separately. Also, the _union tag will not be added to the union containing the elements of the CHOICE.
The -C++ option is specified for both generated outputs.
ASN.1:
Module DEFINITIONS ::= BEGIN Data ::= SEQUENCE { a INTEGER, b CHOICE { c BOOLEAN, d SEQUENCE { e IA5String, f PrintableString } } } END
With -compat nestUnions | Without -compat nestUnions |
---|---|
typedef struct Data { int a; struct _choice1 { unsigned short choice; # define c_chosen 1 # define d_chosen 2 union { ossBoolean c; /* to choose, set choice to * c_chosen */ struct _seq1 { char *e; char *f; } d; /* to choose, set choice to d_chosen */ } u; } b; } Data; |
typedef struct _choice1 { unsigned short choice; # define c_chosen 1 # define d_chosen 2 union _union { ossBoolean c; /* to choose, set choice to * c_chosen */ struct _seq1 { char *e; char *f; } d; /* to choose, set choice to d_chosen */ } u; } _choice1; typedef struct Data { int a; _choice1 b; } Data; |
Alias: -compat 3
Starting with version 5.4.0, ASN.1 comment content is transferred by default to the generated header file using valid C/C++ comment constructs. The -compat noASN.1Comments flag restores the previous behavior and allows you to reduce the size of the generated header file.
Starting with version 4.0, the ASN.1 compiler generates representations in the header file for SEQUENCE, SEQUENCE OF, SET, or SET OF built-in types used in value assignments and initializations are generated in the .c file. The -compat noBTypeValues flag restores the previous behavior. The compiler will not generate the representations for the above mentioned built-in types in the header file and will not generate initializations in the .c file.
ASN.1:
Module DEFINITIONS ::= BEGIN AsciiType ::= SEQUENCE OF IA5String success AsciiType ::= {"Address found."} failure SEQUENCE OF PrintableString ::= {"Address found."} END
With -compat noBTypeValues | Without -compat noBTypeValues | .c file without -compat noBTypeValues |
---|---|---|
typedef struct AsciiType { struct AsciiType *next; char *value; } *AsciiType; extern AsciiType success; .c file contains: static char _v1[] = "Address found."; static struct AsciiType _v0[] = { {NULL, _v1} }; AsciiType success = _v0; |
typedef struct AsciiType { struct AsciiType *next; char *value; } *AsciiType; extern AsciiType success; typedef struct _seqof1 { struct _seqof1 *next; char *value; } *_seqof1; extern _seqof1 failure; |
static char _v1[] = "Address found."; static struct AsciiType _v0[] = { {NULL, _v1} }; AsciiType success = _v0; static char _v3[] = "Address not found."; static struct _seqof1 _v2[] = { {NULL, _v3} }; _seqof1 failure = _v2; |
Instructs the compiler not to generate user-defined functions for fields with a CONSTRAINED BY constraint within an inner subtype constraint when the -userConstraints option is specified.
When this flag is specified, the ASN.1 compiler will not generate const declarations for values of simple types. This flag is implied when the -noDefines, noStaticValues, or -test option is specified.
ASN.1:
B ::= BOOLEAN b B ::= TRUE
With -compat noConstDeclarations | Without -compat noConstDeclarations |
---|---|
.h file: extern B b; .c file: B b = TRUE; |
.h file: extern const B b; .c file: const B b = TRUE; |
Starting with version 5.0.0, the following name-mangling rules are introduced:
The -compat noDecoupledNames flag restores the previous behavior.
Mod DEFINITIONS ::= BEGIN Type1 ::= CHOICE { ambig BOOLEAN } Type2 ::= SEQUENCE { ambig INTEGER OPTIONAL} ambig-present Type1 ::= ambig : TRUE END
In the following example, the ambig field name for Type1 is not mangled and the one in Type2 is mangled. Both of the conflicting names are mangled (Type2.ambig and the extern variable ambig_present.
When -compat noDecoupledNames is not specified, neither the extern variable name nor the ambig field name is mangled, according to the introduced rules:
ASN.1:
With -compat noDecoupledNames | Without -compat noDecoupledNames |
---|---|
typedef struct Type1 { unsigned short choice; # define ambig_chosen 1 union { ossBoolean ambig; /* to choose, set choice to ambig_chosen */ } u; } Type1; typedef struct Type2 { unsigned char bit_mask; # define Type2_ambig_present 0x80 int Type2_ambig; /* optional; set in bit_mask * Type2_ambig_present if present */ } Type2; extern Type1 Mod_ambig_present; |
typedef struct Type1 { unsigned short choice; # define ambig_chosen 1 union { ossBoolean ambig; /* to choose, set choice to ambig_chosen */ } u; } Type1; typedef struct Type2 { unsigned char bit_mask; # define Type2_ambig_present 0x80 int ambig; /* optional; set in bit_mask Type2_ambig_present if * present */ } Type2; extern Type1 ambig_present; |
Starting with version 4.0, the OSS decoder fills with its specified default value any DEFAULT component that has no value passed. The -compat noDefaultValues flag restores the previous behavior and instructs the OSS decoder to ignore components of SEQUENCE and SET types marked as DEFAULT if no value are passed for them in the encoding (they are treated as OPTIONAL elements).
NOTE: When using the -compat noDefaultValues flag, a bitmask field may not be generated for a DEFAULT element in a SEQUENCE or SET that is the first field specified in the definition.
ASN.1:
Module DEFINITIONS ::= BEGIN DataCard ::= SEQUENCE { a [0] BOOLEAN DEFAULT TRUE, b [1] BOOLEAN } END
With -compat noDefaultValues | Without -compat noDefaultValues |
---|---|
typedef struct DataCard { unsigned char bit_mask; # define a_present 0x80 ossBoolean a; /* optional; set in bit_mask a_present if present */ ossBoolean b; } DataCard; |
typedef struct DataCard { unsigned char bit_mask; # define a_present 0x80 ossBoolean a; /* a_present not set in bit_mask implies value is TRUE */ ossBoolean b; } DataCard; |
Alias: -compat 8
Starting with version 5.0, the ASN.1 compiler automatically treats macro arguments as PDUs. The -compat noMacroArgumentPDUs flag restores the previous behavior and macro arguments will not be automatically treated as PDUs.
ASN.1:
Module DEFINITIONS ::= BEGIN ERROR MACRO ::= BEGIN TYPE NOTATION ::= "PARAMETER" NamedType | empty VALUE NOTATION ::= value(VALUE INTEGER) NamedType ::= identifier type | type END invalidName ERROR PARAMETER reason BIT STRING {nameTooLong(1), illegalCharacter(2), unspecified(3)} ::= 2 END
With -compat noMacroArgumentPDUs | Without -compat noMacroArgumentPDUs |
---|---|
No output files are generated and the following messages are printed to the standard output device: "nomcrpdu.asn" (Module): C0220I: No PDUs in abstract syntax. "nomcrpdu.asn" (Module): C0244I: No types to print, so header file was not created. "nomcrpdu.asn" (Module): C0213I: No PDUs to print, so control table was not created. |
#define InvalidName_PARAMETER_PDU 1 typedef struct InvalidName_PARAMETER { unsigned int length; /* number of significant bits */ unsigned char *value; } InvalidName_PARAMETER; #define nameTooLong 0x40 #define nameTooLong_byte 0 #define illegalCharacter 0x20 #define illegalCharacter_byte 0 #define unspecified 0x10 #define unspecified_byte 0 extern int invalidName; |
Starting with version 5.2, the ASN.1 compiler generates additional _OSET declarations for instances of parameterized information object sets used in table constraints and uses parameterized information object set to initialize table constraints. The -compat noObjectSetsFromDummyObjects flag restores the previous behavior and the compiler will not generate the declarations and initialize table constraints accordingly; however, note that this might cause memory violation issues during runtime for certain applications.
ASN.1:
Errors {OPERATION:Operations} ERROR ::= {Operations.&Errors} ROS {InvokeId:InvokeIdSet, OPERATION:Invokable, OPERATION:Returnable} ::= CHOICE { returnError [3] ReturnError {{Errors{{Returnable}}}} } ReturnError {ERROR:Errors} ::= SEQUENCE { errcode ERROR.&errorCode ({Errors}), parameter ERROR.&ParameterType ({Errors}{@errcode}) OPTIONAL }
Starting with version 4.2, the ASN.1 compiler generates a call to the function ossterm() in the .c file when the -test command-line option. The -compat noOssterm flag restores the previous behavior and the compiler will not generate the call.
NOTE: The ossterm() function frees additional memory used by the memory manager when encoding/decoding stops.
Starting with version 5.1, the ASN.1 compiler implements type sharing for parametrized types which share the same structure (but have different field names). This change does not affect the runtime processing of such types. The -compat noParamTypesharing flag restores the previous behavior and the compiler will not implement type sharing.
ASN.1:
A {Type} ::= SEQUENCE {a Type} B ::= A {SET {a INTEGER} } C ::= SET { b A {SEQUENCE {a INTEGER}} }
With -compat noParamTypesharing | Without -compat noParamTypesharing |
---|---|
typedef struct _set1 { int a; } _set1; typedef struct B { _set1 a; } B; typedef struct C { struct { _set1 a; } b; } C; |
typedef struct _set1 { int a; } _set1; typedef struct A { _set1 a; } A; typedef A B; typedef struct C { A b; } C; |
Starting with version 8.3.0, the ASN.1 compiler generates a PDU constant in the header file for an EXTERNAL type used in a contents constraint. The -compat noPduForContainedExternal flag restores the previous behavior and provides compatibility with versions 8.1.0 through 8.2.0. The compiler will not generate PDU constants.
ASN.1:
Module DEFINITIONS ::= BEGIN Param ::= BIT STRING (CONTAINING EXTERNAL) END
With -compat noPduForContainedExternal | Without -compat noPduForContainedExternal |
---|---|
#define Param_PDU 1 |
#define External_PDU 1 #define Param_PDU 2 |
Starting with version 5.0, the ASN.1 compiler treats types imported into root modules as PDUs, even if they are not referenced from within a root module. The -compat noPDUsForImports flag restores the previous behavior and ignores the types if they are not referenced from within a root module.
ASN.1 with mod1.ans (a non-root module) and mod2.asn (specified as a root module):
Mod1 DEFINITIONS ::= BEGIN Mod1Data ::= SEQUENCE { type ENUMERATED {random, sequential}, address INTEGER } END Mod2 DEFINITIONS ::= BEGIN IMPORTS Mod1Data FROM Mod1; Mod2Data ::= SEQUENCE { cmdCode INTEGER, success BOOLEAN } END
With -compat noPDUsForImports | Without -compat noPDUsForImports |
---|---|
#define Mod2Data_PDU 1 typedef struct Mod2Data { int cmdCode; ossBoolean success; } Mod2Data; |
#define Mod1Data_PDU 1 #define Mod2Data_PDU 2 typedef struct Mod1Data { enum { random = 0, sequential = 1 } type; int address; } Mod1Data; typedef struct Mod2Data { int cmdCode; ossBoolean success; } Mod2Data; |
Starting with version 3.6, the ASN.1 compiler implements a type-sharing optimization in which a structure shared among different data units is separately type-defined, and replaces its various locations with its type definition. The -compat noSharedTypes flag restores the previous behavior and the compiler will not implement such types.
NOTE: Starting with version 5.2.0 of the ASN.1/C compiler, -compat noSharedTypes flag has no effect unless the compat v5.1typesharing option is present.
ASN.1
Mod DEFINITIONS ::= BEGIN Type1 ::= SET { SET OF INTEGER } Type2 ::= SET { SET OF INTEGER } Type3 ::= SET { SET OF INTEGER } END
With -compat noSharedTypes | Without -compat noSharedTypes |
---|---|
typedef struct Type1 { struct _setof1 { struct _setof1 *next; int value; } *setOf; } Type1; typedef struct Type2 { struct _setof2 { struct _setof2 *next; int value; } *setOf; } Type2; typedef struct Type3 { struct _setof3 { struct _setof3 *next; int value; } *setOf; } Type3; |
typedef struct _setof1 { struct _setof1 *next; int value; } *_setof1; typedef struct Type1 { struct _setof1 *setOf; } Type1; typedef struct Type2 { struct _setof1 *setOf; } Type2; typedef struct Type3 { struct _setof1 *setOf; } Type3; |
Alias: -compat 1
Prior to version 8.1.2, the ASN.1 compiler did not always share top-level types that had both the OSS.UseThis and OSS.TYPENAME directives applied. Often this situation occurred when a .gen file was specified on the ASN.1 compiler command line. When the previously separate types become shared, the names of their corresponding C-types and macros in the header file could be changed.
The -compat noTypeRefWithUseThisSharing flag restores the previous behavior.
Starting with version 4.0, the ASN.1 compiler generates signed INTEGERs for non-negative constrained INTEGER types. The -compat noUInt flag restores the previous behavior. The compiler will not generate the INTEGERs.
ASN.1
Module DEFINITIONS ::= BEGIN MilesPerGallon ::= INTEGER (1..70) Price ::= INTEGER (60000..100000) END
With -compat noUInt | Without -compat noUInt |
---|---|
typedef short MilesPerGallon; typedef int Price; |
typedef unsigned short MilesPerGallon; typedef unsigned int Price; |
Alias: -compat 5
Starting with version 4.0, the ASN.1 compiler generates unsigned INTEGERs for count and length fields in the header file. The -compat noULength flag restores the previous behavior. The compiler will instead generate signed INTEGERs.
ASN.1
Module DEFINITIONS ::= BEGIN VoiceClip ::= BIT STRING END
With -compat noULength | Without -compat noULength |
---|---|
typedef struct VoiceClip { int length; /* number of significant bits */ unsigned char *value; } VoiceClip; |
typedef struct VoiceClip { unsigned int length; /* number of significant bits */ unsigned char *value; } VoiceClip; |
Alias: -compat 4
Starting with version 9.0, instead of an untyped pointer, the decoded open type value is represented as a union of all of the possible type alternatives specified in the object set associated with the open type via table constraints. The -compat noUnionRepresentationForOpenTypes flag restores the previous behavior and instructs the compiler to generate a common representation for each open type as a predefined open type structure.
ASN.1
Module DEFINITIONS ::= BEGIN C ::= CLASS { &key INTEGER, &Type } Object C ::= { { &key 1, &Type INTEGER } | { &key 2, &Type UTF8String } } S ::= SEQUENCE { key C.&key ({Object}), value C.&Type ({Object}{@key}) } END
With -compat noUnionRepresentationForOpenTypes | Without -compat noUnionRepresentationForOpenTypes |
---|---|
typedef struct S { int key; OpenType value; } S; |
enum Object_Type_PDUs { PDU_Object_Type_UNKNOWN = 0, PDU_Object_Type_integer = Object_integer_PDU, PDU_Object_Type_UTF8String = Object_UTF8String_PDU }; union Object_Type_union { Object_integer *pdu_Object_integer; /* PDU_Object_Type_integer */ Object_UTF8String *pdu_Object_UTF8String; /* PDU_Object_Type_UTF8String */ }; typedef struct Object_Type { enum Object_Type_PDUs pduNum; OssBuf encoded; union Object_Type_union decoded; } Object_Type; typedef struct S { int key; Object_Type value; } S; |
Starting with version 4.2, the ASN.1 compiler treats parameters to CONSTRAINED BY constraints as PDUs. The -compat noUserConstraintPDUs flag restores the previous behavior. The compiler will not treat the parameters as PDUs.
ASN.1
Module DEFINITIONS ::= BEGIN SpecialNumber ::= INTEGER (CONSTRAINED BY {INTEGER --Integer parameter determines allowed values.--}) END
The following example is compiled with the -userConstraints option.
With -compat noUserConstraintPDUs | Without -compat noUserConstraintPDUs |
---|---|
#define SpecialNumber_PDU 1 typedef int SpecialNumber; /* SpecialNumber_fn is user-defined constraint function for * ASN.1 item Module.SpecialNumber */ extern int DLL_ENTRY SpecialNumber_fn(struct ossGlobal *, SpecialNumber *, void **); |
#define SpecialNumber_PDU 1 #define SpecialNumber_integer_PDU 2 typedef int SpecialNumber; typedef int SpecialNumber_integer; /* SpecialNumber_fn is user-defined constraint function for * ASN.1 item Module.SpecialNumber */ extern int DLL_ENTRY SpecialNumber_fn(struct ossGlobal *, SpecialNumber *, void **); |
Starting with version 4.0, the ASN.1 compiler generates initializations for each valuereference in the .c file. The -compat noValues flag restores the previous behavior. The compiler will not generate the initializations.
ASN.1
Module DEFINITIONS ::= BEGIN Magnitude ::= INTEGER (1..10) powerLevel Magnitude ::= 8 END
With -compat noValues | Without -compat noValues |
---|---|
.h file contains: typedef unsigned short Magnitude; .c file contains no initializations. |
.h file contains: typedef unsigned short Magnitude; extern Magnitude powerLevel; .c file contains: Magnitude powerLevel = 8; |
Alias: -compat 9
Starting with version 4.1, the ASN.1 compiler represents ASN.1 BOOLEAN types using the ossBoolean type. The -compat oldBooleanType flag restores the previous behavior and instructs the compiler to generate a type definition that equates BOOLEAN and ossBoolean.
ASN.1
Module DEFINITIONS ::= BEGIN Married ::= BOOLEAN END
With -compat oldBooleanType | Without -compat oldBooleanType |
---|---|
typedef ossBoolean Boolean; typedef ossBoolean Married; |
typedef ossBoolean Married; |
Starting with version 5.1.0, the ASN.1 compiler no longer generates additional typedefs for certain types that have an ASN1.DeferDecoding or OSS.ENCODABLE directive applied when the type is a parameter of a parameterized type or is referenced from a different part of the specification. The -compat oldEncodableNames flag restores the previous behavior.
ASN.1
--<ASN1.DeferDecoding Module.Parm.*>-- Module DEFINITIONS ::= BEGIN Parm {Type} ::= SET OF Type N ::= SET OF INTEGER B ::= SEQUENCE { n Parm {N} } END
With -compat oldEncodableNames | Without -compat oldEncodableNames |
---|---|
typedef struct Parm { struct Parm *next; OpenType value; /* Parm_N_encodable type */ } *Parm; typedef struct N { struct N *next; int value; } *N; typedef struct B { struct Parm *n; } B; typedef struct N *Parm_N_encodable; |
typedef struct Parm { struct Parm *next; OpenType value; /* N type */ } *Parm; typedef struct N { struct N *next; int value; } *N; typedef struct B { struct Parm *n; } B; |
Starting with version 5.0, the ASN.1 compiler no longer appends the ObjHandle string to type names representing EXTERNAL, CHARACTER STRING, and EMBEDDED PDV types when an OBJHANDLE directive is specified. The -compat oldExternObjHdl flag restores the previous behavior.
ASN.1
Module DEFINITIONS ::= BEGIN MyExtern ::= EXTERNAL --<OBJHANDLE>-- END
With -compat oldExternObjHdl | Without -compat oldExternObjHdl |
---|---|
typedef struct ObjectID { unsigned short length; unsigned char *value; } ObjectID; typedef struct ExternalObjHandle { . . . . } ExternalObjHandle; typedef ExternalObjHandle MyExtern; |
typedef struct ObjectID { unsigned short length; unsigned char *value; } ObjectID; typedef struct External { . . . . } External; typedef External MyExtern; |
Starting with version 5.0.1, the ASN.1 compiler no longer mangles #define names in internal structures such as External, EmbeddedPDV, and UnrestrictedChar when a name conflict is detected. The -compat oldInternalDefineNames flag restores the previous behavior.
ASN.1
SNI-Extensions DEFINITIONS ::= BEGIN E ::= EXTERNAL MySeq ::= SEQUENCE { presentation-data-values CHOICE { octet-aligned OCTET STRING , arbitrary BIT STRING } } END
With -compat oldInternalDefineNames | Without -compat oldInternalDefineNames |
---|---|
typedef struct ObjectID { . . . . } ObjectID; typedef struct External { . . . . # define encoding_octet_aligned_chosen 2 # define encoding_arbitrary_chosen 3 . . . . } External; typedef External E; typedef struct MySeq { . . . . } MySeq; |
typedef struct ObjectID { . . . . } ObjectID; typedef struct External { . . . . # define octet_aligned_chosen 2 # define arbitrary_chosen 3 . . . . } External; typedef External E; typedef struct MySeq { . . . . } MySeq; |
Prior to version 8.2, the ASN.1 compiler generated names of artificial types created due to the presence of the ASN1.DeferDecoding or OSS.ENCODABLE directives, as well as for types with the CONTAINING subtype and open types within information objects that appear within parameterized types whose instances are shared by the compiler and UseThis directives are also applied. These names were based on the names of types that contain one of the instances of such parameterized types instead of names of the parameterized types themselves.
Starting with version 8.2, the names of such artificial types are derived from the name of the parameterized type whose instances are shared in the presence of the UseThis directives.
ASN.1
--<ASN1.DeferDecoding M.P.*>-- --<OSS.UseThis M.T.a M.P>-- --<OSS.UseThis M.T-T.* M.P-T>-- M DEFINITIONS AUTOMATIC TAGS ::= BEGIN P {PT} ::= SET OF PT T ::= SET { a P {INTEGER}} P-T {P-PT} ::= BIT STRING (CONTAINING P-PT ) T-T ::= SET OF P-T {INTEGER} END
The .h file generated with -compat oldInternalNamesWithinUseThisSharedTypescontains the artificially generated types T_integer_encodable and T_T_integer instead of P_integer_encodable and P_T_integer.
With -compat oldInternalNamesWithinUseThisSharedTypes | Without -compat oldInternalNamesWithinUseThisSharedTypes |
---|---|
#define T_PDU 1 #define T_T_PDU 2 #define P_integer_encodable_PDU 3 #define P_T_integer_PDU 4 typedef struct P { struct P *next; OpenType value; /* P_integer_encodable type */ } *P; typedef struct T { struct P *a; } T; typedef int P_T_integer; typedef struct P_T { /* ContentsConstraint is applied to P_T */ struct { unsigned int length; /* number of significant bits */ unsigned char *value; } encoded; P_T_integer *decoded; } P_T; typedef struct T_T { struct T_T *next; P_T value; } *T_T; typedef int P_integer_encodable; |
#define T_PDU 1 #define T_T_PDU 2 #define T_integer_encodable_PDU 3 #define T_T_integer_PDU 4 typedef struct P { struct P *next; OpenType value; /* T_integer_encodable type */ } *P; typedef struct T { struct P *a; } T; typedef int T_T_integer; typedef struct P_T { /* ContentsConstraint is applied to P_T */ struct { unsigned int length; /* number of significant bits */ unsigned char *value; } encoded; T_T_integer *decoded; } P_T; typedef struct T_T { struct T_T *next; P_T value; } *T_T; typedef int T_integer_encodable; |
When you apply a contents constraint to a BIT STRING or OCTET STRING type, the generated type representation differs from the original one. When you apply a contents constraint within an inner subtype, the compiler preserves the original type representation and generates an additional type with a new representation for the contents constraints. The flag instructs the compiler to generate structures for additional types in the location used in previous versions instead of generating the structures within the same headers as the ones in which the structures for the original types are generated when you specify the -splitHeaders option with the -c++ or -dualHeaders option.
Starting with version 5.3.0, the ASN.1 compiler no longer mangles certain typenames when both the -c++ and -prefix options were specified. The -compat oldNamesManglingWithPrefix flag restores the previous behavior.
Starting with version 4.2.6, ambiguous names within separate information objects are prefixed with their containing module's name. The -compat oldObjectNames flag restores the previous behavior and instructs the compiler to add a "_#" suffix. Note that this has no effect unless either the -genDirectives or -keepNames option is specified.
ASN.1
--<OSS.ROOT>-- Mod1 DEFINITIONS ::= BEGIN C1 ::= CLASS {&Type DEFAULT INTEGER --<LONG>--, &ValueSet &Type DEFAULT { INTEGER } } myClass C1 ::= { &Type IA5String --<UNBOUNDED>-- } END Mod2 DEFINITIONS ::= BEGIN C1 ::= CLASS {&Type DEFAULT INTEGER, &ValueSet &Type DEFAULT { INTEGER } } myClass C1 ::= { &Type BOOLEAN } END
With -compat oldObjectNames | Without -compat oldObjectNames |
---|---|
#define C1_integer_1_PDU 1 #define MyClass_IA5String_1_PDU 2 #define C1_integer_2_PDU 3 #define MyClass_IA5String_2_PDU 4 typedef struct Mod1_C1 { unsigned char bit_mask; # define Mod1_C1_ValueSet_present 0x80 # define Mod1_C1_ValueSet_present 0x40 unsigned short Type; /* optional; set in bit_mask * Mod1_C1_Type_present if present */ unsigned short ValueSet; /* optional; set in bit_mask * Mod1_C1_ValueSet_present if present */ long _oss_unique_index; } Mod1_C1; typedef struct Mod2_C1 { unsigned char bit_mask; # define Mod2_C1_ValueSet_present 0x80 # define Mod2_C1_ValueSet_present 0x40 unsigned short Type; /* optional; set in bit_mask * Mod1_C1_Type_present if present */ unsigned short ValueSet; /* optional; set in bit_mask * Mod2_C1_ValueSet_present if present */ long _oss_unique_index; } Mod2_C1; typedef long C1_integer_1; typedef struct MyClass_IA5String_1 { unsigned int length; char *value; } MyClass_IA5String_1; typedef int C1_integer_2; typedef char *MyClass_IA5String_2; extern Mod1_C1 Mod1_myClass; extern Mod2_C1 Mod2_myClass; |
#define C1_integer_1_PDU 1 #define Mod1_MyClass_IA5String_PDU 2 #define C1_integer_2_PDU 3 #define Mod2_MyClass_IA5String_PDU 4 typedef struct Mod1_C1 { unsigned char bit_mask; # define Mod1_C1_ValueSet_present 0x80 # define Mod1_C1_ValueSet_present 0x40 unsigned short Type; /* optional; set in bit_mask * Mod1_C1_Type_present if present */ unsigned short ValueSet; /* optional; set in bit_mask * Mod1_C1_ValueSet_present if present */ long _oss_unique_index; } Mod1_C1; typedef struct Mod2_C1 { unsigned char bit_mask; # define Mod2_C1_ValueSet_present 0x80 # define Mod1_C1_ValueSet_present 0x40 unsigned short Type; unsigned short ValueSet; /* optional; set in bit_mask * Mod2_C1_ValueSet_present if present */ long _oss_unique_index; } Mod2_C1; typedef long C1_integer_1; typedef struct Mod1_MyClass_IA5String { unsigned int length; char *value; } Mod1_MyClass_IA5String; typedef int C1_integer_2; typedef char *Mod2_MyClass_IA5String; extern Mod1_C1 Mod1_myClass; extern Mod2_C1 Mod2_myClass; |
NOTE: Using -compat oldObjectNames with the -genDirectives command-line option might cause names for information object types to be omitted from the .gen file.
Starting with version 5.0, the ASN.1 compiler includes types used as parameters in a parameterized type in type sharing optimization. The -compat oldParamTypesharing flag restores the previous behavior. The compiler will not include the types.
NOTE: Using -compat oldParamTypesharing might cause structures with the same name to be generated in the .h file.
Starting with version 5.2, the ASN.1 compiler allows type sharing of nested structures which have the OSS.DefineName or OSS.FIELDNAME directive applied to one of their fields. The -compat oldSharingFieldsWithDirectives flag restores the previous behavior.
NOTE: For versions 5.2.1 through 7.0.0 of the ASN.1/C compiler, this option has no effect unless the -compat v5.1typesharing option is also specified. Starting with version 7.0.0, pre-5.2 sharing is restored, therefore the -compat oldSharingFieldsWithDirectives option is not required.
ASN.1
--<OSS.DefineName Mod.IN-EntryInformation.information.attribute -- "attribute">-- --<OSS.DefineName Mod.EntryInformation.information.attribute -- "attribute">-- Mod DEFINITIONS ::= BEGIN Attribute ::= INTEGER IN-EntryInformation ::= SEQUENCE { information CHOICE { attribute Attribute } OPTIONAL } EntryInformation ::= SEQUENCE { information CHOICE attribute Attribute } OPTIONAL } END
With -compat oldSharingFieldsWithDirectives | Without -compat oldSharingFieldsWithDirectives |
---|---|
typedef int Attribute; typedef struct IN_EntryInformation { unsigned char bit_mask; # define IN_EntryInformation_information_present 0x80 struct { unsigned short choice; # define attribute_chosen 1 union { Attribute attribute; /* to choose, set choice to * attribute_chosen */ } u; } information; /* optional; set in bit_mask * IN_EntryInformation_information_present if present */ } IN_EntryInformation; typedef struct EntryInformation { unsigned char bit_mask; # define EntryInformation_information_present 0x80 struct { unsigned short choice; # define attribute_chosen 1 union { Attribute attribute; /* to choose, set choice to * attribute_chosen */ } u; } information; /* optional; set in bit_mask * EntryInformation_information_present if present */ } EntryInformation; |
typedef int Attribute; typedef struct _choice1 { unsigned short choice; # define attribute_chosen 1 union { Attribute attribute; /* to choose, set choice to * attribute_chosen */ } u; } _choice1; typedef struct IN_EntryInformation { unsigned char bit_mask; # define information_present 0x80 _choice1 information; /* optional; set in bit_mask * information_present if present */ } IN_EntryInformation; typedef struct EntryInformation { unsigned char bit_mask; # define information_present 0x80 _choice1 information; /* optional; set in bit_mask * information_present if present */ } EntryInformation; |
Instructs the compiler to use the same name specified with a TYPENAME directive for generated representations of both the base type and the type created after using contents constraints within an inner subtype constraint.
Starting with version 4.0, the ASN.1 compiler allows a PADDED directive only on fixed length strings. The -compat padded flag restores the previous behavior and instructs the compiler to allow a PADDED directive on variable length strings.
ASN.1
--<OSS.PADDED IA5String>-- Module DEFINITIONS ::= BEGIN VariableString ::= [1] IA5String (SIZE (2..10)) NullTerm ::= [2] IA5String (SIZE(10)) END
With -compat padded | without -compat padded |
---|---|
typedef char VariableString[10]; typedef char NullTerm[10]; |
Compiler will refuse to compile the above syntax issuing the following message: C0455E: PADDED directive for VariableString requires a single size constraint. |
Alias: -compat 6
Starting with version 6.0, the ASN.1 compiler no longer represents BIT STRING with a named bit list in the PADDED representation by default. The default representation is UNBOUNDED. The -compat paddedForNamedBits flag restores the previous behavior.
ASN.1
B DEFINITIONS ::= BEGIN BSN ::= BIT STRING { a(0) } END
With -compat paddedForNamedBits | Without -compat paddedForNamedBits |
---|---|
typedef unsigned char BSN; #define a 0x80 |
typedef struct BSN { unsigned short length; /* number of significant bits */ unsigned char *value; } BSN; #define a 0x80 #define a_byte 0 |
Starting with version 8.2, the ASN.1 compiler no longer generates typedefs with an additional pointer for parameterized types with contents constraints and a UseThis directive. The -compat pointeredParamTypesWithContConstrAndUseThis flag restores the previous behavior.
ASN.1
--<OSS.UseThis M.T-T.* M.P-T>-- M DEFINITIONS AUTOMATIC TAGS ::= BEGIN P-T {P-PT} ::= BIT STRING (CONTAINING SEQUENCE { a P-PT } ) T-T ::= SET OF P-T {INTEGER} END
Without -compat pointeredParamTypesWithContConstrAndUseThis | With -compat pointeredParamTypesWithContConstrAndUseThis |
---|---|
typedef struct P_T_seq { int a; } P_T_seq; typedef struct P_T { /* ContentsConstraint is applied to P_T */ _BitStr encoded; P_T_seq *decoded; } P_T; typedef P_T T_T_seq; |
typedef struct P_T_seq { int a; } P_T_seq; typedef struct P_T { /* ContentsConstraint is applied to P_T */ _BitStr encoded; P_T_seq *decoded; } *P_T; |
Starting with version 5.0, comments printed in the header file are more verbose. The -compat terseComments flag restores the previous behavior and prints brief comments.
ASN.1
Module DEFINITIONS ::= BEGIN A ::= SEQUENCE { a INTEGER OPTIONAL, b BOOLEAN DEFAULT TRUE } END
With -compat terseComments | Without -compat terseComments |
---|---|
typedef struct A { unsigned char bit_mask; # define a_present 0x80 # define b_present 0x40 int a; /* optional */ ossBoolean b; /* default assumed if omitted */ } A; |
typedef struct A { unsigned char bit_mask; # define a_present 0x80 # define b_present 0x40 int a; /* optional; set in bit_mask a_present * if present */ ossBoolean b; /* b_present not set in bit_mask * implies value is TRUE */ } A; |
Note that this option can also be used to suppress descriptive comments for user-defined constraint-checking functions.
Between versions 4.2 (inclusive) and 4.2.6 (exclusive), the ASN.1 compiler generated additional typedefs into the header file for user-defined CHOICE, SEQUENCE, and SET types. These additional typedefs were generated in the following situations:
Starting with version 4.2.6, these additional typedefs are no longer generated.
The -compat typedefsForGenNames flag restores the previous behavior.
ASN.1
Module DEFINITIONS ::= BEGIN C ::= SEQUENCE { a AlgorithmIdentifier --<FIELDNAME "signatureAlgorithm">-- } C1 ::= SEQUENCE { b AlgorithmIdentifier --<FIELDNAME "signatureAlgorithm">-- } AlgorithmIdentifier ::= SEQUENCE { idStamp INTEGER, returnType INTEGER } END
With -compat typedefsForGenNames | Without -compat typedefsForGenNames |
---|---|
typedef struct AlgorithmIdentifier { int idStamp; int returnType; } AlgorithmIdentifier; typedef AlgorithmIdentifier _seq1; typedef struct C { _seq1 signatureAlgorithm; } C; typedef struct C1 { _seq1 signatureAlgorithm; } C1; |
typedef struct AlgorithmIdentifier { int idStamp; int returnType; } AlgorithmIdentifier; typedef struct C { AlgorithmIdentifier signatureAlgorithm; } C; typedef struct C1 { AlgorithmIdentifier signatureAlgorithm; } C1; |
In version 3.6, the ASN.1 compiler gave size constraints precedence over named bit lists when determining the representation of the BIT STRING type. Additionally, an UNBOUNDED structure was generated for the BIT STRING by default. In versions prior to 3.6 and after 3.6, the named bit list takes precedence over the size constraint if both are specified with the BIT STRING type. Also, an UNBOUNDED structure is not always generated.
The -compat undbndBit option provides compatibility with version 3.6.
NOTE: Starting with version 6.0 of the ASN.1/C compiler, BIT STRING types are represented the same as in version 3.6, therefore this flag is not needed.
ASN.1
Module DEFINITIONS ::= BEGIN AccessLevel1 ::= BIT STRING {guest(1), user(2), superuser(3)} (SIZE (10)) END
With -compat undbndBit (SizeConstraint used) | Without -compat undbndBit specified (SizeConstraint disregarded) |
---|---|
typedef struct AccessLevel1 { unsigned short length; /* number of significant bits */ unsigned char *value; } AccessLevel1; #define guest 0x40 #define guest_byte 0 #define user 0x20 #define user_byte 0 #define superuser 0x10 #define superuser_byte 0 |
typedef unsigned short AccessLevel1; #define guest 0x4000 #define user 0x2000 #define superuser 0x1000 |
NOTE: The Draft of the International Standard (DIS) of ASN.1:1994 states that size constraints must have precedence over named bit lists when applied to the BIT STRING type. However, the actual International Standard (IS) of ASN.1:1994 reverted to the ASN.1:1990 decision of letting the named bit list have precedence over the size constraint, in such a case.
Alias -compat 7.
Prior to version 5.0, the ASN.1 compiler generated unnamed structures for SEQUENCE and SET types defined with CONSTRAINED BY nested within SEQUENCE OF and SET OF types marked with an OSS.LINKED, OSS.DLINKED, or OSS.ARRAY directive (this scenario resulted in the generation of an unnamed_type in the constraint function prototypes when the -userConstraints option was specified). Starting with version 5.0, such unnamed structures are no longer generated.
The -compat unnamedStructForConstrBy flag restores the previous behavior.
ASN.1
Module DEFINITIONS ::= BEGIN DataPacket ::= SEQUENCE { oddNumber SET --<ARRAY>-- (SIZE(10)) OF SET { evenOrOdd INTEGER } (CONSTRAINED BY {--Must be odd--}) } END
With -compat unnamedStructForConstrBy | Without -compat unnamedStructForConstrBy |
---|---|
typedef struct DataPacket { struct { unsigned short count; struct { int evenOrOdd; } value[10]; } oddNumber; } DataPacket; /* _cnstr_by1_fn is user-defined constraint function for ASN.1 * item Module.DataPacket.oddNumber.* */ extern int DLL_ENTRY _cnstr_by1_fn(struct ossGlobal *, unknown_type *, void **); |
typedef struct DataPacket { struct { unsigned short count; struct _set1 { int evenOrOdd; } value[10]; } oddNumber; } DataPacket; /* _set1_fn is user-defined constraint function for ASN.1 item * Module.DataPacket.oddNumber.* */ extern int DLL_ENTRY _set1_fn(struct ossGlobal *, struct _set1 *, void **); |
Starting with version 8.6, the ASN.1 compiler no longer generates representations for BIT STRINGs with named bits that have values that exceed SHRT_MAX and are less than USHRT_MAX (which might have caused problems with runtimes that access the values of those named bits).
The -compat useUShortForBitStringsWithNamedBits option restores the previous behavior.
ASN.1
Mod DEFINITIONS ::= BEGIN B ::= BIT STRING {bit(65534)} (SIZE(1..65535)) END
Without the -compat useUShortForBitStringsWithNamedBits | With the -compat useUShortForBitStringsWithNamedBits |
---|---|
typedef struct B { unsigned int length; /* number of significant bits */ unsigned char *value; } B; #define bit 0x02 #define bit_byte 8191 |
typedef struct B { unsigned short length; /* number of significant bits */ unsigned char *value; } B; #define bit 0x02 #define bit_byte 8191 |
Provides compatibility with version 2.0 of the ASN.1 compiler.
The v2.0 flag is equivalent to the following flags: noSharedTypes, intEnums, nestUnions, noULength, noUInt, padded, noDefaultValues, noBTypeValues, badExternalPrefix, badLengthDirectives, and v4.0.
Provides compatibility with version 3.0 of the ASN.1 compiler.
The v3.0 flag is equivalent to the -compat v2.0 flag.
Provides compatibility with version 3.5 of the ASN.1 compiler.
The v3.5 flag is equivalent to the following flags: noSharedTypes, intEnums, nestUnions, noULength, noUInt, padded, badExternalPrefix, badUnderscorePrefix, badLengthDirectives, and v4.0.
Provides compatibility with version 3.6 of the ASN.1 compiler.
The v3.6 flag is equivalent to the following flags: nestUnions, noULength, noUInt, padded, unbndBit, badUnderscorePrefix, badLengthDirectives, and v4.0.
Provides compatibility with version 4.0 of the ASN.1 compiler.
The v4.0 flag is the equivalent of the following flags: badValuePrefix, oldBooleanType, badNameConflicts, and v4.1.0.
Provides compatibility with version 4.1.0 of the ASN.1 compiler.
The v4.1.0 flag is equivalent to the following flags: extraLink and v4.1.6.
Starting with version 4.2, a more aggressive type sharing optimization is used.
The -compat v4.1typesharing flag provides compatibility with version 4.2.
These options provide compatibility with their respective version numbers.
These options are equivalent to the extSizeNotUnbounded and v4.1.9 flags.
Starting with version 4.2, the ASN.1 compiler no longer generates unneeded typedefs for complex user-defined types marked with an OSS.ENCODABLE directive. The -compat v4.1.6encodable flag restores the previous behavior.
ASN.1
Module DEFINITIONS ::= BEGIN Certificate ::= [0] SEQUENCE { signedData CertificateInfo --<ENCODABLE>--, signature BIT STRING } CertificateInfo ::= [1] SEQUENCE { version IA5String, serialNumber INTEGER } END
With -compat v4.1.6encodable | Without -compat v4.1.6encodable |
---|---|
#define Certificate_PDU 1 #define Certificate_signedData_encodable_PDU 2 typedef struct Certificate { OpenType signedData; /* Certificate_signedData_encodable * type */ struct { unsigned int length; /* number of significant bits */ unsigned char *value; } signature; } Certificate; typedef struct CertificateInfo { char *version; int serialNumber; } CertificateInfo; typedef CertificateInfo Certificate_signedData_encodable; |
#define Certificate_PDU 1 #define CertificateInfo_PDU 2 typedef struct Certificate { OpenType signedData; /* CertificateInfo type */ struct { unsigned int length; /* number of significant bits */ unsigned char *value; } signature; } Certificate; typedef struct CertificateInfo { char *version; int serialNumber; } CertificateInfo; |
Starting with version 4.2, the ASN.1 compiler no longer generates a double pointer ("**") to represent a circular reference to a SEQUENCE OF or SET OF type that has a size constraint and uses the LINKED representation (due to a global OSS.LINKED directive). A single pointer is used for such a type. The -compat v4.1.6extraLinkedSETOFPtr flag restores the previous behavior.
ASN.1
--<OSS.LINKED SET OF>-- Circle DEFINITIONS --<PDU>-- ::= BEGIN Circ ::= SET (SIZE(10)) OF SEQUENCE {b Circ} END
With -compat v4.1.6extraLinkedSETOFPtr | Without -compat v4.1.6extraLinkedSETOFPtr |
---|---|
typedef struct Circ { struct Circ *next; struct { struct Circ **b; } value; } *Circ; |
typedef struct Circ { struct Circ *next; struct { struct Circ *b; } value; } *Circ; |
Provides compatibility with version 4.1.9 of the ASN.1 compiler.
The v4.1.9 flag is equivalent to the following flags: multipleUserFunctions, noUserConstraintPDUs, v4.1typesharing, extraNameShortening, v4.1.6encodable, noOssterm, v4.2.5typesharing, and v4.2.6.
Provides compatibility with version 4.2.0 of the ASN.1 compiler.
In version 4.2.5, the ASN.1 compiler used a different type sharing optimization than in later versions.
The -compat v4.2.5typesharing flag provides compatibility with version 4.2.5.
Provides compatibility with version 4.2.6 of the ASN.1 compiler.
The v4.2.6 flag is equivalent to the following flags: noDecoupledNames, terseComments, extensionWithMask, oldExternObjHdl, oldObjectNames, v4.2defaults, unnamedStructForConstrBy, noMacroArgumentPDUs, noPDUsForImports, v4.2objhandleCstrPointer, v4.2namesforopentypes, decoderUpdatesInputAddress, oldParamTypesharing, and v5.0.0.
In version 4.2, the ASN.1 compiler incorrectly gave precedence to the earlier of two or more mutually exclusive global directives applied to SET OF or SEQUENCE OF types. Starting with version 5.0.4, the last mutually exclusive global directive specified is given precedence in conformity with how the rest of the mutually exclusive OSS global directives are handled.
The -compat v4.2badSetOfWithGlobalDir flag provides compatibility with version 4.2.
Note that this flag is not included in any v4.2.x or v5.0.x compat flags.
ASN.1
--<OSS.UNBOUNDED SEQUENCE OF>-- --<OSS.ARRAY SEQUENCE OF>-- Module DEFINITIONS ::= BEGIN Seq ::= SEQUENCE { a SEQUENCE OF INTEGER OPTIONAL } END
With -compat v4.2badSetOfWithGlobalDir | Without -compat v4.2badSetOfWithGlobalDir |
---|---|
typedef struct Seq { struct _seqof1 { unsigned int count; int *value; } *a; /* NULL for not present */ } Seq; |
typedef struct Seq { struct _seqof1 { unsigned int count; int value[1]; /* first element of the array */ } *a; /* NULL for not present */ } Seq; |
In version 4.2, the ASN.1 compiler prefixed internal names (such as the value field in UNBOUNDED structures) with an underscore when a user-defined name was found to be the same as these internal names. Starting with version 5.0.1, these internal names are no longer prefixed with an underscore when some user-defined variable has a name that is the same as an internal name (count, next, length, prev, value, etc.).
The -compat v4.2badUnderscorePrefix flag restores the previous behavior.
ASN.1
Module DEFINITIONS ::= BEGIN YourOctStr ::= OCTET STRING MyOctStr ::= OCTET STRING value MyOctStr ::= 'FF'H length INTEGER ::= 10 END
With -compat v4.2badUnderscorePrefix | Without -compat v4.2badUnderscorePrefix |
---|---|
typedef struct YourOctStr { unsigned int _length; unsigned char *_value; } YourOctStr; typedef struct MyOctStr { unsigned int _length; unsigned char *_value; } MyOctStr; extern MyOctStr value; extern int length; |
typedef struct YourOctStr { unsigned int length; unsigned char *value; } YourOctStr; typedef struct MyOctStr { unsigned int length; unsigned char *value; } MyOctStr; extern MyOctStr value; extern int length; |
Instructs the ASN.1 compiler to use the default representation schema present in version 4.2 of the ASN.1 compiler. For example in version 4.2, the default representation of SEQUENCE OF and SET OF types with size constraints was ARRAY not LINKED (as is in version 5.0).
The -compat v4.2defaults flag restores the previous behavior.
ASN.1
Mod DEFINITIONS ::= BEGIN MySet ::= SET (SIZE(5)) OF INTEGER YourSeq ::= SEQUENCE (SIZE (5)) OF INTEGER END
With -compat v4.2defaults | Without -compat v4.2defaults |
---|---|
typedef struct MySet { unsigned short count; int value[5]; } MySet; typedef struct YourSeq { unsigned short count; int value[5]; } YourSeq; |
typedef struct MySet { struct MySet *next; int value; } *MySet; typedef struct YourSeq { struct YourSeq *next; int value; } *YourSeq; |
In version 4.2.x, when ASN1.DeferDecoding, OSS.ENCODABLE, or a component relation constraint was specified for a type, the affected type had its name replaced with a name of the form: Type_builtInTypeName_encodable in its generated typedef. builtInTypeName was the name of an ASN.1 built-in type in lowercase letters. Starting with version 5.0, the suffix _encodable is added.
ASN.1
--<ASN1.DeferDecoding Module.Type.setComponent>-- Module DEFINITIONS ::= BEGIN Type ::= SET { setComponent INTEGER, b BOOLEAN } END
With -compat v4.2namesForOpenTypes | Without -compat v4.2namesForOpenTypes |
---|---|
#define Type_PDU 1 #define Type_integer_encodable_PDU 2 typedef struct Type { OpenType setComponent; /* Type_integer_encodable * type */ ossBoolean b; } Type; typedef int Type_integer_encodable; |
#define Type_PDU 1 #define Type_setComponent_encodable_PDU 2 typedef struct Type { OpenType setComponent; /* Type_setComponent_encodable type */ ossBoolean b; } Type; typedef int Type_setComponent_encodable; |
Starting with version 5.0.5, the ASN.1 compiler no longer applies the ASN1.Nickname and OSS.TYPENAME directives to parameters of parameterized types and other types referenced by parmaterized types. The -compat v4.2nicknames flag restores the previous behavior.
NOTE: Starting with version 5.2.1 of the ASN.1/C compiler, this option has no effect unless the -compat v5.2noextraparamref flag is also specified.
ASN.1
--<ASN1.Nickname Mod.CA "MyCa">-- Mod DEFINITIONS ::= BEGIN CA ::= SET OF INTEGER Param {Type} ::= CA P1 ::= Param {INTEGER} P2 ::= Param {BOOLEAN} END
With -compat v4.2nicknames and -compat v4.2.0 | Without -compat v4.2nicknames and -compat v4.2.0 |
---|---|
#define MyCa_PDU 1 #define MyCa_PDU 2 typedef struct MyCa { struct MyCa *next; int value; } *MyCa; typedef struct MyCa *MyCa; typedef struct MyCa *MyCa; |
#define P1_PDU 1 #define P2_PDU 2 typedef struct MyCa { struct MyCa *next; int value; } *MyCa; typedef struct MyCa *Param; typedef struct MyCa *P1; typedef struct MyCa *P2; |
Starting with version 5.0, the ASN.1 compiler no longer generates pointered structures for character string types specified with the OBJHANDLE | NOCOPY directive. The -compat v4.2objHandleCstrPointer flag restores the previous behavior.
ASN.1
Module DEFINITIONS ::= BEGIN StringA ::= IA5String --<OBJHANDLE>-- END
With -compat v4.2objHandleCstrPointer | Without -compat v4.2objHandleCstrPointer |
---|---|
typedef struct StringA { unsigned int length; char *value; } *StringA; |
typedef struct StringA { unsigned int length; char *value; } StringA; |
In version 4.2, the ASN.1 compiler used the VARYING representation for OCTET STRING types with a size constraint larger than 256. Starting with version 5.0.1, such OCTET STRING types take on the UNBOUNDED representation.
The -compat v4.2octetStringDefault flag provides compatibility with version 4.2.
ASN.1
Module DEFINITIONS ::= BEGIN StringA ::= IA5String --<OBJHANDLE>-- END
With -compat v4.2octetStringDefault | Without -compat v4.2octetStringDefault |
---|---|
typedef struct DefaultOctetString { unsigned short length; unsigned char value[300]; } DefaultOctetString; |
typedef struct DefaultOctetString { unsigned short length; unsigned char *value; } DefaultOctetString; |
Provides compatibility with version 5.0.0 of the ASN.1 compiler.
The v5.0.0 flag is equivalent to the following flags: oldInternalDefineNames, v4.2badUnderScorePrefix, v5.0.0namesPrefixes, v5.0.0badNamesForNamedItems, and v5.0.1.
In version 5.0.0, the ASN.1 compiler interpreted the ASN1.Nickname directive as having a general effect when used on a named number (for an INTEGER type), named bit (for a BIT STRING type), or named enumerator (for an ENUMERATED type) nested in a component of a parameterized type. In other words, applying the ASN1.Nickname directive to an instance of a parameterized type to change the name of a named item in a nested INTEGER, BIT STRING, or ENUMERATED type caused the changing of this name in all other instance of this parameterized type. Starting with version 5.0.1, the ASN1.Nickname directive affects only the parameterized type instance that it is applied to.
The -compat v5.0.0badNamesForNamedItems provides compatibility with version 5.0.0.
ASN.1
--<ASN1.Nickname Mod.SearchArgument.signed.subset.baseObjectInt -- nicknamed_baseObjectInt>-- Mod DEFINITIONS ::= BEGIN SearchArgument ::= Param {SET { subset [1] INTEGER { baseObjectInt(0), oneLevelInt(1)} DEFAULT baseObjectInt }} --<PDU>-- Param {Type} ::= SET { signed [1] Type, unsigned [2] Type, a [3] Type } END
With -compat v5.0.0badNamesForNamedItems | Without -compat v5.0.0badNamesForNamedItems |
---|---|
typedef struct _set1 { unsigned char bit_mask; # define subset_present 0x80 int subset; /* subset_present not set in bit_mask implies value * is baseObjectInt */ # define nicknamed_baseObjectInt 0 # define oneLevelInt 1 # define nicknamed_baseObjectInt 0 # define Mod_Param_signed_subset_oneLevelInt_1 1 # define nicknamed_baseObjectInt 0 # define Mod_Param_signed_subset_oneLevelInt_2 1 } _set1; typedef struct Param { _set1 Param_signed; _set1 Param_unsigned; _set1 a; } Param; typedef Param SearchArgument; |
typedef struct _set1 { unsigned char bit_mask; # define subset_present 0x80 int subset; /* subset_present not set in bit_mask implies value * is baseObjectInt */ # define nicknamed_baseObjectInt 0 # define oneLevelInt 1 # define Mod_Param_signed_subset_baseObjectInt_1 0 # define Mod_Param_signed_subset_oneLevelInt_1 1 # define Mod_Param_signed_subset_baseObjectInt_2 0 # define Mod_Param_signed_subset_oneLevelInt_2 1 } _set1; typedef struct Param { _set1 Param_signed; _set1 Param_unsigned; _set1 a; } Param; typedef Param SearchArgument; |
In version 5.0.0, the ASN.1 compiler unnecessarily prefixed module names to #define statements with a _chosen and _present suffix when an OSS.TYPENAME directive was used to rename a CHOICE alternative or an OPTIONAL field. Starting with version 5.0.1, such prefixing is no longer done.
The -compat v5.0.0namesPrefixes disables the behavior introduced in version 5.0.1 and provides compatibility with previous versions.
ASN.1
--<OSS.TYPENAME SNI-Extensions.AA.unsigned "AA_unsigned">-- SNI-Extensions DEFINITIONS ::= BEGIN AA ::= CHOICE { unsigned SET OF INTEGER } END
With -compat v5.0.0namesPrefixes | Without -compat v5.0.0namesPrefixes |
---|---|
typedef struct AA { unsigned short choice; # define SNI_Extensions_AA_unsigned_chosen 1 union { struct AA_unsigned { struct AA_unsigned *next; int value; } *AA_unsigned; /* to choose, set choice to * SNI_Extensions_AA_unsigned_chosen */ } u; } AA; |
typedef struct AA { unsigned short choice; # define AA_unsigned_chosen 1 union { struct AA_unsigned { struct AA_unsigned *next; int value; } *AA_unsigned; /* to choose, set choice to AA_unsigned_chosen */ } u; } AA; |
Starting with version 5.0.5, the ASN1.Nickname and OSS.TYPENAME directives affect certain parameterized types. The -compat v5.0.0nicknames flag restores the previous behavior and the directives will be ignored for such types.
NOTE: Starting with version 5.2.1 of the ASN.1/C compiler, this flag has no effect unless the -compat v5.2noextraparamref flag is also specified.
ASN.1
--<ASN1.Nickname Mod.CA "MyCa">-- Mod DEFINITIONS ::= BEGIN CA ::= SET OF INTEGER Param {Type} ::= CA P1 ::= Param {INTEGER} P2 ::= Param {BOOLEAN} END
With -compat v5.0.0nicknames and -compat v5.0.4 | Without -compat v5.0.0nicknames or -compat v5.0.4 |
---|---|
#define P1_PDU 1 #define P2_PDU 2 typedef struct CA { struct CA *next; int value; } *CA; typedef struct CA *P1; typedef struct CA *P2; |
#define P1_PDU 1 #define P2_PDU 2 typedef struct MyCa { struct MyCa *next; int value; } *MyCa; typedef struct MyCa *Param; typedef struct MyCa *P1; typedef struct MyCa *P2; |
Provides compatibility with version 5.0.1 of the ASN.1 compiler.
The v5.0.1 flag is equivalent to the v4.2octetStringDefault and v5.0.4 compat options.
Provides compatibility with version 5.0.4 of the ASN.1 compiler.
The v5.0.4 flag is equivalent to the following flags: badSetOfOidWithPointer, v5.0.0nicknames, v5.0.6.
Provides compatibility with version 5.0.6 of the ASN.1 compiler.
The v5.0.6 flag is equivalent to the oldEncodableNames flag.
In version 5.1, the ASN.1 compiler allowed an OSS.POINTER directive to be applied to linked SET OF or SEQUENCE OF types even when they circularly referenced each other. Starting with version 5.2, the ASN.1 compiler does not allow an OSS.POINTER directive to be applied to SET OF or SEQUENCE OF types in such cases.
The -compat v5.1extraPointer option disables the behavior introduced in version 5.2 and provides compatibility with version 5.1.
In version 5.1, the ASN.1 compiler produced the most general representation for restricted character types, BIT STRING, OCTET STRING, and INTEGER types with parameterized size or range subtype constraints. Subsequent versions of the ASN.1 compiler generate an UNBOUNDED representation for such restricted character strings, BIT STRING, and OCTET STRING types, and an appropriate int representation for INTEGER types.
The -compat v5.1parameterizedTypes flag provides compatibility with version 5.1.
In version 5.1, the ASN.1 compiler used a different algorithm to perform type sharing for parameterized types. Subsequent versions of the ASN.1 compiler use a slightly different algorithm in certain rare cases.
The -compat v5.1typesharing flag provides compatibility with version 5.1.
Starting with version 5.2, the ASN.1 compiler no longer generates inline types for unnamed structures within CONSTRAINED BY clauses when the -C++ and -userConstraints options are both specified. Starting with version 5.2, such unnamed structures are extracted and defined outside of their containing structure. This behavior results in a better and simpler naming scheme for parameterized types in the generated user-defined constraint checking functions. The -compat v5.1unnamedStructForConstrBy flag restores the previous behavior.
-compat v5.1unnamedStructForConstrBy
Provides compatibility with version 5.1.0 of the ASN.1 compiler.
The v5.1.0 flag is equivalent to the following flags: noParamTypesharing, v5.1extraPointer, v5.1typesharing, v5.1parameterizedTypes, and v5.1.3.
Provides compatibility with version 5.1.3 of the ASN.1 compiler.
The v5.1.3 flag is equivalent to the following flags: oldSharingFieldsWithDirectives, v5.1unnamedStructForConstrBy, and v5.1.4.
Provides compatibility with version 5.1.4 of the ASN.1 compiler.
The v5.1.4 flag is equivalent to the following flags: badRefNames, noParamTypeSharing, v5.1parameterizedtypes, v5.1typesharing, v5.1unnamedStructForConstrBy, and v5.2.0.
In version 5.2, the ASN.1 compiler incorrectly handled types with an OSS.UseThis directive applied when they were defined as references to other types. Starting with version 5.3.0, such nested applications of a OSS.UseThis directive are now correctly handled.
The -compat v5.2nestedUsethisTypes flag provides compatibility with version 5.2.
ASN.1
--<OSS.UseThis Mod.B Mod.A>-- Mod DEFINITIONS ::= BEGIN A ::= SEQUENCE OF INTEGER B ::= BB BB ::= SET (SIZE(1..20)) OF INTEGER C ::= CHOICE { a B} END
With -compat v5.2nestedUsethisTypes | Without -compat v5.2nestedUsethisTypes |
---|---|
typedef struct A { struct A *next; int value; } *A; typedef struct BB { struct BB *next; int value; } *BB; typedef struct C { unsigned short choice; # define a_chosen 1 union { struct BB *a; /* to choose, set choice to a_chosen */ } u; } C; |
typedef struct A { struct A *next; int value; } *A; typedef struct BB { struct BB *next; int value; } *BB; typedef struct C { unsigned short choice; # define a_chosen 1 union { struct A *a; /* to choose, set choice to a_chosen */ } u; } C; |
Starting with version 5.3.0, a separate typedef is generated for an ASN.1 type referenced by a parameterized type.
The -compat v5.2noExtraParamRef flag provides compatibility with version 5.2. The ASN.1 compiler will not generate a separate typedef.
ASN.1
Mod DEFINITIONS ::= BEGIN MyType ::= IA5String P {Type} ::= MyType (CONSTRAINED BY {Type}) P1 ::= SET OF P {INTEGER (1..2)} P2 ::= CHOICE { a P {INTEGER (20..22)}} END
With -compat v5.2noExtraParamRef | Without -compat v5.2noExtraParamRef |
---|---|
typedef char *MyType; typedef struct P1 { struct P1 *next; MyType value; } *P1; typedef struct P2 { unsigned short choice; # define a_chosen 1 union { MyType a; /* to choose, set choice to a_chosen */ } u; } P2; typedef unsigned short P1_integer; typedef unsigned short P2_integer; |
typedef char *MyType; typedef MyType P; typedef struct P1 { struct P1 *next; P value; } *P1; typedef struct P2 { unsigned short choice; # define a_chosen 1 union { P a; /* to choose, set choice to a_chosen */ } u; } P2; typedef unsigned short P1_integer; typedef unsigned short P2_integer; |
In version 5.2, the ASN.1 compiler sometimes incorrectly handled the application of a OSS.TYPENAME and ASN1.Nickname directive on parameterized types; previously, some of the instances of such types were not affected by the directives although they should have been (when they were marked with OSS.ExtractType). Additionally, some parameterized SET OF and SEQUENCE OF structures in some cases received an incorrect C representation (ARRAY instead of LINKED) when they were marked with an OSS.TYPENAME directive. Starting with version 5.3.0, these errors no longer occur.
The -compat v5.2paramNickname flag provides compatibility with version 5.2.
In version 5.2, the ASN.1 compiler produced the long int representation for instances of INTEGER types with dummy parameterized range constraints, even if the instances were of a value that surpassed the capacity of signed long int. Starting with version 5.3.0, the ASN.1 compiler now generates either a signed long int or the LONG_LONG representation for all instances of INTEGER types with dummy parameter range constraints depending upon the size of the largest instance.
The -compat v5.2paramRangeConstraints flag provides compatibility with version 5.2.
In version 5.2, the ASN.1 compiler used a special type sharing algorithm which was replaced by an improved one in version 5.3.0. The following changes have been made:
The -compat v5.2sharing flag provides compatibility with version 5.2.
In version 5.2, certain issues occurred when using a rare type of parameterization for type sharing, which were fixed for version 5.3.0.
The -compat v5.2typesharing flag provides compatibility with version 5.2.
Provides compatibility with version 5.2.0 of the ASN.1 compiler.
The v5.2.0 flag is equivalent to the following flags: charUTF8String, v5.2paramRangeConstraints, v5.2paramNicknames, v5.2sharing, v5.2noExtraParamRef, v5.2nestedUsethisTypes, and v5.2.1.
Provides compatibility with version 5.2.1 of the ASN.1 compiler.
The v5.2.1 flag is equivalent to the following flags: oldnamesmanglingwithprefix, v5.2typesharing, and v5.3.0.
Provides compatibility with version 5.3.0 of the ASN.1 compiler.
Provides compatibility with version 5.3.1. This includes forcing the ASN.1 compiler to print numbers instead of LLONG_MIN, LLONG_MAX, ULLONG_MAX definitions into the .c output file, allowing you to proceed with previous c-header files that do not contain these definitions.
In version 5.4, LONG_LONG was the default representation for INTEGER types with an extensible size constraint. Instead of using the -compat flag, you can also apply the LONGLONG directive or specify constraint boundaries that do not fit within the 4-byte int range, to instruct the compiler to use the LONG_LONG representation.
Provides compatibility with version 5.4.0 of the ASN.1 compiler.
Provides compatibility with version 5.4.2 of the ASN.1 compiler.
Starting with version 5.4.4, the ASN.1 compiler handles INTEGERs marked with a HUGE directive present as a field of a structured type when the -code option is specified. Previously COMPILER ERROR #22 was issued. The -compat noHugeIntegerStructNames or -compat v5.4.4 option restores the previous behavior. Note that these -compat options can cause a compiler error.
Starting with version 5.4.4, the ASN.1 compiler correctly handles CHOICE types present as fields to a CLASS definition when the -code option is specified. The union representing the CHOICE type is defined outside the C struct of the containing CLASS definition. Previously, the C-representation of the field was generated inline within the CLASS type. This could have caused duplication of the manifest constants (used to identify which alternative is contained within the union) if there was a field name conflict. The v5.4typesharing or v5.4.4 -compat flag restores the previous behavior of the ASN.1 compiler.
Provides compatibility with version 6.0.0 of the ASN.1 compiler.
The ASN.1 compiler generates the NULLTERM C-representation for character strings with SIZE constraints defined with the MAX keyword on 64-bit platforms. Starting with version 6.0 the ASN.1 compiler generated different C-representations for such strings on 64-bit and on 32-bit platforms.
For backward compatibility the -compat v6.0stringswithMAXsize flag restores the previous behavior of the ASN.1 compiler on 64-bit platforms.
Starting with version 6.1.4, the ASN.1 compiler no longer generate the same representation for unconstrained BIT STRING type with present named bits and the POINTER and VARYING directives applied as for a constrained BIT STRING with an upper bound of its SIZE constraint equal to the highest named bit plus one. The representation for such BIT STRING types is the same as the one for the unconstrained BIT STRING without named bits.
The -compat v6.1.3varyingbitstring flag restores the previous behavior.
ASN.1
Mod DEFINITIONS ::= BEGIN PVaryNamedBits ::= BIT STRING {b1(1), b12(12)} --<POINTER>-- --<VARYING>-- END
With -compat v6.1.3varyingbitstring | Without -compat v6.1.3varyingbitstring |
---|---|
typedef struct PVaryNamedBits { unsigned short length; /* number of significant bits */ unsigned char value[2]; } *PVaryNamedBits; #define b1 0x40 #define b1_byte 0 #define b12 0x08 #define b12_byte 1 |
typedef struct PVaryNamedBits { unsigned short length; /* number of significant bits */ unsigned char value[1]; /* first element of the array */ } *PVaryNamedBits; #define b1 0x40 #define b1_byte 0 #define b12 0x08 #define b12_byte 1 |
Provides compatibility with version 6.1.3 of the ASN.1 compiler.
Starting with version 7.0, the following changes in name-mangling rules apply:
The -compat v6.1.4DefineNameSharing option can be used to disable the changes mentioned above, providing compatibility with version 6.1.4 or earlier.
ASN.1
Z DEFINITIONS AUTOMATIC TAGS ::= BEGIN A ::= SET { f1 BOOLEAN OPTIONAL } B ::= SET { f1 BOOLEAN OPTIONAL } C ::= SET OF SET { f1 BOOLEAN OPTIONAL } D ::= SET OF SET { f1 BOOLEAN OPTIONAL } E ::= SET { f1 BOOLEAN OPTIONAL, f2 INTEGER } END
Note that B type uses B_f1_present as define name and the shared _seq1 type used by both the C and D types includes the f1_1_present define name.
Also, note that A_f1_present define name is used by the A, B, C, D types.
Without -compat v6.1.4DefineNameSharing | With -compat v6.1.4DefineNameSharing |
---|---|
typedef struct A { unsigned char bit_mask; # define A_f1_present 0x80 ossBoolean f1; /* optional; set in bit_mask A_f1_present if present */ } A; typedef struct B { unsigned char bit_mask; # define B_f1_present 0x80 ossBoolean f1; /* optional; set in bit_mask B_f1_present if present */ } B; typedef struct _set1 { unsigned char bit_mask; # define f1_1_present 0x80 ossBoolean f1; /* optional; set in bit_mask f1_1_present if present */ } _set1; typedef struct C { struct C *next; _set1 value; } *C; typedef struct D { struct D *next; _set1 value; } *D; typedef struct E { unsigned char bit_mask; # define E_f1_present 0x80 ossBoolean f1; /* optional; set in bit_mask E_f1_present if present */ int f2; } E; |
typedef struct A { unsigned char bit_mask; # define A_f1_present 0x80 ossBoolean f1; /* optional; set in bit_mask A_f1_present if present */ } A; typedef struct B { unsigned char bit_mask; # define A_f1_present 0x80 ossBoolean f1; /* optional; set in bit_mask A_f1_present if present */ } B; typedef struct _set1 { unsigned char bit_mask; # define A_f1_present 0x80 ossBoolean f1; /* optional; set in bit_mask A_f1_present if present */ } _set1; typedef struct C { struct C *next; _set1 value; } *C; typedef struct D { struct D *next; _set1 value; } *D; typedef struct E { unsigned char bit_mask; # define E_f1_present 0x80 ossBoolean f1; /* optional; set in bit_mask E_f1_present if present */ int f2; } E; |
The ASN.1 compiler no longer applies an additional POINTER directive to fields of a SEQUENCE, SET, or CHOICE type when the field types are recursive and circularly reference themselves via a certain SEQUENCE OF or SET OF type and when one of the following conditions occurs:
Previously, in the cases described above, the ASN.1 compiler internally applied an additional POINTER directive to recursive components of SEQUENCE, SET, or CHOICE types, causing, in the first case, the components to be double-pointered. Now, such recursive components do not receive an additional pointer.
This behavior is present in versions 6.1.2 to 6.1.4 and 7.0BetaA of the ASN.1/C compiler. The -compat v6.1.4extrapointer compat flag restores the previous behavior of the ASN.1 Compiler.
When the -lean option was introduced in 5.1, the compiler produced references to named simple types incorrectly, using the LED built-in type name (such as ossOctetString) instead of a user-defined type name. Also, if the referenced type is a BIT STRING with a named bit list, #defines for the named bits are no longer duplicated in the output header file.
The -compat v6.1.4ReferencesToLeanTypes flag provides compatibility with version 6.1.4.
ASN.1
B ::= BIT STRING { b0(0) } Name ::= SEQUENCE { bit B }
With -compat v6.1.4ReferencesToLeanTypes | Without -compat v6.1.4ReferencesToLeanTypes |
---|---|
typedef ossBitString B; #define b0 0x80 #define b0_byte 0 typedef struct Name { ossBitString bit; # define b0 0x80 # define b0_byte 0 } Name; |
typedef ossBitString B; #define b0 0x80 #define b0_byte 0 typedef struct Name { B bit; } Name; |
Provides compatibility with version 6.1.4 of the ASN.1 compiler.
Starting with version 8.2.0, the -compat v7.0DefineNames flag restores the names generated in certain #define. In prior 8 versions of the compiler, such names were qualified with top-level types names.
Starting with version 7.0.2 the ASN.1 compiler no longer generates a separate PDU for every built-in type used in an information object set. The -compat v7.0pdusForBuiltinTypesInObjectSet flag restores the previous behavior.
ASN.1
KEY-IDENTIFIER ::= CLASS { &id INTEGER UNIQUE, &Value } WITH SYNTAX { SYNTAX &Value IDENTIFIED BY &id } KeyIdentifiers KEY-IDENTIFIER ::= { {SYNTAX OCTET STRING IDENTIFIED BY 2} | {SYNTAX OCTET STRING IDENTIFIED BY 3} } TestType ::= SEQUENCE { identifier SEQUENCE { idType KEY-IDENTIFIER.&id ({KeyIdentifiers}), idValue KEY-IDENTIFIER.&Value ({KeyIdentifiers}{@.idType}) } }
With -compat v7.0pdusForBuiltinTypesinObjectSet | Without -compat v7.0.1pdusForBuiltinTypesinObjectSet |
---|---|
#define TestType_PDU 1 #define M_KeyIdentifiers_SYNTAX_1_PDU 2 #define M_KeyIdentifiers_SYNTAX_2_PDU 3 #define KeyIdentifiers_OSET 1 /* Class is KEY-IDENTIFIER */ typedef struct KEY_IDENTIFIER { int id; unsigned short Value; } KEY_IDENTIFIER; typedef struct M_KeyIdentifiers_SYNTAX_1 { unsigned int length; unsigned char *value; } M_KeyIdentifiers_SYNTAX_1; typedef M_KeyIdentifiers_SYNTAX_1 M_KeyIdentifiers_SYNTAX_2; enum KeyIdentifiers_Value_PDUs { PDU_KeyIdentifiers_Value_UNKNOWN = 0, PDU_KeyIdentifiers_Value_SYNTAX_1 = M_KeyIdentifiers_SYNTAX_1_PDU, PDU_KeyIdentifiers_Value_SYNTAX_2 = M_KeyIdentifiers_SYNTAX_2_PDU }; union KeyIdentifiers_Value_union { M_KeyIdentifiers_SYNTAX_1 *pdu_KeyIdentifiers_SYNTAX_1; /* PDU_KeyIdentifiers_Value_SYNTAX_1 */ M_KeyIdentifiers_SYNTAX_1 *pdu_KeyIdentifiers_SYNTAX_2; /* PDU_KeyIdentifiers_Value_SYNTAX_2 */ }; typedef struct KeyIdentifiers_Value { enum KeyIdentifiers_Value_PDUs pduNum; OssBuf encoded; union KeyIdentifiers_Value_union decoded; } KeyIdentifiers_Value; typedef struct TestType { struct { int idType; KeyIdentifiers_Value idValue; } identifier; } TestType; |
define TestType_PDU 1 #define KeyIdentifiers_SYNTAX_PDU 2 #define KeyIdentifiers_OSET 1 /* Class is KEY-IDENTIFIER */ typedef struct KEY_IDENTIFIER { int id; unsigned short Value; } KEY_IDENTIFIER; typedef struct KeyIdentifiers_SYNTAX { unsigned int length; unsigned char *value; } KeyIdentifiers_SYNTAX; enum KeyIdentifiers_Value_PDUs { PDU_KeyIdentifiers_Value_UNKNOWN = 0, PDU_KeyIdentifiers_Value_SYNTAX = KeyIdentifiers_SYNTAX_PDU }; union KeyIdentifiers_Value_union { KeyIdentifiers_SYNTAX *pdu_KeyIdentifiers_SYNTAX; /* PDU_KeyIdentifiers_Value_SYNTAX */ }; typedef struct KeyIdentifiers_Value { enum KeyIdentifiers_Value_PDUs pduNum; OssBuf encoded; union KeyIdentifiers_Value_union decoded; } KeyIdentifiers_Value; typedef struct TestType { struct { int idType; KeyIdentifiers_Value idValue; } identifier; } TestType; |
Prior to version 5.1, the compiler did not share structures generated for OCTET STRING types with structures generated for BIT STRING types, even if both had the same representation. However, structures which included fields of such types could share the same C structure even if one structure contained a field of an OCTET STRING type and the other structure contained a field of a BIT STRING type.
Starting with version 7.0.2 the compiler shares structures generated for these fields as well. That is, a field of an OCTET STRING type shares the structure generated for a field of a BIT STRING type if the outer structures containing these fields share the same generated type. However, when the -lean command line option is specified, no structures are generated for OCTET STRING, BIT STRING and character string types. The structures ossOctetString, ossBitString and ossCharString, predefined in the ossasn1.h header file, are used instead. When -lean is specified, the compiler does not share a generated structure between two types with the same binary representation if one of the types contains a field of an OCTET STRING type (generated as ossOctetString) and another type contains a respective field of a BIT STRING (or a character string) type.
In the following example, S1.a and S2.a have the same C representation only if the -lean option is not specified.
ASN.1
a SEQUENCE OF OCTET STRING } S2 ::= SET { a SEQUENCE OF BIT STRING, b BIT STRING }
When the ASN.1 Compiler generates structures for SOED or TOED, the fields S1.a and S2.a share the same generated structure, _seqof1. The generated type _octet1 is shared between S1.a.*, S2.a.* and S2.b:
/* no compiler options specified */ typedef struct _octet1 { unsigned int length; unsigned char *value; } _octet1; typedef struct _seqof1 { struct _seqof1 *next; _octet1 value; } *_seqof1; typedef struct S1 { struct _seqof1 *a; } S1; typedef struct S2 { struct _seqof1 *a; _octet1 b; } S2;
The -compat v7.0typeSharing flag, the ASN.1 compiler does not share structures generated for S1.a.*, S2.a.* and S2.b. However, the compiler shares structures generated for S1.a and S2.a, and for the following example no _octet1 type definition will be generated:
/* options specified: -compat v7.0typeSharing */ typedef struct _seqof1 { struct _seqof1 *next; struct { unsigned int length; unsigned char *value; } value; } *_seqof1; typedef struct S1 { struct _seqof1 *a; } S1; typedef struct _bit1 { unsigned int length; /* number of significant bits */ unsigned char *value; } _bit1; typedef struct S2 { struct _seqof1 *a; _bit1 b; } S2;
This compatibility parameter may be useful only to revert to the previous enumeration of artificially generated names like _octet1 and _bit1.
NOTE: Starting with version 8.5.0 of the ASN.1/C compiler, this option has no effect unless the -compat v8.4PrimitiveTypesSharing option is also specified.
When the ASN.1 Compiler generates structures for LED, the structures generated for S1.a and S2.a do not share the same type:
/* options specified: -lean */ typedef struct S1 { struct _seqof1 { struct _seqof1 *next; ossOctetString value; } *a; } S1; typedef struct S2 { struct _seqof2 { struct _seqof2 *next; ossBitString value; } *a; ossBitString b; } S2;
The -compat v7.0typeSharing flag allows sharing of types generated for S1.a and S2.a:
/* options specified: -lean -compat v7.0typeSharing */ typedef struct _seqof1 { struct _seqof1 *next; ossOctetString value; } *_seqof1; typedef struct S1 { struct _seqof1 *a; } S1; typedef struct S2 { struct _seqof1 *a; ossBitString b; } S2;
When -lean is specified, this compatibility parameter may be useful if the application code refers to BIT STRING field S2.a.* using an ossOctetString type as in the following fragment of code:
S2 s2; ossOctetString *field = &(s2.a->value);
Provides compatibility with version 8.0.0 of the ASN.1 compiler.
The v8.0.0 flag is equivalent to the ignore1994ExternalConstr compat flag.
Provides compatibility with version 8.1.0 of the ASN.1 compiler.
The v8.1.0 flag is equivalent to the following compat flags bad1994ExternalWithContentsConstr and noTypeRefWithUseThisSharing.
Starting with version 8.2, the ASN.1 compiler shares identical types with the assigned encoding E-XER instructions. The -compat v8.1.2SharingTypesWithEXERInstruction flag restores the previous behavior.
Provides compatibility with version 8.1.2 of the ASN.1 compiler.
Starting with version 8.2, the ASN.1 compiler no longer changes typedefs generated for parameterized types with shared instances, if certain directives are applied. The same typedef is generated for a parameterized type if all instances of this type can be shared and the OSS.TYPENAME, OSS.ExtractType, OSS.FIELDNAME, or OSS.DefineName directives are applied to certain instances or to the parameterized type itself. The compat flag v8.1.2ParamRefSharingWithDirectives restores the previous behavior.
ASN.1
M DEFINITIONS AUTOMATIC TAGS ::= BEGIN T1 ::= SET { a P1 {BIT STRING} OPTIONAL} T2 ::= SET OF P1 {BIT STRING} P1 {PT} ::= SET OF PT END
typedef struct T1 { unsigned char bit_mask; # define a_present 0x80 struct P1 *a; /* optional; set in bit_mask a_present if present */ } T1; typedef struct T2 { struct T2 *next; struct P1 *value; } *T2; typedef struct P1 { struct P1 *next; struct { unsigned int length; /* number of significant bits */ unsigned char *value; } value; } *P1;
The following directives are added:
--<OSS.TYPENAME M.P1 "P1">-- --<OSS.FIELDNAME M.T1.a "a">--
The compiler now generates the same structure for the parameterized type in the header file as if the compat option was not specified. The previous .h file is generated with -compat v8.1.2ParamRefSharingWithDirectives:
typedef struct _bit1 { unsigned int length; /* number of significant bits */ unsigned char *value; } _bit1; typedef struct P1 { struct P1 *next; _bit1 value; } *P1; typedef struct T1 { unsigned char bit_mask; # define a_present 0x80 struct P1 *a; /* optional; set in bit_mask a_present if present */ } T1; typedef struct T2 { struct T2 *next; struct P1 *value; } *T2;
Provides compatibility with version 8.2.0 of the ASN.1 compiler.
Starting with version 8.3.0, the ASN.1 compiler uses the XML name of a type, instead of its ASN.1 name, to resolve any name conflicts related to the type's components when the -useXmlNames option is specified.
The -compat v8.2.0DefineNamesSharingWhenUsingXmlNames flag restores the previous behavior. The compiler will use the ASN.1 names of types to resolve name conflicts, in certain cases.
NOTE: Starting with version 8.5.0 of the ASN.1/C compiler, this option has no effect unless the compat v8.4TypesSharingWithAutomaticTagging option is also specified.
NOTE: This issue does not occur when using helper mode, that is, when the -helperNames option is explicitly specified or implied.
ASN.1
B1357-2 DEFINITIONS AUTOMATIC TAGS ::= BEGIN A ::= SEQUENCE { s SET { f1 INTEGER OPTIONAL }} B ::= [XER:NAME AS "b-type"] SEQUENCE { s SET { f1 INTEGER OPTIONAL } } C ::= SEQUENCE { s SET { f1 INTEGER OPTIONAL, f2 BOOLEAN OPTIONAL }} END
With both -compat v8.2.0DefineNamesSharingWhenUsingXmlNames and useXmlNames | Without -compat v8.2.0DefineNamesSharingWhenUsingXmlNames and with -useXmlNames |
---|---|
typedef struct b_type { struct { unsigned char bit_mask; # define B_s_f1_present 0x80 int f1; /* optional; set in bit_mask B_s_f1_present if * present */ } s; } b_type; |
typedef struct b_type { struct { unsigned char bit_mask; # define b_type_s_f1_present 0x80 int f1; /* optional; set in bit_mask b_type_s_f1_present if * present */ } s; } b_type; |
The XML name of the B type is used in the b_type_s_f1_present define name.
Provides compatibility with version 8.3.1 of the ASN.1 compiler.
The -compat v8.3.1 flag is equivalent to the -compat ignoreInlineTypeDirForSharedTypes flag.
Provides compatibility with version 8.4.0 of the ASN.1 compiler. This flag does not replace the -compat badSharingForTypesWithInlineTypeDir, the -compat v8.4PrimitiveTypeSharing or the -compat v8.4ExtraTypedefForParamRefWithUseThis flag.
Prior to version 8.5.0, the .gen file that was generated with the -keepNames option could not be used to restore old names for shared instances of parameterized types.
The -compat v8.4DirForInstancesOfParamRef flag, when it is used with the -compat v8.4ExtraTypedefForParamRefWithUseThis option, restores the previous behavior of the compiler.
The following syntax is compiled with -keepNames and with the generated .gen file.
ASN.1
M DEFINITIONS AUTOMATIC TAGS ::= BEGIN PDU-P1 {INTEGER: nVal} ::= SEQUENCE { a INTEGER (nVal) } PDU-P2 {INTEGER: setSz} ::= CHOICE { b SET OF PDU-P1 {setSz} } PDU-1 ::= SET { c PDU-P2 {2} } PDU-2 ::= PDU-P2 {2} END
The following representation is generated:
typedef struct PDU_P1 { unsigned short a; } PDU_P1; typedef struct _setof1 { struct _setof1 *next; PDU_P1 value; } *_setof1; typedef struct PDU_P2 { unsigned short choice; # define b_chosen 1 union { struct _setof1 *b; /* to choose, set choice to b_chosen */ } u; } PDU_P2; typedef struct PDU_1 { PDU_P2 c; } PDU_1; typedef PDU_P2 PDU_2;
Representation with the following additional directives:
--<OSS.TYPENAME M.PDU-P1 "PDU_P1">-- --<OSS.ExtractType M.PDU-P1>-- --<OSS.TYPENAME M.PDU-1 "PDU_1">-- --<OSS.ExtractType M.PDU-1.c>-- --<OSS.UseThis M.PDU-1.c M.PDU-P2>-- --<OSS.TYPENAME M.PDU-1.c.b "_setof1">-- --<OSS.ExtractType M.PDU-1.c.b>-- --<OSS.DefineName M.PDU-1.c.b "b">-- --<OSS.UseThis M.PDU-2 M.PDU-1.c>-- --<OSS.TYPENAME M.PDU-2 "PDU_2">-- --<OSS.ExtractType M.PDU-2.b>-- --<OSS.UseThis M.PDU-2.b M.PDU-1.c.b>-- --<OSS.DefineName M.PDU-2.b "b">-- --<OSS.TYPENAME M.PDU-P1 "PDU_P1">-- --<OSS.TYPENAME M.PDU-1.c "PDU_P2">--
and compat flags for release 8.5.0 or later:
-compat v8.4DirForInstancesOfParamRef -compat v8.4ExtraTypedefForParamRefWithUseThis typedef struct PDU_P1 { unsigned short a; } PDU_P1; typedef struct _setof1 { struct _setof1 *next; PDU_P1 value; } *_setof1; typedef struct M_PDU_P2 { unsigned short choice; # define b_chosen 1 union { struct _setof1 *b; /* to choose, set choice to b_chosen */ } u; } M_PDU_P2; typedef M_PDU_P2 PDU_P2; typedef struct PDU_1 { M_PDU_P2 c; } PDU_1; typedef M_PDU_P2 PDU_2;
Prior to version 8.5.0, the ASN.1 compiler could generate additional unused typedefs for one of the shared instances of a parameterized type. This is a standalone compat flag. The -compat 8.4ExtraTypedefForParamRefWithUseThis option restores the previous behavior.
ASN.1
--<OSS.UseThis M.PDU-2.b M.PDU-1.c.b>-- --<OSS.UseThis M.PDU-1.c M.PDU-P2>-- --<OSS.UseThis M.PDU-2 M.PDU-1.c>-- M DEFINITIONS AUTOMATIC TAGS ::= BEGIN PDU-P1 {INTEGER: nVal} ::= SEQUENCE { a INTEGER (nVal) } PDU-P2 {INTEGER: setSz} ::= CHOICE { b SET OF PDU-P1 {setSz} } PDU-1 ::= SET { c PDU-P2 {2} } PDU-2 ::= PDU-P2 {2} END
Without -compat 8.4ExtraTypedefForParamRefWithUseThis | With -compat 8.4ExtraTypedefForParamRefWithUseThis |
---|---|
typedef struct PDU_P1 { unsigned short a; } PDU_P1; typedef struct _setof1 { struct _setof1 *next; PDU_P1 value; } *_setof1; typedef struct PDU_P2 { unsigned short choice; # define b_chosen 1 union { struct _setof1 *b; /* to choose, set choice to b_chosen */ } u; } PDU_P2; typedef struct PDU_1 { PDU_P2 c; } PDU_1; typedef PDU_P2 PDU_2; |
An extra typedef is added: typedef PDU_P2 _choice2; |
Prior to version 8.5, the ASN.1 compiler incorrectly processed a Union of size constraint and single value subtype constraints. The compiler truncated the type C representation using the upper bound of the size constraint. Starting with version 8.5, the C representation is limited by the size of the single value, if it is greater than the upper bound of the size constraint.
The -compat v8.4InvalidSizeForUnionConstraint option disables the behavior introduced in version 8.5 and provides compatibility with pre-8.5 versions.
ASN.1
X1 DEFINITIONS ::= BEGIN OS ::= OCTET STRING ('010203040506'H | SIZE(4)) END
Without -compat v8.4InvalidSizeForUnionConstraint | With -compat v8.4InvalidSizeForUnionConstraint |
---|---|
typedef struct OS { unsigned short length; unsigned char value[6]; } OS; |
typedef struct OS { unsigned short length; unsigned char value[4]; } OS; |
Prior to version 8.5.0, the ASN.1 compiler could generate additional unneeded typedefs for similar types that appear within other similar types linked by OSS.UseThis directives. The -compat v8.4PrimitiveTypeSharing option is a standalone flag that restores the previous behavior.
ASN.1
--<OSS.TYPENAME M1.T1.a "_seq1">-- --<OSS.ExtractType M1.T1.a>-- --<OSS.TYPENAME M1.T2.a "_seq2">-- --<OSS.ExtractType M1.T2.a>-- --<OSS.ExtractType M1.T2.b>-- --<OSS.UseThis M1.T2.a.f1 M1.T1.a>-- --<OSS.UseThis M1.T2.a.f2 M1.T1.a>-- --<OSS.UseThis M1.T2.b M1.T2.a>-- M1 DEFINITIONS AUTOMATIC TAGS ::= BEGIN T1 ::= CHOICE {a SEQUENCE {} } T2 ::= CHOICE { a SEQUENCE { f1 SEQUENCE {}, f2 SEQUENCE {} }, b SEQUENCE { f1 SEQUENCE {}, f2 SEQUENCE {} } } END
Without -compat v8.4PrimitiveTypeSharing | With -compat v8.4PrimitiveTypeSharing |
---|---|
typedef struct _seq1 { char placeholder; } _seq1; typedef struct T1 { unsigned short choice; # define T1_a_chosen 1 union { _seq1 a; /* to choose, set choice to T1_a_chosen */ } u; } T1; typedef struct _seq2 { _seq1 f1; _seq1 f2; } _seq2; typedef struct T2 { unsigned short choice; # define T2_a_chosen 1 # define b_chosen 2 union { _seq2 a; /* to choose, set choice to T2_a_chosen */ _seq2 b; /* to choose, set choice to b_chosen */ } u; } T2; |
typedef struct _seq1 { char placeholder; } _seq1; typedef struct T1 { unsigned short choice; # define T1_a_chosen 1 union { _seq1 a; /* to choose, set choice to T1_a_chosen */ } u; } T1; typedef struct _seq2 { _seq1 f1; _seq1 f2; } _seq2; typedef struct _seq1_2 { char placeholder; } _seq1_2; typedef struct T2 { unsigned short choice; # define T2_a_chosen 1 # define b_chosen 2 union { _seq2 a; /* to choose, set choice to T2_a_chosen */ _seq2 b; /* to choose, set choice to b_chosen */ } u; } T2; |
Prior to version 8.5.0, the ASN.1 compiler could generate duplicate structures in the header file for similar ASN.1 types that are defined in the module with automatic tagging, instead of sharing such structures.
The -compat v8.4TypesSharingWithAutomaticTagging option restores the previous behavior.
ASN.1
T DEFINITIONS AUTOMATIC TAGS ::= BEGIN Seq1 ::= [1]SEQUENCE { f1 BOOLEAN, f2 CHOICE {a INTEGER, b SET {bf IA5String}}} Seq2 ::= [2]SEQUENCE { f1 BOOLEAN, f2 CHOICE {a INTEGER, b SET {bf IA5String}}} END
Without -compat v8.4TypesSharingWithAutomaticTagging | With -compat v8.4PrimitiveTypeSharing |
---|---|
typedef struct _seq1 { char placeholder; } _seq1; typedef struct T1 { unsigned short choice; # define T1_a_chosen 1 union { _seq1 a; /* to choose, set choice to T1_a_chosen */ } u; } T1; typedef struct _seq2 { _seq1 f1; _seq1 f2; } _seq2; typedef struct T2 { unsigned short choice; # define T2_a_chosen 1 # define b_chosen 2 union { _seq2 a; /* to choose, set choice to T2_a_chosen */ _seq2 b; /* to choose, set choice to b_chosen */ } u; } T2; |
typedef struct _seq1 { char placeholder; } _seq1; typedef struct T1 { unsigned short choice; # define T1_a_chosen 1 union { _seq1 a; /* to choose, set choice to T1_a_chosen */ } u; } T1; typedef struct _seq2 { _seq1 f1; _seq1 f2; } _seq2; typedef struct _seq1_2 { char placeholder; } _seq1_2; typedef struct T2 { unsigned short choice; # define T2_a_chosen 1 # define b_chosen 2 union { _seq2 a; /* to choose, set choice to T2_a_chosen */ _seq2 b; /* to choose, set choice to b_chosen */ } u; } T2; |
Provides compatibility with version 8.5.0 of the ASN.1 compiler.
This flag does not replace the -compat v8.5FalseExtendedConstraintEncoding or the compat v8.5TableConstraintForExtensibleObjectSets flags.
Prior to version 8.6, the OSS PER runtime mishandled extensible SIZE constraints with no upper bound and extensible single value constraints on SEQUENCE or SET OF and OCTET or BIT STRING, for example:
SEQUENCE ({0}, ..., {1,2,3}) OF INTEGER
As a result, the PER encoder sometimes produced invalid encodings and the PER decoder failed to decode those encodings or incorrectly decoded them. Starting with version 8.6, the OSS ASN.1 compiler and the OSS PER runtime correctly handle such specifications.
The -compat v8.5FalseExtendedConstraintEncoding flag restores the previous behavior.
ASN.1
Exts DEFINITIONS::= BEGIN B ::= BIT STRING (SIZE(6..MAX, ...)) value B ::= '11111111'B END
PER encoding with -compat v8.5FalseExtendedConstraintEncoding | PER decoding with -compat v8.5FalseExtendedConstraintEncoding |
---|---|
08FF |
D0081S: End of input reached before message was fully decoded; |
PER encoding without -compat v8.5FalseExtendedConstraintEncoding | PER decoding with -compat v8.5FalseExtendedConstraintEncoding |
---|---|
0008FF |
value B ::= '11111111'B |
Prior to version 8.6, the ASN.1 compiler incorrectly generated a LINKED representation for SET OF and SEQUENCE OF types with extensible size constraints and the DLINKED | DLINKED-PLUS directive applied. Starting with version 8.6, the ASN.1 compiler generates the DLINKED | DLINKED-PLUS representation for such types.
The -compat v8.5DLinkedSeqOfSetOfWithExtSizeConstraint option restores the previous behavior.
ASN.1
M DEFINITIONS::= BEGIN SDEB ::= [2]SEQUENCE (SIZE(6..200, ...)) --<DLINKED-PLUS>-- OF INTEGER END
Without the -compat v8.5DLinkedSeqOfSetOfWithExtSizeConstraint | With the -compat v8.5DLinkedSeqOfSetOfWithExtSizeConstraint |
---|---|
typedef struct SDEB { struct SDEB_node *head; struct SDEB_node *tail; unsigned int count; } SDEB; typedef struct SDEB_node { struct SDEB_node *next; struct SDEB_node *prev; int value; } SDEB_node; |
typedef struct SDEB { struct SDEB *next; int value; } *SDEB; |
Prior to version 8.6, the OSS Constraint Checker mishandled table or component relation constraint violations for extensible object sets. Starting with version 8.6, the OSS ASN.1 compiler and the OSS runtime support X.681 Annex E.2. That is, a constraint violation error is reported if table or component relation constraints are not satisfied for an extensible object set and any of the following conditions is true:
The -compat v8.5TableConstraintForExtensibleObjectSets flag restores the previous behavior.
Prior to version 9.0, the ASN.1 compiler generated a fabricated name for the C-structure representing an element of a SET OF or SEQUENCE OF type when the latter type had no ASN.1 name. Starting with 9.0 the compiler uses the name of the element type for the structure (if available).
The -compat v8.6namesForSetOfAndSeqOfWithNamedElements flag restores the previous behavior.
ASN.1
M DEFINITIONS ::= BEGIN Fox ::= SEQUENCE { foo SEQUENCE OF bar INTEGER } END
With -compat v8.6namesForSetOfAndSeqOfWithNamedElements | Without the -compat v8.6namesForSetOfAndSeqOfWithNamedElements |
---|---|
typedef struct Fox { struct _seqof1 { struct _seqof1 *next; int value; } *foo; } Fox; |
typedef struct Fox { struct bar { struct bar *next; int value; } *foo; } Fox; |
Prior to version 9.0, the OSS ASN.1/C Compiler generated (when -lean was specified) different UTF8String C-representations when wide characters were present in the type values in the input syntax. Starting with version 9.0, the compiler always generates C-representations independently of the values.
The -compat 8.6UTF8StringRepresentation option restores the old incorrect behavior.
ASN.1
MOD DEFINITIONS ::= BEGIN U1b ::= UTF8String u1 U1b ::= {{0,0,3,4}} U4b ::= UTF8String u4 U4b ::= {{0,1,3,4}} END
With -compat 8.6UTF8StringRepresentation | Without -compat 8.6UTF8StringRepresentation |
---|---|
typedef ossCharString U1b; typedef ossUniversalString U4b; |
typedef ossCharString U1b; typedef ossCharString U4b; |
Provides compatibility with version 8.7.0 of the ASN.1 compiler.
Prior to version 9.0, the ASN.1 compiler generated different C representations for BIT STRING types having the size constraint with a MAX upper bound and the PADDED or the VARYING directive applied on 64-bit and 32-bit platforms. Starting with version 9.0, the 64-bit version of the ASN.1 compiler generates the same C representations for those types as on 32-bit platforms.
The -compat v8.7BitStringsWithMAXUpperBound option can be used to restore the previous behavior.
ASN.1
M DEFINITIONS ::= BEGIN BS1 ::= BIT STRING (SIZE(1..MAX)) --<PADDED>-- BS2 ::= BIT STRING (SIZE(1..MAX)) --<VARYING>-- END
With -compat v8.7BitStringsWithMAXUpperBound | Without -compat v8.7BitStringsWithMAXUpperBound |
---|---|
typedef unsigned char BS1[268435456]; typedef struct BS2 { unsigned int length; /* number of significant bits */ unsigned char value[268435456]; } *BS2; |
typedef struct BS1 { unsigned int length; /* number of significant bits */ unsigned char *value; } BS1; typedef struct BS2 { unsigned short length; /* number of significant bits */ unsigned char value[1]; /* first element of the array */ } *BS2; |
Prior to version 9.0, the ASN.1 compiler generated the names SID and small, if present in the ASN.1 specification, without mangling. This led to name conflicts with identifiers in system headers on MS Windows platform. Starting with 9.0 the compiler mangles these names in generated code.
The -compat v8.7reservedWords flag restores the previous behavior.
ASN.1
M DEFINITIONS ::= BEGIN SID ::= SEQUENCE { small INTEGER } END
With -compat v8.7reservedWords | Without the -compat v8.7reservedWords |
---|---|
typedef struct SID { int small; } SID; |
typedef struct M_SID { int SID_small; } M_SID; |
Prior to version 9.0.2, the ASN.1 compiler could generate code code for deeply nested ASN.1 CHOICE types that was uncompilable by the Microsoft Visual C/C++ compiler. This occurred because the nesting level of structures and unions exceeded the MS VC implementation limit of 15. Starting with version 9.0.2, the compiler correctly limits the nesting level of generated inline structures and unions.
The -compat v9.0.0extractionForDeeplyNestedTypes flag restores the previous behavior.
ASN.1
M DEFINITIONS ::= BEGIN C ::= CHOICE { f1 CHOICE { f2 CHOICE { f3 CHOICE { f4 CHOICE { f5 CHOICE { f6 CHOICE { f7 SET { f8 SET { f9 SET { i INTEGER } } } } } } } } } } END
With -compat v9.0.0extractionForDeeplyNestedTypes | Without -compat v9.0.0extractionForDeeplyNestedTypes |
---|---|
typedef struct C { unsigned short choice; # define f1_chosen 1 union { struct _choice6 { unsigned short choice; # define f2_chosen 1 union { struct _choice5 { unsigned short choice; # define f3_chosen 1 union { struct _choice4 { unsigned short choice; # define f4_chosen 1 union { struct _choice3 { unsigned short choice; # define f5_chosen 1 union { struct _choice2 { unsigned short choice; # define f6_chosen 1 union { struct _choice1 { unsigned short choice; # define f7_chosen 1 union { struct _set1 { struct { struct { int i; } f9; } f8; } f7; /* to * choose, set choice to f7_chosen */ } u; } f6; /* to choose, set * choice to f6_chosen */ } u; } f5; /* to choose, set choice to * f5_chosen */ } u; } f4; /* to choose, set choice to * f4_chosen */ } u; } f3; /* to choose, set choice to f3_chosen */ } u; } f2; /* to choose, set choice to f2_chosen */ } u; } f1; /* to choose, set choice to f1_chosen */ } u; } C; |
typedef struct _choice2 { unsigned short choice; # define f6_chosen 1 union { struct _choice1 { unsigned short choice; # define f7_chosen 1 union { struct _set1 { struct { struct { int i; } f9; } f8; } f7; /* to choose, set choice to f7_chosen */ } u; } f6; /* to choose, set choice to f6_chosen */ } u; } _choice2; typedef struct C { unsigned short choice; # define f1_chosen 1 union { struct _choice6 { unsigned short choice; # define f2_chosen 1 union { struct _choice5 { unsigned short choice; # define f3_chosen 1 union { struct _choice4 { unsigned short choice; # define f4_chosen 1 union { struct _choice3 { unsigned short choice; # define f5_chosen 1 union { _choice2 f5; /* to choose, * set choice to f5_chosen */ } u; } f4; /* to choose, set choice to * f4_chosen */ } u; } f3; /* to choose, set choice to f3_chosen */ } u; } f2; /* to choose, set choice to f2_chosen */ } u; } f1; /* to choose, set choice to f1_chosen */ } u; } C; |
Prior to version 10.0, the ASN.1 compiler generated the names "floor" and "send", if present in the ASN.1 specification, without mangling. This led to name conflicts with identifiers in system headers on MS Windows platforms. Starting with 10.0, the compiler mangles these names in generated code.
The -compat v9.0reservedWords option can be used to disable the changes mentioned above and provides compatibility with versions earlier than 10.0.
ASN.1
M DEFINITIONS ::= BEGIN TEN ::= ENUMERATED {send(1), floor(2), small(3)} END
With -compat v9.0reservedWords | Without -compat v9.0reservedWords |
---|---|
typedef enum TEN { send = 1, floor = 2 } TEN; |
typedef enum TEN { TEN_send = 1, TEN_floor = 2 } TEN; |
Prior to version 10.1, the ASN.1 compiler generated the value of a SEQUENCE OF or SET OF type with an extensible size constraint without truncation. Starting with 10.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 v10.0valueTruncation option provides compatiblity with previous versions.
ASN.1
M DEFINITIONS AUTOMATIC TAGS ::= BEGIN A ::= SEQUENCE (SIZE (1..2, ...)) OF INTEGER val A ::= {1, 2, 3} END
With -compat v10.0valueTruncation | Without -compat v10.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; |
Prior to version 10.1, the ASN.1 compiler generated the interface name, when present in the ASN.1 specification, without mangling. This led to name conflicts with C runtime functions on Microsoft Windows platforms. Starting with 10.1, the compiler mangles this name in the generated code.
The -compat v10.0reservedWords option can be used to disable this change and provides compatibility with previous versions.
ASN.1
M DEFINITIONS ::= BEGIN S ::= SEQUENCE { interface INTEGER, connection INTEGER } END
With -compat v10.0reservedWords | Without -compat v10.0reservedWords |
---|---|
typedef struct S { int interface; int connection; } S; |
typedef struct S { int S_interface; int connection; } S; |
Provides compatibility with version 10.1.0 of the ASN.1 compiler.
Provides compatibility with version 10.5.0 of the ASN.1 compiler. The -compat v10.5.0 flag is the equivalent of the -compat v10.5NamesConflictingWithNicknames flag.
Prior to version 10.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 v10.5NamesConflictingWithNicknames flag restores the previous behavior, which, in many cases, generates syntactically correct header files that provide compatibility with pre-10.6 versions.
Provides compatibility with version 10.6.0 of the ASN.1 compiler.
The -compat v10.6.0 flag is equivalent to the following compat flags: -compat v10.6PdusForReferencedTypesOfRemovedFields, -compat v10.6PointeredTypesFromInnerWithContentConstraints, -compat v10.6DefineNamesForTypesFromInnerWithContentConstraints, -compat noConstrainedByFunctionsFromInnerSubtype, and -compat oldTypesFromInnerSubtypeWithContentConstraints.
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.
When the ASN1.Remove directive was applied to a SET or SEQUENCE field or to a CHOICE alternative, the compiler treated the referenced type as a PDU type, thus, the generated code size was increased. The generated code size was increased even further when an OSS.ENCODEONLY/OSS.DECODEONLY directive was applied to the enclosing PDU. Previously, as a workaround, the --<OSS.NOPDU>-- and OSS.PDU directives were applied to all the required PDU types.
Starting with version 10.7, the compiler no longer treats a named ASN.1 type as a PDU type when the type is referenced only by the fields removed with the ASN1.Remove compiler directive.
The v10.6PdusForReferencedTypesOfRemovedFields compat flag restores the previous compiler behavior.
Instructs the compiler to generate additional pointers for duplicate types created after applying contents constraints within inner subtype constraints in case of circular definitions in the helper mode.
Provides compatibility with version 10.7.0 of the ASN.1 compiler.
The -compat v10.7.0 flag is the equivalent of the -compat v10.7OrderOfSharedTypedefsForOpenTypes flag.
Instructs the ASN.1 compiler to not generate PDU typedefs for types derived from contents constraints that are included inside recursively defined types when the recursion occurs within a nested user-defined constraint applied using an inner subtype constraint. This standalone flag restores the behavior of previous ASN.1 compiler versions (prior to version 11.0).
Prior to version 11.0, the compiler generated calls to DataCallback functions 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 v10.7DataCallback flag restores the previous behavior.
Starting with version 11.0, the JSON encoder/decoder handles TeletexString, T61String, VideotexString, GraphicString, and GeneralString (also ObjectDescriptor) types as if they were octet strings (that is, in hex format), in accordance with X.697 clause 38.
Previously, the JER encoder/decoder violated this requirement and processed these types as JSON strings. The v10.7JsonEncodeRestrictedCharStringUsingNonHexForm compiler compat flag restores the previous behavior.
When the default union representation is used for decoded values of open types, this flag instructs the ASN.1 compiler to generate typedefs for shared open types derived from component relation constraints that are present within a contents constraint applied to a BIT STRING or OCTET STRING. The typedefs are generated in the order used by ASN.1 compiler versions prior to v11.0. Note that the generated code could result in C-compilation errors when this flag is used.
ASN.1
B4467 DEFINITIONS EXPLICIT TAGS ::= BEGIN SIGNATURE-ALGORITHM ::= CLASS { &id OBJECT IDENTIFIER UNIQUE, &Value OPTIONAL, &Params OPTIONAL } Certificate ::= SIGNED{INTEGER} CertificateList ::= SIGNED{BOOLEAN} SignatureAlgorithms SIGNATURE-ALGORITHM ::= { { &id { 0 1 }, &Value INTEGER }, ... } SIGNED {ToBeSigned} ::= SEQUENCE { toBeSigned ToBeSigned, algorithm SIGNATURE-ALGORITHM.&id({SignatureAlgorithms}), parameters SEQUENCE OF SIGNATURE-ALGORITHM.&Params( {SignatureAlgorithms}{@algorithm}), signature BIT STRING (CONTAINING SIGNATURE-ALGORITHM.&Value( {SignatureAlgorithms}{@algorithm})) } END
Code generated with -compat v10.7OrderOfSharedTypedefsForOpenTypes includes:
union CertificateList_openType_union { SignatureAlgorithms_integer *pdu_SignatureAlgorithms_integer; /* PDU_SignatureAlgorithms_Value_integer */ union All_PDU_Types_union other; /* for known extensions */ }; typedef SignatureAlgorithms_Value CertificateList_openType; typedef struct SignatureAlgorithms_Value { enum CertificateList_openType_PDUs pduNum; OssBuf encoded; union CertificateList_openType_union decoded; } SignatureAlgorithms_Value;
Code generated without -compat v10.7OrderOfSharedTypedefsForOpenTypes includes:
union SignatureAlgorithms_Value_union { SignatureAlgorithms_integer *pdu_SignatureAlgorithms_integer; /* PDU_SignatureAlgorithms_Value_integer */ union All_PDU_Types_union other; /* for known extensions */ }; typedef struct SignatureAlgorithms_Value { enum SignatureAlgorithms_Value_PDUs pduNum; OssBuf encoded; union SignatureAlgorithms_Value_union decoded; } SignatureAlgorithms_Value; typedef SignatureAlgorithms_Value CertificateList_openType;
Provides compatibility with version 11.0.0 of the ASN.1 compiler.
Restores the behavior of ASN.1 compiler versions prior to v11.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.
Instructs the ASN.1 compiler to ignore OSS.UseThis directives applied to open type fields inside parametrized types that can be shared and used in the new "union" representation of open types in the generated header file.
The ignoreUseThisDirectivesForFieldsInsideParamTypes compat flag was added in version 11.1.0.1.
Provides compatibility with version 11.1.0 of the ASN.1 compiler.
The v11.1.0 flag is the equivalent of the -compat v11.1DefineNamesForTypesFromInnerWithContentConstraints and -compat ignoreUseThisDirectivesForFieldsInsideParamTypes flags.
The v11.1.0 compat flag was added in version 11.1.0.1.
Restores the behavior of ASN.1 compiler versions prior to version 11.1 and instructs the ASN.1 compiler to create new artificial PDUs for complex recursive types defined through a CONSTRAINED BY syntax inside parameterized types.
The v11.1ArtificialPDUsForRecursivesTypes compat flag was added in version 11.1.0.2.
Restores the behavior of ASN.1 compiler versions prior to version 11.1 and instructs the ASN.1 compiler to create a new artificial PDU for a type with a contents constraint inside an open type value even when a matching type exists in the information object set specified in the component relation constraint.
The v11.1ContentsConstraintInsideOpenTypeValue compat flag was added in version 11.1.0.2.
The v11.1DefineNamesForTypesFromInnerWithContentConstraints compat flag provides compatibility with compiler versions 10.6 through 11.1 and instructs the compiler to generate the same define names that are generated for fields inside structurally different artificial types created after applying a contents contraint inside an inner subtype.
The v11.1DefineNamesForTypesFromInnerWithContentConstraints compat flag was added in version 11.1.0.1.
Restores the behavior of ASN.1 compiler versions prior to version 11.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.
--<OSS.DefineName Mod.Type.password "password">-- Mod DEFINITIONS AUTOMATIC TAGS ::= BEGIN Type ::= SEQUENCE { password CHOICE { switch OCTET STRING } OPTIONAL } END
When the v11.1FieldNamesAndGlobalPrefix compat flag is not used, the following code is generated:
typedef struct X_Type { unsigned char bit_mask; # define password_present 0x80 struct { unsigned short choice; # define X_switch_chosen 1 union { struct X__octet1 { unsigned int length; unsigned char *value; } password_switch; /* to choose, set choice to X_switch_chosen */ } u; } password; /* optional; set in bit_mask password_present if present */ } X_Type;
When the -compat v11.1FieldNamesAndGlobalPrefix flag is used, the "password_switch" field name is truncated to "ssword_switch". The following code is generated:
typedef struct X_Type { unsigned char bit_mask; # define password_present 0x80 struct { unsigned short choice; # define X_switch_chosen 1 union { struct X__octet1 { unsigned int length; unsigned char *value; } ssword_switch; /* to choose, set choice to X_switch_chosen */ } u; } password; /* optional; set in bit_mask password_present if present */ } X_Type;
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 v11.1ForwardedNonParamReferencesImportedWithSuccessors compat flag was added in version 11.1.0.2.
Provides compatibility with version 11.2.0 of the ASN.1 compiler. This flag is equivalent to the following -compat options: v11.2TypesFromConstrainedBy and v11.2PdusForTypesFromDEFAULTInsideInfoObjClass.
Restores the behavior of ASN.1 compiler versions prior to version 11.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.
Restores the behavior of ASN.1 compiler versions prior to version 11.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 v11.2TypesFromConstrainedBy flag could restore an unexpected circular reference error for some syntaxes.
This documentation applies to the OSS® ASN.1 Tools for C release 11.3 and later.
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.