Class: PacketGen::Header::EAP::TLS

Inherits:
PacketGen::Header::EAP show all
Defined in:
lib/packetgen/header/eap/tls.rb

Overview

Extensible Authentication Protocol (EAP) - TLS, RFC 5216

TLS has following fields:

  • #flags (BinStruct::Int8),

  • optionally #tls_length (BinStruct::Int32), if #l? is true,

  • #body (BinStruct::String).

Author:

  • Sylvain Daubert

Since:

  • 2.1.4

Constant Summary

Constants inherited from PacketGen::Header::EAP

CODES, TYPES

Instance Attribute Summary collapse

Attributes inherited from PacketGen::Header::EAP

#body, #code, #id, #length, #type, #vendor_id, #vendor_type

Instance Method Summary collapse

Methods inherited from PacketGen::Header::EAP

#added_to_packet, #calc_length, #desired_auth_type, #failure?, #human_code, #human_type, #initialize, #nak?, #old_read, #read, #reply!, #request?, #response?, #success?, #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::EAP

Instance Attribute Details

#flagsInteger

8-bit flags

Returns:

  • (Integer)


35
# File 'lib/packetgen/header/eap/tls.rb', line 35

define_bit_attr_before :body, :flags, l: 1, m: 1, s: 1, reserved: 5

#l?Integer Also known as: length_present?

Say if 32-bit TLS length attribute is included.

Returns:

  • (Integer)


35
# File 'lib/packetgen/header/eap/tls.rb', line 35

define_bit_attr_before :body, :flags, l: 1, m: 1, s: 1, reserved: 5

#m?Integer Also known as: more_fragments?

Say if there are more fragments

Returns:

  • (Integer)


35
# File 'lib/packetgen/header/eap/tls.rb', line 35

define_bit_attr_before :body, :flags, l: 1, m: 1, s: 1, reserved: 5

#s?Integer Also known as: tls_start?

If set, this message is a TLS-Start

Returns:

  • (Integer)


35
# File 'lib/packetgen/header/eap/tls.rb', line 35

define_bit_attr_before :body, :flags, l: 1, m: 1, s: 1, reserved: 5

#tls_lengthInteger

TLS message length. This field provides the total length of the TLS message or set of messages that is being fragmented. So, it cannot be automatically calculated (no #calc_length method).

Returns:

  • (Integer)

    32-bit TLS length



45
46
# File 'lib/packetgen/header/eap/tls.rb', line 45

define_attr_before :body, :tls_length, BinStruct::Int32,
optional: lambda(&:l?)

Instance Method Details

#inspectString

Returns:

  • (String)

Since:

  • 2.1.4



49
50
51
52
53
54
55
56
57
58
59
# File 'lib/packetgen/header/eap/tls.rb', line 49

def inspect
  super do |attr|
    next unless attr == :flags

    str = Inspect.shift_level
    value = %i[l m s].map { |f| send(:"#{f}?") ? f.to_s : '.' }.join
    value = '%-16s (0x%02x)' % [value, self.flags]
    str << Inspect::FMT_ATTR % [self[attr].class.to_s.sub(/.*::/, ''),
                                attr, value]
  end
end