Kea  2.1.7-git
isc::asiolink::IOAcceptor< ProtocolType, CallbackType > Class Template Reference

Base class for acceptor services in Kea. More...

#include <io_acceptor.h>

+ Inheritance diagram for isc::asiolink::IOAcceptor< ProtocolType, CallbackType >:

Public Member Functions

 IOAcceptor (IOService &io_service)
 Constructor. More...
 
virtual ~IOAcceptor ()
 Destructor. More...
 
template<typename EndpointType >
void bind (const EndpointType &endpoint)
 Binds socket to an endpoint. More...
 
void close () const
 Closes the acceptor. More...
 
virtual int getNative () const
 Returns file descriptor of the underlying socket. More...
 
bool isOpen () const
 Checks if the acceptor is open. More...
 
void listen ()
 Starts listening new connections. More...
 
template<typename EndpointType >
void open (const EndpointType &endpoint)
 Opens acceptor socket given the endpoint. More...
 
template<typename SettableSocketOption >
void setOption (const SettableSocketOption &socket_option)
 Sets socket option. More...
 

Protected Member Functions

template<typename SocketType >
void asyncAcceptInternal (const SocketType &socket, const CallbackType &callback)
 Asynchronously accept new connection. More...
 

Protected Attributes

boost::shared_ptr< typename ProtocolType::acceptor > acceptor_
 Underlying ASIO acceptor implementation. More...
 

Additional Inherited Members

Detailed Description

template<typename ProtocolType, typename CallbackType>
class isc::asiolink::IOAcceptor< ProtocolType, CallbackType >

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.

Template Parameters
ProtocolTypeASIO protocol type, e.g. stream_protocol
CallbackTypeCallback function type which should have the following signature: void(const boost::system::error_code&).

Definition at line 34 of file io_acceptor.h.

Constructor & Destructor Documentation

◆ IOAcceptor()

template<typename ProtocolType, typename CallbackType>
isc::asiolink::IOAcceptor< ProtocolType, CallbackType >::IOAcceptor ( IOService io_service)
inlineexplicit

Constructor.

Parameters
io_serviceReference to the IO service.

Definition at line 40 of file io_acceptor.h.

◆ ~IOAcceptor()

template<typename ProtocolType, typename CallbackType>
virtual isc::asiolink::IOAcceptor< ProtocolType, CallbackType >::~IOAcceptor ( )
inlinevirtual

Destructor.

Definition at line 46 of file io_acceptor.h.

Member Function Documentation

◆ asyncAcceptInternal()

template<typename ProtocolType, typename CallbackType>
template<typename SocketType >
void isc::asiolink::IOAcceptor< ProtocolType, CallbackType >::asyncAcceptInternal ( const SocketType &  socket,
const CallbackType &  callback 
)
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.

Parameters
socketSocket into which connection should be accepted.
callbackCallback function to be invoked when the new connection arrives.
Template Parameters
SocketTypeSocket type, e.g. UnixDomainSocket. It must implement getASIOSocket method.

Definition at line 121 of file io_acceptor.h.

Referenced by isc::asiolink::TCPAcceptor< C >::asyncAccept().

◆ bind()

template<typename ProtocolType, typename CallbackType>
template<typename EndpointType >
void isc::asiolink::IOAcceptor< ProtocolType, CallbackType >::bind ( const EndpointType &  endpoint)
inline

Binds socket to an endpoint.

Parameters
endpointReference to the endpoint object defining local acceptor endpoint.
Template Parameters
EndpointTypeEndpoint type.

Definition at line 75 of file io_acceptor.h.

◆ close()

template<typename ProtocolType, typename CallbackType>
void isc::asiolink::IOAcceptor< ProtocolType, CallbackType >::close ( ) const
inline

Closes the acceptor.

Definition at line 103 of file io_acceptor.h.

◆ getNative()

template<typename ProtocolType, typename CallbackType>
virtual int isc::asiolink::IOAcceptor< ProtocolType, CallbackType >::getNative ( ) const
inlinevirtual

Returns file descriptor of the underlying socket.

Implements isc::asiolink::IOSocket.

Definition at line 49 of file io_acceptor.h.

◆ isOpen()

template<typename ProtocolType, typename CallbackType>
bool isc::asiolink::IOAcceptor< ProtocolType, CallbackType >::isOpen ( ) const
inline

Checks if the acceptor is open.

Returns
true if acceptor is open.

Definition at line 98 of file io_acceptor.h.

◆ listen()

template<typename ProtocolType, typename CallbackType>
void isc::asiolink::IOAcceptor< ProtocolType, CallbackType >::listen ( )
inline

Starts listening new connections.

Definition at line 91 of file io_acceptor.h.

◆ open()

template<typename ProtocolType, typename CallbackType>
template<typename EndpointType >
void isc::asiolink::IOAcceptor< ProtocolType, CallbackType >::open ( const EndpointType &  endpoint)
inline

Opens acceptor socket given the endpoint.

Parameters
endpointReference to the endpoint object defining local acceptor endpoint.
Template Parameters
EndpointTypeEndpoint type.

Definition at line 64 of file io_acceptor.h.

◆ setOption()

template<typename ProtocolType, typename CallbackType>
template<typename SettableSocketOption >
void isc::asiolink::IOAcceptor< ProtocolType, CallbackType >::setOption ( const SettableSocketOption &  socket_option)
inline

Sets socket option.

Parameters
socket_optionReference to the object encapsulating an option to be set for the socket.
Template Parameters
SettableSocketOptionType of the object encapsulating socket option being set.

Definition at line 86 of file io_acceptor.h.

Member Data Documentation

◆ acceptor_


The documentation for this class was generated from the following file: