• Main Page
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

daemon/src/core/Node.h

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                          * Set a description for the node.
00091                          * @param description a description
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 
00117                         void setEID(const dtn::data::EID &id);
00118 
00123                         const dtn::data::EID& getEID() const;
00124 
00130                         void setTimeout(int timeout);
00131 
00136                         int getTimeout() const;
00137 
00141                         unsigned int getRoundTripTime() const;
00142 
00148                         bool decrementTimeout(int step);
00149 
00156                         bool operator==(const Node &other) const;
00157                         bool operator<(const Node &other) const;
00158 
00159                         std::string toString() const;
00160 
00161                         bool doConnectImmediately() const;
00162                         void setConnectImmediately(bool val);
00163 
00164                 private:
00165                         bool _connect_immediately;
00166                         std::string _address;
00167                         std::string _description;
00168                         dtn::data::EID _id;
00169                         int _timeout;
00170                         unsigned int _rtt;
00171                         Node::Type _type;
00172                         unsigned int _port;
00173                         Node::Protocol _protocol;
00174                 };
00175         }
00176 }
00177 
00178 #endif /*IBRDTN_DAEMON_NODE_H_*/

Generated on Wed Mar 30 2011 11:11:49 for IBR-DTNSuite by  doxygen 1.7.1