Base Class¶
pcapkit.foundation.reassembly.ip
contains
IP
only, which reconstructs fragmented IP packets back to
origin. The following algorithm implement is based on IP
reassembly procedure introduced in RFC 791, using
RCVBT
(fragment receivedbit table). Though another
algorithm is explained in RFC 815, replacing RCVBT
,
however, this implement still used the elder one.
- class pcapkit.foundation.reassembly.ip.IP(*, strict=True, store=True)[source]¶
Bases:
ReassemblyBase
[Packet
[_AT
],Datagram
[_AT
],tuple
[_AT
,_AT
,int
, TransType],Buffer
[_AT
]],Generic
[_AT
]Reassembly for IP payload.
- Parameters:
strict (
bool
) – if return all datagrams (including those not implemented) when submitstore (
bool
) – if store reassembled datagram in memory, i.e.,self._dtgram
(if not, datagram will be discarded after callback)
Important
This class is not intended to be instantiated directly, but rather used as a base class for the protocol-aware reassembly classes.
Data Models¶
- class pcapkit.foundation.reassembly.data.ip.Packet(*args: VT, **kwargs: VT)[source]¶
-
Data model for IPv4 and/or IPv6 packet representation..
- bufid: BufferID¶
Buffer ID.
- num: int¶
Original packet range number.
- fo: int¶
Fragment offset.
- ihl: int¶
Internet header length.
- mf: bool¶
More fragments flag.
- tl: int¶
Total length, header included.
- pcapkit.foundation.reassembly.data.ip.BufferID: Tuple[_AT, _AT, int, pcapkit.const.reg.transtype.TransType]¶
Data module for buffer ID.
- class pcapkit.foundation.reassembly.data.ip.Buffer(*args: VT, **kwargs: VT)[source]¶
-
Data model for IPv4 and/or IPv6 reassembly buffer entry.
- TDL: int¶
Total data length.
- RCVBT: bytearray¶
Fragment received bit table.
- index: list[int]¶
List of reassembled packets.
- header: bytes¶
Header buffer.
- datagram: bytearray¶
Data buffer, holes set to
b'\x00'
.
- class pcapkit.foundation.reassembly.data.ip.DatagramID(*args: VT, **kwargs: VT)[source]¶
-
Data model for IPv4 and/or IPv6 original packet identifier.
- src: _AT¶
Source address.
- dst: _AT¶
Destination address.
- id: int¶
IP protocol identifier.
- proto: TransType¶
Payload protocol type.
- class pcapkit.foundation.reassembly.data.ip.Datagram(*args: VT, **kwargs: VT)[source]¶
-
Data model for IPv4 and/or IPv6 reassembled datagram.
- completed: bool¶
Completed flag.
- id: DatagramID[_AT]¶
Original packet identifier.
- index: tuple[int, ...]¶
Packet numbers.
- header: bytes¶
Initial IP header.
- payload: bytes | tuple[bytes, ...]¶
Reassembled IP payload.
- packet: Optional[Protocol]¶
Parsed IP payload.
Type Variables¶
- pcapkit.foundation.reassembly.data.ip._AT: ipaddress.IPv4Address | ipaddress.IPv4Address¶