Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Byte Order and nested messages #914

Closed
kanigsson opened this issue Jan 25, 2022 · 0 comments · Fixed by #928
Closed

Byte Order and nested messages #914

kanigsson opened this issue Jan 25, 2022 · 0 comments · Fixed by #928
Assignees
Labels
architectural decision Discussion of design decision

Comments

@kanigsson
Copy link
Collaborator

Context and Problem Statement

The current implementation of the Byte_Order aspect is broken when nested messages are used. The byte order of the outermost message type will be used throughout. Instead, for each message, the byte order that was specified for this message type should be used for fields of this type, even if this message type is then used as a field type in other messages.

Design

  • Internally, Recordflux merges or "inlines" the fields of inner messages into the outer message. This means we need to track byte order per field instead of per message, as this inlining can create messages with mixed byte order. This also means that a message can contain the same type with different byte orders.
  • We need to change the interface of RFLX_Generic_Types so that only one variant of Extract and Insert exists, and not one variant per byte order. The byte order is then passed as an additional parameter instead. This permits a single instance of Extract and Insert even if a message uses a type with both byte orders.
  • Usage of Extract/Insert needs to be adapted, including sequences of scalars.
@kanigsson kanigsson added the architectural decision Discussion of design decision label Jan 25, 2022
@kanigsson kanigsson self-assigned this Jan 25, 2022
kanigsson added a commit that referenced this issue Feb 8, 2022
- We track byte order by field instead of by message, using a new
  map that maps fields to their byte order. This is similar to the
  existing types map.
- To avoid having to potentially instantiate Insert/Extract
  functions per byte order and type, we use a single Insert (and a
  single Extract) function which takes the byte order as argument.
- This requires adding a Byte_Order type to the interface.
- Byte order in scalar sequences is hard-coded to High_Order_First
  (as it was already before).
- adapt session_endianness test to account for nested messages

Fixes #914
kanigsson added a commit that referenced this issue Feb 8, 2022
- We track byte order by field instead of by message, using a new
  map that maps fields to their byte order. This is similar to the
  existing types map.
- To avoid having to potentially instantiate Insert/Extract
  functions per byte order and type, we use a single Insert (and a
  single Extract) function which takes the byte order as argument.
- This requires adding a Byte_Order type to the interface.
- Byte order in scalar sequences is hard-coded to High_Order_First
  (as it was already before).
- adapt session_endianness test to account for nested messages

Fixes #914
kanigsson added a commit that referenced this issue Feb 11, 2022
- We track byte order by field instead of by message, using a new
  map that maps fields to their byte order. This is similar to the
  existing types map.
- To avoid having to potentially instantiate Insert/Extract
  functions per byte order and type, we use a single Insert (and a
  single Extract) function which takes the byte order as argument.
- This requires adding a Byte_Order type to the interface.
- Byte order in scalar sequences is hard-coded to High_Order_First
  (as it was already before).
- adapt session_endianness test to account for nested messages

Fixes #914
kanigsson added a commit that referenced this issue Feb 14, 2022
- We track byte order by field instead of by message, using a new
  map that maps fields to their byte order. This is similar to the
  existing types map.
- To avoid having to potentially instantiate Insert/Extract
  functions per byte order and type, we use a single Insert (and a
  single Extract) function which takes the byte order as argument.
- This requires adding a Byte_Order type to the interface.
- Byte order in scalar sequences is hard-coded to High_Order_First
  (as it was already before).
- adapt session_endianness test to account for nested messages

Fixes #914
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
architectural decision Discussion of design decision
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant