Source code for pcapkit.protocols.schema.internet.ipv6
# -*- coding: utf-8 -*-# mypy: disable-error-code=assignment"""header schema for internet protocol version 6"""fromtypingimportTYPE_CHECKINGfrompcapkit.const.reg.transtypeimportTransTypeasEnum_TransTypefrompcapkit.corekit.fields.ipaddressimportIPv6AddressFieldfrompcapkit.corekit.fields.miscimportPayloadFieldfrompcapkit.corekit.fields.numbersimportEnumField,UInt8Field,UInt16Fieldfrompcapkit.corekit.fields.stringsimportBitFieldfrompcapkit.protocols.schema.schemaimportSchema,schema_finalfrompcapkit.utilities.loggingimportSPHINX_TYPE_CHECKING__all__=['IPv6']ifTYPE_CHECKING:fromipaddressimportIPv6Addressfrompcapkit.protocols.protocolimportProtocolBaseasProtocolifSPHINX_TYPE_CHECKING:fromtyping_extensionsimportTypedDict#: Version, traffic class and flow label.IPv6Hextet=TypedDict('IPv6Hextet',{#: Version.'version':int,#: Traffic class.'class':int,#: Flow label.'label':int,})
[docs]@schema_finalclassIPv6(Schema):"""Header schema for IPv6 packet."""#: Version, traffic class and flow label.hextet:'IPv6Hextet'=BitField(length=4,namespace={'version':(0,4),'class':(4,8),'label':(8,20),})#: Payload length.length:int=UInt16Field()#: Next header.next:'Enum_TransType'=EnumField(length=1,namespace=Enum_TransType)#: Hop limit.limit:int=UInt8Field()#: Source address.src:'IPv6Address'=IPv6AddressField()#: Destination address.dst:'IPv6Address'=IPv6AddressField()#: Payload.payload:'bytes'=PayloadField(length=lambdapkt:pkt['length'])ifTYPE_CHECKING:def__init__(self,hextet:'IPv6Hextet',length:'int',next:'Enum_TransType',limit:'int',src:'IPv6Address | bytes | str | int',dst:'IPv6Address | bytes | str | int',payload:'bytes | Protocol | Schema')->None:...