IPX - Internetwork Packet Exchange

pcapkit.protocols.internet.ipx.protocol contains IPX only, which implements the extractor for Internetwork Packet Exchange (IPX) [*], whose structure is:

Octets

Bits

Name

Description

0

0

ipx.chksum

Checksum

2

16

ipx.len

Packet Length (header included)

4

32

ipx.count

Transport Control (hop count)

5

40

ipx.type

Packet Type

6

48

ipx.dst

Destination Address

18

144

ipx.src

Source Address

class pcapkit.protocols.internet.ipx.protocol.IPX(file=None, length=None, **kwargs)[source]

Bases: Internet[IPX, IPX]

This class implements Internetwork Packet Exchange.

Changed in version 1.5.0: from_data() rebuilds a parsed packet rather than raising struct.error (#1315), and the octets past the IPX Length field are kept as trailer (#1433).

The payload is dissected by IPX Packet Type from a registry of its own, __proto__, rather than looked up as an IP protocol number (#2169).

Changed in version 1.6.0: The type of make() takes a member or an int code, resolved with the enumeration’s get; a name, a bool, or a code the field cannot carry raises ProtocolError, rather than resolving against an enumeration inferred from the caller’s frame or writing a different value (#2594).

make() raises ProtocolError for a checksum that is not two octets, or an address that is not twelve, rather than padding or cutting it (#2676).

Removed in version 1.6.0: The type_default, type_namespace and type_reversed arguments that went with the type of make(); resolve a name with resolve_index() first (#2594).

__proto__: DefaultDict[int, ModuleDescriptor[ProtocolBase] | Type[ProtocolBase]]

Protocol index mapping for decoding next layer, see self._decode_next_layer & self._import_next_layer. Keyed by IPX Packet Type, as in Packet, rather than by IP protocol number, so this class keeps a registry of its own instead of sharing Internet.__proto__ (#2169). No IPX-native protocol is shipped, so the payload is Raw unless one is registered with register_ipx().

__proto_key__: ClassVar[tuple[Type[EnumRegistry], bool]]

What __proto__ is keyed by, declared as Internet.__proto_key__ is, so a code= key is checked as register_ipx() checks its own. A bare int is a valid key too, because the IPX Packet Type is a number in its own right (#2268, #2511).

property name: Literal['Internetwork Packet Exchange']

Name of corresponding protocol.

property length: Literal[30]

Header length of corresponding protocol.

property protocol: Packet

IPX Packet Type of next layer protocol.

property src: str

Source IPX address.

property dst: str

Destination IPX address.

read(length=None, **kwargs)[source]

Read Internetwork Packet Exchange.

Parameters:
  • length (int | None) – Length of packet data.

  • **kwargs (Any) – Arbitrary keyword arguments.

Return type:

IPX

Returns:

Parsed packet data.

make(chksum=b'\x00\x00', count=0, type=Packet.Unknown, total_length=None, dst=b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', src=b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', payload=b'', trailer=b'', **kwargs)[source]

Make (construct) packet data.

Parameters:
  • chksum (bytes) – Checksum, two octets.

  • count (int) – Transport Control (hop count).

  • type (Packet | int) – Packet Type.

  • total_length (int | None) – Packet length (header included); computed as 30 plus the payload length when not given.

  • dst (bytes) – Destination Address, twelve octets.

  • src (bytes) – Source Address, twelve octets.

  • payload (bytes | ProtocolBase | Schema) – Payload data.

  • trailer (bytes) – Octets after the packet, outside the Packet Length, such as link-layer padding; written as is.

  • **kwargs (Any) – Arbitrary keyword arguments.

Return type:

IPX

Returns:

Constructed packet data.

Raises:

ProtocolError – If type is a name, a bool, or a member or code that does not fit in one octet, chksum is not two octets, or dst or src is not twelve.

Changed in version 1.5.0: Takes total_length ahead of dst (#1315), which shifts every later positional argument.

classmethod register(code, protocol)[source]

Register a new protocol class for an IPX Packet Type.

Notes

The fully qualified class name of the new protocol class should be {protocol.module}.{protocol.name}.

Parameters:

Important

This overrides Internet.register because self.__proto__ is keyed by IPX Packet Type rather than by IP protocol number (#2511).

Raises:

pcapkit.utilities.exceptions.RegistryError – If protocol is not a class, or not a ProtocolBase subclass.

Warns:

pcapkit.utilities.warnings.RegistryWarning – If this packet type is already registered and the incumbent differs from the replacement; the message names both. See Protocol.register for the guard, and for the shipped descriptor a restore puts back (#1504).

classmethod __index__()[source]

Numeral registry index of the protocol.

Return type:

TransType

Returns:

Numeral registry index of the protocol in IANA.

classmethod _make_data(data)[source]

Create key-value pairs from data for protocol construction.

Parameters:

data (IPX) – protocol data

Return type:

dict[str, Any]

Returns:

Key-value pairs for protocol construction.

_next_exthdr_depth(proto, extension=False)[source]

Place the next layer in its chain of IPv6 extension headers.

Parameters:
  • proto (int | None) – next layer IPX Packet Type

  • extension (bool) – if the next layer is parsed as an extension header

Returns:

an IPX Packet Type is not an IP protocol number, so it never names an IPv6 extension header (#2169).

Return type:

int

Header Schemas

Removed in version 1.6.0: pcapkit.protocols.schema.internet.ipx, with no alias: the module moved here (#2534).

class pcapkit.protocols.internet.ipx.schema.IPX(chksum=NO_VALUE, len=NO_VALUE, count=NO_VALUE, type=NO_VALUE, dst=NO_VALUE, src=NO_VALUE, payload=NO_VALUE, trailer=NO_VALUE, *, __packet__=None, **kwargs)[source]

Bases: Schema

Header schema for IPX packet.

Changed in version 1.5.0: New field trailer, which keeps the octets captured past the Packet Length rather than dropping them (#1433).

chksum: bytes = <BytesField chksum>

Checksum.

len: int = <UInt16Field len>

Packet length (header included).

count: int = <UInt8Field count>

Transport control (hop count).

type: Packet = <EnumField type>

Packet type.

dst: bytes = <BytesField dst>

Destination address.

src: bytes = <BytesField src>

Source address.

payload: bytes = <PayloadField payload>

Payload.

trailer: bytes = <PayloadField trailer>

Octets captured past the Packet Length, such as Ethernet minimum-frame padding. A PayloadField with no length takes whatever the payload leaves on unpack and writes its value verbatim on pack, so the octets survive whatever they hold.

Data Models

Removed in version 1.6.0: pcapkit.protocols.data.internet.ipx, with no alias: the module moved here (#2534).

class pcapkit.protocols.internet.ipx.data.IPX(chksum, len, count, type, dst, src)[source]

Bases: Protocol

Data model for Internetwork Packet Exchange.

chksum: bytes

Checksum.

len: int

Packet length (header included).

count: int

Transport control (hop count).

type: Packet

Packet type.

dst: Address

Destination Address.

src: Address

Source Address.

trailer: bytes

Octets captured past the Packet Length, present only when there are any.

class pcapkit.protocols.internet.ipx.data.Address(network, node, socket, addr)[source]

Bases: Data

Data model for IPX address.

network: str

Network number (: separated).

node: str

Node number (- separated).

socket: Socket

Socket number.

addr: str

Full address (: separated).

Footnotes