Kea  1.9.9-git
isc::config::ClientConnectionImpl Class Reference

Implementation of the ClientConnection. More...

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

Public Member Functions

 ClientConnectionImpl (IOService &io_service)
 Constructor. More...
 
void doReceive (ClientConnection::Handler handler)
 Starts asynchronous receive from the server. More...
 
void doSend (const void *buffer, const size_t length, ClientConnection::Handler handler)
 Starts asynchronous send. More...
 
void scheduleTimer (ClientConnection::Handler handler)
 This method schedules timer or reschedules existing timer. More...
 
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. More...
 
void stop ()
 Closes the socket. More...
 
void terminate (const boost::system::error_code &ec, ClientConnection::Handler handler)
 Terminates the connection and invokes a user callback indicating an error. More...
 
void timeoutCallback (ClientConnection::Handler handler)
 Callback invoked when the timeout occurs. More...
 

Detailed Description

Implementation of the ClientConnection.

Definition at line 24 of file client_connection.cc.

Constructor & Destructor Documentation

isc::config::ClientConnectionImpl::ClientConnectionImpl ( IOService io_service)
explicit

Constructor.

Parameters
io_serviceReference to the IO service.

Definition at line 118 of file client_connection.cc.

Member Function Documentation

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.

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.

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::setup(), and timeoutCallback().

Referenced by start().

+ Here is the call graph for this function:

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(), isc::config::ClientConnection::ControlCommand::control_command_, scheduleTimer(), isc::config::ClientConnection::SocketPath::socket_path_, and isc::config::ClientConnection::Timeout::timeout_.

+ Here is the call graph for this function:

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

Closes the socket.

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.

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: