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 |
|
Next Header |
1 |
8 |
|
Header Extensive Length |
2 |
16 |
|
Routing Type |
3 |
24 |
|
Segments Left |
4 |
32 |
|
Type-Specific Data |
- class pcapkit.protocols.internet.ipv6_route.IPv6_Route(file=None, length=None, **kwargs)[source]¶
Bases:
Internet
[IPv6_Route
]This class implements Routing Header for IPv6.
This class currently supports parsing of the following Routing Header for IPv6 routing data types, which are registered in the
self.__routing__
attribute:Routing Code
Data Parser
- Parameters
*args (Any) – Arbitrary positional arguments.
**kwargs (Any) – Arbitrary keyword arguments.
- Return type
Protocol[PT]
- __post_init__(file: BinaryIO, length: Optional[int] = None, *, extension: bool = False, **kwargs: Any) None [source]¶
- __post_init__(**kwargs: Any) None
Post initialisation hook.
- Parameters
- Keyword Arguments
extension – If the protocol is used as an IPv6 extension header.
**kwargs – Arbitrary keyword arguments.
See also
For construction argument, please refer to
make()
.- Return type
- property name: Literal['Routing Header for IPv6']¶
Name of current protocol.
- Return type
Literal
[‘Routing Header for IPv6’]
- property alias: Literal['IPv6-Route']¶
Acronym of corresponding protocol.
- Return type
Literal
[‘IPv6-Route’]
- property payload: Protocol | NoReturn¶
Payload of current instance.
- Raises
UnsupportedCall – if the protocol is used as an IPv6 extension header
- Return type
- property protocol: Optional[str] | NoReturn¶
Name of next layer protocol (if any).
- Raises
UnsupportedCall – if the protocol is used as an IPv6 extension header
- property protochain: ProtoChain | NoReturn¶
Protocol chain of current instance.
- Raises
UnsupportedCall – if the protocol is used as an IPv6 extension header
- 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
- Return type
- Returns
Parsed packet data.
- classmethod register_routing(code, meth)[source]¶
Register an routing data parser.
- Parameters
code (RegType_Routing) – IPv6-Route data type code.
meth (str | TypeParser) – Method name or callable to parse the data.
- Return type
None
- _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- Return type
- Returns
Parsed route data.
- _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- Return type
- Returns
Parsed route data.
- _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- Return type
- Returns
Parsed route data.
- Raises
ProtocolError – If
length
is NOT20
.
- _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- Return type
- Returns
Parsed route data.
- Raises
ProtocolError – If
length
is NOT20
.
Data Structures¶
- class pcapkit.protocols.data.internet.ipv6_route.IPv6_Route(next, length, type, seg_left)[source]¶
Bases:
Info
Data model for IPv6-Route protocol.
See also
The type-specific routing data is stored directly in the top-level
IPv6_Route
object. Please refer to theRoutingType
subclasses for the details.- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.internet.ipv6_route.RoutingType[source]¶
Bases:
Info
Data model for Routing Type.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.internet.ipv6_route.UnknownType(data)[source]¶
Bases:
RoutingType
Data model for IPv6-Route unknown type.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.internet.ipv6_route.SourceRoute(ip)[source]¶
Bases:
RoutingType
Data model for IPv6-Route Source Route data type.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- class pcapkit.protocols.data.internet.ipv6_route.Type2(ip)[source]¶
Bases:
RoutingType
Data model for IPv6-Route Type 2 data type.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- ip: IPv6Address¶
Address.
- class pcapkit.protocols.data.internet.ipv6_route.RPL(cmpr_i, cmpr_e, pad, ip)[source]¶
Bases:
RoutingType
Data model for RPL Source data type.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type