Shared Context Variables¶
pcapkit.utilities.contextvars holds the ContextVar
objects that more than one pcapkit module sets or reads, so that no module
imports another’s private state (#2616). A context variable that only its
own module uses stays there. This module imports nothing from pcapkit, so
a module at any layer may import it; see Choosing Between utilities and corekit.
Added in version 1.6.0.
- pcapkit.utilities.contextvars.beholding¶
Whether a layer that raises is discarded by its caller, as
beholder()replaces it and_default_extension_header()drops it, so thatProtocol._parse_next_layerdrops its warnings with it (#2308).- Type:
- pcapkit.utilities.contextvars.frame_depth¶
How many layers of the frame being dissected come before the next one
Protocol._parse_next_layerparses; seeFRAME_LAYER_LIMIT.- Type:
- pcapkit.utilities.contextvars.frame_length: ContextVar[tuple[int, int] | None]¶
The captured and the original length of the frame being dissected, in octets, as its PCAP record or PCAP-NG packet block states them;
Noneoutside a frame, and inside the payload of anInternetlayer that bounds it, which neither an IPv4 Total Length of 0 norAHdoes (#2689). A frame the capture cut short holds fewer octets than were on the wire, which a layer stating no length of its own, asGRE, cannot tell from the octets it is handed (#2653).- Type:
contextvars.ContextVar[tuple[int, int] | None]
- pcapkit.utilities.contextvars.rebuilding¶
Whether a payload is being rebuilt by
Protocol._make_payload, so that the layer it is rebuilt for parses the same octets again and reports what they carry, which the payload’s own parse then does not (#2711); seeFRAME_LAYER_LIMIT.- Type: