Class: PacketGen::Header::EAP::TTLS

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

Overview

Extensible Authentication Protocol (EAP) - Tunneled-TLS, RFC 5281

TTLS has following fields:

Author:

  • Sylvain Daubert

Since:

  • 2.1.4

Direct Known Subclasses

FAST

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/ttls.rb', line 25

define_field_before :body, :flags, Types::Int8

#lBoolean

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

Returns:

  • (Boolean)


40
# File 'lib/packetgen/header/eap/ttls.rb', line 40

define_bit_fields_on :flags, :l, :m, :s, :reserved, 2, :version, 3

#mBoolean

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

Returns:

  • (Boolean)


40
# File 'lib/packetgen/header/eap/ttls.rb', line 40

define_bit_fields_on :flags, :l, :m, :s, :reserved, 2, :version, 3

#message_lengthInteger

Message length. This field provides the total length of the raw data message sequence prior to fragmentation. So, it cannot be automatically calculated (no #calc_length method).

Returns:

  • (Integer)

    32-bit message length



50
51
# File 'lib/packetgen/header/eap/ttls.rb', line 50

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

#reservedInteger

Returns 2-bit reserved integer.

Returns:

  • (Integer)

    2-bit reserved integer



40
# File 'lib/packetgen/header/eap/ttls.rb', line 40

define_bit_fields_on :flags, :l, :m, :s, :reserved, 2, :version, 3

#sBoolean

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

Returns:

  • (Boolean)


40
# File 'lib/packetgen/header/eap/ttls.rb', line 40

define_bit_fields_on :flags, :l, :m, :s, :reserved, 2, :version, 3

#versionInteger

Returns 3-bit version.

Returns:

  • (Integer)

    3-bit version



40
# File 'lib/packetgen/header/eap/ttls.rb', line 40

define_bit_fields_on :flags, :l, :m, :s, :reserved, 2, :version, 3

Instance Method Details

#inspectString

Returns:

  • (String)

Since:

  • 2.1.4



54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/packetgen/header/eap/ttls.rb', line 54

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

    shift = Inspect.shift_level
    str = shift.dup
    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]
    str << shift
    str << Inspect::FMT_ATTR % ['', 'version', self.version]
  end
end