Class: PacketGen::Header::Dot1q

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

Overview

IEEE 802.1Q VLAN tagging

A VLAN tag consists of:

Create a Dot1q header

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

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

Methods inherited from Types::Fields

#[], #[]=, #bits_on, define_bit_fields_on, define_field, define_field_after, define_field_before, #fields, fields, inherited, #initialize, #inspect, #offset_of, #optional?, #optional_fields, #present?, #read, remove_bit_fields_on, remove_field, #sz, #to_h, #to_s, update_field

Constructor Details

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

Instance Attribute Details

#bodyTypes::String, Header::Base


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

define_field :body, Types::String

#deiBoolean

Returns Drop Eligible Indicator from #tci.

Returns:

  • (Boolean)

    Drop Eligible Indicator from #tci


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

define_bit_fields_on :tci, :pcp, 3, :dei, :vid, 12

#ethertypeInteger

Returns 16-bit EtherType.

Returns:

  • (Integer)

    16-bit EtherType


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

define_field :ethertype, Types::Int16

#pcpInteger

Returns 3-bit Priority Code Point from #tci.

Returns:

  • (Integer)

    3-bit Priority Code Point from #tci


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

define_bit_fields_on :tci, :pcp, 3, :dei, :vid, 12

#tciInteger

Returns 16-bit Tag Control Information.

Returns:

  • (Integer)

    16-bit Tag Control Information


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

define_field :tci, Types::Int16

#vidInteger

Returns 12-bit VLAN ID from #tci.

Returns:

  • (Integer)

    12-bit VLAN ID from #tci


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

define_bit_fields_on :tci, :pcp, 3, :dei, :vid, 12