Kea 2.7.5
|
Class that acts as a UnixCommandSocket client. More...
#include <unix_control_client.h>
Public Member Functions | |
UnixControlClient () | |
Default constructor. | |
~UnixControlClient () | |
Destructor. | |
bool | connectToServer (const std::string &socket_path) |
Connects to a Unix socket at the given path. | |
void | disconnectFromServer () |
Closes the Control Channel socket. | |
bool | getResponse (std::string &response, const unsigned int timeout_sec=0) |
Reads the response text from the open Control Channel. | |
int | selectCheck (const unsigned int timeout_sec) |
Uses select to poll the Control Channel for data waiting. | |
bool | sendCommand (const std::string &command) |
Sends the given command across the open Control Channel. | |
Public Attributes | |
int | socket_fd_ |
Retains the fd of the open socket. | |
Class that acts as a UnixCommandSocket client.
This class is expected to be used unit-tests that attempt to communicate with the servers that use control channel (see src/lib/config/command_mgr.h) It can connect to an open UnixCommandSocket and exchange ControlChannel commands and responses.
Definition at line 22 of file unix_control_client.h.
isc::dhcp::test::UnixControlClient::UnixControlClient | ( | ) |
isc::dhcp::test::UnixControlClient::~UnixControlClient | ( | ) |
Destructor.
Definition at line 25 of file unix_control_client.cc.
References disconnectFromServer().
bool isc::dhcp::test::UnixControlClient::connectToServer | ( | const std::string & | socket_path | ) |
Connects to a Unix socket at the given path.
socket_path | pathname of the socket to open |
Definition at line 37 of file unix_control_client.cc.
References disconnectFromServer(), and socket_fd_.
void isc::dhcp::test::UnixControlClient::disconnectFromServer | ( | ) |
Closes the Control Channel socket.
Definition at line 30 of file unix_control_client.cc.
References socket_fd_.
Referenced by ~UnixControlClient(), and connectToServer().
bool isc::dhcp::test::UnixControlClient::getResponse | ( | std::string & | response, |
const unsigned int | timeout_sec = 0 ) |
Reads the response text from the open Control Channel.
response | variable into which the received response should be placed. |
timeout_sec | Timeout for receiving response in seconds. |
Definition at line 93 of file unix_control_client.cc.
References selectCheck(), and socket_fd_.
int isc::dhcp::test::UnixControlClient::selectCheck | ( | const unsigned int | timeout_sec | ) |
Uses select to poll the Control Channel for data waiting.
timeout_sec | Select timeout in seconds |
Definition at line 124 of file unix_control_client.cc.
References socket_fd_.
Referenced by getResponse().
bool isc::dhcp::test::UnixControlClient::sendCommand | ( | const std::string & | command | ) |
Sends the given command across the open Control Channel.
command | the command text to execute in JSON form |
Definition at line 75 of file unix_control_client.cc.
References socket_fd_.
int isc::dhcp::test::UnixControlClient::socket_fd_ |
Retains the fd of the open socket.
Definition at line 59 of file unix_control_client.h.
Referenced by UnixControlClient(), connectToServer(), disconnectFromServer(), getResponse(), selectCheck(), and sendCommand().