SocketCommunication

## Classes

class | scim::SocketError
| An exception class to hold Socket related errors. More...
class | scim::SocketAddress
| The class to hold a socket address. More...
class | scim::Socket
| Socket communication class. More...
class | scim::SocketServer
| Socket Server class. More...
class | scim::SocketClient
| Socket client class. More...
class | scim::TransactionError
| An exception class to hold Transaction related errors. More...
class | scim::Transaction
| This class is used to pack up many data and commands into one package and send them via socket. More...
class | scim::TransactionReader
| This class is used to read data from a transaction without changing it. More...

## Typedefs

typedef Slot2< void, SocketServer *, const Socket & > | scim::SocketServerSlotSocket
typedef Signal2< void, SocketServer *, const Socket & > | scim::SocketServerSignalSocket

## Enumerations

enum | scim::SocketFamily { scim::SCIM_SOCKET_UNKNOWN , scim::SCIM_SOCKET_LOCAL , scim::SCIM_SOCKET_INET }
| The vaild socket address/protocol family,. More...

enum

scim::TransactionDataType {
scim::SCIM_TRANS_DATA_UNKNOWN , scim::SCIM_TRANS_DATA_COMMAND , scim::SCIM_TRANS_DATA_RAW , scim::SCIM_TRANS_DATA_UINT32 ,
scim::SCIM_TRANS_DATA_STRING , scim::SCIM_TRANS_DATA_WSTRING , scim::SCIM_TRANS_DATA_KEYEVENT , scim::SCIM_TRANS_DATA_ATTRIBUTE_LIST ,
scim::SCIM_TRANS_DATA_LOOKUP_TABLE , scim::SCIM_TRANS_DATA_PROPERTY , scim::SCIM_TRANS_DATA_PROPERTY_LIST , scim::SCIM_TRANS_DATA_VECTOR_UINT32 ,
scim::SCIM_TRANS_DATA_VECTOR_STRING , scim::SCIM_TRANS_DATA_VECTOR_WSTRING , scim::SCIM_TRANS_DATA_TRANSACTION
}

| Signature of all valid data types which can be store into transaction. More...

## Functions

String | scim::scim_get_default_socket_frontend_address ()
| Get the default socket address of SocketFrontEnd.
String | scim::scim_get_default_socket_imengine_address ()
| Get the default socket address of SocketIMEngine.
String | scim::scim_get_default_socket_config_address ()
| Get the default socket address of SocketConfig.
String | scim::scim_get_default_panel_socket_address (const String &display)
| Get the default socket address of the Panel running on localhost.
String | scim::scim_get_default_helper_manager_socket_address ()
| Get the default socket address of Helper Manager Server running on localhost.
int | scim::scim_get_default_socket_timeout ()
| Get the default socket timeout value.
bool | scim::scim_socket_open_connection (uint32 &key, const String &client_type, const String &server_type, const Socket &socket, int timeout=-1)
| Helper function to open a connection to a socket server with a standard hand shake protocol.
String | scim::scim_socket_accept_connection (uint32 &key, const String &server_types, const String &client_types, const Socket &socket, int timeout=-1)
| Helper function to accept a connection request from a socket client with a standard hand shake protocol.

## Detailed Description

## Typedef Documentation

## SocketServerSlotSocket

typedef Slot2<void, SocketServer *, const Socket &> scim::SocketServerSlotSocket

## SocketServerSignalSocket

typedef Signal2<void, SocketServer *, const Socket &> scim::SocketServerSignalSocket

## Enumeration Type Documentation

## SocketFamily

enum scim::SocketFamily

The vaild socket address/protocol family,.

Corresponding to libc PF_LOCAL/AF_LOCAL and PF_INET/AF_INET

Enumerator
SCIM_SOCKET_UNKNOWN | Unknown or invalid socket address/protocol
SCIM_SOCKET_LOCAL | Unix local socket address/protocol
SCIM_SOCKET_INET | Internet (ipv4) socket address/protocol

## TransactionDataType

enum scim::TransactionDataType

Signature of all valid data types which can be store into transaction.

Enumerator
SCIM_TRANS_DATA_UNKNOWN | Unknown transaction data type.
SCIM_TRANS_DATA_COMMAND | Send/Receive command.
SCIM_TRANS_DATA_RAW | Send/Receive raw buffer.
SCIM_TRANS_DATA_UINT32 | Send/Receive uint32.
SCIM_TRANS_DATA_STRING | Send/Receive String.
SCIM_TRANS_DATA_WSTRING | Send/Receive WideString.
SCIM_TRANS_DATA_KEYEVENT | Send/Receive KeyEvent.
SCIM_TRANS_DATA_ATTRIBUTE_LIST | Send/Receive AttributeList.
SCIM_TRANS_DATA_LOOKUP_TABLE | Send/Receive LookupTable.
SCIM_TRANS_DATA_PROPERTY | Send/Receive Property.
SCIM_TRANS_DATA_PROPERTY_LIST | Send/Receive PropertyList.
SCIM_TRANS_DATA_VECTOR_UINT32 | Send/Receive vector<uint32>.
SCIM_TRANS_DATA_VECTOR_STRING | Send/Receive vector<String>.
SCIM_TRANS_DATA_VECTOR_WSTRING | Send/Receive vector<WideString>.
SCIM_TRANS_DATA_TRANSACTION | Send/Receive another Transaction.

## Function Documentation

## scim_get_default_socket_frontend_address()

String scim::scim_get_default_socket_frontend_address | ( |  | ) |

Get the default socket address of SocketFrontEnd.

SocketFrontEnd should listen on this address by default.

## scim_get_default_socket_imengine_address()

String scim::scim_get_default_socket_imengine_address | ( |  | ) |

Get the default socket address of SocketIMEngine.

SocketIMEngine should connect to this address by default.

## scim_get_default_socket_config_address()

String scim::scim_get_default_socket_config_address | ( |  | ) |

Get the default socket address of SocketConfig.

SocketConfig should connect to this address by default.

## scim_get_default_panel_socket_address()

String scim::scim_get_default_panel_socket_address | ( | const String & | display | ) |

Get the default socket address of the Panel running on localhost.

The panel running on local host should listen on this address by default. All FrontEnds which need panel should connect to this address by default.

## scim_get_default_helper_manager_socket_address()

String scim::scim_get_default_helper_manager_socket_address | ( |  | ) |

Get the default socket address of Helper Manager Server running on localhost.

## scim_get_default_socket_timeout()

int scim::scim_get_default_socket_timeout | ( |  | ) |

Get the default socket timeout value.

All socket connection should use this timeout value.

## scim_socket_open_connection()

bool scim::scim_socket_open_connection | ( | uint32 & | key,
|  | const String & | client_type,
|  | const String & | server_type,
|  | const Socket & | socket,
|  | int | timeout = -1 )

Helper function to open a connection to a socket server with a standard hand shake protocol.

This function is used by a socket client to establish a connection between a socket server with a standard hand shake protocol.

The communication between Panel and FrontEnd, SocketFrontEnd and SocketIMEngine, SocketFrontEnd and SocketConfig all uses this hand shake protocol.

Parameters

  key | A random magic key sent from the socket server to identify this client in later communications.
  client_type | The type of this socket client, for example: "FrontEnd", "GUI", "SocketIMEngine", "SocketConfig" etc. If the type is "ConnectionTester" then this call just test if the connection can be established. The client should close this socket just after the call.
  server_type | The request socket server type, for example: "Panel", "SocketFrontEnd" etc.
  socket | The reference to the client socket which has been connected to the socket server.
  timeout | The socket read timeout in millisecond, -1 means unlimited.

Returns
  true if the connection was established successfully, otherwise return false, and the client should close the socket.

## scim_socket_accept_connection()

String scim::scim_socket_accept_connection | ( | uint32 & | key,
|  | const String & | server_types,
|  | const String & | client_types,
|  | const Socket & | socket,
|  | int | timeout = -1 )

Helper function to accept a connection request from a socket client with a standard hand shake protocol.

This function is used by a socket server to accept a connection request from a socket client which is calling scim_socket_open_connection ().

If a client with type "ConnectionTester" connected to this socket server, then this function will return an empty string, but tell the client the connection was established successfully.

Parameters

  key | A random magic key to identify the socket client in later communications.
  server_types | The type of this server, for example: "SocketFrontEnd", "Panel" etc. One server can have multiple types, separated by comma.
  client_types | A list of acceptable client types, separated by comma. The client type maybe: "FrontEnd", "GUI", "SocketIMEngine" etc.
  socket | The socket connected to the client.
  timeout | the socket read timeout in millisecond, -1 means unlimited.

Returns
  The type of the accepted socket client, or an empty string if the connection could not be established.