59 : _stream(stream), _encoding(enc)
73 _stream <<
"Blocks: " << obj.
size() << std::endl;
110 _stream <<
"Block: " << (int)((
unsigned char)obj.
getType()) << std::endl;
112 std::stringstream flags;
116 flags <<
" LAST_BLOCK";
121 flags <<
" REPLICATE_IN_EVERY_FRAGMENT";
126 flags <<
" TRANSMIT_STATUSREPORT_IF_NOT_PROCESSED";
131 flags <<
" DELETE_BUNDLE_IF_NOT_PROCESSED";
136 flags <<
" DISCARD_IF_NOT_PROCESSED";
141 flags <<
" FORWARDED_WITHOUT_PROCESSED";
144 if (flags.str().length() > 0)
146 _stream <<
"Flags:" << flags.str() << std::endl;
151 std::list<dtn::data::EID> eid_list = obj.
getEIDList();
153 for (std::list<dtn::data::EID>::const_iterator iter = eid_list.begin(); iter != eid_list.end(); ++iter)
155 _stream <<
"EID: " << (*iter).getString() << std::endl;
159 _stream <<
"Length: " << obj.
getLength() << std::endl;
165 _stream << std::endl;
181 _stream << std::flush;
188 }
catch (
const std::exception &ex) {
189 std::cerr << ex.what() << std::endl;
192 _stream << std::endl;
214 : _stream(stream), _lastblock(false)
236 while (!_stream.eof() && !_lastblock)
257 while (_stream.good())
259 getline(_stream, data);
261 std::string::reverse_iterator iter = data.rbegin();
262 if ( (*iter) ==
'\r' ) data = data.substr(0, data.length() - 1);
268 if (data.size() == 0)
break;
277 if (values[0] ==
"Processing flags")
281 else if (values[0] ==
"Timestamp")
285 else if (values[0] ==
"Sequencenumber")
289 else if (values[0] ==
"Source")
293 else if (values[0] ==
"Destination")
297 else if (values[0] ==
"Reportto")
301 else if (values[0] ==
"Custodian")
305 else if (values[0] ==
"Lifetime")
309 else if (values[0] ==
"Fragment offset")
313 else if (values[0] ==
"Application data length")
329 while (_stream.good())
331 getline(_stream, data);
333 std::string::reverse_iterator iter = data.rbegin();
334 if ( (*iter) ==
'\r' ) data = data.substr(0, data.length() - 1);
340 if (data.size() == 0)
break;
346 if(values.size() < 2)
350 if (values[0] ==
"Flags")
354 for (std::vector<std::string>::const_iterator iter = flags.begin(); iter != flags.end(); ++iter)
356 const std::string &value = (*iter);
357 if (value ==
"LAST_BLOCK")
362 else if (value ==
"FORWARDED_WITHOUT_PROCESSED")
366 else if (value ==
"DISCARD_IF_NOT_PROCESSED")
370 else if (value ==
"DELETE_BUNDLE_IF_NOT_PROCESSED")
374 else if (value ==
"TRANSMIT_STATUSREPORT_IF_NOT_PROCESSED")
378 else if (value ==
"REPLICATE_IN_EVERY_FRAGMENT")
384 else if (values[0] ==
"EID")
389 else if (values[0] ==
"Length")
391 std::stringstream ss; ss.str(values[1]);
394 else if (values[0] ==
"Encoding")
396 std::stringstream ss; ss << values[1]; ss.clear(); ss >> values[1];
423 getline(_stream, buffer);
424 std::string::reverse_iterator iter = buffer.rbegin();
425 if ( (*iter) ==
'\r' ) buffer = buffer.substr(0, buffer.length() - 1);
429 getline(_stream, buffer);
430 iter = buffer.rbegin();
431 if ( (*iter) ==
'\r' ) buffer = buffer.substr(0, buffer.length() - 1);
444 while (_stream.good())
446 getline(_stream, data);
448 std::string::reverse_iterator iter = data.rbegin();
449 if ( (*iter) ==
'\r' ) data = data.substr(0, data.length() - 1);
452 if (data.size() == 0)
break;
458 if(values.size() < 1)
462 if (values[0] ==
"Length")
464 std::stringstream ss; ss.str(values[1]);
467 else if (values[0] ==
"Encoding")
469 std::stringstream ss; ss << values[1]; ss.clear(); ss >> values[1];
494 getline(_stream, buffer);
495 std::string::reverse_iterator iter = buffer.rbegin();
496 if ( (*iter) ==
'\r' ) buffer = buffer.substr(0, buffer.length() - 1);
500 getline(_stream, buffer);
501 iter = buffer.rbegin();
502 if ( (*iter) ==
'\r' ) buffer = buffer.substr(0, buffer.length() - 1);
510 _stream <<
"Length: " << block.
getLength() << std::endl;
512 _stream << std::endl;
534 _stream << std::endl;
539 _stream <<
"Length: " << len << std::endl;
541 _stream << std::endl;
555 _stream << std::flush;
561 _stream << std::endl;
574 getline(_stream, data);
576 std::string::reverse_iterator iter = data.rbegin();
577 if ( (*iter) ==
'\r' ) data = data.substr(0, data.length() - 1);
580 if (data.size() == 0)
break;
585 if (values[0] ==
"Length")
587 std::stringstream ss; ss.str(values[1]);
590 else if (values[0] ==
"Encoding")
592 std::stringstream ss; ss << values[1]; ss.clear(); ss >> values[1];
607 getline(_stream, data);
609 std::string::reverse_iterator iter = data.rbegin();
610 if ( (*iter) ==
'\r' ) data = data.substr(0, data.length() - 1);
613 if (data.size() == 0)
break;
631 getline(_stream, buffer);
633 std::string::reverse_iterator iter = buffer.rbegin();
634 if ( (*iter) ==
'\r' ) buffer = buffer.substr(0, buffer.length() - 1);
642 if (values[0] ==
"Block")
644 std::stringstream ss; ss.str(values[1]);