00001 #ifndef BUNDLECORE_H_
00002 #define BUNDLECORE_H_
00003
00004 #include "core/AbstractBundleStorage.h"
00005 #include "core/ConvergenceLayer.h"
00006 #include "data/BundleFactory.h"
00007 #include "core/BundleRouter.h"
00008 #include "core/CustodyTimer.h"
00009 #include "core/BundleReceiver.h"
00010 #include "core/EventReceiver.h"
00011 #include "core/CustodyManager.h"
00012 #include "core/Event.h"
00013
00014 #include "data/CustodySignalBlock.h"
00015 #include "data/StatusReportBlock.h"
00016 #include <vector>
00017 #include <list>
00018 #include "utils/MutexLock.h"
00019 #include "utils/Mutex.h"
00020 #include "utils/Service.h"
00021
00022
00023 using namespace dtn::data;
00024 using namespace dtn::utils;
00025
00026 namespace dtn
00027 {
00028 namespace core
00029 {
00030 class AbstractWorker;
00031
00035 class BundleCore : public Service, public BundleReceiver, public EventReceiver
00036 {
00037 public:
00038 static BundleCore& getInstance(string eid);
00039 static BundleCore& getInstance();
00040
00047 void setConvergenceLayer(ConvergenceLayer *cl);
00048
00053 ConvergenceLayer* getConvergenceLayer();
00054
00058 CustodyManager& getCustodyManager();
00059
00060 void registerSubNode(string eid, AbstractWorker *node);
00061 void unregisterSubNode(string eid);
00062
00063 virtual void received(const ConvergenceLayer &cl, const Bundle &b);
00064
00065 string getLocalURI() const;
00066
00070 void raiseEvent(const Event *evt);
00071
00075 void transmit(const Node &n, const Bundle &b);
00076
00080 void deliver(const Bundle &b);
00081
00082 protected:
00083 void tick();
00084
00085 private:
00089 BundleCore();
00090
00094 virtual ~BundleCore();
00095
00096 void transmit(const Bundle &b);
00097
00101 BundleCore operator=(const BundleCore &k) {};
00102
00103 void setLocalEID(string eid);
00104
00105 void transmitCustody(bool accept, const Bundle &b);
00106
00107 Bundle createStatusReport(const Bundle &b, StatusReportType type, StatusReportReasonCode reason = NO_ADDITIONAL_INFORMATION);
00108 Bundle createCustodySignal(const Bundle &b, bool accepted);
00109
00110 ConvergenceLayer *m_clayer;
00111 map<string, AbstractWorker*> m_worker;
00112 string m_localeid;
00113 CustodyManager m_cm;
00114 unsigned int m_dtntime;
00115 };
00116 }
00117 }
00118
00119 #endif
00120