00001 /* 00002 * IPNDAgent.h 00003 * 00004 * Created on: 09.09.2009 00005 * Author: morgenro 00006 * 00007 * IPND is based on the Internet-Draft for DTN-IPND. 00008 * 00009 * MUST support multicast 00010 * SHOULD support broadcast and unicast 00011 * 00012 * 00013 * 00014 */ 00015 00016 #ifndef IPNDAGENT_H_ 00017 #define IPNDAGENT_H_ 00018 00019 #include "net/DiscoveryAgent.h" 00020 #include "net/DiscoveryAnnouncement.h" 00021 #include <ibrcommon/net/vinterface.h> 00022 #include <ibrcommon/net/udpsocket.h> 00023 #include <ibrcommon/net/vsocket.h> 00024 #include <list> 00025 #include <map> 00026 00027 using namespace dtn::data; 00028 00029 namespace dtn 00030 { 00031 namespace net 00032 { 00033 class IPNDAgent : public DiscoveryAgent 00034 { 00035 public: 00036 IPNDAgent(int port, const ibrcommon::vaddress &address); 00037 virtual ~IPNDAgent(); 00038 00039 void bind(const ibrcommon::vinterface &net); 00040 00044 virtual const std::string getName() const; 00045 00046 protected: 00047 void sendAnnoucement(const u_int16_t &sn, std::list<DiscoveryService> &services); 00048 virtual void componentRun(); 00049 virtual void componentUp(); 00050 virtual void componentDown(); 00051 bool __cancellation(); 00052 00053 private: 00054 void send(const DiscoveryAnnouncement &a, const ibrcommon::vinterface &iface, const ibrcommon::vaddress &addr, const unsigned int port); 00055 00056 DiscoveryAnnouncement::DiscoveryVersion _version; 00057 ibrcommon::vsocket _socket; 00058 ibrcommon::vaddress _destination; 00059 std::list<ibrcommon::vinterface> _interfaces; 00060 00061 int _port; 00062 }; 00063 } 00064 } 00065 00066 #endif /* IPNDAGENT_H_ */
1.7.1