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 |
|
Checksum |
2 |
16 |
|
Packet Length (header included) |
4 |
32 |
|
Transport Control (hop count) |
5 |
40 |
|
Packet Type |
6 |
48 |
|
Destination Address |
18 |
144 |
|
Source Address |
- class pcapkit.protocols.internet.ipx.protocol.IPX(file=None, length=None, **kwargs)[source]¶
-
This class implements Internetwork Packet Exchange.
Changed in version 1.5.0:
from_data()rebuilds a parsed packet rather than raisingstruct.error(#1315), and the octets past the IPX Length field are kept astrailer(#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
typeofmake()takes a member or anintcode, resolved with the enumeration’sget; a name, abool, or a code the field cannot carry raisesProtocolError, rather than resolving against an enumeration inferred from the caller’s frame or writing a different value (#2594).make()raisesProtocolErrorfor 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_namespaceandtype_reversedarguments that went with thetypeofmake(); resolve a name withresolve_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 inPacket, rather than by IP protocol number, so this class keeps a registry of its own instead of sharingInternet.__proto__(#2169). No IPX-native protocol is shipped, so the payload isRawunless one is registered withregister_ipx().
- __proto_key__: ClassVar[tuple[Type[EnumRegistry], bool]]¶
What
__proto__is keyed by, declared asInternet.__proto_key__is, so acode=key is checked asregister_ipx()checks its own. A bareintis a valid key too, because the IPX Packet Type is a number in its own right (#2268, #2511).
- 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).total_length (
int|None) – Packet length (header included); computed as30plus 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:
- Returns:
Constructed packet data.
- Raises:
ProtocolError – If
typeis a name, abool, or a member or code that does not fit in one octet,chksumis not two octets, ordstorsrcis not twelve.
Changed in version 1.5.0: Takes
total_lengthahead ofdst(#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:
protocol (
ModuleDescriptor[ProtocolBase] |Type[ProtocolBase]) – module descriptor or aProtocolBasesubclass
Important
This overrides
Internet.registerbecauseself.__proto__is keyed by IPX Packet Type rather than by IP protocol number (#2511).- Raises:
pcapkit.utilities.exceptions.RegistryError – If
protocolis not a class, or not aProtocolBasesubclass.- Warns:
pcapkit.utilities.warnings.RegistryWarning– If this packet type is already registered and the incumbent differs from the replacement; the message names both. SeeProtocol.registerfor the guard, and for the shipped descriptor a restore puts back (#1504).
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:
SchemaHeader 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).- trailer: bytes = <PayloadField trailer>¶
Octets captured past the Packet Length, such as Ethernet minimum-frame padding. A
PayloadFieldwith 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:
ProtocolData model for Internetwork Packet Exchange.
- class pcapkit.protocols.internet.ipx.data.Address(network, node, socket, addr)[source]¶
Bases:
DataData model for IPX address.
Footnotes