2003-09-23 01:09:32 -07:00
|
|
|
#ifndef _ECORE_CON_H
|
|
|
|
#define _ECORE_CON_H
|
|
|
|
|
2004-11-24 21:18:31 -08:00
|
|
|
#ifdef EAPI
|
|
|
|
#undef EAPI
|
|
|
|
#endif
|
|
|
|
#ifdef WIN32
|
|
|
|
# ifdef BUILDING_DLL
|
|
|
|
# define EAPI __declspec(dllexport)
|
|
|
|
# else
|
|
|
|
# define EAPI __declspec(dllimport)
|
|
|
|
# endif
|
|
|
|
#else
|
|
|
|
# ifdef GCC_HASCLASSVISIBILITY
|
|
|
|
# define EAPI __attribute__ ((visibility("default")))
|
|
|
|
# else
|
|
|
|
# define EAPI
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
|
2004-04-29 20:10:17 -07:00
|
|
|
/**
|
|
|
|
* @file Ecore_Con.h
|
|
|
|
* @brief Sockets functions.
|
2004-09-22 21:58:16 -07:00
|
|
|
*
|
|
|
|
* The Ecore Connection Library ( @c Ecore_Con ) provides simple mechanisms
|
|
|
|
* for communications between programs using reliable sockets. It saves
|
|
|
|
* the programmer from having to worry about file descripters and waiting
|
|
|
|
* for incoming connections.
|
|
|
|
*
|
|
|
|
* There are two main objects in the @c Ecore_Con library: the @c
|
|
|
|
* Ecore_Con_Server and the @c Ecore_Con_Client.
|
|
|
|
*
|
|
|
|
* The @c Ecore_Con_Server represents a server to connect to. It is
|
|
|
|
* represents a server that can be connected to. It is used regardless
|
|
|
|
* of whether the program is acting as a server or client itself.
|
|
|
|
*
|
|
|
|
* To create a listening server, call @c ecore_con_server_add().
|
|
|
|
*
|
|
|
|
* To connect to a server, call @c ecore_Con_server_connect(). Data can
|
|
|
|
* then be sent to the server using the @c ecore_con_server_send().
|
|
|
|
*
|
|
|
|
* Whenever a client connection is made to an @c Ecore_Con_Server, a
|
|
|
|
* @c ECORE_CON_CLIENT_ADD event is emitted. Any event callbacks that are
|
|
|
|
* called receive a @c Ecore_Con_Client object, which represents a
|
|
|
|
* connection that that particular client.
|
|
|
|
*
|
|
|
|
* Functions are described in the following groupings:
|
|
|
|
* @li @ref Ecore_Con_Lib_Group
|
|
|
|
* @li @ref Ecore_Con_Server_Group
|
|
|
|
* @li @ref Ecore_Con_Client_Group
|
2004-04-29 20:10:17 -07:00
|
|
|
*/
|
|
|
|
|
2003-09-23 01:09:32 -07:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _ECORE_CON_PRIVATE_H
|
|
|
|
typedef void Ecore_Con_Server; /**< A connection handle */
|
|
|
|
typedef void Ecore_Con_Client; /**< A connection handle */
|
|
|
|
|
|
|
|
typedef enum _Ecore_Con_Type
|
|
|
|
{
|
2004-03-31 08:47:45 -08:00
|
|
|
ECORE_CON_LOCAL_USER,
|
2003-09-23 01:09:32 -07:00
|
|
|
ECORE_CON_LOCAL_SYSTEM,
|
2004-10-21 20:41:49 -07:00
|
|
|
ECORE_CON_REMOTE_SYSTEM,
|
|
|
|
ECORE_CON_USE_SSL = 16
|
2003-09-23 01:09:32 -07:00
|
|
|
} Ecore_Con_Type;
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
typedef struct _Ecore_Con_Event_Client_Add Ecore_Con_Event_Client_Add;
|
|
|
|
typedef struct _Ecore_Con_Event_Client_Del Ecore_Con_Event_Client_Del;
|
|
|
|
typedef struct _Ecore_Con_Event_Server_Add Ecore_Con_Event_Server_Add;
|
|
|
|
typedef struct _Ecore_Con_Event_Server_Del Ecore_Con_Event_Server_Del;
|
|
|
|
typedef struct _Ecore_Con_Event_Client_Data Ecore_Con_Event_Client_Data;
|
|
|
|
typedef struct _Ecore_Con_Event_Server_Data Ecore_Con_Event_Server_Data;
|
|
|
|
|
|
|
|
struct _Ecore_Con_Event_Client_Add
|
|
|
|
{
|
|
|
|
Ecore_Con_Client *client;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct _Ecore_Con_Event_Client_Del
|
|
|
|
{
|
|
|
|
Ecore_Con_Client *client;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct _Ecore_Con_Event_Server_Add
|
|
|
|
{
|
|
|
|
Ecore_Con_Server *server;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct _Ecore_Con_Event_Server_Del
|
|
|
|
{
|
|
|
|
Ecore_Con_Server *server;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct _Ecore_Con_Event_Client_Data
|
|
|
|
{
|
|
|
|
Ecore_Con_Client *client;
|
|
|
|
void *data;
|
|
|
|
int size;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct _Ecore_Con_Event_Server_Data
|
|
|
|
{
|
|
|
|
Ecore_Con_Server *server;
|
|
|
|
void *data;
|
|
|
|
int size;
|
|
|
|
};
|
|
|
|
|
|
|
|
extern int ECORE_CON_EVENT_CLIENT_ADD;
|
|
|
|
extern int ECORE_CON_EVENT_CLIENT_DEL;
|
|
|
|
extern int ECORE_CON_EVENT_SERVER_ADD;
|
|
|
|
extern int ECORE_CON_EVENT_SERVER_DEL;
|
|
|
|
extern int ECORE_CON_EVENT_CLIENT_DATA;
|
|
|
|
extern int ECORE_CON_EVENT_SERVER_DATA;
|
|
|
|
|
2004-11-24 21:18:31 -08:00
|
|
|
EAPI int ecore_con_init(void);
|
|
|
|
EAPI int ecore_con_shutdown(void);
|
2003-09-23 01:09:32 -07:00
|
|
|
|
2004-11-24 21:18:31 -08:00
|
|
|
EAPI Ecore_Con_Server *ecore_con_server_add(Ecore_Con_Type type, char *name, int port, const void *data);
|
2003-09-23 01:09:32 -07:00
|
|
|
|
2004-11-24 21:18:31 -08:00
|
|
|
EAPI Ecore_Con_Server *ecore_con_server_connect(Ecore_Con_Type type, char *name, int port, const void *data);
|
|
|
|
EAPI void *ecore_con_server_del(Ecore_Con_Server *svr);
|
|
|
|
EAPI void *ecore_con_server_data_get(Ecore_Con_Server *svr);
|
|
|
|
EAPI int ecore_con_server_connected_get(Ecore_Con_Server *svr);
|
|
|
|
EAPI int ecore_con_server_send(Ecore_Con_Server *svr, void *data, int size);
|
2003-09-23 01:09:32 -07:00
|
|
|
|
2004-11-24 21:18:31 -08:00
|
|
|
EAPI int ecore_con_client_send(Ecore_Con_Client *cl, void *data, int size);
|
|
|
|
EAPI Ecore_Con_Server *ecore_con_client_server_get(Ecore_Con_Client *cl);
|
|
|
|
EAPI void *ecore_con_client_del(Ecore_Con_Client *cl);
|
|
|
|
EAPI void ecore_con_client_data_set(Ecore_Con_Client *cl, const void *data);
|
|
|
|
EAPI void *ecore_con_client_data_get(Ecore_Con_Client *cl);
|
2003-09-23 01:09:32 -07:00
|
|
|
|
2004-11-24 21:18:31 -08:00
|
|
|
EAPI int ecore_con_ssl_available_get(void);
|
2004-10-21 20:41:49 -07:00
|
|
|
|
|
|
|
|
2003-09-23 01:09:32 -07:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|