68 std::string buffer =
"";
76 if (buffer.length() == 0)
continue;
79 std::string::reverse_iterator iter = buffer.rbegin();
80 if ( (*iter) ==
'\r' ) buffer = buffer.substr(0, buffer.length() - 1);
83 if (cmd.empty())
continue;
110 void ManagementConnection::processCommand(
const std::vector<std::string> &cmd)
118 virtual ~BundleFilter() {};
122 virtual bool shouldAdd(
const dtn::data::MetaBundle&)
const throw (dtn::storage::BundleSelectorException)
129 if (cmd[0] ==
"neighbor")
133 if (cmd[1] ==
"list")
138 for (std::set<dtn::core::Node>::const_iterator iter = nlist.begin(); iter != nlist.end(); ++iter)
140 _stream << (*iter).getEID().getString() << std::endl;
149 else if (cmd[0] ==
"interface")
151 if (cmd[1] ==
"address")
171 else if (cmd[2] ==
"del")
181 }
catch (
const std::bad_cast&) {
190 else if (cmd[0] ==
"connection")
198 if (cmd.size() > 6) {
199 if (cmd[6] ==
"global") {
210 std::string uri =
"ip=" + cmd[4] +
";port=" + cmd[5] +
";";
216 else if (cmd[3] ==
"del")
218 std::string uri =
"ip=" + cmd[4] +
";port=" + cmd[5] +
";";
225 else if (cmd[2] ==
"udp")
229 std::string uri =
"ip=" + cmd[4] +
";port=" + cmd[5] +
";";
235 else if (cmd[3] ==
"del")
237 std::string uri =
"ip=" + cmd[4] +
";port=" + cmd[5] +
";";
244 else if (cmd[2] ==
"file")
253 else if (cmd[3] ==
"del")
262 else if (cmd[0] ==
"logcat")
267 else if (cmd[0] ==
"core")
269 if (cmd[1] ==
"shutdown")
275 else if (cmd[1] ==
"reload")
281 else if (cmd[1] ==
"resume")
287 else if (cmd[1] ==
"suspend")
293 else if (cmd[1] ==
"start_discovery")
299 else if (cmd[1] ==
"stop_discovery")
305 else if (cmd[1] ==
"internet_off")
311 else if (cmd[1] ==
"internet_on")
318 else if (cmd[0] ==
"bundle")
320 if (cmd[1] ==
"list")
332 for (std::list<dtn::data::MetaBundle>::const_iterator iter = blist.begin(); iter != blist.end(); ++iter)
342 else if (cmd[1] ==
"clear")
349 else if (cmd[0] ==
"routing")
353 if ( cmd[1] ==
"prophet" )
361 dtn::routing::BaseRouter::extension_list::const_iterator it;
365 for(it = routingExtensions.begin(); it != routingExtensions.end(); ++it)
371 if ( cmd[2] ==
"info" ){
375 _stream << *dp_map << std::endl;
376 }
else if ( cmd[2] ==
"acknowledgements" ) {
391 }
catch (
const std::bad_cast&) { }
393 if(it == routingExtensions.end())
398 }
else if ( cmd[1] ==
"static" ) {
406 else if (cmd[2] ==
"del")
415 else if (cmd[0] ==
"stats")
419 if ( cmd[1] ==
"info" ) {
425 }
else if ( cmd[1] ==
"timesync" ) {
435 _stream <<
"Psi: " << std::setprecision(16) << state.
psi << std::endl;
436 _stream <<
"Sigma: " << std::setprecision(16) << state.
sigma << std::endl;
440 }
else if ( cmd[1] ==
"bundles" ) {
451 }
else if ( cmd[1] ==
"convergencelayers" ) {
457 for (dtn::net::ConvergenceLayer::stats_data::const_iterator iter = data.begin(); iter != data.end(); ++iter) {
459 _stream << pair.first <<
": " << pair.second << std::endl;
462 }
else if ( cmd[1] ==
"reset" ) {
483 }
catch (
const std::exception&) {