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]¶
-
This class implements Open Shortest Path First.
- Parameters
*args (Any) – Arbitrary positional arguments.
**kwargs (Any) – Arbitrary keyword arguments.
- Return type
Protocol[PT]
- classmethod __index__()[source]¶
Numeral registry index of the protocol.
- Raises
UnsupportedCall – This protocol has no registry entry.
- 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 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- _read_encrypt_auth()[source]¶
Read Authentication field when Cryptographic Authentication is employed, i.e.
autype
is2
.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 – packet length
- Return type
- Returns
Parsed packet data.
Data Structures¶
- class pcapkit.protocols.data.link.ospf.OSPF(version, type, length, router_id, area_id, chksum, autype)[source]¶
Bases:
Info
Data model for OSPF packet.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type
- router_id: IPv4Address¶
Router ID.
- area_id: IPv4Address¶
Area ID.
- autype: Authentication¶
Authentication type.
- auth: bytes | CrytographicAuthentication¶
Authentication.
- class pcapkit.protocols.data.link.ospf.CrytographicAuthentication(key_id, len, seq)[source]¶
Bases:
Info
Data model for OSPF crytographic authentication.
- Parameters
*args (VT) – Arbitrary positional arguments.
**kwargs (VT) – Arbitrary keyword arguments.
- Return type