Class: PacketGen::Header::Dot1q
- Inherits:
-
Base
- Object
- Types::Fields
- Base
- PacketGen::Header::Dot1q
- Defined in:
- lib/packetgen/header/dot1q.rb
Overview
IEEE 802.1Q VLAN tagging
A VLAN tag consists of:
-
a #ethertype (Types::Int16),
-
and a body (a Types::String or another Header class).
Create a Dot1q header
# Create a IP packet in VLAN #43
pkt = PacketGen.gen('Eth').add('Dot1q', vid: 43).add('IP')
Instance Attribute Summary collapse
- #body ⇒ Types::String, Header::Base
-
#dei ⇒ Boolean
Drop Eligible Indicator from #tci.
-
#ethertype ⇒ Integer
16-bit EtherType.
-
#pcp ⇒ Integer
3-bit Priority Code Point from #tci.
-
#tci ⇒ Integer
16-bit Tag Control Information.
-
#vid ⇒ Integer
12-bit VLAN ID from #tci.
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
#body ⇒ Types::String, Header::Base
32 |
# File 'lib/packetgen/header/dot1q.rb', line 32 define_field :body, Types::String |
#dei ⇒ Boolean
Returns Drop Eligible Indicator from #tci.
40 |
# File 'lib/packetgen/header/dot1q.rb', line 40 define_bit_fields_on :tci, :pcp, 3, :dei, :vid, 12 |
#ethertype ⇒ Integer
Returns 16-bit EtherType.
29 |
# File 'lib/packetgen/header/dot1q.rb', line 29 define_field :ethertype, Types::Int16 |
#pcp ⇒ Integer
Returns 3-bit Priority Code Point from #tci.
40 |
# File 'lib/packetgen/header/dot1q.rb', line 40 define_bit_fields_on :tci, :pcp, 3, :dei, :vid, 12 |
#tci ⇒ Integer
Returns 16-bit Tag Control Information.
26 |
# File 'lib/packetgen/header/dot1q.rb', line 26 define_field :tci, Types::Int16 |
#vid ⇒ Integer
Returns 12-bit VLAN ID from #tci.
40 |
# File 'lib/packetgen/header/dot1q.rb', line 40 define_bit_fields_on :tci, :pcp, 3, :dei, :vid, 12 |