IPv4 Datagram Reassembly

pcapkit.reassembly.ipv4 contains IPv4_Reassembly only, which reconstructs fragmented IPv4 packets back to origin. Please refer to IP Datagram Reassembly for more information.

Data Structure

ipv4.packet

Data structure for IPv4 datagram reassembly (reassembly()) is as following:

ipv4.datagram

Data structure for reassembled IPv4 datagram (element from datagram tuple) is as following:

ipv4.buffer

Data structure for internal buffering when performing reassembly algorithms (_buffer) is as following:

(dict) buffer --> memory buffer for reassembly
 |--> (tuple) BUFID : (dict)
 |     |--> ipv4.src       |
 |     |--> ipc6.dst       |
 |     |--> ipv4.label     |
 |     |--> ipv4_frag.next |
 |                         |--> 'TDL' : (int) total data length
 |                         |--> RCVBT : (bytearray) fragment received bit table
 |                         |             |--> (bytes) b'\x00' -> not received
 |                         |             |--> (bytes) b'\x01' -> received
 |                         |             |--> (bytes) ...
 |                         |--> 'index' : (list) list of reassembled packets
 |                         |               |--> (int) packet range number
 |                         |--> 'header' : (bytearray) header buffer
 |                         |--> 'datagram' : (bytearray) data buffer, holes set to b'\x00'
 |--> (tuple) BUFID ...

Implementation

class pcapkit.reassembly.ipv4.IPv4_Reassembly(*, strict=True)[source]

Bases: pcapkit.reassembly.ip.IP_Reassembly

Reassembly for IPv4 payload.

Example

>>> from pcapkit.reassembly import IPv4_Reassembly
# Initialise instance:
>>> ipv4_reassembly = IPv4_Reassembly()
# Call reassembly:
>>> ipv4_reassembly(packet_dict)
# Fetch result:
>>> result = ipv4_reassembly.datagram
property name

Protocol of current packet.

Return type

Literal[‘Internet Protocol version 4’]

property protocol

Protocol of current reassembly object.

Return type

Literal[‘IPv4’]