41 :
_client(client), _stream(stream)
49 : _srv(srv), _registration(®istration), _stream(conn), _endpoint(dtn::core::
BundleCore::local), _handler(NULL)
60 return *_registration;
70 _registration->
abort();
89 while (_stream->good())
105 getline(*_stream, buffer);
108 std::string::reverse_iterator iter = buffer.rbegin();
109 if ( (*iter) ==
'\r' ) buffer = buffer.substr(0, buffer.length() - 1);
112 if (cmd.empty())
continue;
115 if (cmd[0] ==
"protocol")
117 if (cmd[1] ==
"tcpcl")
123 else if (cmd[1] ==
"management")
129 else if (cmd[1] ==
"event")
135 else if (cmd[1] ==
"extended")
141 else if (cmd[1] ==
"streaming")
147 else if (cmd[1] ==
"p2p_extension")
149 if (cmd.size() < 3) {
154 if (cmd[2] ==
"wifi") {
158 }
else if (cmd[2] ==
"bt") {
177 }
catch (
const std::exception&) {
186 void ClientHandler::error(STATUS_CODES code,
const std::string &msg)
189 (*_stream) << code <<
" " << msg << std::endl;
205 _registration->
abort();
212 void ClientHandler::processCommand(
const std::vector<std::string> &cmd)
220 virtual ~BundleFilter() {};
224 virtual bool shouldAdd(
const dtn::data::MetaBundle&)
const throw (dtn::storage::BundleSelectorException)
235 if (cmd[1] ==
"endpoint")
240 if (cmd[2].length() <= 0) {
263 else if (cmd[0] ==
"registration")
285 else if (cmd[1] ==
"del")
303 else if (cmd[1] ==
"list")
308 (*_stream) <<
API_STATUS_OK <<
" REGISTRATION LIST" << std::endl;
309 for (std::set<dtn::data::EID>::const_iterator iter = list.begin(); iter != list.end(); ++iter)
311 (*_stream) << (*iter).getString() << std::endl;
313 (*_stream) << std::endl;
326 }
catch (
const std::exception&) {