IPC Server Functions

- Main Page
- Related Pages
- Modules
- Data Structures
- Files
- Examples

Functions
IPC Server Functions
Ecore » Ecore_IPC - Ecore inter-process communication functions.

Functions the deal with IPC server objects. More...

## Functions
EAPI Ecore_Ipc_Server * | ecore_ipc_server_add (Ecore_Ipc_Type type, const char *name, int port, const void *data)
| Creates an IPC server that listens for connections.
EAPI Ecore_Ipc_Server * | ecore_ipc_server_connect (Ecore_Ipc_Type type, char *name, int port, const void *data)
| Creates an IPC server object to represent the IPC server listening on the given port.
EAPI void * | ecore_ipc_server_del (Ecore_Ipc_Server *svr)
| Closes the connection and frees the given IPC server.
EAPI void * | ecore_ipc_server_data_get (Ecore_Ipc_Server *svr)
| Retrieves the data associated with the given IPC server.
EAPI Eina_Bool | ecore_ipc_server_connected_get (Ecore_Ipc_Server *svr)
| Retrieves whether the given IPC server is currently connected.
EAPI Eina_List * | ecore_ipc_server_clients_get (Ecore_Ipc_Server *svr)
| Retrieves the list of clients for this server.
EAPI int | ecore_ipc_server_send (Ecore_Ipc_Server *svr, int major, int minor, int ref, int ref_to, int response, const void *data, int size)
| Sends a message to the given IPC server.
EAPI void | ecore_ipc_server_client_limit_set (Ecore_Ipc_Server *svr, int client_limit, char reject_excess_clients)
| Sets a limit on the number of clients that can be handled concurrently by the given server, and a policy on what to do if excess clients try to connect.
EAPI void | ecore_ipc_server_data_size_max_set (Ecore_Ipc_Server *svr, int size)
| Sets the max data payload size for an Ipc message in bytes.
EAPI int | ecore_ipc_server_data_size_max_get (Ecore_Ipc_Server *svr)
| Gets the max data payload size for an Ipc message in bytes.
EAPI const char * | ecore_ipc_server_ip_get (Ecore_Ipc_Server *svr)
| Gets the IP address of a server that has been connected to.
EAPI void | ecore_ipc_server_flush (Ecore_Ipc_Server *svr)
| Flushes all pending data to the given server.

## Detailed Description

Functions the deal with IPC server objects.

## Function Documentation

## ◆ ecore_ipc_server_add()

EAPI Ecore_Ipc_Server * ecore_ipc_server_add | ( | Ecore_Ipc_Type | type,
|  | const char * | name,
|  | int | port,
|  | const void * | data
| ) |  |

Creates an IPC server that listens for connections.

For more details about the `type`, `name` and `port` parameters, see the ecore_con_server_add documentation.

Parameters

  type | The connection type.
  name | Name to associate with the socket used for connection.
  port | Number to identify with socket used for connection.
  data | Data to associate with the IPC server.

Returns
  New IPC server. If there is an error, `NULL` is returned.

References ecore_con_local_path_new(), eina_error_msg_get(), EINA_FALSE, eina_list_append(), EINA_SAFETY_ON_NULL_GOTO, EINA_SAFETY_ON_NULL_RETURN_VAL, and EINA_TRUE.

## ◆ ecore_ipc_server_connect()

EAPI Ecore_Ipc_Server * ecore_ipc_server_connect | ( | Ecore_Ipc_Type | type,
|  | char * | name,
|  | int | port,
|  | const void * | data
| ) |  |

Creates an IPC server object to represent the IPC server listening on the given port.

For more details about the `type`, `name` and `port` parameters, see the ecore_con_server_connect documentation.

Parameters

  type | The IPC connection type.
  name | Name used to determine which socket to use for the IPC connection.
  port | Number used to identify the socket to use for the IPC connection.
  data | Data to associate with the server.

Returns
  A new IPC server. `NULL` is returned on error.

References ecore_con_local_path_new(), eina_error_msg_get(), EINA_FALSE, eina_list_append(), EINA_SAFETY_ON_NULL_GOTO, EINA_SAFETY_ON_NULL_RETURN_VAL, and EINA_TRUE.

## ◆ ecore_ipc_server_del()

EAPI void * ecore_ipc_server_del | ( | Ecore_Ipc_Server * | svr | ) |

Closes the connection and frees the given IPC server.

Parameters

  svr | The given IPC server.

Returns
  The data associated with the server when it was created.

References ecore_ipc_client_del(), eina_list_free(), EINA_LIST_FREE, and eina_list_remove().

Referenced by ecore_ipc_shutdown(), and efreet_cache_disable().

## ◆ ecore_ipc_server_data_get()

EAPI void * ecore_ipc_server_data_get | ( | Ecore_Ipc_Server * | svr | ) |

Retrieves the data associated with the given IPC server.

Parameters

  svr | The given IPC server.

Returns
  The associated data.

## ◆ ecore_ipc_server_connected_get()

EAPI Eina_Bool ecore_ipc_server_connected_get | ( | Ecore_Ipc_Server * | svr | ) |

Retrieves whether the given IPC server is currently connected.

Parameters

  svr | The given IPC server.

Returns
  `EINA_TRUE` if the server is connected, `EINA_FALSE` otherwise.

References EINA_FALSE, and EINA_TRUE.

## ◆ ecore_ipc_server_clients_get()

EAPI Eina_List * ecore_ipc_server_clients_get | ( | Ecore_Ipc_Server * | svr | ) |

Retrieves the list of clients for this server.

Parameters

  svr | The given IPC server.

Returns
  An Eina_List with the clients.

## ◆ ecore_ipc_server_send()

EAPI int ecore_ipc_server_send | ( | Ecore_Ipc_Server * | svr,
|  | int | major,
|  | int | minor,
|  | int | ref,
|  | int | ref_to,
|  | int | response,
|  | const void * | data,
|  | int | size
| ) |  |

Sends a message to the given IPC server.

The content of the parameters, excluding the `svr` parameter, is up to the client.

Parameters

  svr | The given IPC server.
  major | Major opcode of the message.
  minor | Minor opcode of the message.
  ref | Message reference number.
  ref_to | Reference number of the message this message refers to.
  response | Requires response.
  data | The data to send as part of the message.
  size | Length of the data, in bytes, to send.

Returns
  Number of bytes sent. `0` is returned if there is an error.

References eina_error_msg_get(), _Eina_Slice::len, and _Eina_Slice::mem.

## ◆ ecore_ipc_server_client_limit_set()

EAPI void ecore_ipc_server_client_limit_set | ( | Ecore_Ipc_Server * | svr,
|  | int | client_limit,
|  | char | reject_excess_clients
| ) |  |

Sets a limit on the number of clients that can be handled concurrently by the given server, and a policy on what to do if excess clients try to connect.

Beware that if you set this once ecore is already running, you may already have pending CLIENT_ADD events in your event queue. Those clients have already connected and will not be affected by this call. Only clients subsequently trying to connect will be affected.

Parameters

  svr | The given server.
  client_limit | The maximum number of clients to handle concurrently. -1 means unlimited (default). 0 effectively disables the server.
  reject_excess_clients | Set to 1 to automatically disconnect excess clients as soon as they connect if you are already handling client_limit clients. Set to 0 (default) to just hold off on the "accept()" system call until the number of active clients drops. This causes the kernel to queue up to 4096 connections (or your kernel's limit, whichever is lower).

## ◆ ecore_ipc_server_data_size_max_set()

EAPI void ecore_ipc_server_data_size_max_set | ( | Ecore_Ipc_Server * | svr,
|  | int | size
| ) |  |

Sets the max data payload size for an Ipc message in bytes.

Parameters

  svr | The given server.
  size | The maximum data payload size in bytes.

## ◆ ecore_ipc_server_data_size_max_get()

EAPI int ecore_ipc_server_data_size_max_get | ( | Ecore_Ipc_Server * | svr | ) |

Gets the max data payload size for an Ipc message in bytes.

Parameters

  svr | The given server.

Returns
  The maximum data payload in bytes.

## ◆ ecore_ipc_server_ip_get()

EAPI const char * ecore_ipc_server_ip_get | ( | Ecore_Ipc_Server * | svr | ) |

Gets the IP address of a server that has been connected to.

Parameters

  svr | The given server.

Returns
  A pointer to an internal string that contains the IP address of the connected server in the form "XXX.YYY.ZZZ.AAA" IP notation. This string should not be modified or trusted to stay valid after deletion for the `svr` object. If no IP is known NULL is returned.

## ◆ ecore_ipc_server_flush()

EAPI void ecore_ipc_server_flush | ( | Ecore_Ipc_Server * | svr | ) |

Flushes all pending data to the given server.

Will return when done.

Parameters

  svr | The given server.

References ecore_main_loop_iterate(), and EINA_TRUE.