Source code for pcapkit.const.hip.esp_transform_suite

# -*- coding: utf-8 -*-
# pylint: disable=line-too-long,consider-using-f-string
"""ESP Transform Suite IDs
=============================

.. module:: pcapkit.const.hip.esp_transform_suite

This module contains the constant enumeration for **ESP Transform Suite IDs**,
which is automatically generated from :class:`pcapkit.vendor.hip.esp_transform_suite.ESPTransformSuite`.

"""

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__ = ['ESPTransformSuite']


[docs] class ESPTransformSuite(EnumRegistry, IntEnum): """[ESPTransformSuite] ESP Transform Suite IDs""" #: RESERVED [:rfc:`7402`] RESERVED_0 = 0 #: AES-128-CBC with HMAC-SHA1 [:rfc:`3602`][:rfc:`2404`] AES_128_CBC_with_HMAC_SHA1 = 1 #: DEPRECATED [:rfc:`7402`] DEPRECATED_2 = 2 #: DEPRECATED [:rfc:`7402`] DEPRECATED_3 = 3 #: DEPRECATED [:rfc:`7402`] DEPRECATED_4 = 4 #: DEPRECATED [:rfc:`7402`] DEPRECATED_5 = 5 #: DEPRECATED [:rfc:`7402`] DEPRECATED_6 = 6 #: NULL with HMAC-SHA-256 [:rfc:`2410`][:rfc:`4868`] NULL_with_HMAC_SHA_256 = 7 #: AES-128-CBC with HMAC-SHA-256 [:rfc:`3602`][:rfc:`4868`] AES_128_CBC_with_HMAC_SHA_256 = 8 #: AES-256-CBC with HMAC-SHA-256 [:rfc:`3602`][:rfc:`4868`] AES_256_CBC_with_HMAC_SHA_256 = 9 #: AES-CCM-8 [:rfc:`4309`] AES_CCM_8 = 10 #: AES-CCM-16 [:rfc:`4309`] AES_CCM_16 = 11 #: AES-GCM with an 8 octet ICV [:rfc:`4106`] AES_GCM_with_an_8_octet_ICV = 12 #: AES-GCM with a 16 octet ICV [:rfc:`4106`] AES_GCM_with_a_16_octet_ICV = 13 #: AES-CMAC-96 [:rfc:`4493`][:rfc:`4494`] AES_CMAC_96 = 14 #: AES-GMAC [:rfc:`4543`] AES_GMAC = 15
[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 0 <= value <= 65535): raise EnumValueError('%r is not a valid %s' % (value, cls.__name__))
[docs] @classmethod def _missing_(cls, value: 'int') -> 'ESPTransformSuite': """Lookup function used when value is not found. Args: value: Value to get enum item. """ if not (isinstance(value, int) and 0 <= value <= 65535): raise ValueError('%r is not a valid %s' % (value, cls.__name__)) if 16 <= value <= 65535: #: Unassigned return cls._unregistered_member(value, 'Unassigned') return super()._missing_(value)