IPv6 - Internet Protocol version 6¶
pcapkit.protocols.internet.ipv6 contains
IPv6 only,
which implements extractor for Internet Protocol
version 6 (IPv6) [*], whose structure is described
as below:
Octets |
Bits |
Name |
Description |
|---|---|---|---|
0 |
0 |
|
Version ( |
0 |
4 |
|
Traffic Class |
1 |
12 |
|
Flow Label |
4 |
32 |
|
Payload Length (header excludes) |
6 |
48 |
|
Next Header |
7 |
56 |
|
Hop Limit |
8 |
64 |
|
Source Address |
24 |
192 |
|
Destination Address |
- class pcapkit.protocols.internet.ipv6.IPv6(file=None, length=None, **kwargs)[source]¶
-
This class implements Internet Protocol version 6.
- property src: IPv6Address¶
Source IP address.
- property dst: IPv6Address¶
Destination IP address.
- property extension_headers: OrderedMultiDict[ExtensionHeader, ProtocolBase]¶
IPv6 extension header records.
- read(length=None, *, __packet__=None, **kwargs)[source]¶
Read Internet Protocol version 6 (IPv6).
Structure of IPv6 header [RFC 2460]:
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |Version| Traffic Class | Flow Label | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Payload Length | Next Header | Hop Limit | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | + + | | + Source Address + | | + + | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | + + | | + Destination Address + | | + + | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- make(traffic_class=0, flow_label=0, next=<TransType.UDP: 17>, next_default=None, next_namespace=None, next_reversed=False, hop_limit=64, src='::1', dst='::', payload=b'', **kwargs)[source]¶
Make (construct) packet data.
- Parameters:
traffic_class (
int) – Traffic class.flow_label (
int) – Flow label.next (
TransType|IntEnum|IntEnum|str|int) – Next header.next_namespace (
dict[str,int] |dict[int,str] |Type[IntEnum] |Type[IntEnum] |None) – Namespace of next header.next_reversed (
bool) – Whether to reverse the namespace of next header.hop_limit (
int) – Hop limit.src (
IPv6Address|str|bytes|int) – Source IP address.dst (
IPv6Address|str|bytes|int) – Destination IP address.payload (
bytes|ProtocolBase|Schema) – Payload data.**kwargs (
Any) – Arbitrary keyword arguments.
- Return type:
- Returns:
Constructed packet data.
Header Schemas¶
- class pcapkit.protocols.schema.internet.ipv6.IPv6(*args: _VT, **kwargs: _VT)[source]¶
Bases:
SchemaHeader schema for IPv6 packet.
- hextet: IPv6Hextet = <BitField hextet>¶
Version, traffic class and flow label.
The
BitFieldnamespace maps each subfield to a(start_bit, length_in_bits)pair, not to(start_bit, end_bit). Per RFC 8200 Section 3 the first 32 bits of the IPv6 header are Version (bits 0-3), Traffic Class (bits 4-11) and Flow Label (bits 12-31), so the flow label starts at bit 12 – reading it as(8, 20)would overlap the low nibble of the traffic class and drop the low nibble of the label.
- src: IPv6Address = <IPv6AddressField src>¶
Source address.
- dst: IPv6Address = <IPv6AddressField dst>¶
Destination address.
Type Stubs¶
Data Models¶
- class pcapkit.protocols.data.internet.ipv6.IPv6(*args: Any, **kwargs: Any)[source]¶
Bases:
ProtocolData model for Internet Protocol version 6.
Important
Due to the preserved keyword conflict, please use
from_dict()to create an instance of this data model.- src: IPv6Address¶
Source address.
- dst: IPv6Address¶
Destination address.
Footnotes