return;
default:
if ( (*payload_start++ | *payload_start++) != ULE_END_INDICATOR )
- std::cerr << "delimiting error\n";
+ std::cerr << "delimiting error 1\n";
} else {
BOOST_ASSERT( std::distance( payload_start, payload_end ) == 0 );
}
unsigned char payload_pointer = *payload_start++;
if (payload_pointer > 181) {
std::cerr << "invalid payload_pointer\n";
+ this->receiver_state = Idle;
return;
}
switch (this->receiver_state) {
case Idle:
payload_start += payload_pointer;
- readNewSNDUPacket( payload_start, payload_end );
break;
case Reassembly:
// Reassembly Payload Pointer Checking
- unsigned char sndu_bytes_left = snduPacketBytesLeft();
- if (sndu_bytes_left != payload_pointer) {
+ if (snduPacketBytesLeft() != payload_pointer) {
// delimiting error
- std::cerr << "delimiting error\n";
+ std::cerr << "delimiting error 2\n";
payload_start += payload_pointer;
} else {
- readContSNDUPacket( payload_start, payload_end );
+ payload_start = readContSNDUPacket( payload_start, payload_end );
BOOST_ASSERT( isSDNUPacketComplete() );
+ handleSNDUPacket();
}
- readNewSNDUPacket( payload_start, payload_end );
}
+ do {
+ payload_start = readNewSNDUPacket( payload_start, payload_end );
+ if (! isSDNUPacketComplete()) {
+ BOOST_ASSERT( std::distance( payload_start, payload_end ) == 0 );
+ this->receiver_state = Reassembly;
+ break;
+ }
+ handleSNDUPacket();
+ this->receiver_state = Idle;
+ } while (std::distance(payload_start, payload_end) < 2 );
}
} // end pusi-switch
///////////////////////////////cc.e////////////////////////////////////////
#undef prefix_
-\f
+
// Local Variables:
// mode: c++
// fill-column: 100
unsigned offset (0);
std::string ascii;
for (; i != i_end; ++i, ++offset) {
- switch ((offset % block_size)==0) {
- case true:
+ if ((offset % block_size) == 0) {
if (!ascii.empty()) {
stream << " " << ascii << "\n";
ascii = "";
stream << " "
<< std::hex << std::setw(4) << std::setfill('0')
<< offset << ' ';
- break;
- case false:
+ } else if ((offset % block_size) == block_size/2) {
stream << " ";
ascii += ' ';
- break;
}
stream << ' ' << std::hex << std::setw(2) << std::setfill('0')
<< unsigned(*i);
#undef prefix_
//#include "hexdump.mpp"
-\f
+
// Local Variables:
// mode: c++
// fill-column: 100