Class: PacketGen::Header::SCTP
- Inherits:
-
Base
- Object
- Types::Fields
- Base
- PacketGen::Header::SCTP
- Defined in:
- lib/packetgen/header/sctp.rb,
lib/packetgen/header/sctp.rb,
lib/packetgen/header/sctp/chunk.rb,
lib/packetgen/header/sctp/chunk.rb,
lib/packetgen/header/sctp/error.rb,
lib/packetgen/header/sctp/padded32.rb,
lib/packetgen/header/sctp/parameter.rb
Overview
SCTP header (RFC 9260)
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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Source Port Number | Destination Port Number |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Verification Tag |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Checksum |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Chunk #1 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| ... |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Chunk #n |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Defined Under Namespace
Modules: ErrorMixin, Padded32, ParameterMixin Classes: AbortChunk, ArrayOfChunk, ArrayOfError, ArrayOfParameter, BaseChunk, CookieAckChunk, CookieEchoChunk, CookiePreservativeParameter, CookieReceivedWhileShuttingDownError, DataChunk, ECNParameter, Error, ErrorChunk, HearbeatInfoParameter, HeartbeatAckChunk, HeartbeatChunk, HostnameParameter, IPv4Parameter, IPv6Parameter, InitAckChunk, InitChunk, InvalidMandatoryParameterError, InvalidStreamIdError, MissingMandatoryParameterError, NoUserDataError, OutOfResourceError, Parameter, ProtocolViolationError, RestartAssociationWithNewAddressError, SackChunk, ShutdownAckChunk, ShutdownChunk, ShutdownCompleteChunk, StaleCookieError, StateCookieParameter, SupportedAddrTypesParameter, UnknownChunk, UnrecognizedChunkTypeError, UnrecognizedParameter, UnrecognizedParametersError, UnresolvableAddressError, UserInitiatedAbortError
Constant Summary collapse
- IP_PROTOCOL =
IP protocol number for SCTP
132
- UDP_PORT =
Port number for SCTP over TCP (RFC 6951)
9899
Instance Attribute Summary collapse
-
#checksum ⇒ Integer
32-bit TCP checksum.
-
#chunks ⇒ ArrayOfChunk
List of chunks this packet transports.
-
#dport ⇒ Integer
16-bit TCP destination port.
-
#sport ⇒ Integer
16-bit TCP source port.
-
#verification_tag ⇒ Integer
32-bit verification tag.
Instance Method Summary collapse
-
#calc_checksum ⇒ Object
Compute SCTP checksum.
-
#calc_length ⇒ Object
Compute SCTP chunks length.
- #inspect ⇒ String
Methods inherited from Base
bind, calculate_and_set_length, #header_id, inherited, #initialize, #ip_header, #ll_header
Methods included from PacketGen::Headerable
#added_to_packet, included, #method_name, #packet, #packet=, #parse?, #protocol_name, #read
Methods inherited from Types::Fields
#[], #[]=, #bits_on, define_bit_fields_on, define_field, define_field_after, define_field_before, #fields, fields, inherited, #initialize, #offset_of, #optional?, #optional_fields, #present?, #read, remove_bit_fields_on, remove_field, #sz, #to_h, #to_s, update_field
Constructor Details
This class inherits a constructor from PacketGen::Header::Base
Instance Attribute Details
#checksum ⇒ Integer
32-bit TCP checksum
61 |
# File 'lib/packetgen/header/sctp.rb', line 61 define_field :checksum, Types::Int32le |
#chunks ⇒ ArrayOfChunk
List of chunks this packet transports
65 |
# File 'lib/packetgen/header/sctp.rb', line 65 define_field :chunks, ArrayOfChunk |
#dport ⇒ Integer
16-bit TCP destination port
53 |
# File 'lib/packetgen/header/sctp.rb', line 53 define_field :dport, Types::Int16 |
Instance Method Details
#calc_checksum ⇒ Object
Compute SCTP checksum
68 69 70 71 72 73 |
# File 'lib/packetgen/header/sctp.rb', line 68 def calc_checksum self.checksum = 0 crc32c = Digest::CRC32c.new crc32c << to_s self.checksum = crc32c.checksum end |
#calc_length ⇒ Object
Compute SCTP chunks length
76 77 78 |
# File 'lib/packetgen/header/sctp.rb', line 76 def calc_length self.chunks.each(&:calc_length) end |
#inspect ⇒ String
81 82 83 84 85 86 87 |
# File 'lib/packetgen/header/sctp.rb', line 81 def inspect super do |attr| next unless attr == :chunks chunks.map(&:inspect).join end end |