Ecore Connection Server Functions

Functions that operate on Ecore server objects. More...

Functions

EAPI Ecore_Con_Serverecore_con_server_add (Ecore_Con_Type compl_type, const char *name, int port, const void *data)
 Creates a server to listen for connections.
EAPI Ecore_Con_Serverecore_con_server_connect (Ecore_Con_Type compl_type, const char *name, int port, const void *data)
 Creates a server object to represent the server listening at the given port.
EAPI void * ecore_con_server_del (Ecore_Con_Server *svr)
 Closes the connection and frees the given server.
EAPI void * ecore_con_server_data_get (Ecore_Con_Server *svr)
 Retrieves the data associated with the given server.
EAPI int ecore_con_server_connected_get (Ecore_Con_Server *svr)
 Retrieves whether the given server is currently connected.
EAPI Eina_List * ecore_con_server_clients_get (Ecore_Con_Server *svr)
 Retrieves the current list of clients.
EAPI int ecore_con_server_send (Ecore_Con_Server *svr, const void *data, int size)
 Sends the given data to the given server.
EAPI void ecore_con_server_client_limit_set (Ecore_Con_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 char * ecore_con_server_ip_get (Ecore_Con_Server *svr)
 Gets the IP address of a server that has been connected to.
EAPI void ecore_con_server_flush (Ecore_Con_Server *svr)
 Flushes all pending data to the given server.

Detailed Description

Functions that operate on Ecore server objects.


Function Documentation

EAPI Ecore_Con_Server* ecore_con_server_add ( Ecore_Con_Type  compl_type,
const char *  name,
int  port,
const void *  data 
)

Creates a server to listen for connections.

The socket on which the server listens depends on the connection type:

  • If compl_type is ECORE_CON_LOCAL_USER, the server will listen on the Unix socket "~/.ecore/[name]/[port]".
  • If compl_type is ECORE_CON_LOCAL_SYSTEM, the server will listen on Unix socket "/tmp/.ecore_service|[name]|[port]".
  • If compl_type is ECORE_CON_REMOTE_TCP, the server will listen on TCP port port.
Parameters:
compl_typeThe connection type.
nameName to associate with the socket. It is used when generating the socket name of a Unix socket. Though it is not used for the TCP socket, it still needs to be a valid character array. NULL will not be accepted.
portNumber to identify socket. When a Unix socket is used, it becomes part of the socket name. When a TCP socket is used, it is used as the TCP port.
dataData to associate with the created Ecore_Con_Server object.
Returns:
A new Ecore_Con_Server.

References ecore_main_fd_handler_del().

Referenced by ecore_ipc_server_add().

EAPI void ecore_con_server_client_limit_set ( Ecore_Con_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:
svrThe given server.
client_limitThe maximum number of clients to handle concurrently. -1 means unlimited (default). 0 effectively disables the server.
reject_excess_clientsSet 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).

Referenced by ecore_ipc_server_client_limit_set().

EAPI Eina_List* ecore_con_server_clients_get ( Ecore_Con_Server svr)

Retrieves the current list of clients.

Parameters:
svrThe given server.
Returns:
The list of clients on this server.
EAPI Ecore_Con_Server* ecore_con_server_connect ( Ecore_Con_Type  compl_type,
const char *  name,
int  port,
const void *  data 
)

Creates a server object to represent the server listening at the given port.

The socket to which the server connects depends on the connection type:

  • If compl_type is ECORE_CON_LOCAL_USER, the function will connect to the server listening on the Unix socket "~/.ecore/[name]/[port]".
  • If compl_type is ECORE_CON_LOCAL_SYSTEM, the function will connect to the server listening on the Unix socket "/tmp/.ecore_service|[name]|[port]".
  • If compl_type is ECORE_CON_REMOTE_TCP, the function will connect to the server listening on the TCP port "[name]:[port]".
Parameters:
compl_typeThe connection type.
nameName used when determining what socket to connect to. It is used to generate the socket name when the socket is a Unix socket. It is used as the hostname when connecting with a TCP socket.
portNumber to identify the socket to connect to. Used when generating the socket name for a Unix socket, or as the TCP port when connecting to a TCP socket.
dataData to associate with the created Ecore_Con_Server object.
Returns:
A new Ecore_Con_Server.

References ecore_main_fd_handler_del().

Referenced by ecore_ipc_server_connect().

EAPI int ecore_con_server_connected_get ( Ecore_Con_Server svr)

Retrieves whether the given server is currently connected.

Todo:
Check that this function does what the documenter believes it does.
Parameters:
svrThe given server.
Returns:
1 if the server is connected. 0 otherwise.

Referenced by ecore_ipc_server_connected_get().

EAPI void* ecore_con_server_data_get ( Ecore_Con_Server svr)

Retrieves the data associated with the given server.

Parameters:
svrThe given server.
Returns:
The associated data.

Referenced by ecore_ipc_client_del(), and ecore_ipc_client_server_get().

EAPI void* ecore_con_server_del ( Ecore_Con_Server svr)

Closes the connection and frees the given server.

Parameters:
svrThe given server.
Returns:
Data associated with the server when it was created.

References ecore_main_fd_handler_del().

Referenced by ecore_ipc_server_del().

EAPI void ecore_con_server_flush ( Ecore_Con_Server svr)

Flushes all pending data to the given server.

Will return when done.

Parameters:
svrThe given server.

Referenced by ecore_ipc_server_flush().

EAPI char* ecore_con_server_ip_get ( Ecore_Con_Server svr)

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

Parameters:
svrThe 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.

Referenced by ecore_ipc_server_ip_get().

EAPI int ecore_con_server_send ( Ecore_Con_Server svr,
const void *  data,
int  size 
)

Sends the given data to the given server.

Parameters:
svrThe given server.
dataThe given data.
sizeLength of the data, in bytes, to send.
Returns:
The number of bytes sent. 0 will be returned if there is an error.

References ECORE_FD_READ, ECORE_FD_WRITE, and ecore_main_fd_handler_active_set().

Referenced by ecore_ipc_server_send().