Class: PacketGen::Header::SCTP::ErrorChunk

Inherits:
BaseChunk
  • Object
show all
Defined in:
lib/packetgen/header/sctp/chunk.rb

Overview

Operation Error Chunk

       0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|   Type = 9    |  Chunk Flags  |            Length             |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
\                                                               \
/                   zero or more Error Causes                   /
\                                                               \
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

Author:

  • Sylvain Daubert

Since:

  • 3.4.0

  • 4.1.0 Remove ErrorMixin and ParameterMixin

Direct Known Subclasses

AbortChunk

Constant Summary

Constants inherited from BaseChunk

BaseChunk::TYPES

Instance Attribute Summary collapse

Attributes inherited from BaseChunk

#length, #type

Instance Method Summary collapse

Methods inherited from BaseChunk

#human_type

Methods included from Padded32

#padded?, #to_s

Methods inherited from Base

bind, calculate_and_set_length, #header_id, inherited, #ip_header, #ll_header

Methods included from PacketGen::Headerable

#added_to_packet, included, #method_name, #packet, #packet=, #parse?, #protocol_name, #read, #to_s

Constructor Details

#initialize(options = {}) ⇒ ErrorChunk

Returns a new instance of ErrorChunk.

Since:

  • 3.4.0

  • 4.1.0 Remove ErrorMixin and ParameterMixin



423
424
425
426
# File 'lib/packetgen/header/sctp/chunk.rb', line 423

def initialize(options={})
  options[:type] = BaseChunk::TYPES['ERROR'] unless options.key?(:type)
  super
end

Instance Attribute Details

#error_causesArrayOfError

Causes for this error chunk

Returns:



421
# File 'lib/packetgen/header/sctp/chunk.rb', line 421

define_attr :error_causes, ArrayOfError

Instance Method Details

#calc_lengthvoid

This method returns an undefined value.

Calculate lengths, including causes ones.

Since:

  • 3.4.0

  • 4.1.0 Remove ErrorMixin and ParameterMixin



430
431
432
433
# File 'lib/packetgen/header/sctp/chunk.rb', line 430

def calc_length
  error_causes.each(&:calc_length)
  super
end

#to_human::String

Get human-readable description

Returns:

  • (::String)

Since:

  • 3.4.0

  • 4.1.0 Remove ErrorMixin and ParameterMixin



437
438
439
440
441
442
443
# File 'lib/packetgen/header/sctp/chunk.rb', line 437

def to_human
  str = "<chunk:#{human_type}"
  flags_str = flags_to_human
  str << ",flags:#{flags_str}" unless flags_str.empty?
  str << ",causes:#{error_causes.map(&:to_human).join(',')}" unless error_causes.empty?
  str << '>'
end