summaryrefslogtreecommitdiff
path: root/src/packetSource.h
diff options
context:
space:
mode:
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_;