Kea 2.7.4
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 (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.
 

Protected Member Functions

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

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

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 ( const IOServicePtr & 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.

References isc::asiolink::IOAcceptor< ProtocolType, CallbackType >::acceptor_.

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.

References isc::asiolink::IOAcceptor< ProtocolType, CallbackType >::acceptor_.

◆ 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.

References isc::asiolink::IOAcceptor< ProtocolType, CallbackType >::acceptor_.

◆ 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.

References isc::asiolink::IOAcceptor< ProtocolType, CallbackType >::acceptor_.

◆ 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.

References isc::asiolink::IOAcceptor< ProtocolType, CallbackType >::acceptor_.

◆ 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.

References isc::asiolink::IOAcceptor< ProtocolType, CallbackType >::acceptor_.

◆ 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.

References isc::asiolink::IOAcceptor< ProtocolType, CallbackType >::acceptor_.

◆ 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.

References isc::asiolink::IOAcceptor< ProtocolType, CallbackType >::acceptor_.

Member Data Documentation

◆ acceptor_

◆ io_service_

template<typename ProtocolType , typename CallbackType >
IOServicePtr isc::asiolink::IOAcceptor< ProtocolType, CallbackType >::io_service_
protected

The IO service used to handle events.

Definition at line 127 of file io_acceptor.h.


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