Kea 2.7.4
|
Base class for acceptor services in Kea. More...
#include <io_acceptor.h>
Public Member Functions | |
IOAcceptor (const IOServicePtr &io_service) | |
Constructor. | |
virtual | ~IOAcceptor () |
Destructor. | |
template<typename EndpointType > | |
void | bind (const EndpointType &endpoint) |
Binds socket to an endpoint. | |
void | close () const |
Closes the acceptor. | |
virtual int | getNative () const |
Returns file descriptor of the underlying socket. | |
bool | isOpen () const |
Checks if the acceptor is open. | |
void | listen () |
Starts listening new connections. | |
template<typename EndpointType > | |
void | open (const EndpointType &endpoint) |
Opens acceptor socket given the endpoint. | |
template<typename SettableSocketOption > | |
void | setOption (const SettableSocketOption &socket_option) |
Sets socket option. | |
Public Member Functions inherited from isc::asiolink::IOSocket | |
virtual | ~IOSocket () |
The destructor. | |
virtual int | getProtocol () const =0 |
Return the transport protocol of the socket. | |
Protected Member Functions | |
template<typename SocketType > | |
void | asyncAcceptInternal (const SocketType &socket, const CallbackType &callback) |
Asynchronously accept new connection. | |
Protected Member Functions inherited from isc::asiolink::IOSocket | |
IOSocket () | |
The default constructor. | |
Protected Attributes | |
boost::shared_ptr< typename ProtocolType::acceptor > | acceptor_ |
Underlying ASIO acceptor implementation. | |
IOServicePtr | io_service_ |
The IO service used to handle events. | |
Additional Inherited Members | |
Public Types inherited from isc::asiolink::IOSocket | |
typedef boost::asio::socket_base::reuse_address | ReuseAddress |
Represents SO_REUSEADDR socket option. | |
Static Public Member Functions inherited from isc::asiolink::IOSocket | |
static IOSocket & | getDummyUDPSocket () |
Return a non-usable "dummy" UDP socket for testing. | |
static IOSocket & | getDummyTCPSocket () |
Return a non-usable "dummy" TCP socket for testing. | |
Base class for acceptor services in Kea.
This is a wrapper class for ASIO acceptor service. Classes implementing services for specific protocol types should derive from this class.
Acceptor is an IO object which accepts incoming connections into a socket object. This socket is then used for data transmission from the client to server and back. The acceptor is continued to be used to accept new connections while the accepted connection is active.
ProtocolType | ASIO protocol type, e.g. stream_protocol |
CallbackType | Callback function type which should have the following signature: void(const boost::system::error_code&) . |
Definition at line 34 of file io_acceptor.h.
|
inlineexplicit |
Constructor.
io_service | Reference to the IO service. |
Definition at line 40 of file io_acceptor.h.
|
inlinevirtual |
Destructor.
Definition at line 46 of file io_acceptor.h.
|
inlineprotected |
Asynchronously accept new connection.
This method accepts new connection into the specified socket. When the new connection arrives or an error occurs the specified callback function is invoked.
socket | Socket into which connection should be accepted. |
callback | Callback function to be invoked when the new connection arrives. |
SocketType | Socket type, e.g. UnixDomainSocket. It must implement getASIOSocket method. |
Definition at line 121 of file io_acceptor.h.
References isc::asiolink::IOAcceptor< ProtocolType, CallbackType >::acceptor_.
Referenced by isc::asiolink::TCPAcceptor< C >::asyncAccept().
|
inline |
Binds socket to an endpoint.
endpoint | Reference to the endpoint object defining local acceptor endpoint. |
EndpointType | Endpoint type. |
Definition at line 75 of file io_acceptor.h.
References isc::asiolink::IOAcceptor< ProtocolType, CallbackType >::acceptor_.
|
inline |
Closes the acceptor.
Definition at line 103 of file io_acceptor.h.
References isc::asiolink::IOAcceptor< ProtocolType, CallbackType >::acceptor_.
|
inlinevirtual |
Returns file descriptor of the underlying socket.
Implements isc::asiolink::IOSocket.
Definition at line 49 of file io_acceptor.h.
References isc::asiolink::IOAcceptor< ProtocolType, CallbackType >::acceptor_.
|
inline |
Checks if the acceptor is open.
Definition at line 98 of file io_acceptor.h.
References isc::asiolink::IOAcceptor< ProtocolType, CallbackType >::acceptor_.
|
inline |
Starts listening new connections.
Definition at line 91 of file io_acceptor.h.
References isc::asiolink::IOAcceptor< ProtocolType, CallbackType >::acceptor_.
|
inline |
Opens acceptor socket given the endpoint.
endpoint | Reference to the endpoint object defining local acceptor endpoint. |
EndpointType | Endpoint type. |
Definition at line 64 of file io_acceptor.h.
References isc::asiolink::IOAcceptor< ProtocolType, CallbackType >::acceptor_.
|
inline |
Sets socket option.
socket_option | Reference to the object encapsulating an option to be set for the socket. |
SettableSocketOption | Type of the object encapsulating socket option being set. |
Definition at line 86 of file io_acceptor.h.
References isc::asiolink::IOAcceptor< ProtocolType, CallbackType >::acceptor_.
|
protected |
Underlying ASIO acceptor implementation.
Definition at line 130 of file io_acceptor.h.
Referenced by isc::asiolink::IOAcceptor< ProtocolType, CallbackType >::asyncAcceptInternal(), isc::asiolink::IOAcceptor< ProtocolType, CallbackType >::bind(), isc::asiolink::IOAcceptor< ProtocolType, CallbackType >::close(), isc::asiolink::IOAcceptor< ProtocolType, CallbackType >::getNative(), isc::asiolink::IOAcceptor< ProtocolType, CallbackType >::isOpen(), isc::asiolink::IOAcceptor< ProtocolType, CallbackType >::listen(), isc::asiolink::IOAcceptor< ProtocolType, CallbackType >::open(), and isc::asiolink::IOAcceptor< ProtocolType, CallbackType >::setOption().
|
protected |
The IO service used to handle events.
Definition at line 127 of file io_acceptor.h.