You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@plc4x.apache.org by Christofer Dutz <ch...@c-ware.de> on 2021/08/07 13:33:32 UTC

[DISCUSS] Add means to set the endianess in the type declaration?

Hi all,

so now I'm being bitten by some mixed-endianess ... in order to model some types in the Profinet protocol, I currently have the following stack of protocol-layers (which I implement as types):

Ethernet (Big-Endian)
IP (Big-Endian)
UDP (Big-Endian)
DCE/RPC (Little-Endian)
PROFINET IO (Little-Endian)

In this case I will insert a separator between the BE UDP and the LE DCE/RPC and simply switch the Read/WriteBuffer endianess (So the UDP packet will simply have a byte[] payload.

I know we had discussions about being able to "dynamically switch endianess", which I always disliked. However I did notice, that when layering multiple protocols over each other. Some might be in BE and some might be LE.
So how would it be, if we were able to provide the endianess in the type declaration? So if I know: This type is encoded LE, then I make sure the parser/serializer switches to LE when processing this type.

It could simplify things for us ... and no ... I'm still no fan of switching the endianess on individual fields ;)

Chris