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 00020 using namespace dtn::data; 00021 00022 #include <list> 00023 00024 namespace dtn 00025 { 00026 namespace net 00027 { 00028 class DiscoveryAgent : public dtn::daemon::IndependentComponent, public dtn::core::EventReceiver 00029 { 00030 public: 00031 DiscoveryAgent(); 00032 virtual ~DiscoveryAgent() = 0; 00033 00034 void received(const DiscoveryAnnouncement &announcement); 00035 void raiseEvent(const dtn::core::Event *evt); 00036 00037 void addService(string name, string parameters); 00038 void addService(DiscoveryServiceProvider *provider); 00039 00040 protected: 00041 virtual void componentUp(); 00042 virtual void componentDown(); 00043 virtual void componentRun() = 0; 00044 virtual void sendAnnoucement(const u_int16_t &sn, const std::list<DiscoveryService> &services) = 0; 00045 bool _running; 00046 00047 private: 00048 list<Neighbor> _neighbors; 00049 u_int16_t _sn; 00050 std::list<DiscoveryService> _services; 00051 }; 00052 } 00053 } 00054 00055 #endif /* DISCOVERYAGENT_H_ */
1.6.3