diff options
author | Stephen Morris <stephen@isc.org> | 2011-02-15 20:06:32 +0100 |
---|---|---|
committer | Stephen Morris <stephen@isc.org> | 2011-02-15 20:06:32 +0100 |
commit | 7ddfd9eca150efa2fed15114034e5297db765a53 (patch) | |
tree | 6634058bd093e192eda8dc6e3e62ab204418a33c /src/lib/asiolink/udp_endpoint.h | |
parent | [trac554] First stage of adding protocol-dependent upstream fetch (diff) | |
download | kea-7ddfd9eca150efa2fed15114034e5297db765a53.tar.xz kea-7ddfd9eca150efa2fed15114034e5297db765a53.zip |
[trac554] Now have UDPSocket and its unit test working
Diffstat (limited to 'src/lib/asiolink/udp_endpoint.h')
-rw-r--r-- | src/lib/asiolink/udp_endpoint.h | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/src/lib/asiolink/udp_endpoint.h b/src/lib/asiolink/udp_endpoint.h index 27541e0489..0958af6e4d 100644 --- a/src/lib/asiolink/udp_endpoint.h +++ b/src/lib/asiolink/udp_endpoint.h @@ -33,6 +33,16 @@ public: /// \name Constructors and Destructor. /// //@{ + + /// \brief Default Constructor + /// + /// Creates an internal endpoint. This is expected to be set by some + /// external call. + UDPEndpoint() : + asio_endpoint_placeholder_(new asio::ip::udp::endpoint()), + asio_endpoint_(*asio_endpoint_placeholder_) + {} + /// \brief Constructor from a pair of address and port. /// /// \param address The IP address of the endpoint. @@ -50,27 +60,27 @@ public: /// corresponding ASIO class, \c udp::endpoint. /// /// \param asio_endpoint The ASIO representation of the UDP endpoint. - UDPEndpoint(const asio::ip::udp::endpoint& asio_endpoint) : + UDPEndpoint(asio::ip::udp::endpoint& asio_endpoint) : asio_endpoint_placeholder_(NULL), asio_endpoint_(asio_endpoint) {} /// \brief The destructor. - ~UDPEndpoint() { delete asio_endpoint_placeholder_; } + virtual ~UDPEndpoint() { delete asio_endpoint_placeholder_; } //@} - inline IOAddress getAddress() const { + virtual IOAddress getAddress() const { return (asio_endpoint_.address()); } - inline uint16_t getPort() const { + virtual uint16_t getPort() const { return (asio_endpoint_.port()); } - inline short getProtocol() const { + virtual short getProtocol() const { return (asio_endpoint_.protocol().protocol()); } - inline short getFamily() const { + virtual short getFamily() const { return (asio_endpoint_.protocol().family()); } @@ -79,10 +89,13 @@ public: inline const asio::ip::udp::endpoint& getASIOEndpoint() const { return (asio_endpoint_); } + inline asio::ip::udp::endpoint& getASIOEndpoint() { + return (asio_endpoint_); + } private: - const asio::ip::udp::endpoint* asio_endpoint_placeholder_; - const asio::ip::udp::endpoint& asio_endpoint_; + asio::ip::udp::endpoint* asio_endpoint_placeholder_; + asio::ip::udp::endpoint& asio_endpoint_; }; } // namespace asiolink |