Commit d45798e0 authored by Francis Dupont's avatar Francis Dupont

[4029] Removed unused files (tentative)

parent 9b344caa
......@@ -2,9 +2,6 @@ SUBDIRS = . tests
AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib
AM_CPPFLAGS += $(BOOST_INCLUDES)
AM_CPPFLAGS += -I$(top_srcdir)/src/lib/dns -I$(top_builddir)/src/lib/dns
AM_CPPFLAGS += -I$(top_srcdir)/src/lib/asiolink -I$(top_builddir)/src/lib/asiolink
AM_CPPFLAGS += -I$(top_srcdir)/src/lib/util -I$(top_builddir)/src/lib/util
AM_CXXFLAGS = $(KEA_CXXFLAGS)
......@@ -20,15 +17,7 @@ s-messages: asiodns_messages.mes
BUILT_SOURCES = asiodns_messages.h asiodns_messages.cc
lib_LTLIBRARIES = libkea-asiodns.la
libkea_asiodns_la_SOURCES = dns_answer.h
libkea_asiodns_la_SOURCES += asiodns.h
libkea_asiodns_la_SOURCES += dns_lookup.h
libkea_asiodns_la_SOURCES += dns_server.h
libkea_asiodns_la_SOURCES += dns_service.cc dns_service.h
libkea_asiodns_la_SOURCES += tcp_server.cc tcp_server.h
libkea_asiodns_la_SOURCES += udp_server.cc udp_server.h
libkea_asiodns_la_SOURCES += sync_udp_server.cc sync_udp_server.h
libkea_asiodns_la_SOURCES += io_fetch.cc io_fetch.h
libkea_asiodns_la_SOURCES = io_fetch.cc io_fetch.h
libkea_asiodns_la_SOURCES += logger.h logger.cc
nodist_libkea_asiodns_la_SOURCES = asiodns_messages.cc asiodns_messages.h
......
// 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.
#ifndef ASIODNS_H
#define ASIODNS_H 1
#include <asiodns/dns_service.h>
#include <asiodns/dns_server.h>
#include <asiodns/dns_lookup.h>
#include <asiodns/dns_answer.h>
#endif // ASIODNS_H
// 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.
#ifndef ASIOLINK_DNS_ANSWER_H
#define ASIOLINK_DNS_ANSWER_H 1
#include <asiolink/io_message.h>
#include <util/buffer.h>
#include <dns/message.h>
namespace isc {
namespace asiodns {
/// \brief The \c DNSAnswer class is an abstract base class for a DNS
/// Answer provider function.
///
/// Specific derived class implementations are hidden within the
/// implementation. Instances of the derived classes can be called
/// as functions via the operator() interface. Pointers to these
/// instances can then be provided to the \c IOService class
/// via its constructor.
///
/// A DNS Answer provider function takes answer data that has been obtained
/// from a DNS Lookup provider function and readies it to be sent to the
/// client. After it has run, the OutputBuffer object passed to it should
/// contain the answer to the query rendered into wire format.
class DNSAnswer {
///
/// \name Constructors and Destructor
///
/// Note: The copy constructor and the assignment operator are
/// intentionally defined as private, making this class non-copyable.
//@{
private:
DNSAnswer(const DNSAnswer& source);
DNSAnswer& operator=(const DNSAnswer& 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).
DNSAnswer() {}
public:
/// \brief The destructor
virtual ~DNSAnswer() {}
//@}
/// \brief The function operator
///
/// This makes its call indirectly via the "self" pointer, ensuring
/// that the function ultimately invoked will be the one in the derived
/// class.
///
/// \param io_message The event message to handle
/// \param query_message The DNS MessagePtr of the original query
/// \param answer_message The DNS MessagePtr of the answer we are
/// building
/// \param buffer Intermediate data results are put here
virtual void operator()(const asiolink::IOMessage& io_message,
isc::dns::MessagePtr query_message,
isc::dns::MessagePtr answer_message,
isc::util::OutputBufferPtr buffer) const = 0;
};
} // namespace asiodns
} // namespace isc
#endif // ASIOLINK_DNS_ANSWER_H
// 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.
#ifndef ASIOLINK_DNS_LOOKUP_H
#define ASIOLINK_DNS_LOOKUP_H 1
#include <asiolink/io_message.h>
#include <asiodns/dns_server.h>
#include <dns/message.h>
#include <util/buffer.h>
namespace isc {
namespace asiodns {
/// \brief The \c DNSLookup class is an abstract base class for a DNS
/// Lookup provider function.
///
/// Specific derived class implementations are hidden within the
/// implementation. Instances of the derived classes can be called
/// as functions via the operator() interface. Pointers to these
/// instances can then be provided to the \c IOService class
/// via its constructor.
///
/// A DNS Lookup provider function obtains the data needed to answer
/// a DNS query (e.g., from authoritative data source, cache, or upstream
/// query). After it has run, the OutputBuffer object passed to it
/// should contain the answer to the query, in an internal representation.
class DNSLookup {
///
/// \name Constructors and Destructor
///
/// Note: The copy constructor and the assignment operator are
/// intentionally defined as private, making this class non-copyable.
//@{
private:
DNSLookup(const DNSLookup& source);
DNSLookup& operator=(const DNSLookup& 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).
DNSLookup() {
self_ = this;
}
public:
/// \brief The destructor
virtual ~DNSLookup() {}
//@}
/// \brief The function operator
///
/// This makes its call indirectly via the "self" pointer, ensuring
/// that the function ultimately invoked will be the one in the derived
/// class.
///
/// \param io_message The event message to handle
/// \param message The DNS MessagePtr that needs handling
/// \param answer_message The final answer will be constructed in
/// this MessagePtr
/// \param buffer The final answer is put here
/// \param server DNSServer object to use
virtual void operator()(const asiolink::IOMessage& io_message,
isc::dns::MessagePtr message,
isc::dns::MessagePtr answer_message,
isc::util::OutputBufferPtr buffer,
DNSServer* server) const
{
(*self_)(io_message, message, answer_message, buffer, server);
}
private:
DNSLookup* self_;
};
} // namespace asiodns
} // namespace isc
#endif // ASIOLINK_DNS_LOOKUP_H
// 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.
#ifndef ASIOLINK_DNS_SERVER_H
#define ASIOLINK_DNS_SERVER_H 1
#include <asiolink/io_message.h>
namespace isc {
namespace asiodns {
/// \brief The \c DNSServer class is a wrapper (and base class) for
/// classes which provide DNS server functionality.
///
/// The classes derived from this one, \c TCPServer and \c UDPServer,
/// act as the interface layer between clients sending queries, and
/// functions defined elsewhere that provide answers to those queries.
/// Those functions are described in more detail below under
/// \c SimpleCallback, \c DNSLookup, and \c DNSAnswer.
///
/// Notes to developers:
/// When constructed, this class (and its derived classes) will have its
/// "self_" member set to point to "this". Objects of this class (as
/// instantiated through a base class) are sometimes passed by
/// reference (as this superclass); calls to methods in the base
/// class are then rerouted via this pointer to methods in the derived
/// class. This allows code from outside asiodns, with no specific
/// knowledge of \c TCPServer or \c UDPServer, to access their methods.
///
/// This class is both assignable and copy-constructable. Its subclasses
/// use the "stackless coroutine" pattern, meaning that it will copy itself
/// when "forking", and that instances will be posted as ASIO handler
/// objects, which are always copied.
///
/// Because these objects are frequently copied, it is recommended
/// that derived classes be kept small to reduce copy overhead.
class DNSServer {
protected:
///
/// \name Constructors and destructors
///
/// This is intentionally defined as \c protected, as this base class
/// should never be instantiated except as part of a derived class.
//@{
DNSServer() {
self_ = this;
}
public:
/// \brief The destructor
virtual ~DNSServer() {}
//@}
///
/// \name Class methods
///
/// These methods all make their calls indirectly via the "self_"
/// pointer, ensuring that the functions ultimately invoked will be
/// the ones in the derived class. This makes it possible to pass
/// instances of derived classes as references to this base class
/// without losing access to derived class data.
///
//@{
/// \brief The function operator
virtual void operator()(asio::error_code ec = asio::error_code(),
size_t length = 0)
{
(*self_)(ec, length);
}
/// \brief Stop current running server
virtual void stop() { self_->stop();}
/// \brief Resume processing of the server coroutine after an
/// asynchronous call (e.g., to the DNS Lookup provider) has completed.
///
/// \param done If true, this signals the system there is an answer
/// to return.
virtual void resume(const bool done) { self_->resume(done); }
/// \brief Returns a pointer to a clone of this DNSServer object.
///
/// When a \c DNSServer object is copied or assigned, the result will
/// normally be another \c DNSServer object containing a copy
/// of the original "self_" pointer. Calling clone() guarantees
/// that the underlying object is also correctly copied.
///
/// \return A deep copy of this DNSServer object
virtual DNSServer* clone() { return (self_->clone()); }
//@}
/// \brief Set timeout for incoming TCP connections
///
/// Since this value is not relevant for every type of DNSServer
/// (like UDPServer), it has a no-op default implementation.
/// It is in the base class because the AuthSrv's DNSService has
/// no direct access to the derived API's after initialization,
/// and it does need to update running servers if the timeout
/// setting is changed.
///
/// \param timeout The timeout in milliseconds
virtual void setTCPRecvTimeout(size_t) {}
protected:
/// \brief Lookup handler object.
///
/// This is a protected class; it can only be instantiated
/// from within a derived class of \c DNSServer.
///
/// A server object that has received a query creates an instance
/// of this class and scheudles it on the ASIO service queue
/// using asio::io_service::post(). When the handler executes, it
/// calls the asyncLookup() method in the server object to start a
/// DNS lookup. When the lookup is complete, the server object is
/// scheduled to resume, again using io_service::post().
///
/// Note that the calling object is copied into the handler object,
/// not referenced. This is because, once the calling object yields
/// control to the handler, it falls out of scope and may disappear
template <typename T>
class AsyncLookup {
public:
AsyncLookup(T& caller) : caller_(caller) {}
void operator()() { caller_.asyncLookup(); }
private:
T caller_;
};
/// \brief Carries out a DNS lookup.
///
/// This function calls the \c DNSLookup object specified by the
/// DNS server when the \c IOService was created, passing along
/// the details of the query and a pointer back to the current
/// server object. It is called asynchronously via the AsyncLookup
/// handler class.
virtual void asyncLookup() { self_->asyncLookup(); }
private:
DNSServer* self_;
};
} // namespace asiodns
} // namespace isc
#endif // ASIOLINK_DNS_SERVER_H
// 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 <exceptions/exceptions.h>
#include <dns_service.h>
#include <asiolink/io_service.h>
#include <asio.hpp> // xxx_server.h requires this to be included first
#include <tcp_server.h>
#include <udp_server.h>
#include <sync_udp_server.h>
#include <boost/foreach.hpp>
using namespace isc::asiolink;
namespace isc {
namespace asiodns {
class DNSLookup;
class DNSAnswer;
class DNSServiceImpl {
public:
DNSServiceImpl(IOService& io_service,
DNSLookup* lookup, DNSAnswer* answer) :
io_service_(io_service), lookup_(lookup),
answer_(answer), tcp_recv_timeout_(5000)
{}
IOService& io_service_;
typedef boost::shared_ptr<UDPServer> UDPServerPtr;
typedef boost::shared_ptr<SyncUDPServer> SyncUDPServerPtr;
typedef boost::shared_ptr<TCPServer> TCPServerPtr;
typedef boost::shared_ptr<DNSServer> DNSServerPtr;
std::vector<DNSServerPtr> servers_;
DNSLookup* lookup_;
DNSAnswer* answer_;
size_t tcp_recv_timeout_;
template<class Ptr, class Server> void addServerFromFD(int fd, int af) {
Ptr server(new Server(io_service_.get_io_service(), fd, af,
lookup_, answer_));
startServer(server);
}
// SyncUDPServer has different constructor signature so it cannot be
// templated.
void addSyncUDPServerFromFD(int fd, int af) {
SyncUDPServerPtr server(SyncUDPServer::create(
io_service_.get_io_service(), fd, af,
lookup_));
startServer(server);
}
void setTCPRecvTimeout(size_t timeout) {
// Store it for future tcp connections
tcp_recv_timeout_ = timeout;
// Update existing (TCP) Servers
std::vector<DNSServerPtr>::iterator it = servers_.begin();
for (; it != servers_.end(); ++it) {
(*it)->setTCPRecvTimeout(timeout);
}
}
private:
void startServer(DNSServerPtr server) {
server->setTCPRecvTimeout(tcp_recv_timeout_);
(*server)();
servers_.push_back(server);
}
};
DNSService::DNSService(IOService& io_service,
DNSLookup* lookup, DNSAnswer *answer) :
impl_(new DNSServiceImpl(io_service, lookup, answer)),
io_service_(io_service)
{
}
DNSService::~DNSService() {
delete impl_;
}
void DNSService::addServerTCPFromFD(int fd, int af) {
impl_->addServerFromFD<DNSServiceImpl::TCPServerPtr, TCPServer>(fd, af);
}
void DNSService::addServerUDPFromFD(int fd, int af, ServerFlag options) {
if ((~SERVER_DEFINED_FLAGS & static_cast<unsigned int>(options)) != 0) {
isc_throw(isc::InvalidParameter, "Invalid DNS/UDP server option: "
<< options);
}
if ((options & SERVER_SYNC_OK) != 0) {
impl_->addSyncUDPServerFromFD(fd, af);
} else {
impl_->addServerFromFD<DNSServiceImpl::UDPServerPtr, UDPServer>(
fd, af);
}
}
void
DNSService::clearServers() {
BOOST_FOREACH(const DNSServiceImpl::DNSServerPtr& s, impl_->servers_) {
s->stop();
}
impl_->servers_.clear();
}
void
DNSService::setTCPRecvTimeout(size_t timeout) {
impl_->setTCPRecvTimeout(timeout);
}
} // namespace asiodns
} // namespace isc
// 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.
#ifndef ASIOLINK_DNS_SERVICE_H
#define ASIOLINK_DNS_SERVICE_H 1
// The commented header occurs to be unused so we remove it to get
// rid of dependency on resolver.
// #include <resolve/resolver_interface.h>
#include <asiolink/io_service.h>
#include <asiolink/simple_callback.h>
namespace isc {
namespace asiodns {
class DNSLookup;
class DNSAnswer;
class DNSServiceImpl;
/// \brief A base class for common \c DNSService interfaces.
///
/// This class is defined mainly for test code so it can use a faked/mock
/// version of a derived class and test scenarios that would involve
/// \c DNSService without actually instantiating the real service class.
///
/// It doesn't intend to be a customization for other purposes - we generally
/// expect non test code only use \c DNSService directly.
/// For this reason most of the detailed description are given in the
/// \c DNSService class. See that for further details of specific methods
/// and class behaviors.
class DNSServiceBase {
protected:
/// \brief Default constructor.
///
/// This is protected so this class couldn't be accidentally instantiated
/// directly, even if there were no pure virtual functions.
DNSServiceBase() {}
public:
/// \brief Flags for optional server properties.
///
/// The values of this enumerable type are intended to be used to specify
/// a particular property of the server created via the \c addServer
/// variants. As we see need for more such properties, a compound
/// form of flags (i.e., a single value generated by bitwise OR'ed
/// multiple flag values) will be allowed.
///
/// Note: the description is given here because it's used in the method
/// signature. It essentially belongs to the derived \c DNSService
/// class.
enum ServerFlag {
SERVER_DEFAULT = 0, ///< The default flag (no particular property)
SERVER_SYNC_OK = 1 ///< The server can act in the "synchronous" mode.
///< In this mode, the client ensures that the
///< lookup provider always completes the query
///< process and it immediately releases the
///< ownership of the given buffer. This allows
///< the server implementation to introduce some
///< optimization such as omitting unnecessary
///< operation or reusing internal resources.
///< Note that in functionality the non
///< "synchronous" mode is compatible with the
///< synchronous mode; it's up to the server
///< implementation whether it exploits the
///< information given by the client.
};
public:
/// \brief The destructor.
virtual ~DNSServiceBase() {}
virtual void addServerTCPFromFD(int fd, int af) = 0;
virtual void addServerUDPFromFD(int fd, int af,
ServerFlag options = SERVER_DEFAULT) = 0;
virtual void clearServers() = 0;
/// \brief Set the timeout for TCP DNS services
///
/// The timeout is used for incoming TCP connections, so
/// that the connection is dropped if not all query data
/// is read.
///
/// For existing DNSServer objects, where the timeout is
/// relevant (i.e. TCPServer instances), the timeout value
/// is updated.
/// The given value is also kept to use for DNSServer instances
/// which are created later
///
/// \param timeout The timeout in milliseconds
virtual void setTCPRecvTimeout(size_t timeout) = 0;
virtual asiolink::IOService& getIOService() = 0;
};
/// \brief Handle DNS Queries
///
/// DNSService is the service that handles DNS queries and answers with
/// a given IOService. This class is mainly intended to hold all the
/// logic that is shared between the authoritative and the recursive
/// server implementations. As such, it handles asio and listening
/// sockets.
class DNSService : public DNSServiceBase {
///
/// \name Constructors and Destructor
///
/// Note: The copy constructor and the assignment operator are
/// intentionally defined as private, making this class non-copyable.
//@{
private:
DNSService(const DNSService& source);
DNSService& operator=(const DNSService& source);
private:
// Bit or'ed all defined \c ServerFlag values. Used internally for
// compatibility check. Note that this doesn't have to be used by
// applications, and doesn't have to be defined in the "base" class.
static const unsigned int SERVER_DEFINED_FLAGS = 1;
public:
/// \brief The constructor without any servers.
///
/// Use addServerTCPFromFD() or addServerUDPFromFD() to add some servers.
///
/// \param io_service The IOService to work with
/// \param lookup The lookup provider (see \c DNSLookup)
/// \param answer The answer provider (see \c DNSAnswer)
DNSService(asiolink::IOService& io_service,
DNSLookup* lookup, DNSAnswer* answer);
/// \brief The destructor.
virtual ~DNSService();
//@}
/// \brief Add another TCP server/listener to the service from already
/// opened file descriptor
///
/// Adds a new TCP server using an already opened file descriptor (eg. it
/// only wraps it so the file descriptor is usable within the event loop).
/// The file descriptor must be associated with a TCP socket of the given
/// address family that is bound to an appropriate port (and possibly a
/// specific address) and is ready for listening to new connection
/// requests but has not actually started listening.
///
/// At the moment, TCP servers don't support any optional properties;
/// so unlike the UDP version of the method it doesn't have an \c options
/// argument.
///
/// \param fd the file descriptor to be used.
/// \param af the address family of the file descriptor. Must be either
/// AF_INET or AF_INET6.
/// \throw isc::InvalidParameter if af is neither AF_INET nor AF_INET6.
/// \throw isc::asiolink::IOError when a low-level error happens, like the
/// fd is not a valid descriptor or it can't be listened on.
virtual void addServerTCPFromFD(int fd, int af);
/// \brief Add another UDP server to the service from already opened
/// file descriptor
///
/// Adds a new UDP server using an already opened file descriptor (eg. it
/// only wraps it so the file descriptor is usable within the event loop).
/// The file descriptor must be associated with a UDP socket of the given
/// address family that is bound to an appropriate port (and possibly a
/// specific address).
///
/// \param fd the file descriptor to be used.
/// \param af the address family of the file descriptor. Must be either
/// AF_INET or AF_INET6.
/// \param options Optional properties of the server (see ServerFlag).
///
/// \throw isc::InvalidParameter if af is neither AF_INET nor AF_INET6,
/// or the given \c options include an unsupported or invalid value.
/// \throw isc::asiolink::IOError when a low-level error happens, like the
/// fd is not a valid descriptor or it can't be listened on.
virtual void addServerUDPFromFD(int fd, int af,
ServerFlag options = SERVER_DEFAULT);
/// \brief Remove all servers from the service
void clearServers();