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 name: Literal['Internet Protocol version 6']¶
Name of corresponding protocol.
- 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 (Enum_TransType | StdlibEnum | AenumEnum | str | int) – Next header.
next_default (Optional[int]) – Default value of next header.
next_namespace (Optional[dict[str, int] | dict[int, str] | Type[StdlibEnum] | Type[AenumEnum]]) – 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 | Protocol | Schema) – Payload data.
**kwargs (Any) – Arbitrary keyword arguments.
- Return type:
Schema_IPv6
- Returns:
Constructed packet data.
Header Schemas¶
- class pcapkit.protocols.schema.internet.ipv6.IPv6(dict_=None, **kwargs)[source]¶
Bases:
Schema
Header schema for IPv6 packet.
- hextet: IPv6Hextet = <BitField hextet>¶
Version, traffic class and flow label.
- next: Enum_TransType = <EnumField next>¶
Next header.
- src: IPv6Address = <IPv6AddressField src>¶
Source address.
- dst: IPv6Address = <IPv6AddressField dst>¶
Destination address.
- payload: bytes = <PayloadField payload>¶
Payload.
Type Stubs¶
Data Models¶
- class pcapkit.protocols.data.internet.ipv6.IPv6(*args: Any, **kwargs: Any)[source]¶
Bases:
Protocol
Data 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.- version: Literal[6]¶
Version.
- label: int¶
Flow label.
- payload: int¶
Payload length.
- next: TransType¶
Next header.
- limit: int¶
Hop limit.
- src: IPv6Address¶
Source address.
- dst: IPv6Address¶
Destination address.
- fragment: Packet¶
Fragmented packet header & payload (from IPv6-Frag header).
- protocol: TransType¶
Highest header protocol type (extension header excluded).
- hdr_len: int¶
Header length (including extension headers).
- raw_len: int¶
Raw payload length (excluding extension headers).
Footnotes