summaryrefslogtreecommitdiff
path: root/src/packetSource.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/packetSource.h')
-rw-r--r--src/packetSource.h14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/packetSource.h b/src/packetSource.h
index 2b08cf8..d8914b9 100644
--- a/src/packetSource.h
+++ b/src/packetSource.h
@@ -34,23 +34,25 @@
#include "datatypes.h"
#include "buffer.h"
+typedef boost::asio::ip::udp::endpoint PacketSourceEndpoint;
+
class PacketSource
{
public:
virtual ~PacketSource() {}
- virtual u_int32_t recv(u_int8_t* buf, u_int32_t len, std::string& addr, u_int16_t &port) = 0;
- virtual void send(u_int8_t* buf, u_int32_t len, std::string addr, u_int16_t port) = 0;
+ 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;
};
class UDPPacketSource : public PacketSource
{
public:
- UDPPacketSource(u_int16_t port);
- UDPPacketSource(std::string localaddr, u_int16_t port);
+ UDPPacketSource(std::string port);
+ UDPPacketSource(std::string localaddr, std::string port);
- u_int32_t recv(u_int8_t* buf, u_int32_t len, std::string& addr, u_int16_t &port);
- void send(u_int8_t* buf, u_int32_t len, std::string addr, u_int16_t port);
+ 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);
private:
boost::asio::io_service io_service_;