VLAN - 802.1Q Customer VLAN Tag Type

pcapkit.protocols.link.vlan contains VLAN only, which implements extractor for 802.1Q Customer VLAN Tag Type [*], whose structure is described as below:

Octets

Bits

Name

Description

1

0

vlan.tci

Tag Control Information

1

0

vlan.tci.pcp

Priority Code Point

1

3

vlan.tci.dei

Drop Eligible Indicator

1

4

vlan.tci.vid

VLAN Identifier

3

24

vlan.type

Protocol (Internet Layer)

class pcapkit.protocols.link.vlan.VLAN(file=None, length=None, **kwargs)[source]

Bases: Link[VLAN, VLAN]

This class implements 802.1Q Customer VLAN Tag Type.

property name: Literal['802.1Q Customer VLAN Tag Type']

Name of current protocol.

property alias: Literal['802.1Q']

Acronym of corresponding protocol.

property info_name: Literal['c_tag']

Key name of the info dict.

property length: Literal[4]

Header length of current protocol.

property protocol: EtherType

Name of next layer protocol.

read(length=None, **kwargs)[source]

Read 802.1Q Customer VLAN Tag Type.

Structure of 802.1Q Customer VLAN Tag Type [IEEE 802.1Q]:

 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|              TCI              |                               |
|-------------------------------|                               |
|  P  |D|                       |             Type              |
|  C  |E|          VID          |                               |
|  P  |I|                       |                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Parameters:
  • length (Optional[int]) – Length of packet data.

  • **kwargs (Any) – Arbitrary keyword arguments.

Return type:

VLAN

Returns:

Parsed packet data.

make(tci=None, pcp=<PriorityLevel.BE: 0>, pcp_default=None, pcp_namespace=None, pcp_reversed=False, dei=False, vid=0, type=<EtherType.Internet_Protocol_version_4: 2048>, type_default=None, type_namespace=None, type_reversed=False, payload=b'', **kwargs)[source]

Make (construct) packet data.

Parameters:
Return type:

VLAN

Returns:

Constructed packet data.

classmethod _make_data(data)[source]

Create key-value pairs from data for protocol construction.

Parameters:

data (VLAN) – protocol data

Return type:

dict[str, Any]

Returns:

Key-value pairs for protocol construction.

classmethod __index__()[source]

Numeral registry index of the protocol.

Raises:

UnsupportedCall – This protocol has no registry entry.

Return type:

NoReturn

Header Schemas

class pcapkit.protocols.schema.link.vlan.VLAN(dict_=None, **kwargs)[source]

Bases: Schema

Header schema for 802.1Q Customer VLAN Tag Type packet.

tci: TCIType = <BitField tci>

Tag control information.

type: Enum_EtherType = <EnumField type>

EtherType.

payload: bytes = <PayloadField payload>

Payload.

class pcapkit.protocols.schema.link.vlan.TCI(dict_=None, **kwargs)[source]

Bases: Schema

Header schema for 802.1Q Customer VLAN Tag Type tag control information.

pcp: Enum_PriorityLevel = <EnumField pcp>

Priority code point.

dei: int = <UInt8Field dei>

Drop eligible indicator.

vid: int = <UInt16Field vid>

VLAN identifier.

Type Stubs

class pcapkit.protocols.schema.link.vlan.TCIType[source]

Bases: TypedDict

Type of 802.1Q Customer VLAN Tag Type tag control information.

pcp: int

Priority code point.

dei: int

Drop eligible indicator.

vid: int

VLAN identifier.

Data Models

class pcapkit.protocols.data.link.vlan.VLAN(*args: VT, **kwargs: VT)[source]

Bases: Protocol

Data model for 802.1Q customer VLAN tag type.

tci: TCI

Tag control information.

type: EtherType

Protocol (Internet Layer).

class pcapkit.protocols.data.link.vlan.TCI(*args: VT, **kwargs: VT)[source]

Bases: Data

Data model for tag control information.

pcp: PriorityLevel

Priority code point.

dei: bool

Drop eligible indicator.

vid: int

VLAN identifier.

Footnotes