Class: Mu::Pcap::SCTP::Chunk::InitAck
- Inherits:
-
Init
- Object
- Packet
- Mu::Pcap::SCTP::Chunk
- Init
- Mu::Pcap::SCTP::Chunk::InitAck
- Defined in:
- lib/mu/pcap/sctp/chunk/init_ack.rb
Constant Summary
Constants inherited from Packet
Instance Attribute Summary
Attributes inherited from Init
#a_rwnd, #i_streams, #init_tag, #init_tsn, #o_streams
Attributes inherited from Mu::Pcap::SCTP::Chunk
Attributes inherited from Packet
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ InitAck
constructor
A new instance of InitAck.
- #to_s ⇒ Object
Methods inherited from Init
Methods inherited from Mu::Pcap::SCTP::Chunk
dummy_chunk, #padded_size, #write
Methods inherited from Packet
#==, #deepdup, #flow_id, isolate_l7, normalize, #payload_bytes, #to_bytes
Constructor Details
#initialize ⇒ InitAck
Returns a new instance of InitAck.
11 12 13 14 15 |
# File 'lib/mu/pcap/sctp/chunk/init_ack.rb', line 11 def initialize super @type = CHUNK_INIT_ACK end |
Class Method Details
.from_bytes(flags, size, bytes) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/mu/pcap/sctp/chunk/init_ack.rb', line 17 def self.from_bytes flags, size, bytes # Basic validation Pcap.assert(bytes.length >= 16, "Truncated init_ack chunk header: 16 > #{bytes.length}") # Read init_ack chunk header init_tag, a_rwnd, o_streams, i_streams, init_tsn = bytes.unpack('NNnnN') # Create init chunk init_ack = InitAck.new init_ack.flags = flags init_ack.size = size init_ack.init_tag = init_tag init_ack.a_rwnd = a_rwnd init_ack.o_streams = o_streams init_ack.i_streams = i_streams init_ack.init_tsn = init_tsn # Initialize the counter length = 16 # Collect the chunks while length < bytes.length # Parse new parameter from the bytes parameter = Parameter.from_bytes(bytes[length..-1]) # Get parameter size with padding length += parameter.padded_size # Add chunk to the list init_ack << parameter end # Return the result return init_ack end |
Instance Method Details
#to_s ⇒ Object
54 55 56 57 58 59 60 61 62 |
# File 'lib/mu/pcap/sctp/chunk/init_ack.rb', line 54 def to_s return "init_ack(%d, %d, %d, %d, %d, %d, %s)" % [@size, @init_tag, @a_rwnd, @o_streams, @i_streams, @init_tsn, @payload.join(", ")] end |