Commit 121b62df authored by JINMEI Tatuya's avatar JINMEI Tatuya
Browse files

completed implementation of IOAddress


git-svn-id: svn://bind10.isc.org/svn/bind10/branches/trac221@2171 e5f2f494-b856-4b98-b285-d166d9295462
parent 04959743
......@@ -92,8 +92,23 @@ dispatch_axfr_query(const int tcp_sock, char const axfr_query[],
namespace asio_link {
IOAddress::IOAddress(const string& address_str) :
asio_address_placeholder_(NULL),
asio_address_(*asio_address_placeholder_) // XXX
// XXX: we cannot simply construct the address in the initialization list
// because we'd like to throw our own exception on failure.
asio_address_placeholder_(new ip::address()),
asio_address_(*asio_address_placeholder_)
{
error_code err;
const ip::address address = ip::address::from_string(address_str, err);
if (err) {
delete asio_address_placeholder_;
isc_throw(IOError, "Failed to convert string to address '"
<< address_str << "': " << err.message());
}
*asio_address_placeholder_ = address;
}
IOAddress::IOAddress(const ip::address& asio_address) :
asio_address_placeholder_(NULL), asio_address_(asio_address)
{}
IOAddress::~IOAddress() {
......@@ -102,7 +117,7 @@ IOAddress::~IOAddress() {
string
IOAddress::toText() const {
return ("dummy");
return (asio_address_.to_string());
}
//
......
......@@ -44,6 +44,9 @@ public:
};
class IOAddress {
private:
IOAddress(const IOAddress& source);
IOAddress& operator=(const IOAddress& source);
public:
IOAddress(const std::string& adress_str);
IOAddress(const asio::ip::address& asio_adress);
......@@ -51,10 +54,13 @@ public:
~IOAddress();
private:
asio::ip::address* asio_address_placeholder_;
asio::ip::address& asio_address_;
const asio::ip::address& asio_address_;
};
class IOMessage {
private:
IOMessage(const IOMessage& source);
IOMessage& operator=(const IOMessage& source);
public:
IOMessage();
~IOMessage();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment