2012-08-30 20:11:24 -07:00
|
|
|
#ifndef _ECORE_CON_EET
|
|
|
|
# define _ECORE_CON_EET
|
|
|
|
|
|
|
|
#include <Eet.h>
|
|
|
|
#include <Ecore.h>
|
|
|
|
#include <Ecore_Con.h>
|
|
|
|
|
2020-09-15 06:16:24 -07:00
|
|
|
#include <ecore_con_api.h>
|
2012-10-04 10:04:38 -07:00
|
|
|
|
2014-10-03 06:42:43 -07:00
|
|
|
/**
|
2014-10-15 08:59:55 -07:00
|
|
|
* @defgroup Ecore_Con_Eet_Group Eet connection functions
|
|
|
|
* @ingroup Ecore_Con_Group
|
2014-10-03 06:42:43 -07:00
|
|
|
*
|
2017-02-12 22:29:11 -08:00
|
|
|
* The Ecore Connection Eet library (@c Ecore_Con_Eet) adds @c Eet data
|
2014-10-03 06:42:43 -07:00
|
|
|
* serialization features to Ecore Connection objects. Its main aim is to
|
|
|
|
* provide a way to send @c Eet data streams to another program through sockets
|
|
|
|
* using @c Ecore_Con objects.
|
2014-10-15 08:59:55 -07:00
|
|
|
*
|
|
|
|
* @{
|
2014-10-03 06:42:43 -07:00
|
|
|
*/
|
|
|
|
|
2014-09-01 11:08:49 -07:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2015-06-22 09:55:54 -07:00
|
|
|
typedef Eo Ecore_Con_Eet;
|
2016-02-17 01:39:53 -08:00
|
|
|
|
|
|
|
#ifndef _ECORE_CON_EET_BASE_EO_TYPES
|
|
|
|
#define _ECORE_CON_EET_BASE_EO_TYPES
|
|
|
|
|
2012-08-30 20:11:24 -07:00
|
|
|
typedef struct _Ecore_Con_Reply Ecore_Con_Reply;
|
|
|
|
|
2016-02-17 01:39:53 -08:00
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2014-10-03 06:42:43 -07:00
|
|
|
/**
|
|
|
|
* @typedef Ecore_Con_Eet_Data_Cb
|
|
|
|
* @brief Called when an Ecore_Con_Eet object receives data.
|
|
|
|
*/
|
2012-08-30 20:11:24 -07:00
|
|
|
typedef void (*Ecore_Con_Eet_Data_Cb)(void *data, Ecore_Con_Reply *reply, const char *protocol_name, void *value);
|
2014-10-03 06:42:43 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @typedef Ecore_Con_Eet_Raw_Data_Cb
|
|
|
|
* @brief Called when an Ecore_Con_Eet object receives raw data.
|
|
|
|
*/
|
2012-08-30 20:11:24 -07:00
|
|
|
typedef void (*Ecore_Con_Eet_Raw_Data_Cb)(void *data, Ecore_Con_Reply *reply, const char *protocol_name, const char *section, void *value, size_t length);
|
2014-10-03 06:42:43 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @typedef Ecore_Con_Eet_Client_Cb
|
|
|
|
* @brief Called when a client connects to the server.
|
|
|
|
*/
|
2012-08-30 20:11:24 -07:00
|
|
|
typedef Eina_Bool (*Ecore_Con_Eet_Client_Cb)(void *data, Ecore_Con_Reply *reply, Ecore_Con_Client *conn);
|
2014-10-03 06:42:43 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @typedef Ecore_Con_Eet_Server_Cb
|
|
|
|
* @brief Called when the server has accepted the connection of the client.
|
|
|
|
*/
|
2012-08-30 20:11:24 -07:00
|
|
|
typedef Eina_Bool (*Ecore_Con_Eet_Server_Cb)(void *data, Ecore_Con_Reply *reply, Ecore_Con_Server *conn);
|
|
|
|
|
2015-06-22 09:55:54 -07:00
|
|
|
#ifndef EFL_NOLEGACY_API_SUPPORT
|
|
|
|
#include "Ecore_Con_Eet_Legacy.h"
|
|
|
|
#endif
|
2016-06-14 06:59:13 -07:00
|
|
|
#ifdef EFL_BETA_API_SUPPORT
|
2015-06-22 09:55:54 -07:00
|
|
|
#include "Ecore_Con_Eet_Eo.h"
|
|
|
|
#endif
|
|
|
|
|
2014-10-03 06:42:43 -07:00
|
|
|
/**
|
2017-02-12 22:29:11 -08:00
|
|
|
* @brief Creates an Ecore_Con_Eet server.
|
2014-10-03 06:42:43 -07:00
|
|
|
*
|
|
|
|
* @param server An existing Ecore_Con_Server that have been previously
|
|
|
|
* created by the server program with @ref
|
|
|
|
* ecore_con_server_add.
|
|
|
|
*
|
2015-08-07 07:33:38 -07:00
|
|
|
* This object gets deleted automatically when the parent Ecore_Con_Server is
|
|
|
|
* deleted.
|
|
|
|
*
|
2014-10-03 06:42:43 -07:00
|
|
|
* @return A new Ecore_Con_Eet server.
|
|
|
|
*/
|
2020-09-15 06:16:24 -07:00
|
|
|
ECORE_CON_API Ecore_Con_Eet *ecore_con_eet_server_new(Ecore_Con_Server *server);
|
2014-10-03 06:42:43 -07:00
|
|
|
|
|
|
|
/**
|
2017-02-12 22:29:11 -08:00
|
|
|
* @brief Creates an Ecore_Con_Eet client.
|
2014-10-03 06:42:43 -07:00
|
|
|
*
|
|
|
|
* @param server An existing Ecore_Con_Server that have been previously
|
|
|
|
* returned by a call to @ref ecore_con_server_connect in the
|
|
|
|
* client program.
|
|
|
|
*
|
2015-08-07 07:33:38 -07:00
|
|
|
* This object gets deleted automatically when the parent Ecore_Con_Server is
|
|
|
|
* deleted.
|
|
|
|
*
|
2014-10-03 06:42:43 -07:00
|
|
|
* @return A new Ecore_Con_Eet client.
|
|
|
|
*/
|
2020-09-15 06:16:24 -07:00
|
|
|
ECORE_CON_API Ecore_Con_Eet *ecore_con_eet_client_new(Ecore_Con_Server *server);
|
2014-10-03 06:42:43 -07:00
|
|
|
|
|
|
|
/**
|
2017-02-12 22:29:11 -08:00
|
|
|
* @brief Frees an existing Ecore_Con_Eet object.
|
2014-10-03 06:42:43 -07:00
|
|
|
*
|
|
|
|
* @param server An existing Ecore_Con_Eet object that have been previously
|
|
|
|
* allocated by a @ref ecore_con_eet_server_new or @ref
|
|
|
|
* ecore_con_eet_client_new.
|
|
|
|
*
|
|
|
|
*/
|
2020-09-15 06:16:24 -07:00
|
|
|
ECORE_CON_API void ecore_con_eet_server_free(Ecore_Con_Eet *server);
|
2012-08-30 20:11:24 -07:00
|
|
|
|
2014-10-03 06:42:43 -07:00
|
|
|
/**
|
2017-02-12 22:29:11 -08:00
|
|
|
* @brief Registers an @c Eet data descriptor on a Ecore_Con_Eet object.
|
2014-10-03 06:42:43 -07:00
|
|
|
*
|
|
|
|
* @param ece An Ecore_Con_Eet object.
|
|
|
|
* @param name The name of the Eet stream to connect.
|
|
|
|
* @param edd A Eet data descriptor that describes the data organization
|
|
|
|
* in the Eet stream.
|
|
|
|
*
|
|
|
|
*/
|
2020-09-15 06:16:24 -07:00
|
|
|
ECORE_CON_API void ecore_con_eet_register(Ecore_Con_Eet *ece, const char *name, Eet_Data_Descriptor *edd);
|
2012-08-30 20:11:24 -07:00
|
|
|
|
2014-10-03 06:42:43 -07:00
|
|
|
/**
|
2017-02-12 22:29:11 -08:00
|
|
|
* @brief Registers a data callback on a Ecore_Con_Eet object.
|
2015-08-07 07:33:38 -07:00
|
|
|
* When the Ecore_Con_Eet object is deleted, this automatically gets removed.
|
2014-10-03 06:42:43 -07:00
|
|
|
*
|
|
|
|
* @param ece An Ecore_Con_Eet object.
|
|
|
|
* @param name The name of the Eet stream to connect.
|
|
|
|
* @param func The function to call as a callback.
|
|
|
|
* @param data The data to pass to the callback.
|
|
|
|
*
|
|
|
|
*/
|
2020-09-15 06:16:24 -07:00
|
|
|
ECORE_CON_API void ecore_con_eet_data_callback_add(Ecore_Con_Eet *ece, const char *name, Ecore_Con_Eet_Data_Cb func, const void *data);
|
2014-10-03 06:42:43 -07:00
|
|
|
|
|
|
|
/**
|
2017-02-12 22:29:11 -08:00
|
|
|
* @brief Removes a data callback on a Ecore_Con_Eet object.
|
2014-10-03 06:42:43 -07:00
|
|
|
*
|
|
|
|
* @param ece An Ecore_Con_Eet object.
|
|
|
|
* @param name The name of the Eet stream to remove callback on.
|
|
|
|
*
|
|
|
|
*/
|
2020-09-15 06:16:24 -07:00
|
|
|
ECORE_CON_API void ecore_con_eet_data_callback_del(Ecore_Con_Eet *ece, const char *name);
|
2012-08-30 20:11:24 -07:00
|
|
|
|
2014-10-03 06:42:43 -07:00
|
|
|
/**
|
2017-02-12 22:29:11 -08:00
|
|
|
* @brief Registers a raw data callback on a Ecore_Con_Eet object.
|
2015-08-07 07:33:38 -07:00
|
|
|
* When the Ecore_Con_Eet object is deleted, this automatically gets removed.
|
2014-10-03 06:42:43 -07:00
|
|
|
*
|
|
|
|
* @param ece An Ecore_Con_Eet object.
|
|
|
|
* @param name The name of the raw Eet stream to connect.
|
|
|
|
* @param func The function to call as a callback.
|
|
|
|
* @param data The data to pass to the callback.
|
|
|
|
*
|
|
|
|
*/
|
2020-09-15 06:16:24 -07:00
|
|
|
ECORE_CON_API void ecore_con_eet_raw_data_callback_add(Ecore_Con_Eet *ece, const char *name, Ecore_Con_Eet_Raw_Data_Cb func, const void *data);
|
2014-10-03 06:42:43 -07:00
|
|
|
|
|
|
|
/**
|
2017-02-12 22:29:11 -08:00
|
|
|
* @brief Removes a raw data callback on a Ecore_Con_Eet object.
|
2014-10-03 06:42:43 -07:00
|
|
|
*
|
|
|
|
* @param ece An Ecore_Con_Eet object.
|
|
|
|
* @param name The name of the raw Eet stream to remove callback on.
|
|
|
|
*
|
|
|
|
*/
|
2020-09-15 06:16:24 -07:00
|
|
|
ECORE_CON_API void ecore_con_eet_raw_data_callback_del(Ecore_Con_Eet *ece, const char *name);
|
2012-08-30 20:11:24 -07:00
|
|
|
|
2014-10-03 06:42:43 -07:00
|
|
|
/**
|
2017-02-12 22:29:11 -08:00
|
|
|
* @brief Registers a client connect callback on a Ecore_Con_Eet object.
|
2014-10-03 06:42:43 -07:00
|
|
|
* @brief This callback can be registered on the server program to know when a
|
|
|
|
* client connects.
|
2015-08-07 07:33:38 -07:00
|
|
|
* When the Ecore_Con_Eet object is deleted, this automatically gets removed.
|
2014-10-03 06:42:43 -07:00
|
|
|
*
|
|
|
|
* @param ece An Ecore_Con_Eet object.
|
|
|
|
* @param func The function to call as a callback.
|
|
|
|
* @param data The data to pass to the callback.
|
|
|
|
*/
|
2020-09-15 06:16:24 -07:00
|
|
|
ECORE_CON_API void ecore_con_eet_client_connect_callback_add(Ecore_Con_Eet *ece, Ecore_Con_Eet_Client_Cb func, const void *data);
|
2014-10-03 06:42:43 -07:00
|
|
|
|
|
|
|
/**
|
2017-02-12 22:29:11 -08:00
|
|
|
* @brief Removes a client connect callback on a Ecore_Con_Eet object.
|
2014-10-03 06:42:43 -07:00
|
|
|
*
|
|
|
|
* @param ece An Ecore_Con_Eet object.
|
|
|
|
* @param func The callback to remove.
|
|
|
|
* @param data The data passed to this function at the callback registration.
|
|
|
|
*/
|
2020-09-15 06:16:24 -07:00
|
|
|
ECORE_CON_API void ecore_con_eet_client_connect_callback_del(Ecore_Con_Eet *ece, Ecore_Con_Eet_Client_Cb func, const void *data);
|
2012-08-30 20:11:24 -07:00
|
|
|
|
2014-10-03 06:42:43 -07:00
|
|
|
/**
|
2017-02-12 22:29:11 -08:00
|
|
|
* @brief Registers a client disconnect callback on a Ecore_Con_Eet object.
|
2014-10-03 06:42:43 -07:00
|
|
|
* @brief This callback can be registered on the server program to know when a
|
|
|
|
* client disconnects.
|
2015-08-07 07:33:38 -07:00
|
|
|
* When the Ecore_Con_Eet object is deleted, this automatically gets removed.
|
2014-10-03 06:42:43 -07:00
|
|
|
*
|
|
|
|
* @param ece An Ecore_Con_Eet object.
|
|
|
|
* @param func The function to call as a callback.
|
|
|
|
* @param data The data to pass to the callback.
|
|
|
|
*/
|
2020-09-15 06:16:24 -07:00
|
|
|
ECORE_CON_API void ecore_con_eet_client_disconnect_callback_add(Ecore_Con_Eet *ece, Ecore_Con_Eet_Client_Cb func, const void *data);
|
2014-10-03 06:42:43 -07:00
|
|
|
|
|
|
|
/**
|
2017-02-12 22:29:11 -08:00
|
|
|
* @brief Removes a client disconnect callback on a Ecore_Con_Eet object.
|
2014-10-03 06:42:43 -07:00
|
|
|
*
|
|
|
|
* @param ece An Ecore_Con_Eet object.
|
|
|
|
* @param func The callback to remove.
|
|
|
|
* @param data The data passed to this function at the callback registration.
|
|
|
|
*/
|
2020-09-15 06:16:24 -07:00
|
|
|
ECORE_CON_API void ecore_con_eet_client_disconnect_callback_del(Ecore_Con_Eet *ece, Ecore_Con_Eet_Client_Cb func, const void *data);
|
2012-08-30 20:11:24 -07:00
|
|
|
|
2014-10-03 06:42:43 -07:00
|
|
|
/**
|
2017-02-12 22:29:11 -08:00
|
|
|
* @brief Registers a server connect callback on a Ecore_Con_Eet object.
|
|
|
|
* @brief This callback can be registered on the client program to be called.
|
2014-10-03 06:42:43 -07:00
|
|
|
* when it has been connected to the server.
|
2015-08-07 07:33:38 -07:00
|
|
|
* When the Ecore_Con_Eet object is deleted, this automatically gets removed.
|
2014-10-03 06:42:43 -07:00
|
|
|
*
|
|
|
|
* @param ece An Ecore_Con_Eet object.
|
|
|
|
* @param func The function to call as a callback.
|
|
|
|
* @param data The data to pass to the callback.
|
|
|
|
*/
|
2020-09-15 06:16:24 -07:00
|
|
|
ECORE_CON_API void ecore_con_eet_server_connect_callback_add(Ecore_Con_Eet *ece, Ecore_Con_Eet_Server_Cb func, const void *data);
|
2014-10-03 06:42:43 -07:00
|
|
|
|
|
|
|
/**
|
2017-02-12 22:29:11 -08:00
|
|
|
* @brief Removes a server connect callback on a Ecore_Con_Eet object.
|
2014-10-03 06:42:43 -07:00
|
|
|
*
|
|
|
|
* @param ece An Ecore_Con_Eet object.
|
|
|
|
* @param func The callback to remove.
|
|
|
|
* @param data The data passed to this function at the callback registration.
|
|
|
|
*/
|
2020-09-15 06:16:24 -07:00
|
|
|
ECORE_CON_API void ecore_con_eet_server_connect_callback_del(Ecore_Con_Eet *ece, Ecore_Con_Eet_Server_Cb func, const void *data);
|
2012-08-30 20:11:24 -07:00
|
|
|
|
2014-10-03 06:42:43 -07:00
|
|
|
/**
|
2017-02-12 22:29:11 -08:00
|
|
|
* @brief Registers a server disconnect callback on a Ecore_Con_Eet object.
|
2014-10-03 06:42:43 -07:00
|
|
|
* @brief This callback can be registered on the client program to be called
|
|
|
|
* when it has been disconnected from the server.
|
2015-08-07 07:33:38 -07:00
|
|
|
* When the Ecore_Con_Eet object is deleted, this automatically gets removed.
|
2014-10-03 06:42:43 -07:00
|
|
|
*
|
|
|
|
* @param ece An Ecore_Con_Eet object.
|
|
|
|
* @param func The function to call as a callback.
|
|
|
|
* @param data The data to pass to the callback.
|
|
|
|
*/
|
2020-09-15 06:16:24 -07:00
|
|
|
ECORE_CON_API void ecore_con_eet_server_disconnect_callback_add(Ecore_Con_Eet *ece, Ecore_Con_Eet_Server_Cb func, const void *data);
|
2014-10-03 06:42:43 -07:00
|
|
|
|
|
|
|
/**
|
2017-02-12 22:29:11 -08:00
|
|
|
* @brief Removes a server disconnect callback on a Ecore_Con_Eet object.
|
2014-10-03 06:42:43 -07:00
|
|
|
*
|
|
|
|
* @param ece An Ecore_Con_Eet object.
|
|
|
|
* @param func The callback to remove.
|
|
|
|
* @param data The data passed to this function at the callback registration.
|
|
|
|
*/
|
2020-09-15 06:16:24 -07:00
|
|
|
ECORE_CON_API void ecore_con_eet_server_disconnect_callback_del(Ecore_Con_Eet *ece, Ecore_Con_Eet_Server_Cb func, const void *data);
|
2012-08-30 20:11:24 -07:00
|
|
|
|
2014-10-03 06:42:43 -07:00
|
|
|
/**
|
2017-02-12 22:29:11 -08:00
|
|
|
* @brief Attaches data to an Ecore_Con_Eet object.
|
2014-10-03 06:42:43 -07:00
|
|
|
*
|
|
|
|
* @param ece An Ecore_Con_Eet object.
|
|
|
|
* @param data The data to attach to the Ecore_Con_Eet object.
|
|
|
|
*/
|
2020-09-15 06:16:24 -07:00
|
|
|
ECORE_CON_API void ecore_con_eet_data_set(Ecore_Con_Eet *ece, const void *data);
|
2014-10-03 06:42:43 -07:00
|
|
|
|
|
|
|
/**
|
2017-02-12 22:29:11 -08:00
|
|
|
* @brief Gets the data attached to an Ecore_Con_Eet object.
|
2014-10-03 06:42:43 -07:00
|
|
|
*
|
|
|
|
* @param ece An Ecore_Con_Eet object.
|
|
|
|
* @return The data attached to the Ecore_Con_Eet object.
|
|
|
|
*/
|
2020-09-15 06:16:24 -07:00
|
|
|
ECORE_CON_API const void *ecore_con_eet_data_get(Ecore_Con_Eet *ece);
|
2012-08-30 20:11:24 -07:00
|
|
|
|
2014-10-03 06:42:43 -07:00
|
|
|
/**
|
2017-02-12 22:29:11 -08:00
|
|
|
* @brief Gets the Ecore_Con_Eet object corresponding to the Ecore_Con_Reply object.
|
2014-10-03 06:42:43 -07:00
|
|
|
*
|
|
|
|
* @param reply An Ecore_Con_Reply object.
|
|
|
|
* @return The corresponding Ecore_Con_Eet object.
|
|
|
|
*/
|
2020-09-15 06:16:24 -07:00
|
|
|
ECORE_CON_API Ecore_Con_Eet *ecore_con_eet_reply(Ecore_Con_Reply *reply);
|
2014-10-03 06:42:43 -07:00
|
|
|
|
|
|
|
/**
|
2017-02-12 22:29:11 -08:00
|
|
|
* @brief Sends some data using a protocol type.
|
2014-10-03 06:42:43 -07:00
|
|
|
*
|
|
|
|
* @param reply An Ecore_Con_Reply object.
|
|
|
|
* @param protocol_name The protocol type to use.
|
|
|
|
* @param value The data to send.
|
|
|
|
*/
|
2020-09-15 06:16:24 -07:00
|
|
|
ECORE_CON_API void ecore_con_eet_send(Ecore_Con_Reply *reply, const char *protocol_name, void *value);
|
2014-10-03 06:42:43 -07:00
|
|
|
|
|
|
|
/**
|
2017-02-12 22:29:11 -08:00
|
|
|
* @brief Sends some raw data using a protocol type.
|
2014-10-03 06:42:43 -07:00
|
|
|
*
|
|
|
|
* @param reply An Ecore_Con_Reply object.
|
|
|
|
* @param protocol_name The protocol type to use.
|
|
|
|
* @param section The section to add to the protocol.
|
|
|
|
* @param value The data to send.
|
|
|
|
* @param length The data length.
|
|
|
|
*/
|
2020-09-15 06:16:24 -07:00
|
|
|
ECORE_CON_API void ecore_con_eet_raw_send(Ecore_Con_Reply *reply, const char *protocol_name, const char *section, void *value, unsigned int length);
|
2012-08-30 20:11:24 -07:00
|
|
|
|
2014-10-15 08:59:55 -07:00
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
|
2014-09-01 11:08:49 -07:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2012-08-30 20:11:24 -07:00
|
|
|
#endif
|