39 : type(t), protocol(p), value(uri), expire((to == 0) ? 0 : dtn::utils::Clock::getTime() + to), priority(prio)
51 std::vector<string>::const_iterator param_iter = parameters.begin();
53 while (param_iter != parameters.end())
57 if (p[0].compare(
"ip") == 0)
62 if (p[0].compare(
"port") == 0)
64 std::stringstream port_stream;
75 if (protocol < other.
protocol)
return true;
76 if (protocol != other.
protocol)
return false;
78 if (type < other.
type)
return true;
79 if (type != other.
type)
return false;
81 return (value < other.
value);
86 return ((type == other.
type) && (protocol == other.
protocol) && (value == other.
value));
91 return (protocol == p);
106 : type(t), name(n), value(v),
expire((to == 0) ? 0 : dtn::utils::Clock::getTime() + to), priority(p)
116 if (name < other.
name)
return true;
117 if (name != other.
name)
return false;
119 return (type < other.
type);
124 return ((type == other.
type) && (name == other.
name));
139 : _connect_immediately(false), _id(), _announced_mark(false)
144 : _connect_immediately(false), _id(id), _announced_mark(false)
157 return "unavailable";
163 return "static global";
166 return "static local";
172 return "dht discovered";
186 return "unsupported";
213 return "DGRAM:ETHERNET";
216 return "DGRAM:LOWPAN";
230 if (protocol ==
"UDP") {
232 }
else if (protocol ==
"TCP") {
234 }
else if (protocol ==
"LoWPAN") {
236 }
else if (protocol ==
"Bluetooth") {
238 }
else if (protocol ==
"HTTP") {
240 }
else if (protocol ==
"FILE") {
242 }
else if (protocol ==
"DGRAM:UDP") {
244 }
else if (protocol ==
"DGRAM:ETHERNET") {
246 }
else if (protocol ==
"DGRAM:LOWPAN") {
248 }
else if (protocol ==
"P2P:WIFI") {
250 }
else if (protocol ==
"unsupported") {
252 }
else if (protocol ==
"unsupported") {
261 for (std::set<URI>::const_iterator iter = _uri_list.begin(); iter != _uri_list.end(); ++iter)
263 if ((*iter) == proto)
return true;
270 for (std::set<Attribute>::const_iterator iter = _attr_list.begin(); iter != _attr_list.end(); ++iter)
272 if ((*iter) == name)
return true;
285 _attr_list.erase(attr);
286 _attr_list.insert(attr);
296 _attr_list.erase(attr);
307 return _uri_list.size() + _attr_list.size();
325 for (std::set<URI>::const_iterator iter = _uri_list.begin(); iter != _uri_list.end(); ++iter)
327 const URI &uri = (*iter);
342 for (std::set<URI>::const_iterator iter = _uri_list.begin(); iter != _uri_list.end(); ++iter)
344 const URI &uri = (*iter);
359 for (std::set<URI>::const_iterator iter = _uri_list.begin(); iter != _uri_list.end(); ++iter)
361 const URI &uri = (*iter);
363 if ((uri == proto) && (uri == type) &&
isAvailable(uri)) ret.push_back(uri);
371 std::list<Node::URI> ret;
372 for (std::set<URI>::const_iterator iter = _uri_list.begin(); iter != _uri_list.end(); ++iter)
374 const URI &uri = (*iter);
385 for (std::set<URI>::const_iterator iter = _uri_list.begin(); iter != _uri_list.end(); ++iter)
387 ret.insert((*iter).type);
392 std::list<Node::Attribute>
Node::get(
const std::string &name)
const
394 std::list<Attribute> ret;
395 for (std::set<Attribute>::const_iterator iter = _attr_list.begin(); iter != _attr_list.end(); ++iter)
397 if ((*iter) == name) ret.push_back(*iter);
419 std::set<Attribute>::iterator iter = _attr_list.begin();
420 while ( iter != _attr_list.end() )
426 _attr_list.erase(iter++);
437 std::set<URI>::iterator iter = _uri_list.begin();
438 while ( iter != _uri_list.end() )
440 const URI &u = (*iter);
444 _uri_list.erase(iter++);
453 return (_attr_list.empty() && _uri_list.empty());
458 for (std::set<Attribute>::const_iterator iter = other._attr_list.begin(); iter != other._attr_list.end(); ++iter)
464 for (std::set<URI>::const_iterator iter = other._uri_list.begin(); iter != other._uri_list.end(); ++iter)
466 const URI &u = (*iter);
475 for (std::set<Attribute>::const_iterator iter = other._attr_list.begin(); iter != other._attr_list.end(); ++iter)
481 for (std::set<URI>::const_iterator iter = other._uri_list.begin(); iter != other._uri_list.end(); ++iter)
483 const URI &u = (*iter);
492 return (other == _id);
497 return (other._id == _id);
502 if (_id < other._id )
return true;
515 return _connect_immediately;
520 _connect_immediately = val;
525 for (std::set<Node::URI>::const_iterator iter = _uri_list.begin(); iter != _uri_list.end(); ++iter)
537 return !_uri_list.empty();
540 for (std::set<Node::URI>::const_iterator iter = _uri_list.begin(); iter != _uri_list.end(); ++iter)
584 _announced_mark = val;
589 return _announced_mark;
594 stream <<
"Node: " << node._id.
getString() <<
" [ ";
595 for (std::set<Node::Attribute>::const_iterator iter = node._attr_list.begin(); iter != node._attr_list.end(); ++iter)
601 for (std::set<Node::URI>::const_iterator iter = node._uri_list.begin(); iter != node._uri_list.end(); ++iter)