Skip to content
Snippets Groups Projects
Commit e7f13cca authored by Yann Garcia's avatar Yann Garcia
Browse files

Bug fixed in SCTP offline

parent fffe402b
No related branches found
No related tags found
No related merge requests found
......@@ -111,24 +111,24 @@ void sctp_offline_layer::process_chunk(const OCTETSTRING& p_chunk, params &p_par
p += 2; // Skip Chunk type + Chunk flag
// Chunk length
uint16_t l = (*p << 8 | *(p + 1)) & 0xffff;
loggers::get_instance().log("sctp_offline_layer::receive_data: l: %d", l);
loggers::get_instance().log("sctp_offline_layer::process_chunk: l: %d", l);
p += 2;
p += 4; // Skip Transmission sequence number
// Stream identifier
OCTETSTRING stream_id = OCTETSTRING(2, p);
loggers::get_instance().log_msg("sctp_offline_layer::receive_data: stream_id: ", stream_id);
loggers::get_instance().log_msg("sctp_offline_layer::process_chunk: stream_id: ", stream_id);
p += 2;
// Stream sequence number
OCTETSTRING stream_num = OCTETSTRING(2, p);
loggers::get_instance().log_msg("sctp_offline_layer::receive_data: stream_num: ", stream_num);
loggers::get_instance().log_msg("sctp_offline_layer::process_chunk: stream_num: ", stream_num);
p += 2;
// Protocol
uint32_t protocol = (*p << 24 | *(p + 1) << 16 | *(p + 2) << 8 | *(p + 3)) & 0xffffffff;
loggers::get_instance().log("sctp_offline_layer::receive_data: protocol: %d", protocol);
loggers::get_instance().log("sctp_offline_layer::process_chunk: protocol: %d", protocol);
p += 4;
loggers::get_instance().log("sctp_offline_layer::receive_data: pointer offset: %d", (uint32_t)(p - static_cast<const uint8_t*>(p_chunk)));
loggers::get_instance().log("sctp_offline_layer::process_chunk: pointer offset: %d", (uint32_t)(p - static_cast<const uint8_t*>(p_chunk)));
p_payload = OCTETSTRING(p_chunk.lengthof() - (uint32_t)(p - static_cast<const uint8_t*>(p_chunk)), p);
}
break;
......@@ -136,7 +136,19 @@ void sctp_offline_layer::process_chunk(const OCTETSTRING& p_chunk, params &p_par
break;
case 0x02: // INIT_ACK chunk
break;
case 0x03: // SACK
case 0x03: { // SACK
loggers::get_instance().log("sctp_offline_layer::process_chunk (SACK): position: %02x", static_cast<const uint8_t>(*(p)));
const uint8_t f = static_cast<const uint8_t>(*(p + 1));
loggers::get_instance().log("sctp_offline_layer::process_chunk (SACK): flags: %04x", f);
const uint16_t l = static_cast<const uint16_t>((*(p + 2) << 8 | *(p + 3)) & 0xffff);
loggers::get_instance().log("sctp_offline_layer::process_chunk (SACK): length: %d", l);
loggers::get_instance().log("sctp_offline_layer::process_chunk (SACK): p_chunk.lengthof(): %d", p_chunk.lengthof());
if (p_chunk.lengthof() > l) {
// Extract and process the next chunk
OCTETSTRING chunk(p_chunk.lengthof() - l, p + l);
process_chunk(chunk, p_params, p_payload);
}
}
break;
case 0x04: // HEARTBEAT
break;
......@@ -147,7 +159,7 @@ void sctp_offline_layer::process_chunk(const OCTETSTRING& p_chunk, params &p_par
case 0x0b: // COOKIE_ACK chunk
break;
default: //
loggers::get_instance().warning("sctp_offline_layer::send_data: Unprocessed chunk: 0x%02x", *p);
loggers::get_instance().warning("sctp_offline_layer::process_chunk: Unprocessed chunk: 0x%02x", *p);
}
loggers::get_instance().log_msg("<<< sctp_offline_layer::process_chunk: p_payload: ", p_payload);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment