Ecore_IPC - Ecore inter-process communication functions.

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

Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
Ecore_IPC - Ecore inter-process communication functions.
Ecore

## Data Structures
struct | _Ecore_Ipc_Event_Client_Add
| An IPC structure for client_add event. More...
struct | _Ecore_Ipc_Event_Client_Del
| An IPC structure for client_del event. More...
struct | _Ecore_Ipc_Event_Server_Add
| An IPC structure for server_add event. More...
struct | _Ecore_Ipc_Event_Server_Del
| An IPC structure for server_del event. More...
struct | _Ecore_Ipc_Event_Client_Data
| An IPC structure for client_data event. More...
struct | _Ecore_Ipc_Event_Server_Data
| An IPC structure for server_data event. More...

## Macros
#define | ECORE_IPC_SWAP2NET64(x) (x)
#define | ECORE_IPC_SWAP2CPU64(x) (x)
#define | ECORE_IPC_SWAP2NET32(x) (x)
#define | ECORE_IPC_SWAP2CPU32(x) (x)
#define | ECORE_IPC_SWAP2NET16(x) (x)
#define | ECORE_IPC_SWAP2CPU16(x) (x)
#define | ECORE_IPC_SWAP2NET8(x) (x)
#define | ECORE_IPC_SWAP2CPU8(x) (x)
#define | ECORE_IPC_GET64(v)
#define | ECORE_IPC_GET32(v)
#define | ECORE_IPC_GET16(v)
#define | ECORE_IPC_GET8(v)
#define | ECORE_IPC_PUT64(v)
#define | ECORE_IPC_PUT32(v)
#define | ECORE_IPC_PUT16(v)
#define | ECORE_IPC_PUT8(v)
#define | ECORE_IPC_PAD8() ptr += 1
#define | ECORE_IPC_PAD16() ptr += 2
#define | ECORE_IPC_PAD32() ptr += 4
#define | ECORE_IPC_PAD64() ptr += 8
#define | ECORE_IPC_CNT8() len += 1
#define | ECORE_IPC_CNT16() len += 2
#define | ECORE_IPC_CNT32() len += 4
#define | ECORE_IPC_CNT64() len += 8
#define | ECORE_IPC_CHEKS() if (*((unsigned char *)d + s - 1) != 0) return 0;
#define | ECORE_IPC_GETS(v)
#define | ECORE_IPC_PUTS(v, l)
#define | ECORE_IPC_SLEN(l, v) ((l = strlen(p->v)) + 1)
#define | ECORE_IPC_CNTS(v) len += strlen(p->v) + 1
#define | ECORE_IPC_DEC_STRUCT_PROTO(x) static int x(void *d, int s, void *pp)
#define | ECORE_IPC_ENC_STRUCT_PROTO(x) static void *x(void *pp, int *s)
#define | ECORE_IPC_DEC_EINA_LIST_PROTO(x) static Eina_List *x(void *d, int s)
#define | ECORE_IPC_ENC_EINA_LIST_PROTO(x) static void *x(Eina_List *lp, int *s)
#define | ECORE_IPC_DEC_STRUCT_HEAD_EXACT(typ, x)
#define | ECORE_IPC_DEC_STRUCT_HEAD_MIN(typ, x)
#define | ECORE_IPC_DEC_STRUCT_FOOT() return 1
#define | ECORE_IPC_ENC_STRUCT_HEAD(typ, sz)
#define | ECORE_IPC_ENC_STRUCT_FOOT() return d
#define | ECORE_IPC_DEC_EINA_LIST_HEAD(typ)
#define | ECORE_IPC_DEC_EINA_LIST_FOOT()
#define | ECORE_IPC_ENC_EINA_LIST_HEAD_START(typ)
#define | ECORE_IPC_ENC_EINA_LIST_HEAD_FINISH()
#define | ECORE_IPC_ENC_EINA_LIST_FOOT()
#define | EAPI

## Typedefs
typedef struct _Ecore_Ipc_Server | Ecore_Ipc_Server
| An IPC connection handle.
typedef struct _Ecore_Ipc_Client | Ecore_Ipc_Client
| An IPC connection handle.
typedef enum _Ecore_Ipc_Type | Ecore_Ipc_Type
| Enum containing IPC types.
typedef struct _Ecore_Ipc_Event_Client_Add | Ecore_Ipc_Event_Client_Add
typedef struct _Ecore_Ipc_Event_Client_Del | Ecore_Ipc_Event_Client_Del
typedef struct _Ecore_Ipc_Event_Server_Add | Ecore_Ipc_Event_Server_Add
typedef struct _Ecore_Ipc_Event_Server_Del | Ecore_Ipc_Event_Server_Del
typedef struct _Ecore_Ipc_Event_Client_Data | Ecore_Ipc_Event_Client_Data
typedef struct _Ecore_Ipc_Event_Server_Data | Ecore_Ipc_Event_Server_Data

## Enumerations
enum | _Ecore_Ipc_Type { ECORE_IPC_LOCAL_USER, ECORE_IPC_LOCAL_SYSTEM, ECORE_IPC_REMOTE_SYSTEM, ECORE_IPC_USE_SSL = (1 << 4), ECORE_IPC_NO_PROXY = (1 << 5) }

## Functions
EAPI unsigned short | _ecore_ipc_swap_16 (unsigned short v) EINA_DEPRECATED
EAPI unsigned int | _ecore_ipc_swap_32 (unsigned int v) EINA_DEPRECATED
EAPI unsigned long long | _ecore_ipc_swap_64 (unsigned long long v) EINA_DEPRECATED
EAPI int | ecore_ipc_init (void)
| Initialises the Ecore IPC library. More...
EAPI int | ecore_ipc_shutdown (void)
| Shuts down the Ecore IPC library. More...
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. More...
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. More...
EAPI void * | ecore_ipc_server_del (Ecore_Ipc_Server *svr)
| Closes the connection and frees the given IPC server. More...
EAPI void * | ecore_ipc_server_data_get (Ecore_Ipc_Server *svr)
| Retrieves the data associated with the given IPC server. More...
EAPI Eina_Bool | ecore_ipc_server_connected_get (Ecore_Ipc_Server *svr)
| Retrieves whether the given IPC server is currently connected. More...
EAPI Eina_List * | ecore_ipc_server_clients_get (Ecore_Ipc_Server *svr)
| Retrieves the list of clients for this server. More...
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. More...
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. More...
EAPI void | ecore_ipc_server_data_size_max_set (Ecore_Ipc_Server *srv, int size)
| Sets the max data payload size for an Ipc message in bytes. More...
EAPI int | ecore_ipc_server_data_size_max_get (Ecore_Ipc_Server *srv)
| Gets the max data payload size for an Ipc message in bytes. More...
EAPI const char * | ecore_ipc_server_ip_get (Ecore_Ipc_Server *svr)
| Gets the IP address of a server that has been connected to. More...
EAPI void | ecore_ipc_server_flush (Ecore_Ipc_Server *svr)
| Flushes all pending data to the given server. More...
EAPI int | ecore_ipc_client_send (Ecore_Ipc_Client *cl, int major, int minor, int ref, int ref_to, int response, const void *data, int size)
| Sends a message to the given IPC client. More...
EAPI Ecore_Ipc_Server * | ecore_ipc_client_server_get (Ecore_Ipc_Client *cl)
| Retrieves the IPC server that the given IPC client is connected to. More...
EAPI void * | ecore_ipc_client_del (Ecore_Ipc_Client *cl)
| Closes the connection and frees memory allocated to the given IPC client. More...
EAPI void | ecore_ipc_client_data_set (Ecore_Ipc_Client *cl, const void *data)
| Sets the IPC data associated with the given IPC client to `data`. More...
EAPI void * | ecore_ipc_client_data_get (Ecore_Ipc_Client *cl)
| Retrieves the data that has been associated with the given IPC client. More...
EAPI void | ecore_ipc_client_data_size_max_set (Ecore_Ipc_Client *cl, int size)
| Sets the max data payload size for an Ipc message in bytes. More...
EAPI int | ecore_ipc_client_data_size_max_get (Ecore_Ipc_Client *cl)
| Gets the max data payload size for an Ipc message in bytes. More...
EAPI const char * | ecore_ipc_client_ip_get (Ecore_Ipc_Client *cl)
| Gets the IP address of a client that has been connected to. More...
EAPI void | ecore_ipc_client_flush (Ecore_Ipc_Client *cl)
| Flushes all pending data to the given client. More...
EAPI int | ecore_ipc_ssl_available_get (void)
| Returns if SSL support is available. More...

## Variables
EAPI int | ECORE_IPC_EVENT_CLIENT_ADD
EAPI int | ECORE_IPC_EVENT_CLIENT_DEL
EAPI int | ECORE_IPC_EVENT_SERVER_ADD
EAPI int | ECORE_IPC_EVENT_SERVER_DEL
EAPI int | ECORE_IPC_EVENT_CLIENT_DATA
EAPI int | ECORE_IPC_EVENT_SERVER_DATA

## Detailed Description

## Macro Definition Documentation

#define ECORE_IPC_GET64 | ( |  | v | ) |

Value:
{ \
p->v = ECORE_IPC_SWAP2CPU64(*(long long *)(ptr)); \
ptr += 8; \
}

#define ECORE_IPC_GET32 | ( |  | v | ) |

Value:
{ \
p->v = ECORE_IPC_SWAP2CPU32(*(int *)(ptr)); \
ptr += 4; \
}

#define ECORE_IPC_GET16 | ( |  | v | ) |

Value:
{ \
p->v = ECORE_IPC_SWAP2CPU16(*(short *)(ptr)); \
ptr += 2; \
}

#define ECORE_IPC_GET8 | ( |  | v | ) |

Value:
{ \
p->v = ECORE_IPC_SWAP2CPU8(*(char *)(ptr)); \
ptr += 1; \
}

#define ECORE_IPC_PUT64 | ( |  | v | ) |

Value:
{ \
*(long long *)(ptr) = ECORE_IPC_SWAP2NET64(p->v); \
ptr += 8; \
}

#define ECORE_IPC_PUT32 | ( |  | v | ) |

Value:
{ \
*(int *)(ptr) = ECORE_IPC_SWAP2NET32(p->v); \
ptr += 4; \
}

#define ECORE_IPC_PUT16 | ( |  | v | ) |

Value:
{ \
*(short *)(ptr) = ECORE_IPC_SWAP2NET16(p->v); \
ptr += 2; \
}

#define ECORE_IPC_PUT8 | ( |  | v | ) |

Value:
{ \
*(char *)(ptr) = ECORE_IPC_SWAP2NET8(p->v); \
ptr += 1; \
}

#define ECORE_IPC_GETS | ( |  | v | ) |

Value:
{ \
if (ptr < ((unsigned char *)d + s)) \
{ \
p->v = (char *)ptr; \
ptr += strlen(p->v) + 1; \
} \
}

#define ECORE_IPC_PUTS | ( |  | v,
|  |  | l
| ) |  |

Value:
{ \
strcpy((char *)ptr, p->v); \
ptr += l + 1; \
}

#define ECORE_IPC_DEC_STRUCT_HEAD_EXACT | ( |  | typ,
|  |  | x
| ) |  |

Value:
typ *p; \
unsigned char *ptr; \
p = (typ *)pp; \
if (!d) return 0; if (s != (x)) return 0; \
ptr = d;

#define ECORE_IPC_DEC_STRUCT_HEAD_MIN | ( |  | typ,
|  |  | x
| ) |  |

Value:
typ *p; \
unsigned char *ptr; \
p = (typ *)pp; \
if (!d) return 0; if (s < (x)) return 0; \
ptr = d;

#define ECORE_IPC_ENC_STRUCT_HEAD | ( |  | typ,
|  |  | sz
| ) |  |

Value:
typ *p; \
unsigned char *d, *ptr; \
int len; \
*s = 0; \
if(!pp) return NULL; \
p = (typ *)pp; \
len = sz; \
d = malloc(len); \
if (!d) return NULL; \
*s = len; \
ptr = d;

#define ECORE_IPC_DEC_EINA_LIST_HEAD | ( |  | typ | ) |

Value:
unsigned char *ptr; \
Eina_List *l; \
typ *p; \
l = NULL; \
ptr = d; \
while(ptr < (unsigned char *)(d + s)) \
{ \
p = malloc(sizeof(typ));
Eina_List
struct _Eina_List Eina_List
Type for a generic double linked list.
Definition: eina_list.h:307

#define ECORE_IPC_DEC_EINA_LIST_FOOT | ( |  | ) |

Value:
l = eina_list_append(l, p); \
} \
return l
eina_list_append
Eina_List * eina_list_append(Eina_List *list, const void *data)
Append the given data to the given linked list.
Definition: eina_list.c:547

#define ECORE_IPC_ENC_EINA_LIST_HEAD_START | ( |  | typ | ) |

Value:
Eina_List *l; \
typ *p; \
unsigned char *d, *ptr; \
int len; \
*s = 0; \
len = 0; \
for (l = lp; l; l = l->next) \
{ \
p = l->data;
_Eina_List::next
Eina_List * next
Next member in the list.
Definition: eina_list.h:323
_Eina_List
Type for a generic double linked list.
Definition: eina_list.h:320
_Eina_List::data
void * data
Pointer to list element payload.
Definition: eina_list.h:322

#define ECORE_IPC_ENC_EINA_LIST_HEAD_FINISH | ( |  | ) |

Value:
} \
d = malloc(len); \
if(!d) return NULL; \
*s = len; \
ptr = d; \
for (l = lp; l; l = l->next) \
{ \
p = l->data;

#define ECORE_IPC_ENC_EINA_LIST_FOOT | ( |  | ) |

Value:
} \
return d

## Function Documentation

EAPI int ecore_ipc_init | ( | void |  | ) |

Initialises the Ecore IPC library.

Returns
  Number of times the library has been initialised without being shut down.

References ECORE_CON_EVENT_CLIENT_ADD, ECORE_CON_EVENT_CLIENT_DATA, ECORE_CON_EVENT_CLIENT_DEL, ECORE_CON_EVENT_SERVER_ADD, ECORE_CON_EVENT_SERVER_DATA, ECORE_CON_EVENT_SERVER_DEL, ecore_con_init(), ecore_event_handler_add(), ecore_event_type_new(), eina_log_domain_register(), and EINA_LOG_ERR.

EAPI int ecore_ipc_shutdown | ( | void |  | ) |

Shuts down the Ecore IPC library.

Returns
  Number of times the library has been initialised without being shut down.

References ecore_con_shutdown(), ecore_event_handler_del(), ecore_ipc_server_del(), EINA_LIST_FOREACH_SAFE, and eina_log_domain_unregister().

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

Creates an IPC server that listens for connections.

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

Parameters

  compl_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_SYSTEM, ECORE_CON_LOCAL_USER, ecore_con_server_add(), and eina_list_append().

EAPI Ecore_Ipc_Server* ecore_ipc_server_connect | ( | Ecore_Ipc_Type | compl_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 `compl_type`, `name` and `port` parameters, see the ecore_con_server_connect documentation.

Parameters

  compl_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_SYSTEM, ECORE_CON_LOCAL_USER, ECORE_CON_NO_PROXY, ecore_con_server_connect(), and eina_list_append().

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_con_server_del(), ecore_ipc_client_del(), EINA_LIST_FREE, and eina_list_remove().

Referenced by ecore_ipc_shutdown().

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.

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 ecore_con_server_connected_get(), and EINA_FALSE.

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.

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 ecore_con_server_send().

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).

References ecore_con_server_client_limit_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.

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.

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.

References ecore_con_server_ip_get().

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_con_server_flush().

EAPI int ecore_ipc_client_send | ( | Ecore_Ipc_Client * | cl,
|  | int | major,
|  | int | minor,
|  | int | ref,
|  | int | ref_to,
|  | int | response,
|  | const void * | data,
|  | int | size
| ) |  |

Sends a message to the given IPC client.

Parameters

  cl | The given IPC client.
  major | Major opcode of the message.
  minor | Minor opcode of the message.
  ref | Reference number of the message.
  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
  The number of bytes sent. `0` will be returned if there is an error.

References ecore_con_client_connected_get(), and ecore_con_client_send().

EAPI Ecore_Ipc_Server* ecore_ipc_client_server_get | ( | Ecore_Ipc_Client * | cl | ) |

Retrieves the IPC server that the given IPC client is connected to.

Parameters

  cl | The given IPC client.

Returns
  The IPC server the IPC client is connected to.

EAPI void* ecore_ipc_client_del | ( | Ecore_Ipc_Client * | cl | ) |

Closes the connection and frees memory allocated to the given IPC client.

Parameters

  cl | The given client.

Returns
  Data associated with the client.

References ecore_con_client_del(), and eina_list_remove().

Referenced by ecore_ipc_server_del().

EAPI void ecore_ipc_client_data_set | ( | Ecore_Ipc_Client * | cl,
|  | const void * | data
| ) |  |

Sets the IPC data associated with the given IPC client to `data`.

Parameters

  cl | The given IPC client.
  data | The data to associate with the IPC client.

EAPI void* ecore_ipc_client_data_get | ( | Ecore_Ipc_Client * | cl | ) |

Retrieves the data that has been associated with the given IPC client.

Parameters

  cl | The given client.

Returns
  The data associated with the IPC client.

EAPI void ecore_ipc_client_data_size_max_set | ( | Ecore_Ipc_Client * | cl,
|  | int | size
| ) |  |

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

Parameters

  cl | The given client.
  size | The maximum data payload size in bytes.

EAPI int ecore_ipc_client_data_size_max_get | ( | Ecore_Ipc_Client * | cl | ) |

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

Parameters

  cl | The given client.

Returns
  The maximum data payload size in bytes on success, `-1` on failure.

EAPI const char* ecore_ipc_client_ip_get | ( | Ecore_Ipc_Client * | cl | ) |

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

Parameters

  cl | The given client.

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 `cl` object. If no IP is known `NULL` is returned.

References ecore_con_client_ip_get().

EAPI void ecore_ipc_client_flush | ( | Ecore_Ipc_Client * | cl | ) |

Flushes all pending data to the given client.

Will return when done.

Parameters

  cl | The given client.

References ecore_con_client_flush().

EAPI int ecore_ipc_ssl_available_get | ( | void |  | ) |

Returns if SSL support is available.

Returns
  1 if SSL is available, 0 if it is not.

References ecore_con_ssl_available_get().