00001 /* 00002 * DiscoveryAgent.h 00003 * 00004 * Created on: 09.09.2009 00005 * Author: morgenro 00006 */ 00007 00008 #ifndef DISCOVERYAGENT_H_ 00009 #define DISCOVERYAGENT_H_ 00010 00011 #include "Component.h" 00012 00013 #include "core/Node.h" 00014 #include "core/EventReceiver.h" 00015 00016 #include "net/Neighbor.h" 00017 #include "net/DiscoveryAnnouncement.h" 00018 #include "net/DiscoveryService.h" 00019 #include "Configuration.h" 00020 #include <ibrcommon/thread/Timer.h> 00021 00022 using namespace dtn::data; 00023 00024 #include <list> 00025 00026 namespace dtn 00027 { 00028 namespace net 00029 { 00030 class DiscoveryAgent : public dtn::daemon::IndependentComponent, public ibrcommon::SimpleTimerCallback 00031 { 00032 public: 00033 DiscoveryAgent(const dtn::daemon::Configuration::Discovery &config); 00034 virtual ~DiscoveryAgent() = 0; 00035 00036 void received(const DiscoveryAnnouncement &announcement); 00037 00038 void addService(string name, string parameters); 00039 void addService(DiscoveryServiceProvider *provider); 00040 00041 virtual size_t timeout(size_t identifier); 00042 00043 protected: 00044 virtual void componentUp(); 00045 virtual void componentDown(); 00046 virtual void componentRun() = 0; 00047 virtual void sendAnnoucement(const u_int16_t &sn, std::list<DiscoveryService> &services) = 0; 00048 00049 const dtn::daemon::Configuration::Discovery &_config; 00050 00051 private: 00052 list<Neighbor> _neighbors; 00053 u_int16_t _sn; 00054 std::list<DiscoveryService> _services; 00055 ibrcommon::SimpleTimer _clock; 00056 }; 00057 } 00058 } 00059 00060 #endif /* DISCOVERYAGENT_H_ */
1.7.1