Source code for pcapkit.const.pcapng.block_type
# -*- coding: utf-8 -*-
# pylint: disable=line-too-long,consider-using-f-string
"""Block Types
=================
.. module:: pcapkit.const.pcapng.block_type
This module contains the constant enumeration for **Block Types**,
which is automatically generated from :class:`pcapkit.vendor.pcapng.block_type.BlockType`.
"""
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__ = ['BlockType']
[docs]
class BlockType(EnumRegistry, IntEnum):
"""[BlockType] Block Types"""
#: Reserved ???
Reserved_0x00000000 = 0x00000000
#: Interface Description Block ( Section 4.2 )
Interface_Description_Block = 0x00000001
#: Packet Block ( Appendix A )
Packet_Block = 0x00000002
#: Simple Packet Block ( Section 4.4 )
Simple_Packet_Block = 0x00000003
#: Name Resolution Block ( Section 4.5 )
Name_Resolution_Block = 0x00000004
#: Interface Statistics Block ( Section 4.6 )
Interface_Statistics_Block = 0x00000005
#: Enhanced Packet Block ( Section 4.3 )
Enhanced_Packet_Block = 0x00000006
#: IRIG Timestamp Block (requested by Gianluca Varenni
#: <gianluca.varenni@cacetech.com>, CACE Technologies LLC); code also used for
#: Socket Aggregation Event Block
IRIG_Timestamp_Block = 0x00000007
#: ARINC 429 in AFDX Encapsulation Information Block (requested by Gianluca
#: Varenni <gianluca.varenni@cacetech.com>, CACE Technologies LLC)
ARINC_429_in_AFDX_Encapsulation_Information_Block = 0x00000008
#: systemd Journal Export Block ( Section 4.7 )
systemd_Journal_Export_Block = 0x00000009
#: Decryption Secrets Block ( Section 4.8 )
Decryption_Secrets_Block = 0x0000000a
#: Hone Project Machine Info Block (see also Google version )
Hone_Project_Machine_Info_Block = 0x00000101
#: Hone Project Connection Event Block (see also Google version )
Hone_Project_Connection_Event_Block = 0x00000102
#: Sysdig Machine Info Block
Sysdig_Machine_Info_Block = 0x00000201
#: Sysdig Process Info Block, version 1
Sysdig_Process_Info_Block_version_1 = 0x00000202
#: Sysdig FD List Block
Sysdig_FD_List_Block = 0x00000203
#: Sysdig Event Block
Sysdig_Event_Block = 0x00000204
#: Sysdig Interface List Block
Sysdig_Interface_List_Block = 0x00000205
#: Sysdig User List Block
Sysdig_User_List_Block = 0x00000206
#: Sysdig Process Info Block, version 2
Sysdig_Process_Info_Block_version_2 = 0x00000207
#: Sysdig Event Block with flags
Sysdig_Event_Block_with_flags = 0x00000208
#: Sysdig Process Info Block, version 3
Sysdig_Process_Info_Block_version_3 = 0x00000209
#: Sysdig Process Info Block, version 4
Sysdig_Process_Info_Block_version_4 = 0x00000210
#: Sysdig Process Info Block, version 5
Sysdig_Process_Info_Block_version_5 = 0x00000211
#: Sysdig Process Info Block, version 6
Sysdig_Process_Info_Block_version_6 = 0x00000212
#: Sysdig Process Info Block, version 7
Sysdig_Process_Info_Block_version_7 = 0x00000213
#: Custom Block that rewriters can copy into new files ( Section 4.9 )
Custom_Block_that_rewriters_can_copy_into_new_files = 0x00000bad
#: Custom Block that rewriters should not copy into new files ( Section 4.9 )
Custom_Block_that_rewriters_should_not_copy_into_new_files = 0x40000bad
#: Section Header Block ( Section 4.1 )
Section_Header_Block = 0x0a0d0d0a
[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 <= 0xFFFFFFFF):
raise EnumValueError('%r is not a valid %s' % (value, cls.__name__))
[docs]
@classmethod
def _missing_(cls, value: 'int') -> 'BlockType':
"""Lookup function used when value is not found.
Args:
value: Value to get enum item.
"""
if not (isinstance(value, int) and 0 <= value <= 0xFFFFFFFF):
raise ValueError('%r is not a valid %s' % (value, cls.__name__))
if 0x0a0d0a00 <= value <= 0x0a0d0aff:
#: Reserved. Used to detect trace files corrupted because of file transfers using the HTTP protocol in text mode.
return cls._unregistered_member(value, 'Reserved')
if 0x000a0d0a <= value <= 0xff0a0d0a:
#: Reserved. Used to detect trace files corrupted because of file transfers using the HTTP protocol in text mode.
return cls._unregistered_member(value, 'Reserved')
if 0x000a0d0d <= value <= 0xff0a0d0d:
#: Reserved. Used to detect trace files corrupted because of file transfers using the HTTP protocol in text mode.
return cls._unregistered_member(value, 'Reserved')
if 0x0d0d0a00 <= value <= 0x0d0d0aff:
#: Reserved. Used to detect trace files corrupted because of file transfers using the FTP protocol in text mode.
return cls._unregistered_member(value, 'Reserved')
if 0x80000000 <= value <= 0xffffffff:
#: Reserved for local use.
return cls._unregistered_member(value, 'Reserved')
return super()._missing_(value)