Class: PacketGen::Header::SCTP::Error
- Inherits:
-
BinStruct::AbstractTLV
- Object
- BinStruct::AbstractTLV
- PacketGen::Header::SCTP::Error
- Includes:
- Padded32
- Defined in:
- lib/packetgen/header/sctp/error.rb,
lib/packetgen/header/sctp/error.rb
Overview
Base class/factory for AbortChunk and ErrorChunk error causes
Direct Known Subclasses
InvalidStreamIdError, MissingMandatoryParameterError, NoUserDataError, NoValueError, RestartAssociationWithNewAddressError, StaleCookieError, UnrecognizedChunkTypeError, UnrecognizedParametersError, UnresolvableAddressError
Constant Summary collapse
- TYPES =
Error Causes/Types
{ 'InvalidStreamId' => 1, 'MissingMandatoryParameter' => 2, 'StaleCookie' => 3, 'OutOfResource' => 4, 'UnresolvableAddress' => 5, 'UnrecognizedChunkType' => 6, 'InvalidMandatoryParameter' => 7, 'UnrecognizedParameters' => 8, 'NoUserData' => 9, 'CookieReceivedWhileShuttingDown' => 10, 'RestartAssociationWithNewAddress' => 11, 'UserInitiatedAbort' => 12, 'ProtocolViolation' => 13 }.freeze
Instance Method Summary collapse
-
#error_name ⇒ String
Get error name.
-
#from_human(value) ⇒ Object
Set
#value
fromvalue
. -
#to_human ⇒ String
Get human-readable description.
Methods included from Padded32
Instance Method Details
#error_name ⇒ String
Get error name
44 45 46 |
# File 'lib/packetgen/header/sctp/error.rb', line 44 def error_name self.class.name.split('::').last.delete_suffix('Error') end |
#from_human(value) ⇒ Object
Set #value
from value
57 58 59 60 61 62 63 64 |
# File 'lib/packetgen/header/sctp/error.rb', line 57 def from_human(value) if value.is_a?(self[:value].class) self[:value] = value else self[:value].from_human(value) end self end |
#to_human ⇒ String
Get human-readable description
50 51 52 |
# File 'lib/packetgen/header/sctp/error.rb', line 50 def to_human "<#{error_name}: #{value}>" end |