Source code for pcapkit.protocols.data.application.ospf
# -*- coding: utf-8 -*-
"""data models for OSPF protocol"""
from typing import TYPE_CHECKING
from pcapkit.corekit.infoclass import info_final
from pcapkit.protocols.data.data import Data
from pcapkit.protocols.data.protocol import Protocol
if TYPE_CHECKING:
from ipaddress import IPv4Address
from pcapkit.const.ospf.authentication import Authentication
from pcapkit.const.ospf.packet import Packet
__all__ = ['OSPF', 'CryptographicAuthentication']
[docs]
@info_final
class CryptographicAuthentication(Data):
"""Data model for OSPF cryptographic authentication.
.. versionadded:: 1.5.0
Renamed from ``CrytographicAuthentication``, which
:mod:`pcapkit.protocols.data` exported as
``OSPF_CrytographicAuthentication`` (:issue:`1090`).
.. versionremoved:: 1.5.0
``CrytographicAuthentication`` and ``OSPF_CrytographicAuthentication``,
with no alias (:issue:`1090`).
"""
#: The two reserved octets, as captured.
reserved: 'bytes'
#: Key ID.
key_id: 'int'
#: Authentication data length.
len: 'int'
#: Cryptographic sequence number.
seq: 'int'
if TYPE_CHECKING:
def __init__(self, reserved: 'bytes', key_id: 'int', len: 'int', seq: 'int') -> 'None': ... # pylint: disable=unused-argument,super-init-not-called,multiple-statements,redefined-builtin
[docs]
@info_final
class OSPF(Protocol):
"""Data model for OSPF packet."""
#: Version number.
version: 'int'
#: Type.
type: 'Packet'
#: Packet length (header included).
len: 'int'
#: Router ID.
router_id: 'IPv4Address'
#: Area ID.
area_id: 'IPv4Address'
#: Checksum.
chksum: 'bytes'
#: Authentication type.
autype: 'Authentication'
if TYPE_CHECKING:
#: Authentication.
auth: 'bytes | CryptographicAuthentication'
#: Octets captured past the Packet Length, present only when there are
#: any.
trailer: 'bytes'
def __init__(self, version: 'int', type: 'Packet', len: 'int', router_id: 'IPv4Address',
area_id: 'IPv4Address', chksum: 'bytes', autype: 'Authentication') -> 'None': ... # pylint: disable=super-init-not-called,unused-argument,line-too-long,multiple-statements,redefined-builtin