Transaction command types used by Socket Frontend/IMEngine/Config, Helper and Panel.
More...
Detailed Description
Transaction command types used by Socket Frontend/IMEngine/Config, Helper and Panel.
This commands are used in communication protocols of SocketFrontEnd, SocketIMEngine, SocketConfig, Helper and Panel.
There are mainly four major protocols used in the communications among each part of SCIM:
- between SocketFrontEnd and SocketIMEngine (SocketFrontEnd is server)
- between SocketFrontEnd and SocketConfig (SocketFrontEnd is server)
- between Panel and FrontEnds (eg. X11 FrontEnd, Gtk IMModule and QT IMModule. Panel is server)
- between Panel and Helper (Panel is server).
As soon as the socket to the server is established, the client must call function scim_socket_open_connection() to create the connection and get the magic key for later communication.
At the same time, the server must call function scim_socket_accept_connection() to accept the connection and get the same magic key for later client verification.
The valid types of servers are:
- "SocketFrontEnd"
The socket FrontEnd server provides remote IMEngine and Config services. It accepts "SocketIMEngine" and "SocketConfig" clients.
- "Panel"
The Panel server provides GUI and Helper management services. It accepts "FrontEnd" and "Helper" clients.
The valid types of clients are:
- "SocketIMEngine"
The socket IMEngine client acts as a proxy IMEngine forwarding all requests to SocketFrontEnd. It can only connect to "SocketFrontEnd" server.
- "SocketConfig"
The socket Config client acts as a proxy Config forwarding all request to SocketFrontEnd. It can only connect to "SocketFrontEnd" server.
- "FrontEnd"
If a FrontEnd needs a Panel GUI services, it'll be a "FrontEnd" client of the Panel. It can only connect to "Panel" server.
- "Helper"
All Helper objects should be "Helper" clients of a Panel. It can only connect to "Panel" server.
Then the client and the server can communicate with each other via the socket by sending transactions.
Multiple commands and their data may be put into one transaction with a restricted order. The data of a command must be put into the transaction just follow the command itself.
A transaction sent from a socket client to a socket server (eg. SocketIMEngine to SocketFrontEnd) must be started with a SCIM_TRANS_CMD_REQUEST command followed by an uint32 magic key of the client (returned by scim_socket_open_connection() function.
A transaction sent back to a socket client from a socket server must be started with a SCIM_TRANS_CMD_REPLY command.
So for example, the layout of a transaction sent from SocketIMEngine to SocketFrontEnd may look like:
- #SCIM_TRANS_CMD_REQUEST
- an uint32 data (the magic key of a client)
- #SCIM_TRANS_CMD_PROCESS_KEY_EVENT
- an uint32 data (the id of the IMEngineInstance object used to process the KeyEvent)
- a scim::KeyEvent data (the KeyEvent to be processed)
Some commands may be used in more than one protocols for similar purpose, but they may have different data in different protocol.
Brief introduction of communication protocols used in SCIM:
Please refer to the descriptions of each Transaction commands for details.
- Protocol used between SocketIMEngine and SocketFrontEnd
In this protocol, SocketFrontEnd is socket server, SocketIMEngine is client.
- from SocketIMEngine to SocketFrontEnd:
The Transaction sent from SocketIMEngine to SocketFrontEnd must start with #SCIM_TRANS_CMD_REQUEST and followed by an uint32 magic key which was returned by scim_socket_open_connection() and scim_socket_accept_connection().
Before parsing the Transaction, SocketFrontEnd must verify if the magic key is matched. If the magic key is not matched, then SocketFrontEnd should just discard this transaction.
There can be one or more commands and corresponding data right after the magic key.
The valid commands which can be used here are:
- #SCIM_TRANS_CMD_NEW_INSTANCE
- #SCIM_TRANS_CMD_DELETE_INSTANCE
- #SCIM_TRANS_CMD_DELETE_ALL_INSTANCES
- #SCIM_TRANS_CMD_GET_FACTORY_LIST
- #SCIM_TRANS_CMD_GET_FACTORY_NAME
- #SCIM_TRANS_CMD_GET_FACTORY_AUTHORS
- #SCIM_TRANS_CMD_GET_FACTORY_CREDITS
- #SCIM_TRANS_CMD_GET_FACTORY_HELP
- #SCIM_TRANS_CMD_GET_FACTORY_LOCALES
- #SCIM_TRANS_CMD_GET_FACTORY_ICON_FILE
- #SCIM_TRANS_CMD_GET_FACTORY_LANGUAGE
- #SCIM_TRANS_CMD_PROCESS_KEY_EVENT
- #SCIM_TRANS_CMD_MOVE_PREEDIT_CARET
- #SCIM_TRANS_CMD_SELECT_CANDIDATE
- #SCIM_TRANS_CMD_UPDATE_LOOKUP_TABLE_PAGE_SIZE
- #SCIM_TRANS_CMD_LOOKUP_TABLE_PAGE_UP
- #SCIM_TRANS_CMD_LOOKUP_TABLE_PAGE_DOWN
- #SCIM_TRANS_CMD_RESET
- #SCIM_TRANS_CMD_FOCUS_IN
- #SCIM_TRANS_CMD_FOCUS_OUT
- #SCIM_TRANS_CMD_TRIGGER_PROPERTY
- #SCIM_TRANS_CMD_PROCESS_HELPER_EVENT
- #SCIM_TRANS_CMD_UPDATE_CLIENT_CAPABILITIES
- #SCIM_TRANS_CMD_LOAD_FILE
- #SCIM_TRANS_CMD_CLOSE_CONNECTION
- from SocketFrontEnd to SocketIMEngine:
The Transaction sent back from SocketFrontEnd to SocketIMEngine must start with #SCIM_TRANS_CMD_REPLY and end with #SCIM_TRANS_CMD_OK or #SCIM_TRANS_CMD_FAIL to indicate if the request previously sent by SocketIMEngine was executed successfully.
For some requests, like SCIM_TRANS_CMD_GET_FACTORY_LIST, etc. only some result data will be returned between #SCIM_TRANS_CMD_REPLY and #SCIM_TRANS_CMD_OK.
For some requests, like SCIM_TRANS_CMD_PROCESS_KEY_EVENT, etc. one or more following commands and corresponding data may be returned between #SCIM_TRANS_CMD_REPLY and #SCIM_TRANS_CMD_OK commands.
The valid commands can be used here are:
- #SCIM_TRANS_CMD_SHOW_PREEDIT_STRING
- #SCIM_TRANS_CMD_SHOW_AUX_STRING
- #SCIM_TRANS_CMD_SHOW_LOOKUP_TABLE
- #SCIM_TRANS_CMD_HIDE_PREEDIT_STRING
- #SCIM_TRANS_CMD_HIDE_AUX_STRING
- #SCIM_TRANS_CMD_HIDE_LOOKUP_TABLE
- #SCIM_TRANS_CMD_UPDATE_PREEDIT_CARET
- #SCIM_TRANS_CMD_UPDATE_PREEDIT_STRING
- #SCIM_TRANS_CMD_UPDATE_AUX_STRING
- #SCIM_TRANS_CMD_UPDATE_LOOKUP_TABLE
- #SCIM_TRANS_CMD_COMMIT_STRING
- #SCIM_TRANS_CMD_FORWARD_KEY_EVENT
- #SCIM_TRANS_CMD_REGISTER_PROPERTIES
- #SCIM_TRANS_CMD_UPDATE_PROPERTY
- #SCIM_TRANS_CMD_BEEP
- #SCIM_TRANS_CMD_START_HELPER
- #SCIM_TRANS_CMD_STOP_HELPER
- #SCIM_TRANS_CMD_SEND_HELPER_EVENT
- Protocol used between SocketConfig and SocketFrontEnd
In this protocol, SocketFrontEnd is socket server, SocketConfig is client.
- from SocketConfig to SocketFrontEnd:
The Transaction sent from SocketConfig to SocketFrontEnd must start with #SCIM_TRANS_CMD_REQUEST and followed by an uint32 magic key which was returned by scim_socket_open_connection() and scim_socket_accept_connection().
Before parsing the Transaction, SocketFrontEnd must verify if the magic key is matched. If the magic key is not matched, then SocketFrontEnd should just discard this transaction.
There can be one or more commands and corresponding data right after the magic key.
The valid commands which can be used here are:
- #SCIM_TRANS_CMD_FLUSH_CONFIG
- #SCIM_TRANS_CMD_ERASE_CONFIG
- #SCIM_TRANS_CMD_GET_CONFIG_STRING
- #SCIM_TRANS_CMD_SET_CONFIG_STRING
- #SCIM_TRANS_CMD_GET_CONFIG_INT
- #SCIM_TRANS_CMD_SET_CONFIG_INT
- #SCIM_TRANS_CMD_GET_CONFIG_BOOL
- #SCIM_TRANS_CMD_SET_CONFIG_BOOL
- #SCIM_TRANS_CMD_GET_CONFIG_DOUBLE
- #SCIM_TRANS_CMD_SET_CONFIG_DOUBLE
- #SCIM_TRANS_CMD_GET_CONFIG_VECTOR_STRING
- #SCIM_TRANS_CMD_SET_CONFIG_VECTOR_STRING
- #SCIM_TRANS_CMD_GET_CONFIG_VECTOR_INT
- #SCIM_TRANS_CMD_SET_CONFIG_VECTOR_INT
- #SCIM_TRANS_CMD_RELOAD_CONFIG
- #SCIM_TRANS_CMD_LOAD_FILE
- #SCIM_TRANS_CMD_CLOSE_CONNECTION
- from SocketFrontEnd to SocketConfig:
The Transaction sent back from SocketFrontEnd to SocketConfig must start with #SCIM_TRANS_CMD_REPLY and end with #SCIM_TRANS_CMD_OK or #SCIM_TRANS_CMD_FAIL to indicate if the request previously sent by SocketConfig was executed successfully.
For some requests, like SCIM_TRANS_CMD_FLUSH_CONFIG, etc. no result data will be returned.
For some requests, like SCIM_TRANS_CMD_GET_CONFIG_STRING, etc. the corresponding data will be returned between #SCIM_TRANS_CMD_REPLY and #SCIM_TRANS_CMD_OK commands.
- Protocol used between FrontEnds and Panel
In this protocol, Panel (eg. scim-panel-gtk or scim-panel-kde) is socket server, FrontEnds are clients.
- from FrontEnds to Panel:
The Transaction sent from FrontEnds to Panel must start with #SCIM_TRANS_CMD_REQUEST and followed by an uint32 magic key which was returned by scim_socket_open_connection() and scim_socket_accept_connection(). Then there must be an uint32 id for current focused input context right after the magic key.
Before parsing the Transaction, Panel must verify if the magic key is matched. If the magic key is not matched, then Panel should just discard this transaction.
There can be one or more commands and corresponding data right after the magic key.
The valid commands which can be used here are:
- #SCIM_TRANS_CMD_UPDATE_SCREEN
- #SCIM_TRANS_CMD_UPDATE_SPOT_LOCATION
- #SCIM_TRANS_CMD_PANEL_TURN_ON
- #SCIM_TRANS_CMD_PANEL_TURN_OFF
- #SCIM_TRANS_CMD_PANEL_UPDATE_FACTORY_INFO
- #SCIM_TRANS_CMD_PANEL_SHOW_HELP
- #SCIM_TRANS_CMD_PANEL_SHOW_FACTORY_MENU
- #SCIM_TRANS_CMD_SHOW_PREEDIT_STRING
- #SCIM_TRANS_CMD_SHOW_AUX_STRING
- #SCIM_TRANS_CMD_SHOW_LOOKUP_TABLE
- #SCIM_TRANS_CMD_HIDE_PREEDIT_STRING
- #SCIM_TRANS_CMD_HIDE_AUX_STRING
- #SCIM_TRANS_CMD_HIDE_LOOKUP_TABLE
- #SCIM_TRANS_CMD_UPDATE_PREEDIT_CARET
- #SCIM_TRANS_CMD_UPDATE_PREEDIT_STRING
- #SCIM_TRANS_CMD_UPDATE_AUX_STRING
- #SCIM_TRANS_CMD_UPDATE_LOOKUP_TABLE
- #SCIM_TRANS_CMD_REGISTER_PROPERTIES
- #SCIM_TRANS_CMD_UPDATE_PROPERTY
- #SCIM_TRANS_CMD_START_HELPER
- #SCIM_TRANS_CMD_STOP_HELPER
- #SCIM_TRANS_CMD_SEND_HELPER_EVENT
- from Panel to FrontEnds:
The Transaction sent from Panel to FrontEnds must start with #SCIM_TRANS_CMD_REPLY. For the following commands except #SCIM_TRANS_CMD_RELOAD_CONFIG and #SCIM_TRANS_CMD_EXIT, there must be an uint32 id of the currently focused input context right after the #SCIM_TRANS_CMD_REPLY command. Then there can be one or more commands and corresponding data following.
The valid commands which can be used here are:
- #SCIM_TRANS_CMD_RELOAD_CONFIG
- #SCIM_TRANS_CMD_EXIT
- #SCIM_TRANS_CMD_UPDATE_LOOKUP_TABLE_PAGE_SIZE
- #SCIM_TRANS_CMD_LOOKUP_TABLE_PAGE_UP
- #SCIM_TRANS_CMD_LOOKUP_TABLE_PAGE_DOWN
- #SCIM_TRANS_CMD_PROCESS_KEY_EVENT
- #SCIM_TRANS_CMD_MOVE_PREEDIT_CARET
- #SCIM_TRANS_CMD_SELECT_CANDIDATE
- #SCIM_TRANS_CMD_TRIGGER_PROPERTY
- #SCIM_TRANS_CMD_PROCESS_HELPER_EVENT
- #SCIM_TRANS_CMD_COMMIT_STRING
- #SCIM_TRANS_CMD_FORWARD_KEY_EVENT
- #SCIM_TRANS_CMD_PANEL_REQUEST_HELP
- #SCIM_TRANS_CMD_PANEL_REQUEST_FACTORY_MENU
- #SCIM_TRANS_CMD_PANEL_CHANGE_FACTORY
- Protocol used between Helper and Panel
In this protocol, Panel (eg. scim-panel-gtk or scim-panel-kde) is socket server, Helper is client.
- from Helper to Panel:
The Transaction sent from Helper to Panel must start with #SCIM_TRANS_CMD_REQUEST and followed by an uint32 magic key which was returned by scim_socket_open_connection() and scim_socket_accept_connection(). Before parsing the Transaction, Panel must verify if the magic key is matched. If the magic key is not matched, then Panel should just discard this transaction.
There can be one or more commands and corresponding data right after the magic key.
The valid commands which can be used here are:
- #SCIM_TRANS_CMD_PANEL_REGISTER_HELPER
- #SCIM_TRANS_CMD_PANEL_SEND_IMENGINE_EVENT
- #SCIM_TRANS_CMD_PANEL_SEND_KEY_EVENT
- #SCIM_TRANS_CMD_REGISTER_PROPERTIES
- #SCIM_TRANS_CMD_UPDATE_PROPERTY
- #SCIM_TRANS_CMD_FORWARD_KEY_EVENT
- #SCIM_TRANS_CMD_COMMIT_STRING
- from Panel to Helper:
The Transaction sent from Panel to Helper must start with #SCIM_TRANS_CMD_REPLY and followed by an uint32 input context id and a scim::String input context UUID. Then there can be one or more commands and corresponding data just after the UUID.
The valid commands which can be used here are:
- #SCIM_TRANS_CMD_EXIT
- #SCIM_TRANS_CMD_UPDATE_SCREEN
- #SCIM_TRANS_CMD_UPDATE_SPOT_LOCATION
- #SCIM_TRANS_CMD_TRIGGER_PROPERTY
- #SCIM_TRANS_CMD_HELPER_PROCESS_IMENGINE_EVENT
Variable Documentation
It's the first command which should be put into the Transaction sending from a socket client to a socket server.
The corresponding data for this command is an uint32 magic key which is returned by scim_socket_open_connection() function.
It's the first command which should be put into the Transaction sending from a socket server to a socket client.
The corresponding data for this command is different in each protocol. Please refer to the previous protocol notes for details.
This command is usually used in the Transaction sending from a socket server to a socket client to indicate that the request previously sent from the client was executed successfully.
There is no data for this command.
This command is usually used in the Transaction sending from a socket server to a socket client to indicate that the request previously sent from the client was failed to be executed.
There is no data for this command.
This command is used internally by scim_socket_open_connection() and scim_socket_accept_connection().
It's sent from a socket client to a socket server to request the server to create the connection.
The corresponding data are:
- (scim::String) a version string (the binary version of SCIM).
- (scim::String) type of the client, eg. "SocketIMEngine", "FrontEnd", "Helper" etc.
If the socket server accept the connection request, it must send back a Transaction with following content:
- #SCIM_TRANS_CMD_REPLY
- (scim::String) a comma separated server types which are supported by the server, eg. "SocketFrontEnd" etc.
- (uint32) a magic key used to validate the communication later.
Then if the client accept the result too, it must send the following content back to the socket server:
- #SCIM_TRANS_CMD_REPLY
- #SCIM_TRANS_CMD_OK
Otherwise, the client must return:
- #SCIM_TRANS_CMD_REPLY
- #SCIM_TRANS_CMD_FAIL
If the socket server do not accept the connection in the first stage, it should discard the request and send nothing back.
It's used to request the socket server to close the connection forcedly.
It's currently not used at all.
Request the socket server to load and send a file to the client.
The corresponding data is:
If the file is loaded successfully, then the server should send back:
- #SCIM_TRANS_CMD_REPLY
- (raw buffer) the buffer which holds the file content.
- #SCIM_TRANS_CMD_OK
Otherwise it should send back:
- #SCIM_TRANS_CMD_REPLY
- #SCIM_TRANS_CMD_FAIL
This command is only supported by SocketFrontEnd.
Request the socket server to save a buffer into a file.
The corresponding data is:
- (scim::String) the full file path to be used to save the buffer.
- (raw buffer) the buffer to be saved.
If the file is saved successfully, then the server should return:
- #SCIM_TRANS_CMD_REPLY
- #SCIM_TRANS_CMD_OK
Otherwise it should return:
- #SCIM_TRANS_CMD_REPLY
- #SCIM_TRANS_CMD_FAIL
This command is currently not supported by any servers.
This command should be sent from a socket server to its clients to let them exit.
No data is associated to this command.
This command is currently only used by Panel server.
This command is used in SocketIMEngine to SocketFrontEnd and Panel to FrontEnd protocols to send a KeyEvent to an IMEngineInstance.
When used in SocketIMEngine to SocketFrontEnd protocol, the corresponding data is:
The Transaction returned from SocketFrontEnd should contain:
- #SCIM_TRANS_CMD_REPLY
- (any valid commands and their corresponding data)
- #SCIM_TRANS_CMD_OK or #SCIM_TRANS_CMD_FAIL to indicate that if the KeyEvent was processed successfully.
When used in Panel to FrontEnds protocol, the corresponding data is: