OSPF - Open Shortest Path First¶
pcapkit.protocols.link.ospf contains
OSPF only,
which implements extractor for Open Shortest Path
First (OSPF) *, whose structure is described
as below:
Octets |
Bits |
Name |
Description |
|---|---|---|---|
0 |
0 |
|
Version Number |
0 |
0 |
|
Type |
0 |
1 |
|
Packet Length (header included) |
0 |
2 |
|
Router ID |
0 |
4 |
|
Area ID |
0 |
6 |
|
Checksum |
0 |
7 |
|
Authentication Type |
1 |
8 |
|
Authentication |
-
class
pcapkit.protocols.link.ospf.OSPF(file=None, length=None, **kwargs)[source]¶ Bases:
pcapkit.protocols.link.link.LinkThis class implements Open Shortest Path First.
-
classmethod
__index__()[source]¶ Numeral registry index of the protocol.
- Raises
UnsupportedCall – This protocol has no registry entry.
-
_read_encrypt_auth()[source]¶ Read Authentication field when Cryptographic Authentication is employed, i.e.
autypeis2.Structure of Cryptographic Authentication [RFC 2328]:
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 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 0 | Key ID | Auth Data Len | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Cryptographic sequence number | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters
length (int) – packet length
- Returns
Parsed packet data.
- class Auth(TypedDict):
”””Cryptographic authentication.”””
#: key ID key_id: int #: authentication data length len: int #: cryptographic sequence number seq: int
- Return type
-
_read_id_numbers()[source]¶ Read router and area IDs.
- Returns
Parsed IDs as an IPv4 address.
- Return type
IPv4Address
-
make(**kwargs)[source]¶ Make (construct) packet data.
- Keyword Arguments
**kwargs – Arbitrary keyword arguments.
- Returns
Constructed packet data.
- Return type
-
read(length=None, **kwargs)[source]¶ Read Open Shortest Path First.
Structure of OSPF header [RFC 2328]:
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 # | Type | Packet length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Router ID | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Area ID | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Checksum | AuType | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Authentication | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Authentication | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Parameters
length (Optional[int]) – Length of packet data.
- Keyword Arguments
**kwargs – Arbitrary keyword arguments.
- Returns
Parsed packet data.
- Return type
-
property
length¶ Header length of current protocol.
- Return type
Literal[24]
-
property
type¶ OSPF packet type.
- Return type
-
classmethod
Data Structure¶
Important
Following classes are only for documentation purpose.
They do NOT exist in the pcapkit module.
-
class
pcapkit.protocols.link.ospf.DataType_OSPF¶ - Bases
TypedDict
OSPF header.
-
type: pcapkit.const.ospf.packet.Packet¶ type
-
router_id: ipaddress.IPv4Address¶ router ID
-
area_id: ipaddress.IPv4Address¶ area ID
-
autype: pcapkit.const.ospf.authentication.Authentication¶ authentication type
Cryptographic Authentication Information¶
For cryptographic authentication information as described in RFC 2328, its structure is described as below:
Octets |
Bits |
Name |
Description |
|---|---|---|---|
0 |
0 |
Reserved (must be zero |
|
0 |
0 |
|
Key ID |
0 |
1 |
|
Authentication Data Length |
0 |
2 |
|
Cryptographic Sequence Number |
-
class
pcapkit.protocols.link.ospf.DataType_Auth¶ - Bases
TypedDict
Cryptographic authentication.