MH - Mobility Header

pcapkit.protocols.internet.mh contains MH only, which implements extractor for Mobility Header (MH) *, whose structure is described as below:

Octets

Bits

Name

Description

0

0

mh.next

Next Header

1

8

mh.length

Header Length

2

16

mh.type

Mobility Header Type

3

24

Reserved

4

32

mh.chksum

Checksum

6

48

mh.data

Message Data


Todo

Implements extractor for message data of all MH types.

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

Bases: Internet[MH]

This class implements Mobility Header.

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

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

Return type

Protocol[PT]

__post_init__(file: BinaryIO, length: Optional[int] = None, *, version: Literal[4, 6] = 4, extension: bool = False, **kwargs: Any) None[source]
__post_init__(**kwargs: Any) None

Post initialisation hook.

Parameters
  • file (Optional[BinaryIO]) – Source packet stream.

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

  • version (Literal[4, 6]) – IP protocol version.

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

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

See also

For construction argument, please refer to make().

Return type

None

classmethod __index__()[source]

Numeral registry index of the protocol.

Return type

TransType

Returns

Numeral registry index of the protocol in IANA.

property name: Literal['Mobility Header']

Name of current protocol.

Return type

Literal[‘Mobility Header’]

property length: int

Header length of current protocol.

Return type

int

property payload: Protocol | NoReturn

Payload of current instance.

Raises

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

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, *, version=4, extension=False, **kwargs)[source]

Read Mobility Header.

Structure of MH header [RFC 6275]:

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Payload Proto |  Header Len   |   MH Type     |   Reserved    |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|           Checksum            |                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               |
|                                                               |
.                                                               .
.                       Message Data                            .
.                                                               .
|                                                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Parameters
  • length (Optional[int]) – Length of packet data.

  • version (Literal[4, 6]) – IP protocol version.

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

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

Return type

MH

Returns

Parsed packet data.

make(**kwargs)[source]

Make (construct) packet data.

Parameters

**kwargs (Any) – Arbitrary keyword arguments.

Return type

NoReturn

Returns

Constructed packet data.

Data Structures

class pcapkit.protocols.data.internet.mh.MH(next, length, type, chksum, data)[source]

Bases: Info

Data model for MH protocol.

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

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

Return type

Info

next: TransType

Next header.

length: int

Header length.

type: Packet

Mobility header type.

chksum: bytes

Checksum.

data: bytes

Message data.


*

https://en.wikipedia.org/wiki/Mobile_IP#Changes_in_IPv6_for_Mobile_IPv6