Class: PacketGen::Header::SCTP::Parameter

Inherits:
Object
  • Object
show all
Includes:
ParameterMixin
Defined in:
lib/packetgen/header/sctp/parameter.rb

Overview

Base class/factory for InitChunk and InitAckChunk parameters

Author:

  • Sylvain Daubert

Since:

  • 3.4.0

Constant Summary collapse

TYPES =

Paramter Types

Since:

  • 3.4.0

{
  'IPv4' => 5,
  'IPv6' => 6,
  'StateCookie' => 7,
  'Unrecognized' => 8,
  'CookiePreservative' => 9,
  'Hostname' => 11,
  'SupportedAddrTypes' => 12,
  'ECN' => 32_768
}.freeze

Instance Method Summary collapse

Methods included from ParameterMixin

#parameter_name

Methods included from Padded32

#padded?, #to_s

Instance Method Details

#from_human(value) ⇒ Object

Parameters:

  • value (Object)

Since:

  • 3.4.0



55
56
57
58
59
60
61
# File 'lib/packetgen/header/sctp/parameter.rb', line 55

def from_human(value)
  if value.is_a?(self[:value].class)
    self[:value] = value
  else
    self[:value].from_human(value)
  end
end

#to_human::String

Returns:

  • (::String)

Since:

  • 3.4.0



50
51
52
# File 'lib/packetgen/header/sctp/parameter.rb', line 50

def to_human
  "<#{human_type}: #{self[:value].inspect}>"
end