Kea
1.9.9-git
|
Implementation of the ClientConnection. More...
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... | |
Implementation of the ClientConnection.
Definition at line 24 of file client_connection.cc.
|
explicit |
Constructor.
io_service | Reference to the IO service. |
Definition at line 118 of file client_connection.cc.
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.
handler | User 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.
buffer | Pointer to the buffer holding input data. |
length | Length of the data in the input buffer. |
handler | User 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.
handler | Pointer 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().
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.
socket_path | Path to the socket description that the server is bound to. |
command | Control command to be sent to the server. |
handler | Pointer to the user supplied callback function which should be invoked when transaction completes or when an error has occurred during the transaction. |
timeout | Connection 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_.
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.
ec | Error code. |
handler | User 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().