From 84f11351fe5ab9fb2e8c7b7caecb4c7b5a26b595 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Mon, 24 Nov 2008 20:52:38 +0000 Subject: PacketSource changed to use endpoint instead of port and address --- src/packetSource.h | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src/packetSource.h') 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_; -- cgit v1.2.3