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

daemon/src/net/ConnectionManager.h

Go to the documentation of this file.
00001 /*
00002  * ConnectionManager.h
00003  *
00004  *  Created on: 18.09.2009
00005  *      Author: morgenro
00006  */
00007 
00008 #ifndef CONNECTIONMANAGER_H_
00009 #define CONNECTIONMANAGER_H_
00010 
00011 #include "Component.h"
00012 #include "net/ConvergenceLayer.h"
00013 #include "net/BundleReceiver.h"
00014 #include "core/EventReceiver.h"
00015 #include <ibrdtn/data/EID.h>
00016 #include "core/Node.h"
00017 #include <ibrcommon/Exceptions.h>
00018 
00019 #include <set>
00020 
00021 namespace dtn
00022 {
00023         namespace net
00024         {
00025                 class NeighborNotAvailableException : public ibrcommon::Exception
00026                 {
00027                 public:
00028                         NeighborNotAvailableException(string what = "The requested connection is not available.") throw() : ibrcommon::Exception(what)
00029                         {
00030                         };
00031                 };
00032 
00033                 class ConnectionNotAvailableException : public ibrcommon::Exception
00034                 {
00035                 public:
00036                         ConnectionNotAvailableException(string what = "The requested connection is not available.") throw() : ibrcommon::Exception(what)
00037                         {
00038                         };
00039                 };
00040 
00041                 class ConnectionManager : public dtn::core::EventReceiver, public dtn::daemon::IntegratedComponent
00042                 {
00043                 public:
00044                         ConnectionManager();
00045                         virtual ~ConnectionManager();
00046 
00047                         void addConnection(const dtn::core::Node &n);
00048                         void addConvergenceLayer(ConvergenceLayer *cl);
00049 
00050                         void queue(const dtn::data::EID &eid, const dtn::data::BundleID &b);
00051 
00055                         void raiseEvent(const dtn::core::Event *evt);
00056 
00057                         class ShutdownException : public ibrcommon::Exception
00058                         {
00059                         public:
00060                                 ShutdownException(string what = "System shutdown") throw() : ibrcommon::Exception(what)
00061                                 {
00062                                 };
00063                         };
00064 
00065                         void queue(const ConvergenceLayer::Job &job);
00066 
00071                         const std::set<dtn::core::Node> getNeighbors();
00072 
00078                         bool isNeighbor(const dtn::core::Node&);
00079 
00083                         virtual const std::string getName() const;
00084 
00085                 protected:
00090                         void discovered(dtn::core::Node &node);
00091 
00095                         void check_discovered();
00096 
00097                         virtual void componentUp();
00098                         virtual void componentDown();
00099 
00100                 private:
00104                         void queue(const dtn::core::Node &node, const ConvergenceLayer::Job &job);
00105 
00106                         // if set to true, this module will shutdown
00107                         bool _shutdown;
00108 
00109                         // mutex for the list of convergence layers
00110                         ibrcommon::Mutex _cl_lock;
00111 
00112                         // contains all configured convergence layers
00113                         std::set<ConvergenceLayer*> _cl;
00114 
00115                         // mutex for the lists of nodes
00116                         ibrcommon::Mutex _node_lock;
00117 
00118                         // contains all static configured nodes
00119                         std::set<dtn::core::Node> _static_nodes;
00120 
00121                         // contains all dynamic discovered nodes
00122                         std::set<dtn::core::Node> _discovered_nodes;
00123 
00124                         // contains all connected nodes
00125                         std::set<dtn::core::Node> _connected_nodes;
00126                 };
00127         }
00128 }
00129 
00130 #endif /* CONNECTIONMANAGER_H_ */

Generated on Thu Nov 11 2010 09:49:47 for IBR-DTNSuite by  doxygen 1.7.1