46 uint32 begintsn = tsn, endtsn = 0;
48 EV_INFO <<
"Trying to reassemble message..." << endl;
51 while (queue->getChunk(begintsn) && !(queue->getChunk(begintsn))->bbit)
54 if (queue->getChunk(begintsn)) {
58 while (queue->getChunk(endtsn) && !(queue->getChunk(endtsn))->ebit)
61 if (queue->getChunk(endtsn)) {
62 EV_INFO <<
"All fragments found, now reassembling..." << endl;
64 SCTPDataVariables *firstVar = queue->getChunk(begintsn), *processVar;
65 SCTPSimpleMessage *firstSimple = check_and_cast<SCTPSimpleMessage *>(firstVar->userData);
67 EV_INFO <<
"First fragment has " << firstVar->len / 8 <<
" bytes." << endl;
69 while (++begintsn <= endtsn) {
70 processVar = queue->getAndExtractChunk(begintsn);
71 SCTPSimpleMessage *processSimple = check_and_cast<SCTPSimpleMessage *>(processVar->userData);
73 EV_INFO <<
"Adding fragment with " << processVar->len / 8 <<
" bytes." << endl;
75 if ((firstSimple->getDataArraySize() > 0) && (processSimple->getDataArraySize() > 0)) {
76 firstSimple->setDataArraySize(firstSimple->getDataArraySize() + processSimple->getDataArraySize());
77 firstSimple->setDataLen(firstSimple->getDataLen() + processSimple->getDataLen());
78 firstSimple->setByteLength(firstSimple->getByteLength() + processSimple->getByteLength());
80 for (
uint32 i = 0; i < (processVar->len / 8); i++)
81 firstSimple->setData(i + (firstVar->len / 8), processSimple->getData(i));
84 firstVar->len += processVar->len;
86 delete processVar->userData;
92 EV_INFO <<
"Reassembly done. Length=" << firstVar->len <<
"\n";
uint32_t uint32
Definition: Compat.h:30