BIND 10 trac569, updated. 5e357877317a7a70e9a66643a4f846c32f5dc2ae [trac569] Move coroutine.h to ext/
BIND 10 source code commits
bind10-changes at lists.isc.org
Mon Feb 14 15:19:38 UTC 2011
The branch, trac569 has been updated
via 5e357877317a7a70e9a66643a4f846c32f5dc2ae (commit)
via db9ebc20e4f4b401307d6237796e0252bfaa1c59 (commit)
via b9e1f48df9f398d7641f61317a7d969690af1ff2 (commit)
from d8989e0a05ae7a453a6768f2ff4019d41ad84aab (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 5e357877317a7a70e9a66643a4f846c32f5dc2ae
Author: Jelte Jansen <jelte at isc.org>
Date: Mon Feb 14 16:13:43 2011 +0100
[trac569] Move coroutine.h to ext/
and removed empty top level file
commit db9ebc20e4f4b401307d6237796e0252bfaa1c59
Author: Jelte Jansen <jelte at isc.org>
Date: Mon Feb 14 16:02:25 2011 +0100
[trac569] update includes in other dirs
commit b9e1f48df9f398d7641f61317a7d969690af1ff2
Author: Jelte Jansen <jelte at isc.org>
Date: Mon Feb 14 15:58:40 2011 +0100
[trac569] rename the original ioxxx files to io_xxx
-----------------------------------------------------------------------
Summary of changes:
configure.ac | 3 +++
{src/lib/asiolink => ext/coroutine}/coroutine.h | 0
src/bin/resolver/resolver.cc | 1 -
src/bin/resolver/response_scrubber.h | 2 +-
.../resolver/tests/response_scrubber_unittest.cc | 4 ++--
src/lib/asiolink/Makefile.am | 8 ++++----
src/lib/asiolink/asiolink.h | 8 ++++----
src/lib/asiolink/dns_answer.h | 2 +-
src/lib/asiolink/dns_lookup.h | 2 +-
src/lib/asiolink/dns_server.h | 2 +-
src/lib/asiolink/dns_service.cc | 2 +-
src/lib/asiolink/{ioaddress.cc => io_address.cc} | 0
src/lib/asiolink/{ioaddress.h => io_address.h} | 0
src/lib/asiolink/{ioendpoint.cc => io_endpoint.cc} | 0
src/lib/asiolink/{ioendpoint.h => io_endpoint.h} | 2 +-
src/lib/asiolink/{iomessage.h => io_message.h} | 4 ++--
src/lib/asiolink/{iosocket.cc => io_socket.cc} | 2 +-
src/lib/asiolink/{iosocket.h => io_socket.h} | 0
src/lib/asiolink/simple_callback.h | 2 ++
src/lib/asiolink/tcp_endpoint.h | 2 +-
src/lib/asiolink/tcp_server.h | 2 +-
src/lib/asiolink/tcp_socket.h | 2 +-
src/lib/asiolink/tests/recursive_query_unittest.cc | 2 +-
src/lib/asiolink/udp_endpoint.h | 2 +-
src/lib/asiolink/udp_query.cc | 2 +-
src/lib/asiolink/udp_query.h | 4 ++--
src/lib/asiolink/udp_server.h | 2 +-
src/lib/asiolink/udp_socket.h | 2 +-
28 files changed, 34 insertions(+), 30 deletions(-)
delete mode 100644 dns_answer.h
rename {src/lib/asiolink => ext/coroutine}/coroutine.h (100%)
rename src/lib/asiolink/{ioaddress.cc => io_address.cc} (100%)
rename src/lib/asiolink/{ioaddress.h => io_address.h} (100%)
rename src/lib/asiolink/{ioendpoint.cc => io_endpoint.cc} (100%)
rename src/lib/asiolink/{ioendpoint.h => io_endpoint.h} (99%)
rename src/lib/asiolink/{iomessage.h => io_message.h} (98%)
rename src/lib/asiolink/{iosocket.cc => io_socket.cc} (99%)
rename src/lib/asiolink/{iosocket.h => io_socket.h} (100%)
-----------------------------------------------------------------------
diff --git a/configure.ac b/configure.ac
index ed53d18..fef2cbe 100644
--- a/configure.ac
+++ b/configure.ac
@@ -573,6 +573,9 @@ AC_SUBST(MULTITHREADING_FLAG)
#
CPPFLAGS="$CPPFLAGS -I\$(top_srcdir)/ext/asio"
#
+# Use our 'coroutine' header from ext
+CPPFLAGS="$CPPFLAGS -I\$(top_srcdir)/ext/coroutine"
+#
# Disable threads: Currently we don't use them.
CPPFLAGS="$CPPFLAGS -DASIO_DISABLE_THREADS=1"
#
diff --git a/dns_answer.h b/dns_answer.h
deleted file mode 100644
index e69de29..0000000
diff --git a/ext/coroutine/coroutine.h b/ext/coroutine/coroutine.h
new file mode 100644
index 0000000..985888b
--- /dev/null
+++ b/ext/coroutine/coroutine.h
@@ -0,0 +1,133 @@
+//
+// coroutine.h
+// ~~~~~~~~~~~
+//
+// Copyright (c) 2003-2010 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+//
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+
+#ifndef COROUTINE_HPP
+#define COROUTINE_HPP
+
+
+// \brief Coroutine object
+//
+// A coroutine object maintains the state of a re-enterable routine. It
+// is assignable and copy-constructable, and can be used as a base class
+// for a class that uses it, or as a data member. The copy overhead is
+// a single int.
+//
+// A reenterable function contains a CORO_REENTER (coroutine) { ... }
+// block. Whenever an asychrnonous operation is initiated within the
+// routine, the function is provided as the handler object. (The simplest
+// way to do this is to have the reenterable function be the operator()
+// member for the coroutine object itself.) For example:
+//
+// CORO_YIELD socket->async_read_some(buffer, *this);
+//
+// The CORO_YIELD keyword updates the current status of the coroutine to
+// indicate the line number currently being executed. The
+// async_read_some() call is initiated, with a copy of the updated
+// corotutine as its handler object, and the current coroutine exits. When
+// the async_read_some() call finishes, the copied coroutine will be
+// called, and will resume processing exactly where the original one left
+// off--right after asynchronous call. This allows asynchronous I/O
+// routines to be written with a logical flow, step following step, rather
+// than as a linked chain of separate handler functions.
+//
+// When necessary, a coroutine can fork itself using the CORO_FORK keyword.
+// This updates the status of the coroutine and makes a copy. The copy can
+// then be called directly or posted to the ASIO service queue so that both
+// coroutines will continue forward, one "parent" and one "child". The
+// is_parent() and is_child() methods indicate which is which.
+//
+// The CORO_REENTER, CORO_YIELD and CORO_FORK keywords are implemented
+// via preprocessor macros. The CORO_REENTER block is actually a large,
+// complex switch statement. Because of this, inline variable declaration
+// is impossible within CORO_REENTER unless it is done in a subsidiary
+// scope--and if it is, that scope cannot contain CORO_YIELD or CORO_FORK
+// keywords.
+//
+// Because coroutines are frequently copied, it is best to minimize copy
+// overhead by limiting the size of data members in derived classes.
+//
+// It should be noted that when a coroutine falls out of scope its memory
+// is reclaimed, even though it may be scheduled to resume when an
+// asynchronous operation completes. Any shared_ptr<> objects declared in
+// the coroutine may be destroyed if their reference count drops to zero,
+// in which case the coroutine will have serious problems once it resumes.
+// One solution so this is to have the space that will be used by a
+// coroutine pre-allocated and stored on a free list; a new coroutine can
+// fetch the block of space off a free list, place a shared pointer to it
+// on an "in use" list, and carry on. The reference in the "in use" list
+// would prevent the data from being destroyed.
+class coroutine
+{
+public:
+ coroutine() : value_(0) {}
+ virtual ~coroutine() {}
+ bool is_child() const { return value_ < 0; }
+ bool is_parent() const { return !is_child(); }
+ bool is_complete() const { return value_ == -1; }
+ int get_value() const { return value_; }
+private:
+ friend class coroutine_ref;
+ int value_;
+};
+
+class coroutine_ref
+{
+public:
+ coroutine_ref(coroutine& c) : value_(c.value_), modified_(false) {}
+ coroutine_ref(coroutine* c) : value_(c->value_), modified_(false) {}
+ ~coroutine_ref() { if (!modified_) value_ = -1; }
+ operator int() const { return value_; }
+ int& operator=(int v) { modified_ = true; return value_ = v; }
+private:
+ void operator=(const coroutine_ref&);
+ int& value_;
+ bool modified_;
+};
+
+#define CORO_REENTER(c) \
+ switch (coroutine_ref _coro_value = c) \
+ case -1: if (_coro_value) \
+ { \
+ goto terminate_coroutine; \
+ terminate_coroutine: \
+ _coro_value = -1; \
+ goto bail_out_of_coroutine; \
+ bail_out_of_coroutine: \
+ break; \
+ } \
+ else case 0:
+
+#define CORO_YIELD \
+ for (_coro_value = __LINE__;;) \
+ if (_coro_value == 0) \
+ { \
+ case __LINE__: ; \
+ break; \
+ } \
+ else \
+ switch (_coro_value ? 0 : 1) \
+ for (;;) \
+ case -1: if (_coro_value) \
+ goto terminate_coroutine; \
+ else for (;;) \
+ case 1: if (_coro_value) \
+ goto bail_out_of_coroutine; \
+ else case 0:
+
+#define CORO_FORK \
+ for (_coro_value = -__LINE__;; _coro_value = __LINE__) \
+ if (_coro_value == __LINE__) \
+ { \
+ case -__LINE__: ; \
+ break; \
+ } \
+ else
+#endif // COROUTINE_HPP
+
diff --git a/src/bin/resolver/resolver.cc b/src/bin/resolver/resolver.cc
index 9e9bbd4..dfd84a6 100644
--- a/src/bin/resolver/resolver.cc
+++ b/src/bin/resolver/resolver.cc
@@ -21,7 +21,6 @@
#include <cassert>
#include <asiolink/asiolink.h>
-#include <asiolink/ioaddress.h>
#include <boost/foreach.hpp>
#include <boost/lexical_cast.hpp>
diff --git a/src/bin/resolver/response_scrubber.h b/src/bin/resolver/response_scrubber.h
index 971de64..c3fce57 100644
--- a/src/bin/resolver/response_scrubber.h
+++ b/src/bin/resolver/response_scrubber.h
@@ -243,7 +243,7 @@
/// scrubbed.
#include <config.h>
-#include <asiolink/ioendpoint.h>
+#include <asiolink/io_endpoint.h>
#include <dns/message.h>
#include <dns/name.h>
diff --git a/src/bin/resolver/tests/response_scrubber_unittest.cc b/src/bin/resolver/tests/response_scrubber_unittest.cc
index e561eea..1dc6639 100644
--- a/src/bin/resolver/tests/response_scrubber_unittest.cc
+++ b/src/bin/resolver/tests/response_scrubber_unittest.cc
@@ -21,8 +21,8 @@
#include <config.h>
-#include <asiolink/ioendpoint.h>
-#include <asiolink/ioaddress.h>
+#include <asiolink/io_endpoint.h>
+#include <asiolink/io_address.h>
#include <netinet/in.h>
#include <dns/name.h>
diff --git a/src/lib/asiolink/Makefile.am b/src/lib/asiolink/Makefile.am
index f5e8806..d52e54f 100644
--- a/src/lib/asiolink/Makefile.am
+++ b/src/lib/asiolink/Makefile.am
@@ -21,10 +21,10 @@ libasiolink_la_SOURCES += dns_answer.h
libasiolink_la_SOURCES += simple_callback.h
libasiolink_la_SOURCES += interval_timer.h interval_timer.cc
libasiolink_la_SOURCES += recursive_query.h recursive_query.cc
-libasiolink_la_SOURCES += iosocket.cc iosocket.h
-libasiolink_la_SOURCES += iomessage.h
-libasiolink_la_SOURCES += ioaddress.cc ioaddress.h
-libasiolink_la_SOURCES += ioendpoint.cc ioendpoint.h
+libasiolink_la_SOURCES += io_socket.cc io_socket.h
+libasiolink_la_SOURCES += io_message.h
+libasiolink_la_SOURCES += io_address.cc io_address.h
+libasiolink_la_SOURCES += io_endpoint.cc io_endpoint.h
libasiolink_la_SOURCES += udp_endpoint.h udp_socket.h
libasiolink_la_SOURCES += udp_server.h udp_server.cc
libasiolink_la_SOURCES += udp_query.h udp_query.cc
diff --git a/src/lib/asiolink/asiolink.h b/src/lib/asiolink/asiolink.h
index fefd6c3..43a1244 100644
--- a/src/lib/asiolink/asiolink.h
+++ b/src/lib/asiolink/asiolink.h
@@ -28,10 +28,10 @@
#include <asiolink/recursive_query.h>
#include <asiolink/interval_timer.h>
-#include <asiolink/ioaddress.h>
-#include <asiolink/ioendpoint.h>
-#include <asiolink/iomessage.h>
-#include <asiolink/iosocket.h>
+#include <asiolink/io_address.h>
+#include <asiolink/io_endpoint.h>
+#include <asiolink/io_message.h>
+#include <asiolink/io_socket.h>
/// \namespace asiolink
/// \brief A wrapper interface for the ASIO library.
diff --git a/src/lib/asiolink/coroutine.h b/src/lib/asiolink/coroutine.h
deleted file mode 100644
index 985888b..0000000
--- a/src/lib/asiolink/coroutine.h
+++ /dev/null
@@ -1,133 +0,0 @@
-//
-// coroutine.h
-// ~~~~~~~~~~~
-//
-// Copyright (c) 2003-2010 Christopher M. Kohlhoff (chris at kohlhoff dot com)
-//
-// Distributed under the Boost Software License, Version 1.0. (See accompanying
-// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-//
-
-#ifndef COROUTINE_HPP
-#define COROUTINE_HPP
-
-
-// \brief Coroutine object
-//
-// A coroutine object maintains the state of a re-enterable routine. It
-// is assignable and copy-constructable, and can be used as a base class
-// for a class that uses it, or as a data member. The copy overhead is
-// a single int.
-//
-// A reenterable function contains a CORO_REENTER (coroutine) { ... }
-// block. Whenever an asychrnonous operation is initiated within the
-// routine, the function is provided as the handler object. (The simplest
-// way to do this is to have the reenterable function be the operator()
-// member for the coroutine object itself.) For example:
-//
-// CORO_YIELD socket->async_read_some(buffer, *this);
-//
-// The CORO_YIELD keyword updates the current status of the coroutine to
-// indicate the line number currently being executed. The
-// async_read_some() call is initiated, with a copy of the updated
-// corotutine as its handler object, and the current coroutine exits. When
-// the async_read_some() call finishes, the copied coroutine will be
-// called, and will resume processing exactly where the original one left
-// off--right after asynchronous call. This allows asynchronous I/O
-// routines to be written with a logical flow, step following step, rather
-// than as a linked chain of separate handler functions.
-//
-// When necessary, a coroutine can fork itself using the CORO_FORK keyword.
-// This updates the status of the coroutine and makes a copy. The copy can
-// then be called directly or posted to the ASIO service queue so that both
-// coroutines will continue forward, one "parent" and one "child". The
-// is_parent() and is_child() methods indicate which is which.
-//
-// The CORO_REENTER, CORO_YIELD and CORO_FORK keywords are implemented
-// via preprocessor macros. The CORO_REENTER block is actually a large,
-// complex switch statement. Because of this, inline variable declaration
-// is impossible within CORO_REENTER unless it is done in a subsidiary
-// scope--and if it is, that scope cannot contain CORO_YIELD or CORO_FORK
-// keywords.
-//
-// Because coroutines are frequently copied, it is best to minimize copy
-// overhead by limiting the size of data members in derived classes.
-//
-// It should be noted that when a coroutine falls out of scope its memory
-// is reclaimed, even though it may be scheduled to resume when an
-// asynchronous operation completes. Any shared_ptr<> objects declared in
-// the coroutine may be destroyed if their reference count drops to zero,
-// in which case the coroutine will have serious problems once it resumes.
-// One solution so this is to have the space that will be used by a
-// coroutine pre-allocated and stored on a free list; a new coroutine can
-// fetch the block of space off a free list, place a shared pointer to it
-// on an "in use" list, and carry on. The reference in the "in use" list
-// would prevent the data from being destroyed.
-class coroutine
-{
-public:
- coroutine() : value_(0) {}
- virtual ~coroutine() {}
- bool is_child() const { return value_ < 0; }
- bool is_parent() const { return !is_child(); }
- bool is_complete() const { return value_ == -1; }
- int get_value() const { return value_; }
-private:
- friend class coroutine_ref;
- int value_;
-};
-
-class coroutine_ref
-{
-public:
- coroutine_ref(coroutine& c) : value_(c.value_), modified_(false) {}
- coroutine_ref(coroutine* c) : value_(c->value_), modified_(false) {}
- ~coroutine_ref() { if (!modified_) value_ = -1; }
- operator int() const { return value_; }
- int& operator=(int v) { modified_ = true; return value_ = v; }
-private:
- void operator=(const coroutine_ref&);
- int& value_;
- bool modified_;
-};
-
-#define CORO_REENTER(c) \
- switch (coroutine_ref _coro_value = c) \
- case -1: if (_coro_value) \
- { \
- goto terminate_coroutine; \
- terminate_coroutine: \
- _coro_value = -1; \
- goto bail_out_of_coroutine; \
- bail_out_of_coroutine: \
- break; \
- } \
- else case 0:
-
-#define CORO_YIELD \
- for (_coro_value = __LINE__;;) \
- if (_coro_value == 0) \
- { \
- case __LINE__: ; \
- break; \
- } \
- else \
- switch (_coro_value ? 0 : 1) \
- for (;;) \
- case -1: if (_coro_value) \
- goto terminate_coroutine; \
- else for (;;) \
- case 1: if (_coro_value) \
- goto bail_out_of_coroutine; \
- else case 0:
-
-#define CORO_FORK \
- for (_coro_value = -__LINE__;; _coro_value = __LINE__) \
- if (_coro_value == __LINE__) \
- { \
- case -__LINE__: ; \
- break; \
- } \
- else
-#endif // COROUTINE_HPP
-
diff --git a/src/lib/asiolink/dns_answer.h b/src/lib/asiolink/dns_answer.h
index 80ba70b..84e1f6f 100644
--- a/src/lib/asiolink/dns_answer.h
+++ b/src/lib/asiolink/dns_answer.h
@@ -15,7 +15,7 @@
#ifndef __ASIOLINK_DNS_ANSWER_H
#define __ASIOLINK_DNS_ANSWER_H 1
-#include <asiolink/iomessage.h>
+#include <asiolink/io_message.h>
namespace asiolink {
diff --git a/src/lib/asiolink/dns_lookup.h b/src/lib/asiolink/dns_lookup.h
index e4ccb81..0788853 100644
--- a/src/lib/asiolink/dns_lookup.h
+++ b/src/lib/asiolink/dns_lookup.h
@@ -15,7 +15,7 @@
#ifndef __ASIOLINK_DNS_LOOKUP_H
#define __ASIOLINK_DNS_LOOKUP_H 1
-#include <asiolink/iomessage.h>
+#include <asiolink/io_message.h>
#include <asiolink/dns_server.h>
#include <dns/buffer.h>
#include <dns/message.h>
diff --git a/src/lib/asiolink/dns_server.h b/src/lib/asiolink/dns_server.h
index 73bcf8a..6545275 100644
--- a/src/lib/asiolink/dns_server.h
+++ b/src/lib/asiolink/dns_server.h
@@ -15,7 +15,7 @@
#ifndef __ASIOLINK_DNS_SERVER_H
#define __ASIOLINK_DNS_SERVER_H 1
-#include <asiolink/iomessage.h>
+#include <asiolink/io_message.h>
namespace asiolink {
diff --git a/src/lib/asiolink/dns_service.cc b/src/lib/asiolink/dns_service.cc
index ee4f31b..10e9ce0 100644
--- a/src/lib/asiolink/dns_service.cc
+++ b/src/lib/asiolink/dns_service.cc
@@ -19,7 +19,7 @@
#include <asio/ip/address.hpp>
#include <asio.hpp>
-#include <tcp_server.h>
+#include <asiolink/tcp_server.h>
#include <asiolink/udp_server.h>
#include <log/dummylog.h>
diff --git a/src/lib/asiolink/io_address.cc b/src/lib/asiolink/io_address.cc
new file mode 100644
index 0000000..990524a
--- /dev/null
+++ b/src/lib/asiolink/io_address.cc
@@ -0,0 +1,62 @@
+// Copyright (C) 2010 Internet Systems Consortium, Inc. ("ISC")
+//
+// Permission to use, copy, modify, and/or distribute this software for any
+// purpose with or without fee is hereby granted, provided that the above
+// copyright notice and this permission notice appear in all copies.
+//
+// THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+// AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+// PERFORMANCE OF THIS SOFTWARE.
+
+#include <config.h>
+
+#include <unistd.h> // for some IPC/network system calls
+#include <sys/socket.h>
+#include <netinet/in.h>
+
+#include <asio.hpp>
+
+#include <asiolink/asiolink.h>
+
+using namespace asio;
+using asio::ip::udp;
+using asio::ip::tcp;
+
+using namespace std;
+
+namespace asiolink {
+
+// XXX: we cannot simply construct the address in the initialization list,
+// because we'd like to throw our own exception on failure.
+IOAddress::IOAddress(const string& address_str) {
+ error_code err;
+ asio_address_ = ip::address::from_string(address_str, err);
+ if (err) {
+ isc_throw(IOError, "Failed to convert string to address '"
+ << address_str << "': " << err.message());
+ }
+}
+
+IOAddress::IOAddress(const ip::address& asio_address) :
+ asio_address_(asio_address)
+{}
+
+string
+IOAddress::toText() const {
+ return (asio_address_.to_string());
+}
+
+short
+IOAddress::getFamily() const {
+ if (asio_address_.is_v4()) {
+ return (AF_INET);
+ } else {
+ return (AF_INET6);
+ }
+}
+
+}
diff --git a/src/lib/asiolink/io_address.h b/src/lib/asiolink/io_address.h
new file mode 100644
index 0000000..98e6fe8
--- /dev/null
+++ b/src/lib/asiolink/io_address.h
@@ -0,0 +1,127 @@
+// Copyright (C) 2010 Internet Systems Consortium, Inc. ("ISC")
+//
+// Permission to use, copy, modify, and/or distribute this software for any
+// purpose with or without fee is hereby granted, provided that the above
+// copyright notice and this permission notice appear in all copies.
+//
+// THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+// AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+// PERFORMANCE OF THIS SOFTWARE.
+
+#ifndef __IOADDRESS_H
+#define __IOADDRESS_H 1
+
+// IMPORTANT NOTE: only very few ASIO headers files can be included in
+// this file. In particular, asio.hpp should never be included here.
+// See the description of the namespace below.
+#include <unistd.h> // for some network system calls
+#include <asio/ip/address.hpp>
+
+#include <functional>
+#include <string>
+
+#include <exceptions/exceptions.h>
+
+namespace asiolink {
+
+/// \brief The \c IOAddress class represents an IP addresses (version
+/// agnostic)
+///
+/// This class is a wrapper for the ASIO \c ip::address class.
+class IOAddress {
+public:
+ ///
+ /// \name Constructors and Destructor
+ ///
+ /// This class is copyable. We use default versions of copy constructor
+ /// and the assignment operator.
+ /// We use the default destructor.
+ //@{
+ /// \brief Constructor from string.
+ ///
+ /// This constructor converts a textual representation of IPv4 and IPv6
+ /// addresses into an IOAddress object.
+ /// If \c address_str is not a valid representation of any type of
+ /// address, an exception of class \c IOError will be thrown.
+ /// This constructor allocates memory for the object, and if that fails
+ /// a corresponding standard exception will be thrown.
+ ///
+ /// \param address_str Textual representation of address.
+ IOAddress(const std::string& address_str);
+
+ /// \brief Constructor from an ASIO \c ip::address object.
+ ///
+ /// This constructor is intended to be used within the wrapper
+ /// implementation; user applications of the wrapper API won't use it.
+ ///
+ /// This constructor never throws an exception.
+ ///
+ /// \param asio_address The ASIO \c ip::address to be converted.
+ IOAddress(const asio::ip::address& asio_adress);
+ //@}
+
+ /// \brief Convert the address to a string.
+ ///
+ /// This method is basically expected to be exception free, but
+ /// generating the string will involve resource allocation,
+ /// and if it fails the corresponding standard exception will be thrown.
+ ///
+ /// \return A string representation of the address.
+ std::string toText() const;
+
+ /// \brief Returns the address family
+ ///
+ /// \return AF_INET for IPv4 or AF_INET6 for IPv6.
+ short getFamily() const;
+
+ /// \brief Compare addresses for equality
+ ///
+ /// \param other Address to compare against.
+ ///
+ /// \return true if addresses are equal, false if not.
+ bool equals(const IOAddress& other) const {
+ return (asio_address_ == other.asio_address_);
+ }
+
+ /// \brief Compare addresses for equality
+ ///
+ /// \param other Address to compare against.
+ ///
+ /// \return true if addresses are equal, false if not.
+ bool operator==(const IOAddress& other) const {
+ return equals(other);
+ }
+
+ // \brief Compare addresses for inequality
+ ///
+ /// \param other Address to compare against.
+ ///
+ /// \return false if addresses are equal, true if not.
+ bool nequals(const IOAddress& other) const {
+ return (!equals(other));
+ }
+
+ // \brief Compare addresses for inequality
+ ///
+ /// \param other Address to compare against.
+ ///
+ /// \return false if addresses are equal, true if not.
+ bool operator!=(const IOAddress& other) const {
+ return (nequals(other));
+ }
+
+
+private:
+ asio::ip::address asio_address_;
+};
+
+} // asiolink
+#endif // __IOADDRESS_H
+
+// Local Variables:
+// mode: c++
+// End:
diff --git a/src/lib/asiolink/io_endpoint.cc b/src/lib/asiolink/io_endpoint.cc
new file mode 100644
index 0000000..86e0607
--- /dev/null
+++ b/src/lib/asiolink/io_endpoint.cc
@@ -0,0 +1,45 @@
+// Copyright (C) 2011 Internet Systems Consortium, Inc. ("ISC")
+//
+// Permission to use, copy, modify, and/or distribute this software for any
+// purpose with or without fee is hereby granted, provided that the above
+// copyright notice and this permission notice appear in all copies.
+//
+// THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+// AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+// PERFORMANCE OF THIS SOFTWARE.
+
+#include <config.h>
+
+#include <unistd.h> // for some IPC/network system calls
+#include <sys/socket.h>
+#include <netinet/in.h>
+
+#include <asio.hpp>
+
+#include <asiolink/asiolink.h>
+#include <asiolink/tcp_endpoint.h>
+#include <asiolink/udp_endpoint.h>
+
+using namespace std;
+
+namespace asiolink {
+
+const IOEndpoint*
+IOEndpoint::create(const int protocol, const IOAddress& address,
+ const unsigned short port)
+{
+ if (protocol == IPPROTO_UDP) {
+ return (new UDPEndpoint(address, port));
+ } else if (protocol == IPPROTO_TCP) {
+ return (new TCPEndpoint(address, port));
+ }
+ isc_throw(IOError,
+ "IOEndpoint creation attempt for unsupported protocol: " <<
+ protocol);
+}
+
+}
diff --git a/src/lib/asiolink/io_endpoint.h b/src/lib/asiolink/io_endpoint.h
new file mode 100644
index 0000000..37f9087
--- /dev/null
+++ b/src/lib/asiolink/io_endpoint.h
@@ -0,0 +1,122 @@
+// Copyright (C) 2010 Internet Systems Consortium, Inc. ("ISC")
+//
+// Permission to use, copy, modify, and/or distribute this software for any
+// purpose with or without fee is hereby granted, provided that the above
+// copyright notice and this permission notice appear in all copies.
+//
+// THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+// AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+// PERFORMANCE OF THIS SOFTWARE.
+
+#ifndef __IOENDPOINT_H
+#define __IOENDPOINT_H 1
+
+// IMPORTANT NOTE: only very few ASIO headers files can be included in
+// this file. In particular, asio.hpp should never be included here.
+// See the description of the namespace below.
+#include <unistd.h> // for some network system calls
+
+#include <functional>
+#include <string>
+
+#include <exceptions/exceptions.h>
+#include <asiolink/io_address.h>
+
+namespace asiolink {
+
+/// \brief The \c IOEndpoint class is an abstract base class to represent
+/// a communication endpoint.
+///
+/// This class is a wrapper for the ASIO endpoint classes such as
+/// \c ip::tcp::endpoint and \c ip::udp::endpoint.
+///
+/// Derived class implementations are completely hidden within the
+/// implementation. User applications only get access to concrete
+/// \c IOEndpoint objects via the abstract interfaces.
+class IOEndpoint {
+ ///
+ /// \name Constructors and Destructor
+ ///
+ /// Note: The copy constructor and the assignment operator are
+ /// intentionally defined as private, making this class non-copyable.
+ //@{
+private:
+ IOEndpoint(const IOEndpoint& source);
+ IOEndpoint& operator=(const IOEndpoint& source);
+protected:
+ /// \brief The default constructor.
+ ///
+ /// This is intentionally defined as \c protected as this base class
+ /// should never be instantiated (except as part of a derived class).
+ IOEndpoint() {}
+public:
+ /// The destructor.
+ virtual ~IOEndpoint() {}
+ //@}
+
+ /// \brief Returns the address of the endpoint.
+ ///
+ /// This method returns an IOAddress object corresponding to \c this
+ /// endpoint.
+ ///
+ /// Note that the return value is a real object, not a reference or
+ /// a pointer.
+ ///
+ /// This is aligned with the interface of the ASIO counterpart:
+ /// the \c address() method of \c ip::xxx::endpoint classes returns
+ /// an \c ip::address object.
+ ///
+ /// This also means handling the address of an endpoint using this method
+ /// can be expensive. If the address information is necessary in a
+ /// performance sensitive context and there's a more efficient interface
+ /// for that purpose, it's probably better to avoid using this method.
+ ///
+ /// This method never throws an exception.
+ ///
+ /// \return A copy of \c IOAddress object corresponding to the endpoint.
+ virtual IOAddress getAddress() const = 0;
+
+ /// \brief Returns the port of the endpoint.
+ virtual uint16_t getPort() const = 0;
+
+ /// \brief Returns the protocol number of the endpoint (TCP, UDP...)
+ virtual short getProtocol() const = 0;
+
+ /// \brief Returns the address family of the endpoint.
+ virtual short getFamily() const = 0;
+
+ /// \brief A polymorphic factory of endpoint from address and port.
+ ///
+ /// This method creates a new instance of (a derived class of)
+ /// \c IOEndpoint object that identifies the pair of given address
+ /// and port.
+ /// The appropriate derived class is chosen based on the specified
+ /// transport protocol. If the \c protocol doesn't specify a protocol
+ /// supported in this implementation, an exception of class \c IOError
+ /// will be thrown.
+ ///
+ /// Memory for the created object will be dynamically allocated. It's
+ /// the caller's responsibility to \c delete it later.
+ /// If resource allocation for the new object fails, a corresponding
+ /// standard exception will be thrown.
+ ///
+ /// \param protocol The transport protocol used for the endpoint.
+ /// Currently, only \c IPPROTO_UDP and \c IPPROTO_TCP can be specified.
+ /// \param address The (IP) address of the endpoint.
+ /// \param port The transport port number of the endpoint
+ /// \return A pointer to a newly created \c IOEndpoint object.
+ static const IOEndpoint* create(const int protocol,
+ const IOAddress& address,
+ const unsigned short port);
+};
+
+} // asiolink
+#endif // __IOENDPOINT_H
+
+// Local Variables:
+// mode: c++
+// End:
diff --git a/src/lib/asiolink/io_message.h b/src/lib/asiolink/io_message.h
new file mode 100644
index 0000000..7d7d56c
--- /dev/null
+++ b/src/lib/asiolink/io_message.h
@@ -0,0 +1,103 @@
+// Copyright (C) 2010 Internet Systems Consortium, Inc. ("ISC")
+//
+// Permission to use, copy, modify, and/or distribute this software for any
+// purpose with or without fee is hereby granted, provided that the above
+// copyright notice and this permission notice appear in all copies.
+//
+// THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+// AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+// PERFORMANCE OF THIS SOFTWARE.
+
+#ifndef __IOMESSAGE_H
+#define __IOMESSAGE_H 1
+
+// IMPORTANT NOTE: only very few ASIO headers files can be included in
+// this file. In particular, asio.hpp should never be included here.
+// See the description of the namespace below.
+#include <unistd.h> // for some network system calls
+
+#include <functional>
+#include <string>
+
+#include <exceptions/exceptions.h>
+
+#include <asiolink/io_endpoint.h>
+#include <asiolink/io_socket.h>
+
+namespace asiolink {
+
+/// \brief The \c IOMessage class encapsulates an incoming message received
+/// on a socket.
+///
+/// An \c IOMessage object represents a tuple of a chunk of data
+/// (a UDP packet or some segment of TCP stream), the socket over which the
+/// data is passed, the information about the other end point of the
+/// communication, and perhaps more.
+///
+/// The current design and interfaces of this class is tentative.
+/// It only provides a minimal level of support that is necessary for
+/// the current implementation of the authoritative server.
+/// A future version of this class will definitely support more.
+class IOMessage {
+ ///
+ /// \name Constructors and Destructor
+ ///
+ /// Note: The copy constructor and the assignment operator are
+ /// intentionally defined as private, making this class non-copyable.
+ //@{
+private:
+ IOMessage(const IOMessage& source);
+ IOMessage& operator=(const IOMessage& source);
+public:
+ /// \brief Constructor from message data
+ ///
+ /// This constructor needs to handle the ASIO \c ip::address class,
+ /// and is intended to be used within this wrapper implementation.
+ /// Once the \c IOMessage object is created, the application can
+ /// get access to the information via the wrapper interface such as
+ /// \c getRemoteAddress().
+ ///
+ /// This constructor never throws an exception.
+ ///
+ /// \param data A pointer to the message data.
+ /// \param data_size The size of the message data in bytes.
+ /// \param io_socket The socket over which the data is given.
+ /// \param remote_endpoint The other endpoint of the socket, that is,
+ /// the sender of the message.
+ IOMessage(const void* data, const size_t data_size,
+ const IOSocket& io_socket, const IOEndpoint& remote_endpoint) :
+ data_(data), data_size_(data_size), io_socket_(io_socket),
+ remote_endpoint_(remote_endpoint)
+ {}
+ //@}
+
+ /// \brief Returns a pointer to the received data.
+ const void* getData() const { return (data_); }
+
+ /// \brief Returns the size of the received data in bytes.
+ size_t getDataSize() const { return (data_size_); }
+
+ /// \brief Returns the socket on which the message arrives.
+ const IOSocket& getSocket() const { return (io_socket_); }
+
+ /// \brief Returns the endpoint that sends the message.
+ const IOEndpoint& getRemoteEndpoint() const { return (remote_endpoint_); }
+
+private:
+ const void* data_;
+ const size_t data_size_;
+ const IOSocket& io_socket_;
+ const IOEndpoint& remote_endpoint_;
+};
+
+
+} // asiolink
+#endif // __IOMESSAGE_H
+
+// Local Variables:
+// mode: c++
+// End:
diff --git a/src/lib/asiolink/io_socket.cc b/src/lib/asiolink/io_socket.cc
new file mode 100644
index 0000000..fb325e9
--- /dev/null
+++ b/src/lib/asiolink/io_socket.cc
@@ -0,0 +1,67 @@
+// Copyright (C) 2010 CZ NIC
+// Copyed from other version of auth/asiolink.cc which is:
+// Copyright (C) 2010 Internet Systems Consortium, Inc. ("ISC")
+//
+// Permission to use, copy, modify, and/or distribute this software for any
+// purpose with or without fee is hereby granted, provided that the above
+// copyright notice and this permission notice appear in all copies.
+//
+// THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+// AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+// PERFORMANCE OF THIS SOFTWARE.
+
+#include "io_socket.h"
+
+#include <asio.hpp>
+
+using namespace asio;
+
+namespace asiolink {
+
+/// \brief The \c DummySocket class is a concrete derived class of
+/// \c IOSocket that is not associated with any real socket.
+///
+/// This main purpose of this class is tests, where it may be desirable to
+/// instantiate an \c IOSocket object without involving system resource
+/// allocation such as real network sockets.
+class DummySocket : public IOSocket {
+private:
+ DummySocket(const DummySocket& source);
+ DummySocket& operator=(const DummySocket& source);
+public:
+ /// \brief Constructor from the protocol number.
+ ///
+ /// The protocol must validly identify a standard network protocol.
+ /// For example, to specify TCP \c protocol must be \c IPPROTO_TCP.
+ ///
+ /// \param protocol The network protocol number for the socket.
+ DummySocket(const int protocol) : protocol_(protocol) {}
+
+ /// \brief A dummy derived method of \c IOSocket::getNative().
+ ///
+ /// This version of method always returns -1 as the object is not
+ /// associated with a real (native) socket.
+ virtual int getNative() const { return (-1); }
+
+ virtual int getProtocol() const { return (protocol_); }
+private:
+ const int protocol_;
+};
+
+IOSocket&
+IOSocket::getDummyUDPSocket() {
+ static DummySocket socket(IPPROTO_UDP);
+ return (socket);
+}
+
+IOSocket&
+IOSocket::getDummyTCPSocket() {
+ static DummySocket socket(IPPROTO_TCP);
+ return (socket);
+}
+
+}
diff --git a/src/lib/asiolink/io_socket.h b/src/lib/asiolink/io_socket.h
new file mode 100644
index 0000000..df37d71
--- /dev/null
+++ b/src/lib/asiolink/io_socket.h
@@ -0,0 +1,127 @@
+// Copyright (C) 2010 Internet Systems Consortium, Inc. ("ISC")
+//
+// Permission to use, copy, modify, and/or distribute this software for any
+// purpose with or without fee is hereby granted, provided that the above
+// copyright notice and this permission notice appear in all copies.
+//
+// THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+// AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+// PERFORMANCE OF THIS SOFTWARE.
+
+#ifndef __IOSOCKET_H
+#define __IOSOCKET_H 1
+
+// IMPORTANT NOTE: only very few ASIO headers files can be included in
+// this file. In particular, asio.hpp should never be included here.
+// See the description of the namespace below.
+#include <unistd.h> // for some network system calls
+
+#include <functional>
+#include <string>
+
+#include <exceptions/exceptions.h>
+
+namespace asiolink {
+
+/// \brief The \c IOSocket class is an abstract base class to represent
+/// various types of network sockets.
+///
+/// This class is a wrapper for the ASIO socket classes such as
+/// \c ip::tcp::socket and \c ip::udp::socket.
+///
+/// Derived class implementations are completely hidden within the
+/// implementation. User applications only get access to concrete
+/// \c IOSocket objects via the abstract interfaces.
+///
+/// We may revisit this decision when we generalize the wrapper and more
+/// modules use it. Also, at that point we may define a separate (visible)
+/// derived class for testing purposes rather than providing factory methods
+/// (i.e., getDummy variants below).
+class IOSocket {
+ ///
+ /// \name Constructors and Destructor
+ ///
+ /// Note: The copy constructor and the assignment operator are
+ /// intentionally defined as private, making this class non-copyable.
+ //@{
+private:
+ IOSocket(const IOSocket& source);
+ IOSocket& operator=(const IOSocket& source);
+protected:
+ /// \brief The default constructor.
+ ///
+ /// This is intentionally defined as \c protected as this base class
+ /// should never be instantiated (except as part of a derived class).
+ IOSocket() {}
+public:
+ /// The destructor.
+ virtual ~IOSocket() {}
+ //@}
+
+ /// \brief Return the "native" representation of the socket.
+ ///
+ /// In practice, this is the file descriptor of the socket for
+ /// UNIX-like systems so the current implementation simply uses
+ /// \c int as the type of the return value.
+ /// We may have to need revisit this decision later.
+ ///
+ /// In general, the application should avoid using this method;
+ /// it essentially discloses an implementation specific "handle" that
+ /// can change the internal state of the socket (consider the
+ /// application closes it, for example).
+ /// But we sometimes need to perform very low-level operations that
+ /// requires the native representation. Passing the file descriptor
+ /// to a different process is one example.
+ /// This method is provided as a necessary evil for such limited purposes.
+ ///
+ /// This method never throws an exception.
+ ///
+ /// \return The native representation of the socket. This is the socket
+ /// file descriptor for UNIX-like systems.
+ virtual int getNative() const = 0;
+
+ /// \brief Return the transport protocol of the socket.
+ ///
+ /// Currently, it returns \c IPPROTO_UDP for UDP sockets, and
+ /// \c IPPROTO_TCP for TCP sockets.
+ ///
+ /// This method never throws an exception.
+ ///
+ /// \return IPPROTO_UDP for UDP sockets
+ /// \return IPPROTO_TCP for TCP sockets
+ virtual int getProtocol() const = 0;
+
+ /// \brief Return a non-usable "dummy" UDP socket for testing.
+ ///
+ /// This is a class method that returns a "mock" of UDP socket.
+ /// This is not associated with any actual socket, and its only
+ /// responsibility is to return \c IPPROTO_UDP from \c getProtocol().
+ /// The only feasible usage of this socket is for testing so that
+ /// the test code can prepare some "UDP data" even without opening any
+ /// actual socket.
+ ///
+ /// This method never throws an exception.
+ ///
+ /// \return A reference to an \c IOSocket object whose \c getProtocol()
+ /// returns \c IPPROTO_UDP.
+ static IOSocket& getDummyUDPSocket();
+
+ /// \brief Return a non-usable "dummy" TCP socket for testing.
+ ///
+ /// See \c getDummyUDPSocket(). This method is its TCP version.
+ ///
+ /// \return A reference to an \c IOSocket object whose \c getProtocol()
+ /// returns \c IPPROTO_TCP.
+ static IOSocket& getDummyTCPSocket();
+};
+
+} // asiolink
+#endif // __IOSOCKET_H
+
+// Local Variables:
+// mode: c++
+// End:
diff --git a/src/lib/asiolink/ioaddress.cc b/src/lib/asiolink/ioaddress.cc
deleted file mode 100644
index 990524a..0000000
--- a/src/lib/asiolink/ioaddress.cc
+++ /dev/null
@@ -1,62 +0,0 @@
-// Copyright (C) 2010 Internet Systems Consortium, Inc. ("ISC")
-//
-// Permission to use, copy, modify, and/or distribute this software for any
-// purpose with or without fee is hereby granted, provided that the above
-// copyright notice and this permission notice appear in all copies.
-//
-// THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
-// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-// AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
-// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
-// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
-// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-// PERFORMANCE OF THIS SOFTWARE.
-
-#include <config.h>
-
-#include <unistd.h> // for some IPC/network system calls
-#include <sys/socket.h>
-#include <netinet/in.h>
-
-#include <asio.hpp>
-
-#include <asiolink/asiolink.h>
-
-using namespace asio;
-using asio::ip::udp;
-using asio::ip::tcp;
-
-using namespace std;
-
-namespace asiolink {
-
-// XXX: we cannot simply construct the address in the initialization list,
-// because we'd like to throw our own exception on failure.
-IOAddress::IOAddress(const string& address_str) {
- error_code err;
- asio_address_ = ip::address::from_string(address_str, err);
- if (err) {
- isc_throw(IOError, "Failed to convert string to address '"
- << address_str << "': " << err.message());
- }
-}
-
-IOAddress::IOAddress(const ip::address& asio_address) :
- asio_address_(asio_address)
-{}
-
-string
-IOAddress::toText() const {
- return (asio_address_.to_string());
-}
-
-short
-IOAddress::getFamily() const {
- if (asio_address_.is_v4()) {
- return (AF_INET);
- } else {
- return (AF_INET6);
- }
-}
-
-}
diff --git a/src/lib/asiolink/ioaddress.h b/src/lib/asiolink/ioaddress.h
deleted file mode 100644
index 98e6fe8..0000000
--- a/src/lib/asiolink/ioaddress.h
+++ /dev/null
@@ -1,127 +0,0 @@
-// Copyright (C) 2010 Internet Systems Consortium, Inc. ("ISC")
-//
-// Permission to use, copy, modify, and/or distribute this software for any
-// purpose with or without fee is hereby granted, provided that the above
-// copyright notice and this permission notice appear in all copies.
-//
-// THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
-// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-// AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
-// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
-// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
-// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-// PERFORMANCE OF THIS SOFTWARE.
-
-#ifndef __IOADDRESS_H
-#define __IOADDRESS_H 1
-
-// IMPORTANT NOTE: only very few ASIO headers files can be included in
-// this file. In particular, asio.hpp should never be included here.
-// See the description of the namespace below.
-#include <unistd.h> // for some network system calls
-#include <asio/ip/address.hpp>
-
-#include <functional>
-#include <string>
-
-#include <exceptions/exceptions.h>
-
-namespace asiolink {
-
-/// \brief The \c IOAddress class represents an IP addresses (version
-/// agnostic)
-///
-/// This class is a wrapper for the ASIO \c ip::address class.
-class IOAddress {
-public:
- ///
- /// \name Constructors and Destructor
- ///
- /// This class is copyable. We use default versions of copy constructor
- /// and the assignment operator.
- /// We use the default destructor.
- //@{
- /// \brief Constructor from string.
- ///
- /// This constructor converts a textual representation of IPv4 and IPv6
- /// addresses into an IOAddress object.
- /// If \c address_str is not a valid representation of any type of
- /// address, an exception of class \c IOError will be thrown.
- /// This constructor allocates memory for the object, and if that fails
- /// a corresponding standard exception will be thrown.
- ///
- /// \param address_str Textual representation of address.
- IOAddress(const std::string& address_str);
-
- /// \brief Constructor from an ASIO \c ip::address object.
- ///
- /// This constructor is intended to be used within the wrapper
- /// implementation; user applications of the wrapper API won't use it.
- ///
- /// This constructor never throws an exception.
- ///
- /// \param asio_address The ASIO \c ip::address to be converted.
- IOAddress(const asio::ip::address& asio_adress);
- //@}
-
- /// \brief Convert the address to a string.
- ///
- /// This method is basically expected to be exception free, but
- /// generating the string will involve resource allocation,
- /// and if it fails the corresponding standard exception will be thrown.
- ///
- /// \return A string representation of the address.
- std::string toText() const;
-
- /// \brief Returns the address family
- ///
- /// \return AF_INET for IPv4 or AF_INET6 for IPv6.
- short getFamily() const;
-
- /// \brief Compare addresses for equality
- ///
- /// \param other Address to compare against.
- ///
- /// \return true if addresses are equal, false if not.
- bool equals(const IOAddress& other) const {
- return (asio_address_ == other.asio_address_);
- }
-
- /// \brief Compare addresses for equality
- ///
- /// \param other Address to compare against.
- ///
- /// \return true if addresses are equal, false if not.
- bool operator==(const IOAddress& other) const {
- return equals(other);
- }
-
- // \brief Compare addresses for inequality
- ///
- /// \param other Address to compare against.
- ///
- /// \return false if addresses are equal, true if not.
- bool nequals(const IOAddress& other) const {
- return (!equals(other));
- }
-
- // \brief Compare addresses for inequality
- ///
- /// \param other Address to compare against.
- ///
- /// \return false if addresses are equal, true if not.
- bool operator!=(const IOAddress& other) const {
- return (nequals(other));
- }
-
-
-private:
- asio::ip::address asio_address_;
-};
-
-} // asiolink
-#endif // __IOADDRESS_H
-
-// Local Variables:
-// mode: c++
-// End:
diff --git a/src/lib/asiolink/ioendpoint.cc b/src/lib/asiolink/ioendpoint.cc
deleted file mode 100644
index 86e0607..0000000
--- a/src/lib/asiolink/ioendpoint.cc
+++ /dev/null
@@ -1,45 +0,0 @@
-// Copyright (C) 2011 Internet Systems Consortium, Inc. ("ISC")
-//
-// Permission to use, copy, modify, and/or distribute this software for any
-// purpose with or without fee is hereby granted, provided that the above
-// copyright notice and this permission notice appear in all copies.
-//
-// THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
-// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-// AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
-// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
-// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
-// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-// PERFORMANCE OF THIS SOFTWARE.
-
-#include <config.h>
-
-#include <unistd.h> // for some IPC/network system calls
-#include <sys/socket.h>
-#include <netinet/in.h>
-
-#include <asio.hpp>
-
-#include <asiolink/asiolink.h>
-#include <asiolink/tcp_endpoint.h>
-#include <asiolink/udp_endpoint.h>
-
-using namespace std;
-
-namespace asiolink {
-
-const IOEndpoint*
-IOEndpoint::create(const int protocol, const IOAddress& address,
- const unsigned short port)
-{
- if (protocol == IPPROTO_UDP) {
- return (new UDPEndpoint(address, port));
- } else if (protocol == IPPROTO_TCP) {
- return (new TCPEndpoint(address, port));
- }
- isc_throw(IOError,
- "IOEndpoint creation attempt for unsupported protocol: " <<
- protocol);
-}
-
-}
diff --git a/src/lib/asiolink/ioendpoint.h b/src/lib/asiolink/ioendpoint.h
deleted file mode 100644
index 82190a3..0000000
--- a/src/lib/asiolink/ioendpoint.h
+++ /dev/null
@@ -1,122 +0,0 @@
-// Copyright (C) 2010 Internet Systems Consortium, Inc. ("ISC")
-//
-// Permission to use, copy, modify, and/or distribute this software for any
-// purpose with or without fee is hereby granted, provided that the above
-// copyright notice and this permission notice appear in all copies.
-//
-// THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
-// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-// AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
-// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
-// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
-// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-// PERFORMANCE OF THIS SOFTWARE.
-
-#ifndef __IOENDPOINT_H
-#define __IOENDPOINT_H 1
-
-// IMPORTANT NOTE: only very few ASIO headers files can be included in
-// this file. In particular, asio.hpp should never be included here.
-// See the description of the namespace below.
-#include <unistd.h> // for some network system calls
-
-#include <functional>
-#include <string>
-
-#include <exceptions/exceptions.h>
-#include <asiolink/ioaddress.h>
-
-namespace asiolink {
-
-/// \brief The \c IOEndpoint class is an abstract base class to represent
-/// a communication endpoint.
-///
-/// This class is a wrapper for the ASIO endpoint classes such as
-/// \c ip::tcp::endpoint and \c ip::udp::endpoint.
-///
-/// Derived class implementations are completely hidden within the
-/// implementation. User applications only get access to concrete
-/// \c IOEndpoint objects via the abstract interfaces.
-class IOEndpoint {
- ///
- /// \name Constructors and Destructor
- ///
- /// Note: The copy constructor and the assignment operator are
- /// intentionally defined as private, making this class non-copyable.
- //@{
-private:
- IOEndpoint(const IOEndpoint& source);
- IOEndpoint& operator=(const IOEndpoint& source);
-protected:
- /// \brief The default constructor.
- ///
- /// This is intentionally defined as \c protected as this base class
- /// should never be instantiated (except as part of a derived class).
- IOEndpoint() {}
-public:
- /// The destructor.
- virtual ~IOEndpoint() {}
- //@}
-
- /// \brief Returns the address of the endpoint.
- ///
- /// This method returns an IOAddress object corresponding to \c this
- /// endpoint.
- ///
- /// Note that the return value is a real object, not a reference or
- /// a pointer.
- ///
- /// This is aligned with the interface of the ASIO counterpart:
- /// the \c address() method of \c ip::xxx::endpoint classes returns
- /// an \c ip::address object.
- ///
- /// This also means handling the address of an endpoint using this method
- /// can be expensive. If the address information is necessary in a
- /// performance sensitive context and there's a more efficient interface
- /// for that purpose, it's probably better to avoid using this method.
- ///
- /// This method never throws an exception.
- ///
- /// \return A copy of \c IOAddress object corresponding to the endpoint.
- virtual IOAddress getAddress() const = 0;
-
- /// \brief Returns the port of the endpoint.
- virtual uint16_t getPort() const = 0;
-
- /// \brief Returns the protocol number of the endpoint (TCP, UDP...)
- virtual short getProtocol() const = 0;
-
- /// \brief Returns the address family of the endpoint.
- virtual short getFamily() const = 0;
-
- /// \brief A polymorphic factory of endpoint from address and port.
- ///
- /// This method creates a new instance of (a derived class of)
- /// \c IOEndpoint object that identifies the pair of given address
- /// and port.
- /// The appropriate derived class is chosen based on the specified
- /// transport protocol. If the \c protocol doesn't specify a protocol
- /// supported in this implementation, an exception of class \c IOError
- /// will be thrown.
- ///
- /// Memory for the created object will be dynamically allocated. It's
- /// the caller's responsibility to \c delete it later.
- /// If resource allocation for the new object fails, a corresponding
- /// standard exception will be thrown.
- ///
- /// \param protocol The transport protocol used for the endpoint.
- /// Currently, only \c IPPROTO_UDP and \c IPPROTO_TCP can be specified.
- /// \param address The (IP) address of the endpoint.
- /// \param port The transport port number of the endpoint
- /// \return A pointer to a newly created \c IOEndpoint object.
- static const IOEndpoint* create(const int protocol,
- const IOAddress& address,
- const unsigned short port);
-};
-
-} // asiolink
-#endif // __IOENDPOINT_H
-
-// Local Variables:
-// mode: c++
-// End:
diff --git a/src/lib/asiolink/iomessage.h b/src/lib/asiolink/iomessage.h
deleted file mode 100644
index 27baa8a..0000000
--- a/src/lib/asiolink/iomessage.h
+++ /dev/null
@@ -1,103 +0,0 @@
-// Copyright (C) 2010 Internet Systems Consortium, Inc. ("ISC")
-//
-// Permission to use, copy, modify, and/or distribute this software for any
-// purpose with or without fee is hereby granted, provided that the above
-// copyright notice and this permission notice appear in all copies.
-//
-// THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
-// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-// AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
-// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
-// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
-// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-// PERFORMANCE OF THIS SOFTWARE.
-
-#ifndef __IOMESSAGE_H
-#define __IOMESSAGE_H 1
-
-// IMPORTANT NOTE: only very few ASIO headers files can be included in
-// this file. In particular, asio.hpp should never be included here.
-// See the description of the namespace below.
-#include <unistd.h> // for some network system calls
-
-#include <functional>
-#include <string>
-
-#include <exceptions/exceptions.h>
-
-#include <asiolink/ioendpoint.h>
-#include <asiolink/iosocket.h>
-
-namespace asiolink {
-
-/// \brief The \c IOMessage class encapsulates an incoming message received
-/// on a socket.
-///
-/// An \c IOMessage object represents a tuple of a chunk of data
-/// (a UDP packet or some segment of TCP stream), the socket over which the
-/// data is passed, the information about the other end point of the
-/// communication, and perhaps more.
-///
-/// The current design and interfaces of this class is tentative.
-/// It only provides a minimal level of support that is necessary for
-/// the current implementation of the authoritative server.
-/// A future version of this class will definitely support more.
-class IOMessage {
- ///
- /// \name Constructors and Destructor
- ///
- /// Note: The copy constructor and the assignment operator are
- /// intentionally defined as private, making this class non-copyable.
- //@{
-private:
- IOMessage(const IOMessage& source);
- IOMessage& operator=(const IOMessage& source);
-public:
- /// \brief Constructor from message data
- ///
- /// This constructor needs to handle the ASIO \c ip::address class,
- /// and is intended to be used within this wrapper implementation.
- /// Once the \c IOMessage object is created, the application can
- /// get access to the information via the wrapper interface such as
- /// \c getRemoteAddress().
- ///
- /// This constructor never throws an exception.
- ///
- /// \param data A pointer to the message data.
- /// \param data_size The size of the message data in bytes.
- /// \param io_socket The socket over which the data is given.
- /// \param remote_endpoint The other endpoint of the socket, that is,
- /// the sender of the message.
- IOMessage(const void* data, const size_t data_size,
- const IOSocket& io_socket, const IOEndpoint& remote_endpoint) :
- data_(data), data_size_(data_size), io_socket_(io_socket),
- remote_endpoint_(remote_endpoint)
- {}
- //@}
-
- /// \brief Returns a pointer to the received data.
- const void* getData() const { return (data_); }
-
- /// \brief Returns the size of the received data in bytes.
- size_t getDataSize() const { return (data_size_); }
-
- /// \brief Returns the socket on which the message arrives.
- const IOSocket& getSocket() const { return (io_socket_); }
-
- /// \brief Returns the endpoint that sends the message.
- const IOEndpoint& getRemoteEndpoint() const { return (remote_endpoint_); }
-
-private:
- const void* data_;
- const size_t data_size_;
- const IOSocket& io_socket_;
- const IOEndpoint& remote_endpoint_;
-};
-
-
-} // asiolink
-#endif // __IOMESSAGE_H
-
-// Local Variables:
-// mode: c++
-// End:
diff --git a/src/lib/asiolink/iosocket.cc b/src/lib/asiolink/iosocket.cc
deleted file mode 100644
index a3967d4..0000000
--- a/src/lib/asiolink/iosocket.cc
+++ /dev/null
@@ -1,67 +0,0 @@
-// Copyright (C) 2010 CZ NIC
-// Copyed from other version of auth/asiolink.cc which is:
-// Copyright (C) 2010 Internet Systems Consortium, Inc. ("ISC")
-//
-// Permission to use, copy, modify, and/or distribute this software for any
-// purpose with or without fee is hereby granted, provided that the above
-// copyright notice and this permission notice appear in all copies.
-//
-// THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
-// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-// AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
-// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
-// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
-// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-// PERFORMANCE OF THIS SOFTWARE.
-
-#include "iosocket.h"
-
-#include <asio.hpp>
-
-using namespace asio;
-
-namespace asiolink {
-
-/// \brief The \c DummySocket class is a concrete derived class of
-/// \c IOSocket that is not associated with any real socket.
-///
-/// This main purpose of this class is tests, where it may be desirable to
-/// instantiate an \c IOSocket object without involving system resource
-/// allocation such as real network sockets.
-class DummySocket : public IOSocket {
-private:
- DummySocket(const DummySocket& source);
- DummySocket& operator=(const DummySocket& source);
-public:
- /// \brief Constructor from the protocol number.
- ///
- /// The protocol must validly identify a standard network protocol.
- /// For example, to specify TCP \c protocol must be \c IPPROTO_TCP.
- ///
- /// \param protocol The network protocol number for the socket.
- DummySocket(const int protocol) : protocol_(protocol) {}
-
- /// \brief A dummy derived method of \c IOSocket::getNative().
- ///
- /// This version of method always returns -1 as the object is not
- /// associated with a real (native) socket.
- virtual int getNative() const { return (-1); }
-
- virtual int getProtocol() const { return (protocol_); }
-private:
- const int protocol_;
-};
-
-IOSocket&
-IOSocket::getDummyUDPSocket() {
- static DummySocket socket(IPPROTO_UDP);
- return (socket);
-}
-
-IOSocket&
-IOSocket::getDummyTCPSocket() {
- static DummySocket socket(IPPROTO_TCP);
- return (socket);
-}
-
-}
diff --git a/src/lib/asiolink/iosocket.h b/src/lib/asiolink/iosocket.h
deleted file mode 100644
index df37d71..0000000
--- a/src/lib/asiolink/iosocket.h
+++ /dev/null
@@ -1,127 +0,0 @@
-// Copyright (C) 2010 Internet Systems Consortium, Inc. ("ISC")
-//
-// Permission to use, copy, modify, and/or distribute this software for any
-// purpose with or without fee is hereby granted, provided that the above
-// copyright notice and this permission notice appear in all copies.
-//
-// THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
-// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-// AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
-// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
-// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
-// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-// PERFORMANCE OF THIS SOFTWARE.
-
-#ifndef __IOSOCKET_H
-#define __IOSOCKET_H 1
-
-// IMPORTANT NOTE: only very few ASIO headers files can be included in
-// this file. In particular, asio.hpp should never be included here.
-// See the description of the namespace below.
-#include <unistd.h> // for some network system calls
-
-#include <functional>
-#include <string>
-
-#include <exceptions/exceptions.h>
-
-namespace asiolink {
-
-/// \brief The \c IOSocket class is an abstract base class to represent
-/// various types of network sockets.
-///
-/// This class is a wrapper for the ASIO socket classes such as
-/// \c ip::tcp::socket and \c ip::udp::socket.
-///
-/// Derived class implementations are completely hidden within the
-/// implementation. User applications only get access to concrete
-/// \c IOSocket objects via the abstract interfaces.
-///
-/// We may revisit this decision when we generalize the wrapper and more
-/// modules use it. Also, at that point we may define a separate (visible)
-/// derived class for testing purposes rather than providing factory methods
-/// (i.e., getDummy variants below).
-class IOSocket {
- ///
- /// \name Constructors and Destructor
- ///
- /// Note: The copy constructor and the assignment operator are
- /// intentionally defined as private, making this class non-copyable.
- //@{
-private:
- IOSocket(const IOSocket& source);
- IOSocket& operator=(const IOSocket& source);
-protected:
- /// \brief The default constructor.
- ///
- /// This is intentionally defined as \c protected as this base class
- /// should never be instantiated (except as part of a derived class).
- IOSocket() {}
-public:
- /// The destructor.
- virtual ~IOSocket() {}
- //@}
-
- /// \brief Return the "native" representation of the socket.
- ///
- /// In practice, this is the file descriptor of the socket for
- /// UNIX-like systems so the current implementation simply uses
- /// \c int as the type of the return value.
- /// We may have to need revisit this decision later.
- ///
- /// In general, the application should avoid using this method;
- /// it essentially discloses an implementation specific "handle" that
- /// can change the internal state of the socket (consider the
- /// application closes it, for example).
- /// But we sometimes need to perform very low-level operations that
- /// requires the native representation. Passing the file descriptor
- /// to a different process is one example.
- /// This method is provided as a necessary evil for such limited purposes.
- ///
- /// This method never throws an exception.
- ///
- /// \return The native representation of the socket. This is the socket
- /// file descriptor for UNIX-like systems.
- virtual int getNative() const = 0;
-
- /// \brief Return the transport protocol of the socket.
- ///
- /// Currently, it returns \c IPPROTO_UDP for UDP sockets, and
- /// \c IPPROTO_TCP for TCP sockets.
- ///
- /// This method never throws an exception.
- ///
- /// \return IPPROTO_UDP for UDP sockets
- /// \return IPPROTO_TCP for TCP sockets
- virtual int getProtocol() const = 0;
-
- /// \brief Return a non-usable "dummy" UDP socket for testing.
- ///
- /// This is a class method that returns a "mock" of UDP socket.
- /// This is not associated with any actual socket, and its only
- /// responsibility is to return \c IPPROTO_UDP from \c getProtocol().
- /// The only feasible usage of this socket is for testing so that
- /// the test code can prepare some "UDP data" even without opening any
- /// actual socket.
- ///
- /// This method never throws an exception.
- ///
- /// \return A reference to an \c IOSocket object whose \c getProtocol()
- /// returns \c IPPROTO_UDP.
- static IOSocket& getDummyUDPSocket();
-
- /// \brief Return a non-usable "dummy" TCP socket for testing.
- ///
- /// See \c getDummyUDPSocket(). This method is its TCP version.
- ///
- /// \return A reference to an \c IOSocket object whose \c getProtocol()
- /// returns \c IPPROTO_TCP.
- static IOSocket& getDummyTCPSocket();
-};
-
-} // asiolink
-#endif // __IOSOCKET_H
-
-// Local Variables:
-// mode: c++
-// End:
diff --git a/src/lib/asiolink/simple_callback.h b/src/lib/asiolink/simple_callback.h
index 4c2d58f..ab5deaf 100644
--- a/src/lib/asiolink/simple_callback.h
+++ b/src/lib/asiolink/simple_callback.h
@@ -15,6 +15,8 @@
#ifndef __ASIOLINK_SIMPLE_CALLBACK_H
#define __ASIOLINK_SIMPLE_CALLBACK_H 1
+#include <asiolink/io_message.h>
+
namespace asiolink {
/// \brief The \c SimpleCallback class is an abstract base class for a
diff --git a/src/lib/asiolink/tcp_endpoint.h b/src/lib/asiolink/tcp_endpoint.h
index 6c3cbbc..8f6270f 100644
--- a/src/lib/asiolink/tcp_endpoint.h
+++ b/src/lib/asiolink/tcp_endpoint.h
@@ -19,7 +19,7 @@
#error "asio.hpp must be included before including this, see asiolink.h as to why"
#endif
-#include <asiolink/ioendpoint.h>
+#include <asiolink/io_endpoint.h>
namespace asiolink {
diff --git a/src/lib/asiolink/tcp_server.h b/src/lib/asiolink/tcp_server.h
index fae9fda..9b985ce 100644
--- a/src/lib/asiolink/tcp_server.h
+++ b/src/lib/asiolink/tcp_server.h
@@ -23,7 +23,7 @@
#include <boost/shared_ptr.hpp>
#include <asiolink/asiolink.h>
-#include <asiolink/coroutine.h>
+#include <coroutine.h>
namespace asiolink {
diff --git a/src/lib/asiolink/tcp_socket.h b/src/lib/asiolink/tcp_socket.h
index ef4f9f3..03713a5 100644
--- a/src/lib/asiolink/tcp_socket.h
+++ b/src/lib/asiolink/tcp_socket.h
@@ -19,7 +19,7 @@
#error "asio.hpp must be included before including this, see asiolink.h as to why"
#endif
-#include <asiolink/iosocket.h>
+#include <asiolink/io_socket.h>
namespace asiolink {
diff --git a/src/lib/asiolink/tests/recursive_query_unittest.cc b/src/lib/asiolink/tests/recursive_query_unittest.cc
index fc64452..ad4e5b4 100644
--- a/src/lib/asiolink/tests/recursive_query_unittest.cc
+++ b/src/lib/asiolink/tests/recursive_query_unittest.cc
@@ -42,7 +42,7 @@
// If we need to test something at the level of underlying ASIO and need
// their definition, that test should go to asiolink/internal/tests.
#include <asiolink/asiolink.h>
-#include <asiolink/iosocket.h>
+#include <asiolink/io_socket.h>
using isc::UnitTestUtil;
using namespace std;
diff --git a/src/lib/asiolink/udp_endpoint.h b/src/lib/asiolink/udp_endpoint.h
index 16ee686..27541e0 100644
--- a/src/lib/asiolink/udp_endpoint.h
+++ b/src/lib/asiolink/udp_endpoint.h
@@ -19,7 +19,7 @@
#error "asio.hpp must be included before including this, see asiolink.h as to why"
#endif
-#include <asiolink/ioendpoint.h>
+#include <asiolink/io_endpoint.h>
namespace asiolink {
diff --git a/src/lib/asiolink/udp_query.cc b/src/lib/asiolink/udp_query.cc
index 57ad8cb..6dbb182 100644
--- a/src/lib/asiolink/udp_query.cc
+++ b/src/lib/asiolink/udp_query.cc
@@ -29,7 +29,7 @@
#include <asiolink.h>
-#include <asiolink/coroutine.h>
+#include <coroutine.h>
#include <asiolink/udp_endpoint.h>
#include <asiolink/udp_query.h>
diff --git a/src/lib/asiolink/udp_query.h b/src/lib/asiolink/udp_query.h
index 81ef554..3ed44ad 100644
--- a/src/lib/asiolink/udp_query.h
+++ b/src/lib/asiolink/udp_query.h
@@ -21,8 +21,8 @@
#include <dns/buffer.h>
-#include <asiolink/ioaddress.h>
-#include <asiolink/coroutine.h>
+#include <asiolink/io_address.h>
+#include <coroutine.h>
namespace asiolink {
diff --git a/src/lib/asiolink/udp_server.h b/src/lib/asiolink/udp_server.h
index a6ae32b..16a03dd 100644
--- a/src/lib/asiolink/udp_server.h
+++ b/src/lib/asiolink/udp_server.h
@@ -24,7 +24,7 @@
#include <asiolink/dns_lookup.h>
#include <asiolink/dns_answer.h>
-#include <asiolink/coroutine.h>
+#include <coroutine.h>
namespace asiolink {
diff --git a/src/lib/asiolink/udp_socket.h b/src/lib/asiolink/udp_socket.h
index 253c42b..5c641ff 100644
--- a/src/lib/asiolink/udp_socket.h
+++ b/src/lib/asiolink/udp_socket.h
@@ -19,7 +19,7 @@
#error "asio.hpp must be included before including this, see asiolink.h as to why"
#endif
-#include <asiolink/iosocket.h>
+#include <asiolink/io_socket.h>
namespace asiolink {
More information about the bind10-changes
mailing list