Go to the documentation of this file.00001
00002 #ifndef IBRDTN_DAEMON_NODE_H_
00003 #define IBRDTN_DAEMON_NODE_H_
00004
00005 #include <string>
00006 #include <ibrdtn/data/EID.h>
00007
00008 namespace dtn
00009 {
00010 namespace net
00011 {
00012 class ConvergenceLayer;
00013 }
00014
00015 namespace core
00016 {
00020 class Node
00021 {
00022 public:
00028 enum Type
00029 {
00030 NODE_FLOATING = 0,
00031 NODE_PERMANENT = 1,
00032 NODE_CONNECTED = 2
00033 };
00034
00035 enum Protocol
00036 {
00037 CONN_UNSUPPORTED = -1,
00038 CONN_UNDEFINED = 0,
00039 CONN_UDPIP = 1,
00040 CONN_TCPIP = 2,
00041 CONN_ZIGBEE = 3,
00042 CONN_BLUETOOTH = 4,
00043 CONN_HTTP = 5
00044 };
00045
00046 static std::string getTypeName(Node::Type type);
00047 static std::string getProtocolName(Node::Protocol proto);
00048
00054 Node(Node::Type type = NODE_PERMANENT, unsigned int rtt = 2700);
00055
00056 Node(dtn::data::EID id, Node::Protocol proto = CONN_UNDEFINED, Node::Type type = NODE_PERMANENT, unsigned int rtt = 2700);
00057
00061 virtual ~Node();
00062
00068 Node::Type getType() const;
00069 void setType(Node::Type type);
00070
00071 void setProtocol(Node::Protocol protocol);
00072 Node::Protocol getProtocol() const;
00073
00078 void setAddress(std::string address);
00079
00084 std::string getAddress() const;
00085
00086 void setPort(unsigned int port);
00087 unsigned int getPort() const;
00088
00089
00090
00091
00092
00093 void setDescription(std::string description);
00094
00099 std::string getDescription() const;
00100
00105 void setURI(std::string uri);
00106
00111 std::string getURI() const;
00112
00118 void setTimeout(int timeout);
00119
00124 int getTimeout() const;
00125
00129 unsigned int getRoundTripTime() const;
00130
00136 bool decrementTimeout(int step);
00137
00144 bool operator==(const Node &other) const;
00145 bool operator<(const Node &other) const;
00146
00147 std::string toString() const;
00148
00149 private:
00150 std::string _address;
00151 std::string _description;
00152 dtn::data::EID _id;
00153 int _timeout;
00154 unsigned int _rtt;
00155 Node::Type _type;
00156 unsigned int _port;
00157 Node::Protocol _protocol;
00158 };
00159 }
00160 }
00161
00162 #endif