Skip to content

How to specify length of variable-length field with no explicit length available? #4

@dodohand

Description

@dodohand

Hello,

My question is more-or-less: "Have I misunderstood the documentation? Do you see an existing, supported solution?".
Here's the situation:

I'm trying to represent an inconvenient, existing protocol using CommsDSL and am presented with this situation:
The response to a command, in some cases, will have data, types, and length which all vary depending upon
the particular parameters of the command message which has elicited this response. The only length information
provided is the overall length of the response provided in the layer in the frame definition.

I can imagine success in representing this response as <data> by either:

  1. having a <data> field consume all available bytes remaining in the <frame>
  2. by being able to specify that the length of the <data> field is fixed at a constant offset from the frame.size i.e. length
    of a <data> field is defined as length = frame.size - constant, maybe represented like:
<data name="VaryingPayload" lengthPrefix="$FrameName.size" lengthOffset="7"/>

However, as I read the CommsDSL Schema documentation:

  1. a <data> field with no length specification consumes all data in the input buffer, which wouldn't work in my case,
    ("Such definition of the does NOT have any limit on the length of the data, and will consume
    all the available bytes in the input buffer.")
  2. I can't see that it is possible to specify such a length representation for a <data> field

Thanks for your time, and for this well-thought-out library!

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