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 || p[0].compare(
"email") == 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";
233 if (protocol ==
"UDP") {
235 }
else if (protocol ==
"TCP") {
237 }
else if (protocol ==
"LoWPAN") {
239 }
else if (protocol ==
"Bluetooth") {
241 }
else if (protocol ==
"HTTP") {
243 }
else if (protocol ==
"FILE") {
245 }
else if (protocol ==
"DGRAM:UDP") {
247 }
else if (protocol ==
"DGRAM:ETHERNET") {
249 }
else if (protocol ==
"DGRAM:LOWPAN") {
251 }
else if (protocol ==
"P2P:WIFI") {
253 }
else if (protocol ==
"unsupported") {
255 }
else if (protocol ==
"unsupported") {
264 for (std::set<URI>::const_iterator iter = _uri_list.begin(); iter != _uri_list.end(); ++iter)
266 if ((*iter) == proto)
return true;
273 for (std::set<Attribute>::const_iterator iter = _attr_list.begin(); iter != _attr_list.end(); ++iter)
275 if ((*iter) == name)
return true;
288 _attr_list.erase(attr);
289 _attr_list.insert(attr);
299 _attr_list.erase(attr);
310 return _uri_list.size() + _attr_list.size();
328 for (std::set<URI>::const_iterator iter = _uri_list.begin(); iter != _uri_list.end(); ++iter)
330 const URI &uri = (*iter);
345 for (std::set<URI>::const_iterator iter = _uri_list.begin(); iter != _uri_list.end(); ++iter)
347 const URI &uri = (*iter);
362 for (std::set<URI>::const_iterator iter = _uri_list.begin(); iter != _uri_list.end(); ++iter)
364 const URI &uri = (*iter);
366 if ((uri == proto) && (uri == type) &&
isAvailable(uri)) ret.push_back(uri);
374 std::list<Node::URI> ret;
375 for (std::set<URI>::const_iterator iter = _uri_list.begin(); iter != _uri_list.end(); ++iter)
377 const URI &uri = (*iter);
388 for (std::set<URI>::const_iterator iter = _uri_list.begin(); iter != _uri_list.end(); ++iter)
390 ret.insert((*iter).type);
395 std::list<Node::Attribute>
Node::get(
const std::string &name)
const
397 std::list<Attribute> ret;
398 for (std::set<Attribute>::const_iterator iter = _attr_list.begin(); iter != _attr_list.end(); ++iter)
400 if ((*iter) == name) ret.push_back(*iter);
422 std::set<Attribute>::iterator iter = _attr_list.begin();
423 while ( iter != _attr_list.end() )
429 _attr_list.erase(iter++);
440 std::set<URI>::iterator iter = _uri_list.begin();
441 while ( iter != _uri_list.end() )
443 const URI &u = (*iter);
447 _uri_list.erase(iter++);
456 return (_attr_list.empty() && _uri_list.empty());
461 for (std::set<Attribute>::const_iterator iter = other._attr_list.begin(); iter != other._attr_list.end(); ++iter)
467 for (std::set<URI>::const_iterator iter = other._uri_list.begin(); iter != other._uri_list.end(); ++iter)
469 const URI &u = (*iter);
478 for (std::set<Attribute>::const_iterator iter = other._attr_list.begin(); iter != other._attr_list.end(); ++iter)
484 for (std::set<URI>::const_iterator iter = other._uri_list.begin(); iter != other._uri_list.end(); ++iter)
486 const URI &u = (*iter);
495 return (other == _id);
500 return (other._id == _id);
505 if (_id < other._id )
return true;
518 return _connect_immediately;
523 _connect_immediately = val;
528 for (std::set<Node::URI>::const_iterator iter = _uri_list.begin(); iter != _uri_list.end(); ++iter)
540 return !_uri_list.empty();
543 for (std::set<Node::URI>::const_iterator iter = _uri_list.begin(); iter != _uri_list.end(); ++iter)
587 _announced_mark = val;
592 return _announced_mark;
597 stream <<
"Node: " << node._id.
getString() <<
" [ ";
598 for (std::set<Node::Attribute>::const_iterator iter = node._attr_list.begin(); iter != node._attr_list.end(); ++iter)
604 for (std::set<Node::URI>::const_iterator iter = node._uri_list.begin(); iter != node._uri_list.end(); ++iter)