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 
00049                         const std::set<dtn::core::Node> getNeighbors();
00050 
00051                         void raiseEvent(const dtn::core::Event *evt);
00052 
00053                         virtual void validate(const dtn::data::PrimaryBlock &obj) const throw (RejectedException);
00054                         virtual void validate(const dtn::data::Block &obj, const size_t length) const throw (RejectedException);
00055                         virtual void validate(const dtn::data::Bundle &obj) const throw (RejectedException);
00056 
00060                         static size_t blocksizelimit;
00061 
00065                         static bool forwarding;
00066 
00070                         virtual const std::string getName() const;
00071 
00072                         static void processBlocks(dtn::data::Bundle &b);
00073 
00074                 protected:
00075                         virtual void componentUp();
00076                         virtual void componentDown();
00077 
00078                 private:
00082                         BundleCore();
00083 
00087                         virtual ~BundleCore();
00088 
00092                         BundleCore operator=(const BundleCore &k) { return k; };
00093 
00097                         WallClock _clock;
00098 
00099                         dtn::core::BundleStorage *_storage;
00100 
00101                         // generator for statusreports
00102                         StatusReportGenerator _statusreportgen;
00103 
00104                         // manager class for connections
00105                         dtn::net::ConnectionManager _connectionmanager;
00106                 };
00107         }
00108 }
00109 
00110 #endif /*BUNDLECORE_H_*/
00111