44 : _service(ds),
_running(false), _discovery_sn(0)
56 while (_connections.size() != 0) _cond_connections.
wait();
74 _service->send(HEADER_SEGMENT, flags, seqno, destination, buf, len);
86 _service->send(HEADER_ACK, 0, seqno, destination, NULL, 0);
91 const std::list<dtn::core::Node::URI> uri_list = node.
get(_service->
getProtocol());
92 if (uri_list.empty())
return;
110 DatagramConnection& DatagramConvergenceLayer::getConnection(
const std::string &identifier)
119 for(connection_list::const_iterator i = _connections.begin(); i != _connections.end(); ++i)
121 if ((*i)->getIdentifier() == identifier)
129 _connections.push_back(connection);
130 _cond_connections.
signal(
true);
148 const connection_list::iterator i = std::find(_connections.begin(), _connections.end(), conn);
150 if (i != _connections.end())
154 _connections.erase(i);
155 _cond_connections.
signal(
true);
169 }
catch (
const std::exception &e) {
184 for(connection_list::const_iterator i = _connections.begin(); i != _connections.end(); ++i)
205 std::streamsize len = ss.str().size();
222 unsigned int seqno = 0;
225 std::vector<char> data(maxlen);
234 len = _service->
recvfrom(&data[0], maxlen, type, flags, seqno, address);
252 ss.write(&data[0], len);
259 Node n(announce.getEID());
262 size_t to_value = 30;
267 const std::list<DiscoveryService> services = announce.getServices();
268 for (std::list<DiscoveryService>::const_iterator iter = services.begin(); iter != services.end(); ++iter)
300 connection.
queue(flags, seqno, &data[0], len);
314 connection.
ack(seqno);
328 }
catch (
const std::bad_cast&)