Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
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
00043 virtual const std::string getName() const;
00044
00045 protected:
00046 void sendAnnoucement(const u_int16_t &sn, const std::list<DiscoveryService> &services);
00047 virtual void componentRun();
00048 virtual void componentUp();
00049 virtual void componentDown();
00050 bool __cancellation();
00051
00052 private:
00053 void send(ibrcommon::udpsocket::peer &p, const DiscoveryAnnouncement &announcement);
00054
00055 DiscoveryAnnouncement::DiscoveryVersion _version;
00056 ibrcommon::udpsocket *_socket;
00057 std::string _destination;
00058 std::list<ibrcommon::NetInterface> _interfaces;
00059
00060 std::map<std::string, ibrcommon::udpsocket* > _sockets;
00061 int _port;
00062 };
00063 }
00064 }
00065
00066 #endif