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:

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, #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

Methods inherited from Types::Fields

#[], #[]=, #bits_on, define_bit_fields_on, define_field, define_field_after, define_field_before, #fields, fields, inherited, #initialize, #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::EAP

Instance Attribute Details

#flagsInteger

Returns 8-bit flags.

Returns:

  • (Integer)

    8-bit flags



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

define_field_before :body, :flags, Types::Int8

#lBoolean

Say if length field is included. Defined on #flags field.

Returns:

  • (Boolean)


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

define_bit_fields_on :flags, :l, :m, :s, :reserved, 5

#mBoolean

Say if there are more fragments. Defined on #flags field.

Returns:

  • (Boolean)


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

define_bit_fields_on :flags, :l, :m, :s, :reserved, 5

#sBoolean

If set, this message is a TLS-Start. Defined on #flags field.

Returns:

  • (Boolean)


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

define_bit_fields_on :flags, :l, :m, :s, :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



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

define_field_before :body, :tls_length, Types::Int32,
optional: ->(h) { h.l? }

Instance Method Details

#inspectString

Returns:

  • (String)

Since:

  • 2.1.4



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

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