Source code for pcapkit.protocols.schema.link.vlan
# -*- coding: utf-8 -*-# mypy: disable-error-code=assignment"""header schema for 802.1Q Customer VLAN Tag Type protocol"""fromtypingimportTYPE_CHECKINGfrompcapkit.const.reg.ethertypeimportEtherTypeasEnum_EtherTypefrompcapkit.const.vlan.priority_levelimportPriorityLevelasEnum_PriorityLevelfrompcapkit.corekit.fields.miscimportPayloadFieldfrompcapkit.corekit.fields.numbersimportEnumField,UInt8Field,UInt16Fieldfrompcapkit.corekit.fields.stringsimportBitFieldfrompcapkit.protocols.schema.schemaimportSchema,schema_finalfrompcapkit.utilities.loggingimportSPHINX_TYPE_CHECKING__all__=['VLAN','TCI']ifTYPE_CHECKING:frompcapkit.protocols.protocolimportProtocolBaseasProtocolifSPHINX_TYPE_CHECKING:fromtyping_extensionsimportTypedDict
[docs]classTCIType(TypedDict):"""Type of 802.1Q Customer VLAN Tag Type tag control information."""#: Priority code point.pcp:int#: Drop eligible indicator.dei:int#: VLAN identifier.vid:int
[docs]@schema_finalclassTCI(Schema):"""Header schema for 802.1Q Customer VLAN Tag Type tag control information."""#: Priority code point.pcp:'Enum_PriorityLevel'=EnumField(length=1,bit_length=3,namespace=Enum_PriorityLevel)#: Drop eligible indicator.dei:'int'=UInt8Field(bit_length=1)#: VLAN identifier.vid:'int'=UInt16Field(bit_length=12)ifTYPE_CHECKING:def__init__(self,pcp:'Enum_PriorityLevel',dei:'int',vid:'int')->'None':...
[docs]@schema_finalclassVLAN(Schema):"""Header schema for 802.1Q Customer VLAN Tag Type packet."""#: Tag control information.tci:'TCIType'=BitField(length=2,namespace={'pcp':(0,3),'dei':(3,1),'vid':(4,12),},)#: EtherType.type:'Enum_EtherType'=EnumField(length=2,namespace=Enum_EtherType)#: Payload.payload:'bytes'=PayloadField()ifTYPE_CHECKING:def__init__(self,tci:'TCIType',type:'Enum_EtherType',payload:'bytes | Protocol | Schema')->'None':...