Class: PacketGen::Header::SCTP::InvalidStreamIdError

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

Overview

InvalidStreamIdentifier error

Author:

  • Sylvain Daubert

Since:

  • 3.4.0

Instance Method Summary collapse

Methods included from ErrorMixin

#error_name

Methods included from Padded32

#padded?, #to_s

Instance Method Details

#from_human(val) ⇒ Object

Parameters:

  • val (Integer)

Since:

  • 3.4.0



116
117
118
119
# File 'lib/packetgen/header/sctp/error.rb', line 116

def from_human(val)
  super
  self.value <<= 16 if self[:value] < Types::Int
end

#stream_identifierInteger

Get stream Id value

Returns:

  • (Integer)

Since:

  • 3.4.0



98
99
100
# File 'lib/packetgen/header/sctp/error.rb', line 98

def stream_identifier
  self.value >> 16
end

#stream_identifier=(stream_id) ⇒ Integer

Set stream Id value

Parameters:

  • stream_id (Integer)

Returns:

  • (Integer)

Since:

  • 3.4.0



105
106
107
108
# File 'lib/packetgen/header/sctp/error.rb', line 105

def stream_identifier=(stream_id)
  self.value = (stream_id & 0xffff) << 16
  stream_id
end

#to_human::String

Returns:

  • (::String)

Since:

  • 3.4.0



111
112
113
# File 'lib/packetgen/header/sctp/error.rb', line 111

def to_human
  "<#{error_name}: #{stream_identifier}>"
end