summaryrefslogtreecommitdiff
path: root/src/packetSource.h
diff options
context:
space:
mode:
authorChristian Pointner <equinox@anytun.org>2009-03-05 23:47:47 +0000
committerChristian Pointner <equinox@anytun.org>2009-03-05 23:47:47 +0000
commit74f2885ade3fb44784e1fbc2fd0575f69728077c (patch)
tree6f4df7db14f646d277fe3853b887711d976c2230 /src/packetSource.h
parentfixed daemonizing and boost::thread problem (workaround) (diff)
changed packetSource to use gResolver
Diffstat (limited to 'src/packetSource.h')
-rw-r--r--src/packetSource.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/packetSource.h b/src/packetSource.h
index ce6e997..94c6c45 100644
--- a/src/packetSource.h
+++ b/src/packetSource.h
@@ -35,8 +35,9 @@
#include <boost/asio.hpp>
#include "datatypes.h"
+#include "threadUtils.hpp"
-// TODO: fix this
+// TODO: fix this when other packetSource types are introduced
typedef boost::asio::ip::udp::endpoint PacketSourceEndpoint;
class PacketSource
@@ -46,6 +47,11 @@ public:
virtual u_int32_t recv(u_int8_t* buf, u_int32_t len, PacketSourceEndpoint& remote) = 0;
virtual void send(u_int8_t* buf, u_int32_t len, PacketSourceEndpoint remote) = 0;
+
+ void waitUntilReady();
+
+protected:
+ Semaphore ready_sem_;
};
class UDPPacketSource : public PacketSource
@@ -59,6 +65,8 @@ public:
u_int32_t recv(u_int8_t* buf, u_int32_t len, PacketSourceEndpoint& remote);
void send(u_int8_t* buf, u_int32_t len, PacketSourceEndpoint remote);
+ void onResolve(const boost::asio::ip::udp::endpoint& e);
+
private:
boost::asio::io_service io_service_;