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/NetInterface.h> 00022 #include <ibrcommon/net/udpsocket.h> 00023 #include <list> 00024 #include <map> 00025 00026 using namespace dtn::data; 00027 00028 namespace dtn 00029 { 00030 namespace net 00031 { 00032 class IPNDAgent : public DiscoveryAgent 00033 { 00034 public: 00035 IPNDAgent(int port, std::string address); 00036 virtual ~IPNDAgent(); 00037 00038 void bind(const ibrcommon::NetInterface &net); 00039 00040 protected: 00041 void sendAnnoucement(const u_int16_t &sn, const std::list<DiscoveryService> &services); 00042 virtual void componentRun(); 00043 virtual void componentUp(); 00044 virtual void componentDown(); 00045 00046 private: 00047 void send(ibrcommon::udpsocket::peer &p, const DiscoveryAnnouncement &announcement); 00048 00049 ibrcommon::udpsocket *_socket; 00050 std::string _destination; 00051 std::list<ibrcommon::NetInterface> _interfaces; 00052 00053 std::map<std::string, ibrcommon::udpsocket* > _sockets; 00054 int _port; 00055 }; 00056 } 00057 } 00058 00059 #endif /* IPNDAGENT_H_ */
1.6.3