Class: PacketGen::Header::EAP::TLS
- Inherits:
-
PacketGen::Header::EAP
- Object
- Types::Fields
- Base
- PacketGen::Header::EAP
- PacketGen::Header::EAP::TLS
- Defined in:
- lib/packetgen/header/eap/tls.rb
Overview
Extensible Authentication Protocol (EAP) - TLS, RFC 5216
TLS has following fields:
-
optionally #tls_length (Types::Int32), if
#l?istrue,
Constant Summary
Constants inherited from PacketGen::Header::EAP
Instance Attribute Summary collapse
-
#flags ⇒ Integer
8-bit flags.
-
#l ⇒ Boolean
Say if length field is included.
-
#m ⇒ Boolean
Say if there are more fragments.
-
#s ⇒ Boolean
If set, this message is a TLS-Start.
-
#tls_length ⇒ Integer
TLS message length.
Attributes inherited from PacketGen::Header::EAP
#body, #code, #id, #length, #type, #vendor_id, #vendor_type
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from PacketGen::Header::EAP
#added_to_packet, #calc_length, #desired_auth_type, #failure?, #has_type?, #human_code, #human_type, #old_read, #read, #reply!, #request?, #response?, #success?, #type?
Methods inherited from Base
#added_to_packet, bind, bind_header, calculate_and_set_length, #header_id, inherited, #ip_header, known_headers, #ll_header, #method_name, #parse?, #protocol_name, protocol_name
Methods inherited from Types::Fields
#[], #[]=, #bits_on, #body=, define_bit_fields_on, define_field, define_field_after, define_field_before, delete_field, #fields, #force_binary, inherited, #is_optional?, #is_present?, #offset_of, #optional?, #optional_fields, #present?, #read, #sz, #to_h, #to_s
Constructor Details
#initialize(options = {}) ⇒ EAP::TLS
48 49 50 |
# File 'lib/packetgen/header/eap/tls.rb', line 48 def initialize(={}) super({ type: 13 }.merge!()) end |
Instance Attribute Details
#flags ⇒ Integer
Returns 8-bit flags.
23 |
# File 'lib/packetgen/header/eap/tls.rb', line 23 define_field_before :body, :flags, Types::Int8 |
#l ⇒ Boolean
Say if length field is included. Defined on #flags field.
34 |
# File 'lib/packetgen/header/eap/tls.rb', line 34 define_bit_fields_on :flags, :l, :m, :s, :reserved, 5 |
#m ⇒ Boolean
Say if there are more fragments. Defined on #flags field.
34 |
# File 'lib/packetgen/header/eap/tls.rb', line 34 define_bit_fields_on :flags, :l, :m, :s, :reserved, 5 |
#s ⇒ Boolean
If set, this message is a TLS-Start. Defined on #flags field.
34 |
# File 'lib/packetgen/header/eap/tls.rb', line 34 define_bit_fields_on :flags, :l, :m, :s, :reserved, 5 |
#tls_length ⇒ Integer
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).
44 45 |
# File 'lib/packetgen/header/eap/tls.rb', line 44 define_field_before :body, :tls_length, Types::Int32, optional: ->(h) { h.l? } |
Instance Method Details
#inspect ⇒ String
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/packetgen/header/eap/tls.rb', line 53 def inspect str = Inspect.dashed_line(self.class, 1) fields.each do |attr| next if attr == :body next unless present?(attr) if attr == :flags shift = Inspect.shift_level(1) value = i[l m s].map { |f| send("#{f}?") ? f.to_s : '.' }.join value = '%-16s (0x%02x)' % [value, self.flags] str << shift str << Inspect::FMT_ATTR % [self[attr].class.to_s.sub(/.*::/, ''), attr, value] else str << Inspect.inspect_attribute(attr, self[attr], 1) end end str end |