Ecore con: Rename to Ecore.Con.Base for the C++ bindings.

This commit is contained in:
Tom Hacohen 2014-08-22 17:31:33 +01:00
parent 9a8a416325
commit 974e3afabc
8 changed files with 58 additions and 54 deletions

View File

@ -2,8 +2,8 @@
### Library
ecorecon_eobuiltheaders = \
lib/ecore_con/ecore_con.eo.h \
lib/ecore_con/ecore_con.eo.legacy.h \
lib/ecore_con/ecore_con_base.eo.h \
lib/ecore_con/ecore_con_base.eo.legacy.h \
lib/ecore_con/ecore_con_client.eo.h \
lib/ecore_con/ecore_con_client.eo.legacy.h \
lib/ecore_con/ecore_con_server.eo.h \
@ -11,13 +11,13 @@ ecorecon_eobuiltheaders = \
BUILT_SOURCES += \
${ecorecon_eobuiltheaders} \
lib/ecore_con/ecore_con.eo.c \
lib/ecore_con/ecore_con_base.eo.c \
lib/ecore_con/ecore_con_client.eo.c \
lib/ecore_con/ecore_con_server.eo.c
ecoreconeolianfilesdir = $(datadir)/eolian/include/ecore-@VMAJ@
ecoreconeolianfiles_DATA = \
lib/ecore_con/ecore_con.eo \
lib/ecore_con/ecore_con_base.eo \
lib/ecore_con/ecore_con_client.eo \
lib/ecore_con/ecore_con_server.eo

View File

@ -222,6 +222,8 @@ extern "C" {
#define ECORE_CON_USE_SSL ECORE_CON_USE_SSL2
#define ECORE_CON_REMOTE_SYSTEM ECORE_CON_REMOTE_TCP
typedef Eo Ecore_Con;
/**
* @typedef Ecore_Con_Socks
* An object representing a SOCKS proxy

View File

@ -1,3 +1,3 @@
#include "ecore_con.eo.h"
#include "ecore_con_base.eo.h"
#include "ecore_con_server.eo.h"
#include "ecore_con_client.eo.h"

View File

@ -1,3 +1,3 @@
#include "ecore_con.eo.legacy.h"
#include "ecore_con_base.eo.legacy.h"
#include "ecore_con_server.eo.legacy.h"
#include "ecore_con_client.eo.legacy.h"

View File

@ -273,7 +273,7 @@ ecore_con_shutdown(void)
}
EOLIAN static Eina_Bool
_ecore_con_lookup(Eo *kls_obj EINA_UNUSED, void *pd EINA_UNUSED, const char *name, Ecore_Con_Dns_Cb done_cb, const void *data)
_ecore_con_base_lookup(Eo *kls_obj EINA_UNUSED, void *pd EINA_UNUSED, const char *name, Ecore_Con_Dns_Cb done_cb, const void *data)
{
Ecore_Con_Server *obj;
Ecore_Con_Lookup *lk;
@ -517,7 +517,7 @@ ecore_con_server_timeout_set(Ecore_Con *obj, double timeout)
}
EOLIAN static void
_ecore_con_server_ecore_con_timeout_set(Eo *obj, Ecore_Con_Server_Data *svr, double timeout)
_ecore_con_server_ecore_con_base_timeout_set(Eo *obj, Ecore_Con_Server_Data *svr, double timeout)
{
if (svr->created)
svr->client_disconnect_time = timeout;
@ -534,7 +534,7 @@ ecore_con_server_timeout_get(const Ecore_Con *obj)
}
EOLIAN static double
_ecore_con_server_ecore_con_timeout_get(Eo *obj EINA_UNUSED, Ecore_Con_Server_Data *svr)
_ecore_con_server_ecore_con_base_timeout_get(Eo *obj EINA_UNUSED, Ecore_Con_Server_Data *svr)
{
return svr->created ? svr->client_disconnect_time : svr->disconnect_time;
}
@ -583,7 +583,7 @@ ecore_con_server_connected_get(const Ecore_Con *obj)
}
EOLIAN static Eina_Bool
_ecore_con_server_ecore_con_connected_get(Eo *obj EINA_UNUSED, Ecore_Con_Server_Data *svr)
_ecore_con_server_ecore_con_base_connected_get(Eo *obj EINA_UNUSED, Ecore_Con_Server_Data *svr)
{
return !svr->connecting;
}
@ -607,7 +607,7 @@ ecore_con_server_port_get(const Ecore_Con *obj)
}
EOLIAN static int
_ecore_con_server_ecore_con_port_get(Eo *obj EINA_UNUSED, Ecore_Con_Server_Data *svr)
_ecore_con_server_ecore_con_base_port_get(Eo *obj EINA_UNUSED, Ecore_Con_Server_Data *svr)
{
return svr->port;
}
@ -619,7 +619,7 @@ ecore_con_server_send(Ecore_Con *obj, const void *data, int size)
}
EOLIAN static int
_ecore_con_server_ecore_con_send(Eo *obj EINA_UNUSED, Ecore_Con_Server_Data *svr, const void *data, int size)
_ecore_con_server_ecore_con_base_send(Eo *obj EINA_UNUSED, Ecore_Con_Server_Data *svr, const void *data, int size)
{
EINA_SAFETY_ON_TRUE_RETURN_VAL(svr->delete_me, 0);
@ -675,7 +675,7 @@ ecore_con_server_ip_get(const Ecore_Con *obj)
}
EOLIAN static const char *
_ecore_con_server_ecore_con_ip_get(Eo *obj EINA_UNUSED, Ecore_Con_Server_Data *svr)
_ecore_con_server_ecore_con_base_ip_get(Eo *obj EINA_UNUSED, Ecore_Con_Server_Data *svr)
{
return svr->ip;
}
@ -687,7 +687,7 @@ ecore_con_server_uptime_get(const Ecore_Con *obj)
}
EOLIAN static double
_ecore_con_server_ecore_con_uptime_get(Eo *obj EINA_UNUSED, Ecore_Con_Server_Data *svr)
_ecore_con_server_ecore_con_base_uptime_get(Eo *obj EINA_UNUSED, Ecore_Con_Server_Data *svr)
{
return ecore_time_get() - svr->start_time;
}
@ -699,7 +699,7 @@ ecore_con_server_flush(Ecore_Con *obj)
}
EOLIAN static void
_ecore_con_server_ecore_con_flush(Eo *obj, Ecore_Con_Server_Data *svr EINA_UNUSED)
_ecore_con_server_ecore_con_base_flush(Eo *obj, Ecore_Con_Server_Data *svr EINA_UNUSED)
{
_ecore_con_server_flush(obj);
}
@ -728,7 +728,7 @@ ecore_con_client_send(Ecore_Con *obj, const void *data, int size)
}
EOLIAN static int
_ecore_con_client_ecore_con_send(Eo *obj EINA_UNUSED, Ecore_Con_Client_Data *cl, const void *data, int size)
_ecore_con_client_ecore_con_base_send(Eo *obj EINA_UNUSED, Ecore_Con_Client_Data *cl, const void *data, int size)
{
Ecore_Con_Server_Data *host_server = NULL;
EINA_SAFETY_ON_TRUE_RETURN_VAL(cl->delete_me, 0);
@ -776,7 +776,7 @@ _ecore_con_client_server_get(Eo *obj EINA_UNUSED, Ecore_Con_Client_Data *cl)
}
EOLIAN static Eina_Bool
_ecore_con_client_ecore_con_connected_get(Eo *obj EINA_UNUSED, Ecore_Con_Client_Data *cl)
_ecore_con_client_ecore_con_base_connected_get(Eo *obj EINA_UNUSED, Ecore_Con_Client_Data *cl)
{
return !cl->delete_me;
}
@ -788,7 +788,7 @@ ecore_con_client_connected_get(const Ecore_Con *obj)
}
EOLIAN static void
_ecore_con_client_ecore_con_timeout_set(Eo *obj, Ecore_Con_Client_Data *cl, double timeout)
_ecore_con_client_ecore_con_base_timeout_set(Eo *obj, Ecore_Con_Client_Data *cl, double timeout)
{
cl->disconnect_time = timeout;
@ -802,7 +802,7 @@ ecore_con_client_timeout_set(Ecore_Con *obj, double timeout)
}
EOLIAN static double
_ecore_con_client_ecore_con_timeout_get(Eo *obj EINA_UNUSED, Ecore_Con_Client_Data *cl)
_ecore_con_client_ecore_con_base_timeout_get(Eo *obj EINA_UNUSED, Ecore_Con_Client_Data *cl)
{
return cl->disconnect_time;
}
@ -846,7 +846,7 @@ ecore_con_client_data_get(Ecore_Con_Client *obj)
}
EOLIAN static const char *
_ecore_con_client_ecore_con_ip_get(Eo *obj EINA_UNUSED, Ecore_Con_Client_Data *cl)
_ecore_con_client_ecore_con_base_ip_get(Eo *obj EINA_UNUSED, Ecore_Con_Client_Data *cl)
{
if (!cl->ip)
cl->ip = _ecore_con_pretty_ip(cl->client_addr);
@ -861,7 +861,7 @@ ecore_con_client_ip_get(const Ecore_Con *obj)
}
EOLIAN static int
_ecore_con_client_ecore_con_port_get(Eo *obj EINA_UNUSED, Ecore_Con_Client_Data *cl)
_ecore_con_client_ecore_con_base_port_get(Eo *obj EINA_UNUSED, Ecore_Con_Client_Data *cl)
{
if (cl->client_addr->sa_family == AF_INET)
return ((struct sockaddr_in *)cl->client_addr)->sin_port;
@ -879,7 +879,7 @@ ecore_con_client_port_get(const Ecore_Con *obj)
}
EOLIAN static double
_ecore_con_client_ecore_con_uptime_get(Eo *obj EINA_UNUSED, Ecore_Con_Client_Data *cl)
_ecore_con_client_ecore_con_base_uptime_get(Eo *obj EINA_UNUSED, Ecore_Con_Client_Data *cl)
{
return ecore_time_get() - cl->start_time;
}
@ -891,7 +891,7 @@ ecore_con_client_uptime_get(const Ecore_Con *obj)
}
EOLIAN static void
_ecore_con_client_ecore_con_flush(Eo *obj, Ecore_Con_Client_Data *cl EINA_UNUSED)
_ecore_con_client_ecore_con_base_flush(Eo *obj, Ecore_Con_Client_Data *cl EINA_UNUSED)
{
_ecore_con_client_flush(obj);
}
@ -909,7 +909,7 @@ ecore_con_server_fd_get(const Ecore_Con *obj)
}
EOLIAN static int
_ecore_con_server_ecore_con_fd_get(Eo *obj EINA_UNUSED, Ecore_Con_Server_Data *svr)
_ecore_con_server_ecore_con_base_fd_get(Eo *obj EINA_UNUSED, Ecore_Con_Server_Data *svr)
{
if (svr->created) return -1;
if (svr->delete_me) return -1;
@ -917,7 +917,7 @@ _ecore_con_server_ecore_con_fd_get(Eo *obj EINA_UNUSED, Ecore_Con_Server_Data *s
}
EOLIAN static int
_ecore_con_client_ecore_con_fd_get(Eo *obj EINA_UNUSED, Ecore_Con_Client_Data *cl)
_ecore_con_client_ecore_con_base_fd_get(Eo *obj EINA_UNUSED, Ecore_Con_Client_Data *cl)
{
return ecore_main_fd_handler_fd_get(cl->fd_handler);
}
@ -971,7 +971,7 @@ ecore_con_event_server_add(Ecore_Con_Server *obj)
if (svr->upgrade) ev = ECORE_CON_EVENT_SERVER_UPGRADE;
ecore_event_add(ev, e,
_ecore_con_event_server_add_free, NULL);
eo_do(obj, eo_event_callback_call(ECORE_CON_EVENT_CONNECTION_UPGRADED, NULL));
eo_do(obj, eo_event_callback_call(ECORE_CON_BASE_EVENT_CONNECTION_UPGRADED, NULL));
_ecore_con_event_count++;
}
@ -1050,7 +1050,7 @@ ecore_con_event_server_data(Ecore_Con_Server *obj, unsigned char *buf, int num,
Ecore_Con_Event_Data_Received event_info = { 0 };
event_info.data = e->data;
event_info.size = e->size;
eo_do(obj, eo_event_callback_call(ECORE_CON_EVENT_DATA_RECEIVED, &event_info));
eo_do(obj, eo_event_callback_call(ECORE_CON_BASE_EVENT_DATA_RECEIVED, &event_info));
}
_ecore_con_event_count++;
}
@ -1075,7 +1075,7 @@ ecore_con_event_client_add(Ecore_Con_Client *obj)
if (cl->upgrade) ev = ECORE_CON_EVENT_CLIENT_UPGRADE;
ecore_event_add(ev, e,
(Ecore_End_Cb)_ecore_con_event_client_add_free, cl->host_server);
eo_do(obj, eo_event_callback_call(ECORE_CON_EVENT_CONNECTION_UPGRADED, NULL));
eo_do(obj, eo_event_callback_call(ECORE_CON_BASE_EVENT_CONNECTION_UPGRADED, NULL));
_ecore_con_event_count++;
}
@ -1157,7 +1157,7 @@ ecore_con_event_client_data(Ecore_Con_Client *obj, unsigned char *buf, int num,
Ecore_Con_Event_Data_Received event_info = { 0 };
event_info.data = e->data;
event_info.size = e->size;
eo_do(obj, eo_event_callback_call(ECORE_CON_EVENT_DATA_RECEIVED, &event_info));
eo_do(obj, eo_event_callback_call(ECORE_CON_BASE_EVENT_DATA_RECEIVED, &event_info));
}
_ecore_con_event_count++;
}
@ -1183,7 +1183,7 @@ _ecore_con_event_server_error(Ecore_Con_Server *obj, char *error, Eina_Bool dupl
DBG("%s", error);
svr->event_count = eina_list_append(svr->event_count, e);
ecore_event_add(ECORE_CON_EVENT_SERVER_ERROR, e, (Ecore_End_Cb)_ecore_con_event_server_error_free, NULL);
eo_do(obj, eo_event_callback_call(ECORE_CON_EVENT_CONNECTION_ERROR, e->error));
eo_do(obj, eo_event_callback_call(ECORE_CON_BASE_EVENT_CONNECTION_ERROR, e->error));
_ecore_con_event_count++;
}
@ -1204,7 +1204,7 @@ ecore_con_event_client_error(Ecore_Con_Client *obj, const char *error)
cl->event_count = eina_list_append(cl->event_count, e);
host_server->event_count = eina_list_append(host_server->event_count, e);
ecore_event_add(ECORE_CON_EVENT_CLIENT_ERROR, e, (Ecore_End_Cb)_ecore_con_event_client_error_free, cl->host_server);
eo_do(obj, eo_event_callback_call(ECORE_CON_EVENT_CONNECTION_ERROR, e->error));
eo_do(obj, eo_event_callback_call(ECORE_CON_BASE_EVENT_CONNECTION_ERROR, e->error));
_ecore_con_event_count++;
}
@ -2770,6 +2770,6 @@ _ecore_con_lookup_done(void *data,
free(svr);
}
#include "ecore_con.eo.c"
#include "ecore_con_base.eo.c"
#include "ecore_con_client.eo.c"
#include "ecore_con_server.eo.c"

View File

@ -1,4 +1,5 @@
abstract Ecore.Con (Eo.Base) {
abstract Ecore.Con.Base (Eo.Base) {
legacy_prefix: ecore_con;
eo_prefix: ecore_con_obj;
data: null;
properties {

View File

@ -1,4 +1,4 @@
class Ecore.Con.Client (Ecore.Con) {
class Ecore.Con.Client (Ecore.Con.Base) {
eo_prefix: ecore_con_client_obj;
properties {
server {
@ -16,15 +16,15 @@ class Ecore.Con.Client (Ecore.Con) {
}
implements {
Eo.Base.destructor;
Ecore.Con.ip.get;
Ecore.Con.uptime.get;
Ecore.Con.port.get;
Ecore.Con.fd.get;
Ecore.Con.connected.get;
Ecore.Con.timeout.set;
Ecore.Con.timeout.get;
Ecore.Con.flush;
Ecore.Con.send;
Ecore.Con.Base.ip.get;
Ecore.Con.Base.uptime.get;
Ecore.Con.Base.port.get;
Ecore.Con.Base.fd.get;
Ecore.Con.Base.connected.get;
Ecore.Con.Base.timeout.set;
Ecore.Con.Base.timeout.get;
Ecore.Con.Base.flush;
Ecore.Con.Base.send;
}
}

View File

@ -1,5 +1,5 @@
/* FIXME: make abstract. */
class Ecore.Con.Server (Ecore.Con) {
class Ecore.Con.Server (Ecore.Con.Base) {
eo_prefix: ecore_con_server_obj;
properties {
name {
@ -49,20 +49,21 @@ class Ecore.Con.Server (Ecore.Con) {
get {
}
values {
const(Eina_List <const(Ecore.Con.Client) *>) *clients; /*@ The list of clients on this server. */
/* FIXME: Change to Ecore.Con.Client when eolian cycle bug is fixed. */
const(Eina_List <const(Ecore.Con.Base) *>) *clients; /*@ The list of clients on this server. */
}
}
}
implements {
Eo.Base.destructor;
Ecore.Con.ip.get;
Ecore.Con.uptime.get;
Ecore.Con.port.get;
Ecore.Con.fd.get;
Ecore.Con.connected.get;
Ecore.Con.timeout.set;
Ecore.Con.timeout.get;
Ecore.Con.flush;
Ecore.Con.send;
Ecore.Con.Base.ip.get;
Ecore.Con.Base.uptime.get;
Ecore.Con.Base.port.get;
Ecore.Con.Base.fd.get;
Ecore.Con.Base.connected.get;
Ecore.Con.Base.timeout.set;
Ecore.Con.Base.timeout.get;
Ecore.Con.Base.flush;
Ecore.Con.Base.send;
}
}