00001 /* 00002 * NeighborRoutingExtension.h 00003 * 00004 * Created on: 16.02.2010 00005 * Author: morgenro 00006 */ 00007 00008 #ifndef NEIGHBORROUTINGEXTENSION_H_ 00009 #define NEIGHBORROUTINGEXTENSION_H_ 00010 00011 #include "routing/BaseRouter.h" 00012 #include <ibrdtn/data/MetaBundle.h> 00013 #include "ibrdtn/data/EID.h" 00014 #include "core/Node.h" 00015 #include <list> 00016 #include <map> 00017 #include <queue> 00018 00019 namespace dtn 00020 { 00021 namespace routing 00022 { 00023 class NeighborRoutingExtension : public BaseRouter::ThreadedExtension 00024 { 00025 public: 00026 NeighborRoutingExtension(); 00027 ~NeighborRoutingExtension(); 00028 00029 void notify(const dtn::core::Event *evt); 00030 00031 virtual void stopExtension(); 00032 00033 protected: 00034 void run(); 00035 00036 private: 00043 bool isNeighbor(const dtn::data::EID &eid) const; 00044 00051 void remove(const dtn::data::BundleID &id); 00052 00053 void route(const dtn::data::MetaBundle &meta); 00054 00055 std::list<dtn::core::Node> _neighbors; 00056 std::map<dtn::data::EID, std::queue<dtn::data::BundleID> > _stored_bundles; 00057 std::queue<dtn::data::EID> _available; 00058 00059 bool _running; 00060 ibrcommon::Conditional _wait; 00061 }; 00062 } 00063 } 00064 00065 #endif /* NEIGHBORROUTINGEXTENSION_H_ */
1.6.3