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

ip.version

Version (6)

0

4

ip.class

Traffic Class

1

12

ip.label

Flow Label

4

32

ip.payload

Payload Length (header excludes)

6

48

ip.next

Next Header

7

56

ip.limit

Hop Limit

8

64

ip.src

Source Address

24

192

ip.dst

Destination Address


class pcapkit.protocols.internet.ipv6.IPv6(file=None, length=None, **kwargs)[source]

Bases: IP[IPv6]

This class implements Internet Protocol version 6.

Parameters
  • *args (Any) – Arbitrary positional arguments.

  • **kwargs (Any) – Arbitrary keyword arguments.

Return type

Protocol[PT]

classmethod __index__()[source]

Numeral registry index of the protocol.

Return type

TransType

Returns

Numeral registry index of the protocol in IANA.

property name: Literal['Internet Protocol version 6']

Name of corresponding protocol.

Return type

Literal[‘Internet Protocol version 6’]

property length: Literal[40]

Header length of corresponding protocol.

Return type

Literal[40]

property protocol: TransType

Name of next layer protocol.

Return type

TransType

property src: IPv6Address

Source IP address.

Return type

IPv6Address

property dst: IPv6Address

Destination IP address.

Return type

IPv6Address

property extension_headers: OrderedMultiDict[ExtensionHeader, Protocol]

IPv6 extension header records.

Return type

OrderedMultiDict[ExtensionHeader, Protocol]

read(length=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                      +
|                                                               |
+                                                               +
|                                                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Parameters
  • length (Optional[int]) – Length of packet data.

  • **kwargs (Any) – Arbitrary keyword arguments.

Return type

IPv6

Returns

Parsed packet data.

make(**kwargs)[source]

Make (construct) packet data.

Parameters

**kwargs (Any) – Arbitrary keyword arguments.

Return type

NoReturn

Returns

Constructed packet data.

classmethod id()[source]

Index ID of the protocol.

Returns

Index ID of the protocol.

Return type

tuple[Literal[“IPv6”]]

_read_ip_hextet()[source]

Read first four hextets of IPv6.

Returns

Parsed hextets data, including version number, traffic class and flow label.

Return type

tuple[int, int, int]

_read_ip_addr()[source]

Read IP address.

Return type

IPv6Address

Returns

Parsed IP address.

_decode_next_layer(ipv6, proto=None, length=None)[source]

Decode next layer extractor.

Parameters
  • ipv6 (IPv6) – info buffer

  • proto (Optional[int]) – next layer protocol name

  • length (Optional[int]) – valid (not padding) length

Return type

IPv6

Returns

Current protocol with next layer extracted.

Data Structures

class pcapkit.protocols.data.internet.ipv6.IPv6(version, class, label, payload, next, limit, src, dst)[source]

Bases: Info

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.

Parameters
  • *args (Any) – Arbitrary positional arguments.

  • **kwargs (Any) – Arbitrary keyword arguments.

Return type

IPv6

version: Literal[6]

Version.

class: int

Traffic class.

Note

This field is conflict with class keyword. To access this field, directly use getattr() instead.

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).


*

https://en.wikipedia.org/wiki/IPv6_packet