A class that implements connection adapter for TCP-IP transport type. More...
#include <connection_adapter_socket_client.hpp>
Public Member Functions | |
ClientSocketConnectionAdapter (int socketType) | |
Constructor. More... | |
virtual bool | configure (const ClientConnectionAdapter::Parameters ¶meters) |
See ConnectionAdapter::configure. More... | |
virtual bool | connect () |
See ConnectionAdapter::connect. More... | |
virtual void | disconnect () |
See ConnectionAdapter::disconnect. More... | |
virtual string | getState (const string ¶meter) |
See ConnectionAdapter::getState. More... | |
virtual void | interrupt () |
See ConnectionAdapter::interrupt. More... | |
virtual int | wait () |
See ConnectionAdapter::wait. More... | |
virtual void | work (int status) |
See ConnectionAdapter::work. More... | |
virtual | ~ClientSocketConnectionAdapter () |
Destructor. More... | |
Public Member Functions inherited from kanzi::connect::ClientConnectionAdapter | |
virtual void | aboutToStop () |
Invoked when the adapter should stop. Called before the object will be destroyed. More... | |
void | addObserver (Observer *observer) |
Adds observer to receive notification from this adapter. More... | |
ClientConnectionAdapter () | |
Constructor. More... | |
virtual shared_ptr< MessageTranslator > | getNetworkTranslator (MessagePackage::SerializationFormat format=MessagePackage::SerializationFormatBinary) |
virtual string | getParameter (const string ¶meter) |
Adapter can expose it's parameters using key-value pairs. More... | |
virtual string | getType () const =0 |
Returns type of the adapter, this needs to be unique for every adapter. More... | |
void | removeObserver (Observer *observer) |
Removes observer from this adapter. More... | |
virtual void | send (const vector< char > &data)=0 |
Sends data to network. More... | |
virtual void | setClient (Client *client) |
Allows to set a pointer to the Client instance for this adapter. More... | |
virtual | ~ClientConnectionAdapter () |
Destructor. More... | |
Static Public Attributes | |
static const string | PARAMETER_HOST_IP |
Configuration parameter for server ip address. More... | |
static const string | PARAMETER_HOST_PORT |
Configuration parameter for server port. More... | |
static const string | STATE_IP |
State parameter to read adapter ip address back. More... | |
static const string | STATE_PORT |
State parameter to read adapter port back. More... | |
Protected Member Functions | |
void | clearTxQueue () |
Clears the transmit queue. More... | |
void | discardFromTxQueue (size_t bytes) |
Discards data (after being sent) from tx queue. More... | |
virtual bool | hasPendingTxSocketData () |
Determine whether the client implementation has pending data to write. More... | |
bool | queueTxData (const vector< char > &data, size_t maxQueueDepth, size_t position=0) |
Tries to queue given buffer to tx queue. More... | |
virtual void | read ()=0 |
Do the reading from socket. More... | |
virtual void | sendPendingTxSocketData () |
Write pending data into the socket. More... | |
Protected Member Functions inherited from kanzi::connect::ClientConnectionAdapter | |
void | notifyConnected () |
Allows derived class to invoke connection notification to all observers. More... | |
void | notifyDisconnected () |
Allows derived class to invoke disconnect notification to all observers. More... | |
void | notifyReceive (const vector< char > &data) |
Allows derived class to invoke data received notification to all observers. More... | |
Protected Attributes | |
recursive_mutex | m_mutex |
int | m_port |
Configured server port. More... | |
string | m_server |
Configured server address. More... | |
::fd_set * | m_set |
Activated sockets during wait. More... | |
int | m_signal [2] |
Socket * | m_socket |
Socket used by this adapter. More... | |
int | m_socketType |
Socket type. More... | |
vector< char > | m_txBuffer |
int | m_workResult |
Result of wait is stored here. More... | |
::fd_set * | m_writeSet |
Additional Inherited Members | |
Public Types inherited from kanzi::connect::ClientConnectionAdapter | |
typedef map< string, string > | Parameters |
Container type for parameters. More... | |
Static Protected Member Functions inherited from kanzi::connect::ClientConnectionAdapter | |
static string | getConfigurationParameterString (const Parameters ¶meters, const string ¶meter) |
Get single single string type configuration parameter. Returns empty string for missing parameter. More... | |
A class that implements connection adapter for TCP-IP transport type.
kanzi::connect::ClientSocketConnectionAdapter::ClientSocketConnectionAdapter | ( | int | socketType | ) |
Constructor.
socketType | Sets the type of the socket to be created (either streaming or datagram). |
|
virtual |
Destructor.
|
protected |
Clears the transmit queue.
|
virtual |
See ConnectionAdapter::configure.
Reimplemented from kanzi::connect::ClientConnectionAdapter.
|
virtual |
See ConnectionAdapter::connect.
Implements kanzi::connect::ClientConnectionAdapter.
|
protected |
Discards data (after being sent) from tx queue.
bytes | amount of data to discard. |
|
virtual |
See ConnectionAdapter::disconnect.
Implements kanzi::connect::ClientConnectionAdapter.
|
virtual |
See ConnectionAdapter::getState.
Implements kanzi::connect::ClientConnectionAdapter.
|
inlineprotectedvirtual |
Determine whether the client implementation has pending data to write.
|
virtual |
See ConnectionAdapter::interrupt.
Implements kanzi::connect::ClientConnectionAdapter.
|
protected |
Tries to queue given buffer to tx queue.
data | the data to queue |
maxQueueDepth | the maximum allowed depth for the queue |
position | from the data vector, at which position to start inserting data to queue. optional. |
|
protectedpure virtual |
Do the reading from socket.
|
inlineprotectedvirtual |
Write pending data into the socket.
|
virtual |
Implements kanzi::connect::ClientConnectionAdapter.
|
virtual |
Implements kanzi::connect::ClientConnectionAdapter.
|
protected |
|
protected |
Configured server port.
|
protected |
Configured server address.
|
protected |
Activated sockets during wait.
|
protected |
|
protected |
Socket used by this adapter.
|
protected |
Socket type.
|
protected |
|
protected |
Result of wait is stored here.
|
protected |
|
static |
Configuration parameter for server ip address.
|
static |
Configuration parameter for server port.
|
static |
State parameter to read adapter ip address back.
|
static |
State parameter to read adapter port back.