Source code for pcapkit.const.ipv6.option

# -*- coding: utf-8 -*-
# pylint: disable=line-too-long,consider-using-f-string
"""Destination Options and Hop-by-Hop Options
================================================

.. module:: pcapkit.const.ipv6.option

This module contains the constant enumeration for **Destination Options and Hop-by-Hop Options**,
which is automatically generated from :class:`pcapkit.vendor.ipv6.option.Option`.

"""

from typing import TYPE_CHECKING

from aenum import IntEnum

from pcapkit.corekit.enum import EnumRegistry
from pcapkit.utilities.exceptions import EnumValueError

if TYPE_CHECKING:
    from typing import Any

__all__ = ['Option']


[docs] class Option(EnumRegistry, IntEnum): """[Option] Destination Options and Hop-by-Hop Options""" #: Pad1 [:rfc:`2460`] Pad1 = 0x00 #: PadN [:rfc:`2460`] PadN = 0x01 #: Jumbo Payload [:rfc:`2675`] Jumbo_Payload = 0xC2 #: RPL Option [:rfc:`9008`] RPL_Option_0x23 = 0x23 #: RPL Option (DEPRECATED) [:rfc:`6553`][:rfc:`9008`] RPL_Option_0x63 = 0x63 #: Tunnel Encapsulation Limit [:rfc:`2473`] Tunnel_Encapsulation_Limit = 0x04 #: Router Alert (DEPRECATED for New Protocols) [:rfc:`2711`][:rfc:`9805`] Router_Alert = 0x05 #: Quick-Start [:rfc:`4782`][RFC Errata 2034] Quick_Start = 0x26 #: CALIPSO [:rfc:`5570`] CALIPSO = 0x07 #: SMF_DPD [:rfc:`6621`] SMF_DPD = 0x08 #: Home Address [:rfc:`6275`] Home_Address = 0xC9 #: Endpoint Identification (DEPRECATED) [CHARLES LYNN] Endpoint_Identification = 0x8A #: ILNP Nonce [:rfc:`6744`] ILNP_Nonce = 0x8B #: Line-Identification Option [:rfc:`6788`] Line_Identification_Option = 0x8C #: Deprecated [:rfc:`7731`] Deprecated = 0x4D #: MPL Option [:rfc:`7731`] MPL_Option = 0x6D #: IP_DFF [:rfc:`6971`] IP_DFF = 0xEE #: Performance and Diagnostic Metrics (PDM) [:rfc:`8250`] PDM = 0x0F #: Minimum Path MTU Hop-by-Hop Option [:rfc:`9268`] Minimum_Path_MTU_Hop_by_Hop_Option = 0x30 #: IOAM Destination Option and IOAM Hop-by-Hop Option [:rfc:`9486`] IOAM_Destination_Option_and_IOAM_Hop_by_Hop_Option_0x11 = 0x11 #: IOAM Destination Option and IOAM Hop-by-Hop Option [:rfc:`9486`] IOAM_Destination_Option_and_IOAM_Hop_by_Hop_Option_0x31 = 0x31 #: AltMark [:rfc:`9343`] AltMark = 0x12 #: RFC3692-style Experiment [:rfc:`4727`] RFC3692_style_Experiment_0x1E = 0x1E #: RFC3692-style Experiment [:rfc:`4727`] RFC3692_style_Experiment_0x3E = 0x3E #: RFC3692-style Experiment [:rfc:`4727`] RFC3692_style_Experiment_0x5E = 0x5E #: RFC3692-style Experiment [:rfc:`4727`] RFC3692_style_Experiment_0x7E = 0x7E #: RFC3692-style Experiment [:rfc:`4727`] RFC3692_style_Experiment_0x9E = 0x9E #: RFC3692-style Experiment [:rfc:`4727`] RFC3692_style_Experiment_0xBE = 0xBE #: RFC3692-style Experiment [:rfc:`4727`] RFC3692_style_Experiment_0xDE = 0xDE #: RFC3692-style Experiment [:rfc:`4727`] RFC3692_style_Experiment_0xFE = 0xFE
[docs] @classmethod def _validate_value(cls, value: 'Any') -> 'None': """Reject ``value`` unless it passes the range check :meth:`_missing_` makes. Overrides :meth:`~pcapkit.corekit.enum.EnumLookup._validate_value` with that check and the message it raises, so :meth:`~pcapkit.corekit.enum.EnumRegistry.register` refuses exactly the values :meth:`~pcapkit.corekit.enum.EnumLookup.get` refuses, in the same words (:issue:`1816`). Args: value: Value about to be looked up or minted. Raises: EnumValueError: If ``value`` fails that check. A :exc:`ValueError`, so an ``except ValueError`` caller is unaffected. """ if not (isinstance(value, int) and 0x00 <= value <= 0xFF): raise EnumValueError('%r is not a valid %s' % (value, cls.__name__))
[docs] @classmethod def _missing_(cls, value: 'int') -> 'Option': """Lookup function used when value is not found. Args: value: Value to get enum item. """ if not (isinstance(value, int) and 0x00 <= value <= 0xFF): raise ValueError('%r is not a valid %s' % (value, cls.__name__)) return cls._unregistered_member(value, 'Unassigned')