IBR-DTNSuite 0.6

daemon/src/core/BundleCore.h

Go to the documentation of this file.
00001 #ifndef BUNDLECORE_H_
00002 #define BUNDLECORE_H_
00003 
00004 #include "Component.h"
00005 
00006 #include "core/EventReceiver.h"
00007 #include "core/StatusReportGenerator.h"
00008 #include "core/BundleStorage.h"
00009 #include "core/WallClock.h"
00010 
00011 #include "net/ConnectionManager.h"
00012 #include "net/ConvergenceLayer.h"
00013 
00014 #include <ibrdtn/data/Serializer.h>
00015 #include <ibrdtn/data/EID.h>
00016 #include <ibrdtn/data/CustodySignalBlock.h>
00017 
00018 #include <vector>
00019 #include <set>
00020 #include <map>
00021 
00022 using namespace dtn::data;
00023 
00024 namespace dtn
00025 {
00026         namespace core
00027         {
00031                 class BundleCore : public dtn::daemon::IntegratedComponent, public dtn::core::EventReceiver, public dtn::data::Validator
00032                 {
00033                 public:
00034                         static dtn::data::EID local;
00035 
00036                         static BundleCore& getInstance();
00037 
00038                         WallClock& getClock();
00039 
00040                         void setStorage(dtn::core::BundleStorage *storage);
00041                         dtn::core::BundleStorage& getStorage();
00042 
00043                         void transferTo(const dtn::data::EID &destination, const dtn::data::BundleID &bundle);
00044 
00045                         void addConvergenceLayer(dtn::net::ConvergenceLayer *cl);
00046 
00047                         void addConnection(const dtn::core::Node &n);
00048                         void removeConnection(const dtn::core::Node &n);
00049 
00050                         const std::set<dtn::core::Node> getNeighbors();
00051 
00052                         void raiseEvent(const dtn::core::Event *evt);
00053 
00054                         virtual void validate(const dtn::data::PrimaryBlock &obj) const throw (RejectedException);
00055                         virtual void validate(const dtn::data::Block &obj, const size_t length) const throw (RejectedException);
00056                         virtual void validate(const dtn::data::Bundle &obj) const throw (RejectedException);
00057 
00061                         static size_t blocksizelimit;
00062 
00066                         static bool forwarding;
00067 
00071                         virtual const std::string getName() const;
00072 
00073                         static void processBlocks(dtn::data::Bundle &b);
00074 
00075                 protected:
00076                         virtual void componentUp();
00077                         virtual void componentDown();
00078 
00079                 private:
00083                         BundleCore();
00084 
00088                         virtual ~BundleCore();
00089 
00093                         BundleCore operator=(const BundleCore &k) { return k; };
00094 
00098                         WallClock _clock;
00099 
00100                         dtn::core::BundleStorage *_storage;
00101 
00102                         // generator for statusreports
00103                         StatusReportGenerator _statusreportgen;
00104 
00105                         // manager class for connections
00106                         dtn::net::ConnectionManager _connectionmanager;
00107                 };
00108         }
00109 }
00110 
00111 #endif /*BUNDLECORE_H_*/
00112