iNetX Documentation

iNetX is a FTI packet format that is decribed in Tech Note 69. It is typically encapsulated in a UDP payload.

This module supports the creating and analysis of iNetX packets

In typical use, a UDP payload is captured from the network or read from a PCAP file. This is then passed to the iNetX.unpack() method which converts it into an iNetX packet

Examples and details are available below

iNetX Objects

class AcraNetwork.iNetX.iNetX(buf: bytes | None = None)

Class to pack and unpack iNetX payloads. iNet-X is an open payload format for use in FTI networks. It is usually transmitted in a UDP packet containing parameter data acquired from sensors and buses

Capture a UDP packet and unpack the payload as an iNetX packet

Here’s an example where you take some bytes, decode it as an iNetX packet, then build the same packet from scratch and compare the two

>>> from base64 import b64decode
>>> data = b64decode('EQAAAAAAANwAAAABAAAAHgAAAAEAAAABAAAAAAUA')
>>> pkt = iNetX()
>>> pkt.unpack(data)
True
>>> print(f"{pkt.streamid:#0X}")
0XDC
>>> i = iNetX()
>>> i.sequence = 1
>>> i.pif = 0
>>> i.streamid = 0xDC
>>> i.setPacketTime(1, 1)
True
>>> i.payload = struct.pack("H", 0x5)
>>> i == pkt
True
pack() bytes

Pack the packet into a binary format and return as a string

Return type:

bytes

setPacketTime(utctimestamp, nanoseconds=0)

Set the packet timestamp

Parameters:

timestamp (int) – The timestamp in seconds since 1 Jan 1970

unpack(buf: bytes) bool

Unpack a raw byte stream to an iNetX object Accepts a buffer to unpack as the required argument

Parameters:

buf (bytes) – The string buffer to unpack

Return type:

bool

DEF_CONTROL_WORD = 285212672

(Object Constant) The default iNetX control word.

inetxcontrol: int

Control Word Defaults to 0x11000000

packetlen: int

Packet Length in bytes

payload: bytes

Payload

pif: int

Payload Information Field

ptptimenanoseconds: int

Nanaosecond timestamp

ptptimeseconds: int

Timestamp of first parameter in the packet. EPOCH time

sequence: int

Unique rollover counter per stream ID.Rolls over at 2^64

streamid: int

Stream ID. Typically to identify a unique packet in an FTI network. 4 bytes in size