Source code for pcapkit.protocols.schema.internet.ipx

# -*- coding: utf-8 -*-
# mypy: disable-error-code=assignment
"""header schema for internetwork packet exchange protocol"""

from typing import TYPE_CHECKING

from pcapkit.const.ipx.packet import Packet as Enum_Packet
from pcapkit.corekit.fields.misc import PayloadField
from pcapkit.corekit.fields.numbers import EnumField, UInt8Field, UInt16Field
from pcapkit.corekit.fields.strings import BytesField
from pcapkit.protocols.schema.schema import Schema, schema_final

__all__ = ['IPX']

if TYPE_CHECKING:
    from pcapkit.protocols.protocol import ProtocolBase


[docs] @schema_final class IPX(Schema): """Header schema for IPX packet. .. versionchanged:: 1.5.0 New field :attr:`trailer`, which keeps the octets captured past the Packet Length rather than dropping them (:issue:`1433`). """ #: Checksum. chksum: 'bytes' = BytesField(length=2) #: Packet length (header included). len: 'int' = UInt16Field() #: Transport control (hop count). count: 'int' = UInt8Field() #: Packet type. type: 'Enum_Packet' = EnumField(length=1, namespace=Enum_Packet) #: Destination address. dst: 'bytes' = BytesField(length=12) #: Source address. src: 'bytes' = BytesField(length=12) #: Payload. payload: 'bytes' = PayloadField(length=lambda pkt: pkt['len'] - 30) #: Octets captured past the Packet Length, such as Ethernet minimum-frame #: padding. A :class:`~pcapkit.corekit.fields.misc.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. trailer: 'bytes' = PayloadField(default=b'') if TYPE_CHECKING: def __init__(self, chksum: 'bytes', len: 'int', count: 'int', type: 'Enum_Packet', dst: 'bytes', src: 'bytes', payload: 'bytes | ProtocolBase | Schema', trailer: 'bytes' = b'') -> 'None': ...