Kea 2.7.5
isc::config::ClientConnectionImpl Class Reference

Implementation of the ClientConnection. More...

+ Inheritance diagram for isc::config::ClientConnectionImpl:

Public Member Functions

 ClientConnectionImpl (const IOServicePtr &io_service)
 Constructor.
 
void doReceive (ClientConnection::Handler handler)
 Starts asynchronous receive from the server.
 
void doSend (const void *buffer, const size_t length, ClientConnection::Handler handler)
 Starts asynchronous send.
 
void scheduleTimer (ClientConnection::Handler handler)
 This method schedules timer or reschedules existing timer.
 
void start (const ClientConnection::SocketPath &socket_path, const ClientConnection::ControlCommand &command, ClientConnection::Handler handler, const ClientConnection::Timeout &timeout)
 Starts asynchronous transaction with a remote endpoint.
 
void stop ()
 Closes the socket.
 
void terminate (const boost::system::error_code &ec, ClientConnection::Handler handler)
 Terminates the connection and invokes a user callback indicating an error.
 
void timeoutCallback (ClientConnection::Handler handler)
 Callback invoked when the timeout occurs.
 

Detailed Description

Implementation of the ClientConnection.

Definition at line 24 of file client_connection.cc.

Constructor & Destructor Documentation

◆ ClientConnectionImpl()

isc::config::ClientConnectionImpl::ClientConnectionImpl ( const IOServicePtr & io_service)
explicit

Constructor.

Parameters
io_serviceReference to the IO service.

Definition at line 118 of file client_connection.cc.

Member Function Documentation

◆ doReceive()

void isc::config::ClientConnectionImpl::doReceive ( ClientConnection::Handler handler)

Starts asynchronous receive from the server.

This method may be called multiple times internally if the response is large. The JSONFeed instance is used to detect the boundaries of the command within the stream. Once the entire command has been received the user callback is invoked and the instance of the JSONFeed is returned.

Parameters
handlerUser supplied callback.

Definition at line 204 of file client_connection.cc.

◆ doSend()

void isc::config::ClientConnectionImpl::doSend ( const void * buffer,
const size_t length,
ClientConnection::Handler handler )

Starts asynchronous send.

This method may be called multiple times internally when the command is large and can't be sent all at once.

Parameters
bufferPointer to the buffer holding input data.
lengthLength of the data in the input buffer.
handlerUser supplied callback invoked after the chunk of data has been sent.

Definition at line 167 of file client_connection.cc.

◆ scheduleTimer()

void isc::config::ClientConnectionImpl::scheduleTimer ( ClientConnection::Handler handler)

This method schedules timer or reschedules existing timer.

Parameters
handlerPointer to the user supplied callback function which should be invoked when transaction completes or when an error has occurred during the transaction.

Definition at line 124 of file client_connection.cc.

References isc::asiolink::IntervalTimer::ONE_SHOT, isc::asiolink::IntervalTimer::setup(), and timeoutCallback().

Referenced by start().

+ Here is the call graph for this function:

◆ start()

void isc::config::ClientConnectionImpl::start ( const ClientConnection::SocketPath & socket_path,
const ClientConnection::ControlCommand & command,
ClientConnection::Handler handler,
const ClientConnection::Timeout & timeout )

Starts asynchronous transaction with a remote endpoint.

See ClientConnection::start documentation for the details.

Parameters
socket_pathPath to the socket description that the server is bound to.
commandControl command to be sent to the server.
handlerPointer to the user supplied callback function which should be invoked when transaction completes or when an error has occurred during the transaction.
timeoutConnection timeout in milliseconds.

Definition at line 133 of file client_connection.cc.

References isc::asiolink::UnixDomainSocket::asyncConnect(), scheduleTimer(), and isc::config::ClientConnection::Timeout::timeout_.

+ Here is the call graph for this function:

◆ stop()

void isc::config::ClientConnectionImpl::stop ( )

Closes the socket.

◆ terminate()

void isc::config::ClientConnectionImpl::terminate ( const boost::system::error_code & ec,
ClientConnection::Handler handler )

Terminates the connection and invokes a user callback indicating an error.

Parameters
ecError code.
handlerUser callback.

Definition at line 248 of file client_connection.cc.

◆ timeoutCallback()

void isc::config::ClientConnectionImpl::timeoutCallback ( ClientConnection::Handler handler)

Callback invoked when the timeout occurs.

It calls terminate with the boost::asio::error::timed_out.

Definition at line 264 of file client_connection.cc.

Referenced by scheduleTimer().


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