Parser Aligned Documentation¶
Parser can generate iNetX or IENA payloads which have a specific format. This packet format is known as ParserAligned payloads. This class will unpack the payload into ParserAlignedPackets.
This packet format is documented in TEC-NOT-67
ParserAlignedPackets contain multiple ParserAlignedBlocks.
ParserAlignedPacket Objects¶
- class AcraNetwork.ParserAligned.ParserAlignedPacket¶
A class that handles iNetx parser aligned packets. Unpack a buffer to populate the field into a list of parserblocks
Capture a UDP packet,unpack as iNetX whose payload is parser aligned
>>> from base64 import b64decode >>> import AcraNetwork.iNetX as inetx >>> data = b64decode('EQAAAAAAAAEAAAAAAAAAQAAAAAAAAAAAAAAAAAADAAAAAAAAQJ+3iAADAQIAAAAAekKvKAADAgYAACcQ7Z6oWA==') >>> i = inetx.iNetX() >>> i.unpack(data) True >>> p = ParserAlignedPacket() >>> p.unpack(i.payload) True >>> print(p[0]) QuadBytes=3 Error=False ErrorCode=0 BusID=0 MessageCount=0 ElapsedTime=0
- pack()¶
Convert a ParserPacket to a buffer
- unpack(buf: bytes)¶
Pass a buffer containing all the Parser alignd payload and this method will unpack all the fields. Returns a list of parserblocks
- Parameters:
buf (bytes) – The string buffer to unpack
- Return type:
- parserblocks: List[ParserAlignedBlock]¶
List of ParserAlignedBlock
ParserAlignedBlock Objects¶
- class AcraNetwork.ParserAligned.ParserAlignedBlock¶
A class to handle a single Parser Block. Returns an object containing all the fields of a parser block
- pack() bytes¶
Convert a ParserAlignedBlock into a buffer :return:
- unpack(buf: bytes)¶
Unpack a single parser block. Unsually called only from the ParserAlignedPacket unpack method.
Returns the length of the parser block
- payload: bytes¶
Payload