# -*- coding: utf-8 -*-# pylint: disable=line-too-long,consider-using-f-string"""OSPF Packet Types=======================.. module:: pcapkit.const.ospf.packetThis module contains the constant enumeration for **OSPF Packet Types**,which is automatically generated from :class:`pcapkit.vendor.ospf.packet.Packet`."""fromaenumimportIntEnum,extend_enum__all__=['Packet']
[docs]classPacket(IntEnum):"""[Packet] OSPF Packet Types"""#: ReservedReserved_0=0#: Hello [:rfc:`2328`]Hello=1#: Database Description [:rfc:`2328`]Database_Description=2#: Link State Request [:rfc:`2328`]Link_State_Request=3#: Link State Update [:rfc:`2328`]Link_State_Update=4#: Link State Ack [:rfc:`2328`]Link_State_Ack=5@staticmethoddefget(key:'int | str',default:'int'=-1)->'Packet':"""Backport support for original codes. Args: key: Key to get enum item. default: Default value if not found. :meta private: """ifisinstance(key,int):returnPacket(key)ifkeynotinPacket._member_map_:# pylint: disable=no-memberreturnextend_enum(Packet,key,default)returnPacket[key]# type: ignore[misc]
[docs]@classmethoddef_missing_(cls,value:'int')->'Packet':"""Lookup function used when value is not found. Args: value: Value to get enum item. """ifnot(isinstance(value,int)and0<=value<=65535):raiseValueError('%r is not a valid %s'%(value,cls.__name__))if6<=value<=127:#: Unassignedreturnextend_enum(cls,'Unassigned_%d'%value,value)if128<=value<=255:#: Reservedreturnextend_enum(cls,'Reserved_%d'%value,value)returnsuper()._missing_(value)