42 using namespace dtn::core;
48 struct CompareNodeDestination:
49 public std::binary_function< dtn::core::Node, dtn::data::EID, bool > {
51 return node.
getEID() == destination;
55 ConnectionManager::ConnectionManager()
56 : _next_autoconnect(0)
94 _next_autoconnect = 0;
128 }
catch (
const std::bad_cast&) { }
139 }
catch (
const std::bad_cast&) { }
162 }
catch (
const std::bad_cast&) { }
167 case GlobalEvent::GLOBAL_INTERNET_AVAILABLE:
171 case GlobalEvent::GLOBAL_INTERNET_UNAVAILABLE:
178 }
catch (
const std::bad_cast&) { };
188 std::list<Node::URI> uri = node.
get(Node::CONN_EMAIL);
189 for(std::list<Node::URI>::iterator iter = uri.begin(); iter != uri.end(); iter++)
193 (*iter).decode(address, port);
207 if(node.
getAll().size() == 0)
217 pair<nodemap::iterator,bool> ret = _nodes.insert( pair<dtn::data::EID, dtn::core::Node>(n.
getEID(), n) );
227 if (old != db.
size()) {
254 if (old != db.
size()) {
278 for (std::set<ConvergenceLayer*>::const_iterator iter = _cl.begin(); iter != _cl.end(); ++iter)
288 for (std::set<ConvergenceLayer*>::iterator iter = _cl.begin(); iter != _cl.end(); ++iter)
298 _dialups.insert(ext);
316 void ConnectionManager::check_available()
321 for (nodemap::iterator iter = _nodes.begin(); iter != _nodes.end(); ++iter)
335 void ConnectionManager::check_unavailable()
340 nodemap::iterator iter = _nodes.begin();
341 while ( iter != _nodes.end() )
364 _nodes.erase( iter++ );
373 void ConnectionManager::check_autoconnect()
375 std::queue<dtn::core::Node> connect_nodes;
378 if (interval == 0)
return;
384 for (nodemap::const_iterator iter = _nodes.begin(); iter != _nodes.end(); ++iter)
386 const Node &n = (*iter).second;
387 std::list<Node::URI> ul = n.
get(Node::NODE_CONNECTED, Node::CONN_TCPIP);
391 connect_nodes.push(n);
399 while (!connect_nodes.empty())
402 open(connect_nodes.front());
417 for (std::set<ConvergenceLayer*>::iterator iter = _cl.begin(); iter != _cl.end(); ++iter)
431 if (node.hasDialup())
446 std::list<Node::URI> uri_list = n.
get(Node::NODE_P2P_DIALUP);
449 for (std::list<Node::URI>::const_iterator it = uri_list.begin(); it != uri_list.end(); ++it)
454 for (std::set<P2PDialupExtension*>::iterator iter = _dialups.begin(); iter != _dialups.end(); ++iter)
469 std::list<Node::URI> uri_list = node.
getAll();
472 for (std::list<Node::URI>::const_iterator it = uri_list.begin(); it != uri_list.end(); ++it)
480 for (std::set<ConvergenceLayer*>::iterator iter = _cl.begin(); iter != _cl.end(); ++iter)
485 cl->
queue(node, job);
506 for (nodemap::const_iterator iter = _nodes.begin(); iter != _nodes.end(); ++iter)
539 std::set<dtn::core::Node> ret;
541 for (nodemap::const_iterator iter = _nodes.begin(); iter != _nodes.end(); ++iter)
543 const Node &n = (*iter).second;
553 const Node &n = getNode(eid);
577 return "ConnectionManager";
582 nodemap::iterator iter = _nodes.find(eid);
584 return (*iter).second;