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 };
00033
00034 enum Protocol
00035 {
00036 CONN_UNSUPPORTED = -1,
00037 CONN_UNDEFINED = 0,
00038 CONN_UDPIP = 1,
00039 CONN_TCPIP = 2,
00040 CONN_ZIGBEE = 3,
00041 CONN_BLUETOOTH = 4,
00042 CONN_HTTP = 5
00043 };
00044
00045 static std::string getTypeName(Node::Type type);
00046 static std::string getProtocolName(Node::Protocol proto);
00047
00053 Node(Node::Type type = NODE_PERMANENT, unsigned int rtt = 2700);
00054
00055 Node(dtn::data::EID id, Node::Protocol proto = CONN_UNDEFINED, Node::Type type = NODE_PERMANENT, unsigned int rtt = 2700);
00056
00060 virtual ~Node();
00061
00067 Node::Type getType() const;
00068
00069 void setProtocol(Node::Protocol protocol);
00070 Node::Protocol getProtocol() const;
00071
00076 void setAddress(std::string address);
00077
00082 std::string getAddress() const;
00083
00084 void setPort(unsigned int port);
00085 unsigned int getPort() const;
00086
00087
00088
00089
00090
00091 void setDescription(std::string description);
00092
00097 std::string getDescription() const;
00098
00103 void setURI(std::string uri);
00104
00109 std::string getURI() const;
00110
00116 void setTimeout(int timeout);
00117
00122 int getTimeout() const;
00123
00127 unsigned int getRoundTripTime() const;
00128
00134 bool decrementTimeout(int step);
00135
00142 bool operator==(const Node &other) const;
00143 bool operator<(const Node &other) const;
00144
00145 std::string toString() const;
00146
00147 private:
00148 std::string _address;
00149 std::string _description;
00150 dtn::data::EID _id;
00151 int _timeout;
00152 unsigned int _rtt;
00153 Node::Type _type;
00154 unsigned int _port;
00155 Node::Protocol _protocol;
00156 };
00157 }
00158 }
00159
00160 #endif