IBR-DTNSuite
0.8
|
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 "core/Node.h" 00012 #include "net/Neighbor.h" 00013 #include "net/DiscoveryAnnouncement.h" 00014 #include "net/DiscoveryService.h" 00015 #include "Configuration.h" 00016 00017 #include <list> 00018 00019 namespace dtn 00020 { 00021 namespace net 00022 { 00023 class DiscoveryAgent 00024 { 00025 public: 00026 DiscoveryAgent(const dtn::daemon::Configuration::Discovery &config); 00027 virtual ~DiscoveryAgent() = 0; 00028 00029 void received(const dtn::net::DiscoveryAnnouncement &announcement, size_t timeout = 0); 00030 00031 void addService(string name, string parameters); 00032 void addService(dtn::net::DiscoveryServiceProvider *provider); 00033 00034 protected: 00035 virtual void sendAnnoucement(const u_int16_t &sn, std::list<dtn::net::DiscoveryService> &services) = 0; 00036 00037 void timeout(); 00038 00039 const dtn::daemon::Configuration::Discovery &_config; 00040 00041 private: 00042 std::list<Neighbor> _neighbors; 00043 u_int16_t _sn; 00044 std::list<dtn::net::DiscoveryService> _services; 00045 size_t _last_announce_sent; 00046 }; 00047 } 00048 } 00049 00050 #endif /* DISCOVERYAGENT_H_ */