IPv6-Route - Routing Header for IPv6

pcapkit.protocols.internet.ipv6_route contains IPv6_Route only, which implements extractor for Routing Header for IPv6 (IPv6-Route) *, whose structure is described as below:

Octets

Bits

Name

Description

0

0

route.next

Next Header

1

8

route.length

Header Extensive Length

2

16

route.type

Routing Type

3

24

route.seg_left

Segments Left

4

32

route.data

Type-Specific Data


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

Bases: pcapkit.protocols.internet.internet.Internet

This class implements Routing Header for IPv6.

classmethod __index__()[source]

Numeral registry index of the protocol.

Returns

Numeral registry index of the protocol in IANA.

Return type

pcapkit.const.reg.transtype.TransType

__length_hint__()[source]

Return an estimated length for the object.

Return type

Literal[4]

__post_init__(file, length=None, *, extension=False, **kwargs)[source]

Post initialisation hook.

Parameters
  • file (io.BytesIO) – Source packet stream.

  • length (Optional[int]) – Length of packet data.

Keyword Arguments
  • extension (bool) – If the protocol is used as an IPv6 extension header.

  • **kwargs – Arbitrary keyword arguments.

See also

For construction argument, please refer to make().

_read_data_type_2(length)[source]

Read IPv6-Route Type 2 data.

Structure of IPv6-Route Type 2 data [RFC 6275]:

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|  Next Header  | Hdr Ext Len=2 | Routing Type=2|Segments Left=1|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                            Reserved                           |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                                                               |
+                                                               +
|                                                               |
+                         Home Address                          +
|                                                               |
+                                                               +
|                                                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Parameters

length (int) – route data length

Returns

parsed route data

Return type

DataType_IPv6_Route_2

Raises

ProtocolError – If length is NOT 20.

_read_data_type_none(length)[source]

Read IPv6-Route unknown type data.

Structure of IPv6-Route unknown type data [RFC 8200][RFC 5095]:

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|  Next Header  |  Hdr Ext Len  |  Routing Type | Segments Left |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                                                               |
.                                                               .
.                       type-specific data                      .
.                                                               .
|                                                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Parameters

length (int) – route data length

Returns

parsed route data

Return type

DataType_IPv6_Route_None

_read_data_type_rpl(length)[source]

Read IPv6-Route RPL Source data.

Structure of IPv6-Route RPL Source data [RFC 6554]:

 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|  Next Header  |  Hdr Ext Len  | Routing Type  | Segments Left |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| CmprI | CmprE |  Pad  |               Reserved                |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                                                               |
.                                                               .
.                        Addresses[1..n]                        .
.                                                               .
|                                                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Parameters

length (int) – route data length

Returns

parsed route data

Return type

DataType_IPv6_Route_RPL

Raises

ProtocolError – If length is NOT 20.

_read_data_type_src(length)[source]

Read IPv6-Route Source Route data.

Structure of IPv6-Route Source Route data [RFC 5095]:

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|  Next Header  |  Hdr Ext Len  | Routing Type=0| Segments Left |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                            Reserved                           |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                                                               |
+                                                               +
|                                                               |
+                           Address[1]                          +
|                                                               |
+                                                               +
|                                                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                                                               |
+                                                               +
|                                                               |
+                           Address[2]                          +
|                                                               |
+                                                               +
|                                                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
.                               .                               .
.                               .                               .
.                               .                               .
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                                                               |
+                                                               +
|                                                               |
+                           Address[n]                          +
|                                                               |
+                                                               +
|                                                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Parameters

length (int) – route data length

Returns

parsed route data

Return type

DataType_IPv6_Route_Source

make(**kwargs)[source]

Make (construct) packet data.

Keyword Arguments

**kwargs – Arbitrary keyword arguments.

Returns

Constructed packet data.

Return type

bytes

read(length=None, *, extension=False, **kwargs)[source]

Read Routing Header for IPv6.

Structure of IPv6-Route header [RFC 8200][RFC 5095]:

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|  Next Header  |  Hdr Ext Len  |  Routing Type | Segments Left |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                                                               |
.                                                               .
.                       type-specific data                      .
.                                                               .
|                                                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Parameters

length (Optional[int]) – Length of packet data.

Keyword Arguments
  • extension (bool) – If the packet is used as an IPv6 extension header.

  • **kwargs – Arbitrary keyword arguments.

Returns

Parsed packet data.

Return type

DataType_IPv6_Route

property alias

Acronym of corresponding protocol.

Return type

Literal[‘IPv6-Route’]

property length

Header length of current protocol.

Return type

int

property name

Name of current protocol.

Return type

Literal[‘Routeing Header for IPv6’]

property payload

Payload of current instance.

Raises

UnsupportedCall – if the protocol is used as an IPv6 extension header

Return type

pcapkit.protocols.protocol.Protocol

property protocol

Name of next layer protocol.

Return type

pcapkit.const.reg.transtype.TransType

pcapkit.protocols.internet.ipv6_route._ROUTE_PROC: Dict[int, str]

IPv6 routing processors.

Code

Processor

Note

0

_read_data_type_src()

[RFC 5095] DEPRECATED

2

_read_data_type_2()

[RFC 6275]

3

_read_data_type_rpl()

[RFC 6554]

Data Structure

Important

Following classes are only for documentation purpose. They do NOT exist in the pcapkit module.

class pcapkit.protocols.internet.ipv6_route.DataType_IPv6_Route

Structure of IPv6-Route header [RFC 8200][RFC 5095].

next: pcapkit.const.reg.transtype.TransType

Next header.

length: int

Header extensive length.

type: pcapkit.const.ipv6.routing.Routing

Routing type.

seg_left: int

Segments left.

packet: bytes

Raw packet data.

IPv6-Route Unknown Type

For IPv6-Route unknown type data as described in RFC 8200 and RFC 5095, its structure is described as below:

Octets

Bits

Name

Description

0

0

route.next

Next Header

1

8

route.length

Header Extensive Length

2

16

route.type

Routing Type

3

24

route.seg_left

Segments Left

4

32

route.data

Type-Specific Data


class pcapkit.protocols.internet.ipv6_route.DataType_IPv6_Route_None
Bases

TypedDict

Structure of IPv6-Route unknown type data [RFC 8200][RFC 5095].

data: bytes

Type-specific data.

IPv6-Route Source Route

For IPv6-Route Source Route data as described in RFC 5095, its structure is described as below:

Octets

Bits

Name

Description

0

0

route.next

Next Header

1

8

route.length

Header Extensive Length

2

16

route.type

Routing Type

3

24

route.seg_left

Segments Left

4

32

Reserved

8

64

route.ip

Address


class pcapkit.protocols.internet.ipv6_route.DataType_IPv6_Route_Source
Bases

TypedDict

Structure of IPv6-Route Source Route data [RFC 5095].

ip: Tuple[ipaddress.IPv6Address]

Array of IPv6 addresses.

IPv6-Route Type 2

For IPv6-Route Type 2 data as described in RFC 6275, its structure is described as below:

Octets

Bits

Name

Description

0

0

route.next

Next Header

1

8

route.length

Header Extensive Length

2

16

route.type

Routing Type

3

24

route.seg_left

Segments Left

4

32

Reserved

8

64

route.ip

Home Address


class pcapkit.protocols.internet.ipv6_route.DataType_IPv6_Route_2
Bases

TypedDict

Structure of IPv6-Route Type 2 data [RFC 6275].

ip: ipaddress.IPv6Address

Home IPv6 addresses.

IPv6-Route RPL Source

For IPv6-Route RPL Source data as described in RFC 6554, its structure is described as below:

Octets

Bits

Name

Description

0

0

route.next

Next Header

1

8

route.length

Header Extensive Length

2

16

route.type

Routing Type

3

24

route.seg_left

Segments Left

4

32

route.cmpr_i

CmprI

4

36

route.cmpr_e

CmprE

5

40

route.pad

Pad Size

5

44

Reserved

8

64

route.ip

Addresses


class pcapkit.protocols.internet.ipv6_route.DataType_IPv6_Route_RPL
Bases

TypedDict

Structure of IPv6-Route RPL Source data [RFC 6554].

cmpr_i: int

CmprI.

cmpr_e: int

CmprE.

pad: int

Pad size.

ip: Tuple[Union[ipaddress.IPv4Address, ipaddress.IPv6Address]]

Array of IPv4 and/or IPv6 addresses.


*

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