Class: PacketGen::Header::Dot1x
- Defined in:
- lib/packetgen/header/dot1x.rb
Overview
IEEE 802.1X / EAPOL
A IEEE 802.1X header consists of:
-
a #version (
BinStruct::Int8
), -
a packet #type (
BinStruct::Int8
), -
a #length (
BinStruct::Int16
), -
and a body (a
BinStruct::String
or another PacketGen::Headerable class).
Constant Summary collapse
- ETHERTYPE =
IEEE 802.1x Ether type
0x888e
- TYPES =
IEEE 802.1X packet types
{ 'EAP Packet' => 0, 'Start' => 1, 'Logoff' => 2, 'Key' => 3, 'Encap-ASF-Alert' => 4 }.freeze
Instance Attribute Summary collapse
- #body ⇒ BinStruct::String, Header::Base
-
#length ⇒ Integer
16-bit body length.
-
#type ⇒ Integer
8-bit Packet Type.
-
#version ⇒ Integer
8-bit Protocol Version.
Instance Method Summary collapse
-
#calc_length ⇒ Integer
Calculate and set body length.
-
#human_type ⇒ String
Get human readable type.
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
#body ⇒ BinStruct::String, Header::Base
49 |
# File 'lib/packetgen/header/dot1x.rb', line 49 define_attr :body, BinStruct::String, builder: ->(h, t) { t.new(length_from: h[:length]) } |
#length ⇒ Integer
Returns 16-bit body length.
46 |
# File 'lib/packetgen/header/dot1x.rb', line 46 define_attr :length, BinStruct::Int16 |
#type ⇒ Integer
Returns 8-bit Packet Type.
43 |
# File 'lib/packetgen/header/dot1x.rb', line 43 define_attr :type, BinStruct::Int8Enum, enum: TYPES |
#version ⇒ Integer
Returns 8-bit Protocol Version.
40 |
# File 'lib/packetgen/header/dot1x.rb', line 40 define_attr :version, BinStruct::Int8, default: 1 |
Instance Method Details
#calc_length ⇒ Integer
Calculate and set body length
60 61 62 |
# File 'lib/packetgen/header/dot1x.rb', line 60 def calc_length Base.calculate_and_set_length self, header_in_size: false end |
#human_type ⇒ String
Get human readable type
53 54 55 |
# File 'lib/packetgen/header/dot1x.rb', line 53 def human_type self[:type].to_human end |