Class: PacketGen::Header::Dot1q

Inherits:
Base
  • Object
show all
Defined in:
lib/packetgen/header/dot1q.rb

Overview

IEEE 802.1Q VLAN tagging

A VLAN tag consists of:

Examples:

Create a Dot1q header

# Create a IP packet in VLAN #43
pkt = PacketGen.gen('Eth').add('Dot1q', vid: 43).add('IP')
pkt.is?('Dot1q')   #=> true

Author:

  • Sylvain Daubert

Since:

  • 1.4.0

Instance Attribute Summary collapse

Method Summary

Methods inherited from Base

bind, calculate_and_set_length, #header_id, inherited, #initialize, #ip_header, #ll_header

Methods included from PacketGen::Headerable

#added_to_packet, included, #method_name, #packet, #packet=, #parse?, #protocol_name, #read, #to_s

Constructor Details

This class inherits a constructor from PacketGen::Header::Base

Instance Attribute Details

#bodyBinStruct::String, Header::Base

Returns:


39
# File 'lib/packetgen/header/dot1q.rb', line 39

define_attr :body, BinStruct::String

#deiBoolean

Returns Drop Eligible Indicator from #tci.

Returns:

  • (Boolean)

    Drop Eligible Indicator from #tci


33
# File 'lib/packetgen/header/dot1q.rb', line 33

define_bit_attr :tci, pcp: 3, dei: 1, vid: 12

#ethertypeInteger

Returns 16-bit EtherType.

Returns:

  • (Integer)

    16-bit EtherType


36
# File 'lib/packetgen/header/dot1q.rb', line 36

define_attr :ethertype, BinStruct::Int16

#pcpInteger

Returns 3-bit Priority Code Point from #tci.

Returns:

  • (Integer)

    3-bit Priority Code Point from #tci


33
# File 'lib/packetgen/header/dot1q.rb', line 33

define_bit_attr :tci, pcp: 3, dei: 1, vid: 12

#tciInteger

Returns 16-bit Tag Control Information.

Returns:

  • (Integer)

    16-bit Tag Control Information


33
# File 'lib/packetgen/header/dot1q.rb', line 33

define_bit_attr :tci, pcp: 3, dei: 1, vid: 12

#vidInteger

Returns 12-bit VLAN ID from #tci.

Returns:

  • (Integer)

    12-bit VLAN ID from #tci


33
# File 'lib/packetgen/header/dot1q.rb', line 33

define_bit_attr :tci, pcp: 3, dei: 1, vid: 12