Functions to communicate with and/or set options on a client. More...
Typedefs | |
typedef struct _Ecore_Con_Client | Ecore_Con_Client |
Used to provide legacy API/ABI compatibility with non-Eo applications. | |
Functions | |
ECORE_CON_API int | ecore_con_client_send (Ecore_Con_Client *cl, const void *data, int size) |
Sends the given data to the given client. More... | |
ECORE_CON_API void * | ecore_con_client_del (Ecore_Con_Client *cl) |
Closes the connection and free memory allocated to the given client. More... | |
ECORE_CON_API void | ecore_con_client_data_set (Ecore_Con_Client *cl, const void *data) |
Sets the data associated with the given client to data . More... | |
ECORE_CON_API void * | ecore_con_client_data_get (Ecore_Con_Client *cl) |
Retrieves the data associated with the given client. More... | |
ECORE_CON_API const char * | ecore_con_client_ip_get (const Ecore_Con_Client *cl) |
Gets the IP address of a client that has connected. More... | |
ECORE_CON_API void | ecore_con_client_flush (Ecore_Con_Client *cl) |
Flushes all pending data to the given client. More... | |
ECORE_CON_API double | ecore_con_client_uptime_get (const Ecore_Con_Client *cl) |
Checks how long a client has been connected. More... | |
ECORE_CON_API double | ecore_con_client_timeout_get (const Ecore_Con_Client *cl) |
Gets the default time after which the client will be disconnected when inactive. More... | |
ECORE_CON_API void | ecore_con_client_timeout_set (Ecore_Con_Client *cl, double timeout) |
Sets the time after which the client will be disconnected when inactive. More... | |
ECORE_CON_API Eina_Bool | ecore_con_client_connected_get (const Ecore_Con_Client *cl) |
Returns whether the client is still connected. More... | |
ECORE_CON_API int | ecore_con_client_port_get (const Ecore_Con_Client *cl) |
Returns the port that the client has connected to. More... | |
ECORE_CON_API Ecore_Con_Server * | ecore_con_client_server_get (const Ecore_Con_Client *cl) |
The server the client is connected to. More... | |
static Efl_Callback_Array_Item * | _ecore_con_client_socket_cbs (void) |
static Efl_Callback_Array_Item * | _ecore_con_client_socket_ssl_cbs (void) |
static void | _ecore_con_client_socket_close (Ecore_Con_Client *cl) |
static void | _ecore_con_client_free (Ecore_Con_Client *cl) |
static void | _ecore_con_free_event_client_add (void *data, void *event) |
static void | _ecore_con_post_event_client_add (Ecore_Con_Client *cl) |
static void | _ecore_con_free_event_client_del (void *data, void *event) |
static Eina_Bool | _ecore_con_post_event_client_del (Ecore_Con_Client *cl) |
static void | _ecore_con_free_event_client_data (void *data, void *event) |
static void | _ecore_con_post_event_client_data (Ecore_Con_Client *cl, Eina_Rw_Slice slice) |
static void | _ecore_con_free_event_client_write (void *data, void *event) |
static void | _ecore_con_post_event_client_write (Ecore_Con_Client *cl, size_t size) |
static void | _ecore_con_free_event_client_error (void *data, void *event) |
static Eina_Bool | _ecore_con_post_event_client_error (Ecore_Con_Client *cl, const char *err) |
static void | _ecore_con_free_event_client_upgrade (void *data, void *event) |
static void | _ecore_con_post_event_client_upgrade (Ecore_Con_Client *cl) |
static void | _ecore_con_client_socket_progress (void *data, const Efl_Event *event) |
static void | _ecore_con_client_socket_slice_changed (void *data, const Efl_Event *event) |
static void | _ecore_con_client_socket_read_finished (void *data, const Efl_Event *event) |
static void | _ecore_con_client_socket_finished (void *data, const Efl_Event *event) |
static void | _ecore_con_client_socket_error (void *data, const Efl_Event *event) |
EFL_CALLBACKS_ARRAY_DEFINE (_ecore_con_client_socket_cbs, { EFL_IO_BUFFERED_STREAM_EVENT_PROGRESS, _ecore_con_client_socket_progress }, { EFL_IO_BUFFERED_STREAM_EVENT_SLICE_CHANGED, _ecore_con_client_socket_slice_changed }, { EFL_IO_BUFFERED_STREAM_EVENT_READ_FINISHED, _ecore_con_client_socket_read_finished }, { EFL_IO_BUFFERED_STREAM_EVENT_FINISHED, _ecore_con_client_socket_finished }, { EFL_IO_BUFFERED_STREAM_EVENT_ERROR, _ecore_con_client_socket_error }) | |
static Ecore_Con_Client * | ecore_con_client_add (Ecore_Con_Server *svr, Eo *socket) |
ECORE_CON_API int | ecore_con_client_fd_get (const Ecore_Con_Client *cl) |
Gets the fd that the client is connected to. More... | |
static void | _ecore_con_client_socket_ssl_ready (void *data, const Efl_Event *event) |
static void | _ecore_con_client_socket_ssl_error (void *data, const Efl_Event *event) |
EFL_CALLBACKS_ARRAY_DEFINE (_ecore_con_client_socket_ssl_cbs, { EFL_NET_SOCKET_SSL_EVENT_SSL_READY, _ecore_con_client_socket_ssl_ready }, { EFL_NET_SOCKET_SSL_EVENT_SSL_ERROR, _ecore_con_client_socket_ssl_error }) | |
static Eina_Value | _ecore_con_client_ssl_upgrade_job (void *data, const Eina_Value v, const Eina_Future *dead) |
static Eo * | _ecore_con_server_ssl_ctx_create (const Ecore_Con_Server *svr) |
static void | _ecore_con_server_job_schedule (Ecore_Con_Server *svr, Eo *loop, Eina_Future_Cb cb) |
ECORE_CON_API Eina_Bool | ecore_con_ssl_client_upgrade (Ecore_Con_Client *cl, Ecore_Con_Type compl_type) |
Upgrades a connection to a specified level of encryption. More... | |
EAPI int | ecore_ipc_ssl_available_get (void) |
Returns if SSL support is available. More... | |
Functions to communicate with and/or set options on a client.
Functions that operate on Ecore connection client objects, these are announced using ECORE_CON_EVENT_CLIENT_ADD by servers created with ecore_con_server_add().
This set of functions, as explained in Ecore Connection Server Functions, is used to send data to a client, or to set options and get information about this client. Most of them should be used on the server, applied on the client object.
If you need to implement a client, the way to connect to a server is described in Ecore Connection Server Functions.
An example of usage of these functions can be found at:
ECORE_CON_API int ecore_con_client_send | ( | Ecore_Con_Client * | cl, |
const void * | data, | ||
int | size | ||
) |
Sends the given data to the given client.
cl | The given client. |
data | The given data. |
size | Length of the data, in bytes, to send. |
0
will be returned if there is an error.This function will send the given data to the client as soon as the program is back to the main loop. Thus, this function returns immediately (non-blocking). If the data needs to be sent now, call ecore_con_client_flush() after this one.
References eina_error_msg_get(), EINA_SAFETY_ON_NULL_RETURN_VAL, EINA_SAFETY_ON_TRUE_RETURN_VAL, ERR, _Eina_Slice::len, and _Eina_Slice::mem.
ECORE_CON_API void * ecore_con_client_del | ( | Ecore_Con_Client * | cl | ) |
Closes the connection and free memory allocated to the given client.
cl | The given client. |
ECORE_CON_API void ecore_con_client_data_set | ( | Ecore_Con_Client * | cl, |
const void * | data | ||
) |
Sets the data associated with the given client to data
.
cl | The given client. |
data | What to set the data to. |
ECORE_CON_API void * ecore_con_client_data_get | ( | Ecore_Con_Client * | cl | ) |
Retrieves the data associated with the given client.
cl | The given client. |
cl
. ECORE_CON_API const char * ecore_con_client_ip_get | ( | const Ecore_Con_Client * | cl | ) |
Gets the IP address of a client that has connected.
cl | The given client. |
The returned string should not be modified, freed or trusted to stay valid after deletion for the cl
object. If no IP is known NULL
is returned.
ECORE_CON_API void ecore_con_client_flush | ( | Ecore_Con_Client * | cl | ) |
Flushes all pending data to the given client.
cl | The given client. |
This function will block until all data is sent to the server.
References EINA_FALSE, and EINA_TRUE.
Referenced by ecore_con_ssl_client_upgrade().
ECORE_CON_API double ecore_con_client_uptime_get | ( | const Ecore_Con_Client * | cl | ) |
Checks how long a client has been connected.
cl | The client to check |
This function is used to find out how long a client has been connected for.
References ecore_time_get().
ECORE_CON_API double ecore_con_client_timeout_get | ( | const Ecore_Con_Client * | cl | ) |
Gets the default time after which the client will be disconnected when inactive.
cl | The client object. |
This function is used to get the idle timeout for a client. A value of < 1 means the idle timeout is disabled.
ECORE_CON_API void ecore_con_client_timeout_set | ( | Ecore_Con_Client * | cl, |
double | timeout | ||
) |
Sets the time after which the client will be disconnected when inactive.
cl | The client object |
timeout | The timeout, in seconds, to disconnect after |
This function is used by the server to set the idle timeout on a specific client. If the client becomes idle for a time higher than this value, it will be disconnected. A value of < 1 disables the idle timeout.
This timeout is not affected by the one set by ecore_con_server_timeout_set(). A client will be disconnected whenever the client or the server timeout is reached. That means, the lower timeout value will be used for that client if ecore_con_server_timeout_set() is used on the server.
ECORE_CON_API Eina_Bool ecore_con_client_connected_get | ( | const Ecore_Con_Client * | cl | ) |
Returns whether the client is still connected.
cl | The given client. |
EINA_TRUE
if connected, EINA_FALSE
otherwise. References EINA_FALSE.
ECORE_CON_API int ecore_con_client_port_get | ( | const Ecore_Con_Client * | cl | ) |
Returns the port that the client has connected to.
cl | The client |
cl
has connected to, or -1
on error Use this function to return the port on which a given client has connected. ECORE_CON_API Ecore_Con_Server * ecore_con_client_server_get | ( | const Ecore_Con_Client * | cl | ) |
The server the client is connected to.
cl | The client |
ECORE_CON_API int ecore_con_client_fd_get | ( | const Ecore_Con_Client * | cl | ) |
Gets the fd that the client is connected to.
cl | The client object |
-1
on failureThis function returns the fd which is used by the underlying client connection. It should not be tampered with unless you REALLY know what you are doing.
ECORE_CON_API Eina_Bool ecore_con_ssl_client_upgrade | ( | Ecore_Con_Client * | cl, |
Ecore_Con_Type | ssl_type | ||
) |
Upgrades a connection to a specified level of encryption.
Use this function to begin an SSL handshake on a connection (STARTTLS or similar). Once the upgrade has been completed, an ECORE_CON_EVENT_CLIENT_UPGRADE event will be emitted. The connection should be treated as disconnected until the next event.
cl | The client object. |
ssl_type | The SSL connection type (ONLY). |
EINA_FALSE
if the connection cannot be upgraded, otherwise EINA_TRUE
. ssl_type
WILL mess up your program. References ecore_animator_frametime_get(), ecore_con_client_flush(), ecore_time_get(), EINA_FALSE, EINA_SAFETY_ON_FALSE_RETURN_VAL, EINA_SAFETY_ON_TRUE_RETURN_VAL, and ERR.
EAPI int ecore_ipc_ssl_available_get | ( | void | ) |
Returns if SSL support is available.
References ecore_con_ssl_available_get().