Skip to content

Extention function position types are not generated for nested sequences #361

@joukewitteveen

Description

@joukewitteveen

If save-position is applied to a grandchild in a sequence, the *_extention_function_positions type is not generated, but the encoding/decoding code does rely on it.

The following reproducer is adapted from the CRC example and tested for the C code generated.

-- ASN.1

MYMODULE DEFINITIONS ::= BEGIN

PacketHeader ::= SEQUENCE
{
    version    INTEGER(1..100),
    release    INTEGER(1..100)
}

PacketPayload ::= CHOICE
{
    aReal               REAL,
    anInteger           INTEGER (0 .. 65535),
    anotherSizeArray    SEQUENCE (SIZE (1..100)) OF INTEGER (1..200)
}

Packet ::= SEQUENCE {
    p-header PacketHeader,
    p-body   SEQUENCE {
        p-payload PacketPayload
    }
}

END
-- ACN

MYMODULE DEFINITIONS ::= BEGIN

Packet [post-encoding-function my-encoding-patcher, post-decoding-validator crc-validator]
{
    p-header [],
    p-body   [] {
        p-payload [],
        packet-crc32 NULL [pattern '00000000'H, save-position] -- 32 bits
    }
}

END

The following errors from the gcc output show how the correct encoding function is generated, but the type definition is missing:

a.c: In function ‘Packet_ACN_Encode’:
a.c:428:9: error: unknown type name ‘Packet_extension_function_positions’
  428 |         Packet_extension_function_positions bitStreamPositions_1;
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.c:443:45: error: request for member ‘Packet_p_body_packet_crc32’ in something not a structure or union
  443 |                         bitStreamPositions_1.Packet_p_body_packet_crc32 = *pBitStrm; //save position of the bit stream
      |                                             ^

It would be very nice if the type were generated (instead of deciding this is not supported).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions