summaryrefslogtreecommitdiff
path: root/src/lib/ecore_con/ecore_con.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/ecore_con/ecore_con.c')
-rw-r--r--src/lib/ecore_con/ecore_con.c75
1 files changed, 33 insertions, 42 deletions
diff --git a/src/lib/ecore_con/ecore_con.c b/src/lib/ecore_con/ecore_con.c
index a08a151..8dd9d82 100644
--- a/src/lib/ecore_con/ecore_con.c
+++ b/src/lib/ecore_con/ecore_con.c
@@ -109,7 +109,7 @@ static const char *_ecore_con_pretty_ip(struct sockaddr *client_addr);
109 109
110#define EO_CONSTRUCTOR_CHECK_RETURN(obj) do { \ 110#define EO_CONSTRUCTOR_CHECK_RETURN(obj) do { \
111 Eina_Bool finalized; \ 111 Eina_Bool finalized; \
112 if (eo_do_ret(obj, finalized, eo_finalized_get())) \ 112 if (eo_finalized_get(obj)) \
113 { \ 113 { \
114 ERR("This function is only allowed during construction."); \ 114 ERR("This function is only allowed during construction."); \
115 return; \ 115 return; \
@@ -306,10 +306,7 @@ _efl_network_base_lookup(Eo *kls_obj EINA_UNUSED, void *pd EINA_UNUSED, const ch
306 if (!name || !done_cb) 306 if (!name || !done_cb)
307 return EINA_FALSE; 307 return EINA_FALSE;
308 308
309 obj = eo_add(EFL_NETWORK_CONNECTOR_CLASS, NULL, 309 obj = eo_add(EFL_NETWORK_CONNECTOR_CLASS, NULL, efl_network_server_connection_type_set(eoid, ECORE_CON_REMOTE_TCP), efl_network_server_name_set(eoid, name), efl_network_base_port_set(eoid, 1025));
310 efl_network_server_connection_type_set(ECORE_CON_REMOTE_TCP),
311 efl_network_server_name_set(name),
312 efl_network_base_port_set(1025));
313 310
314 lk = malloc(sizeof (Ecore_Con_Lookup)); 311 lk = malloc(sizeof (Ecore_Con_Lookup));
315 if (!lk) 312 if (!lk)
@@ -363,10 +360,7 @@ ecore_con_server_add(Ecore_Con_Type compl_type,
363 360
364 /* local system socket: FILE: /tmp/.ecore_service|[name]|[port] */ 361 /* local system socket: FILE: /tmp/.ecore_service|[name]|[port] */
365 /* remote system socket: TCP/IP: [name]:[port] */ 362 /* remote system socket: TCP/IP: [name]:[port] */
366 obj = eo_add(EFL_NETWORK_SERVER_CLASS, NULL, 363 obj = eo_add(EFL_NETWORK_SERVER_CLASS, NULL, efl_network_server_connection_type_set(eoid, compl_type), efl_network_server_name_set(eoid, name), efl_network_base_port_set(eoid, port));
367 efl_network_server_connection_type_set(compl_type),
368 efl_network_server_name_set(name),
369 efl_network_base_port_set(port));
370 364
371 ecore_con_server_data_set(obj, (void *) data); 365 ecore_con_server_data_set(obj, (void *) data);
372 366
@@ -376,7 +370,7 @@ ecore_con_server_add(Ecore_Con_Type compl_type,
376EOLIAN static Eo * 370EOLIAN static Eo *
377_efl_network_server_eo_base_constructor(Ecore_Con_Server *obj, Efl_Network_Server_Data *svr) 371_efl_network_server_eo_base_constructor(Ecore_Con_Server *obj, Efl_Network_Server_Data *svr)
378{ 372{
379 obj = eo_do_super_ret(obj, EFL_NETWORK_SERVER_CLASS, obj, eo_constructor()); 373 obj = eo_constructor(eo_super(obj, EFL_NETWORK_SERVER_CLASS));
380 374
381 svr->fd = -1; 375 svr->fd = -1;
382 svr->reject_excess_clients = EINA_FALSE; 376 svr->reject_excess_clients = EINA_FALSE;
@@ -392,7 +386,7 @@ _efl_network_server_eo_base_finalize(Ecore_Con_Server *obj, Efl_Network_Server_D
392 Ecore_Con_Type compl_type = svr->type; 386 Ecore_Con_Type compl_type = svr->type;
393 Ecore_Con_Type type; 387 Ecore_Con_Type type;
394 388
395 eo_do_super(obj, EFL_NETWORK_SERVER_CLASS, eo_finalize()); 389 eo_finalize(eo_super(obj, EFL_NETWORK_SERVER_CLASS));
396 390
397 svr->created = EINA_TRUE; 391 svr->created = EINA_TRUE;
398 svr->ppid = getpid(); 392 svr->ppid = getpid();
@@ -462,10 +456,7 @@ ecore_con_server_connect(Ecore_Con_Type compl_type,
462 /* local user socket: FILE: ~/.ecore/[name]/[port] */ 456 /* local user socket: FILE: ~/.ecore/[name]/[port] */
463 /* local system socket: FILE: /tmp/.ecore_service|[name]|[port] */ 457 /* local system socket: FILE: /tmp/.ecore_service|[name]|[port] */
464 /* remote system socket: TCP/IP: [name]:[port] */ 458 /* remote system socket: TCP/IP: [name]:[port] */
465 obj = eo_add(EFL_NETWORK_CONNECTOR_CLASS, NULL, 459 obj = eo_add(EFL_NETWORK_CONNECTOR_CLASS, NULL, efl_network_server_connection_type_set(eoid, compl_type), efl_network_server_name_set(eoid, name), efl_network_base_port_set(eoid, port));
466 efl_network_server_connection_type_set(compl_type),
467 efl_network_server_name_set(name),
468 efl_network_base_port_set(port));
469 460
470 ecore_con_server_data_set(obj, (void *) data); 461 ecore_con_server_data_set(obj, (void *) data);
471 462
@@ -481,7 +472,7 @@ _efl_network_connector_eo_base_finalize(Ecore_Con_Server *obj, void *pd EINA_UNU
481 472
482 /* XXX: We intentionally put SERVER class here and not connector, as we'd 473 /* XXX: We intentionally put SERVER class here and not connector, as we'd
483 * like to skip that one. */ 474 * like to skip that one. */
484 eo_do_super(obj, EFL_NETWORK_SERVER_CLASS, eo_finalize()); 475 eo_finalize(eo_super(obj, EFL_NETWORK_SERVER_CLASS));
485 476
486 svr->use_cert = (compl_type & ECORE_CON_SSL & ECORE_CON_LOAD_CERT) == ECORE_CON_LOAD_CERT; 477 svr->use_cert = (compl_type & ECORE_CON_SSL & ECORE_CON_LOAD_CERT) == ECORE_CON_LOAD_CERT;
487 svr->disable_proxy = (compl_type & ECORE_CON_SUPER_SSL & ECORE_CON_NO_PROXY) == ECORE_CON_NO_PROXY; 478 svr->disable_proxy = (compl_type & ECORE_CON_SUPER_SSL & ECORE_CON_NO_PROXY) == ECORE_CON_NO_PROXY;
@@ -548,7 +539,7 @@ error:
548EAPI void 539EAPI void
549ecore_con_server_timeout_set(Ecore_Con *obj, double timeout) 540ecore_con_server_timeout_set(Ecore_Con *obj, double timeout)
550{ 541{
551 eo_do((Ecore_Con *)obj, efl_network_base_timeout_set(timeout)); 542 efl_network_base_timeout_set((Ecore_Con *)obj, timeout);
552} 543}
553 544
554EOLIAN static void 545EOLIAN static void
@@ -566,7 +557,7 @@ EAPI double
566ecore_con_server_timeout_get(const Ecore_Con *obj) 557ecore_con_server_timeout_get(const Ecore_Con *obj)
567{ 558{
568 double ret; 559 double ret;
569 return eo_do_ret((Ecore_Con *)obj, ret, efl_network_base_timeout_get()); 560 return efl_network_base_timeout_get((Ecore_Con *)obj);
570} 561}
571 562
572EOLIAN static double 563EOLIAN static double
@@ -620,7 +611,7 @@ EAPI Eina_Bool
620ecore_con_server_connected_get(const Ecore_Con *obj) 611ecore_con_server_connected_get(const Ecore_Con *obj)
621{ 612{
622 Eina_Bool ret; 613 Eina_Bool ret;
623 return eo_do_ret((Ecore_Con *)obj, ret, efl_network_base_connected_get()); 614 return efl_network_base_connected_get((Ecore_Con *)obj);
624} 615}
625 616
626EOLIAN static Eina_Bool 617EOLIAN static Eina_Bool
@@ -670,7 +661,7 @@ EAPI int
670ecore_con_server_port_get(const Ecore_Con *obj) 661ecore_con_server_port_get(const Ecore_Con *obj)
671{ 662{
672 int ret; 663 int ret;
673 return eo_do_ret((Ecore_Con *)obj, ret, efl_network_base_port_get()); 664 return efl_network_base_port_get((Ecore_Con *)obj);
674} 665}
675 666
676EOLIAN static void 667EOLIAN static void
@@ -691,7 +682,7 @@ EAPI int
691ecore_con_server_send(Ecore_Con *obj, const void *data, int size) 682ecore_con_server_send(Ecore_Con *obj, const void *data, int size)
692{ 683{
693 int ret; 684 int ret;
694 return eo_do_ret((Ecore_Con *)obj, ret, efl_network_base_send(data, size)); 685 return efl_network_base_send((Ecore_Con *)obj, data, size);
695} 686}
696 687
697EOLIAN static int 688EOLIAN static int
@@ -748,7 +739,7 @@ EAPI const char *
748ecore_con_server_ip_get(const Ecore_Con *obj) 739ecore_con_server_ip_get(const Ecore_Con *obj)
749{ 740{
750 const char *ret; 741 const char *ret;
751 return eo_do_ret(obj, ret, efl_network_base_ip_get()); 742 return efl_network_base_ip_get(obj);
752} 743}
753 744
754EOLIAN static const char * 745EOLIAN static const char *
@@ -761,7 +752,7 @@ EAPI double
761ecore_con_server_uptime_get(const Ecore_Con *obj) 752ecore_con_server_uptime_get(const Ecore_Con *obj)
762{ 753{
763 double ret; 754 double ret;
764 return eo_do_ret(obj, ret, efl_network_base_uptime_get()); 755 return efl_network_base_uptime_get(obj);
765} 756}
766 757
767EOLIAN static double 758EOLIAN static double
@@ -773,7 +764,7 @@ _efl_network_server_efl_network_base_uptime_get(Eo *obj EINA_UNUSED, Efl_Network
773EAPI void 764EAPI void
774ecore_con_server_flush(Ecore_Con *obj) 765ecore_con_server_flush(Ecore_Con *obj)
775{ 766{
776 eo_do((Ecore_Con *)obj, efl_network_base_flush()); 767 efl_network_base_flush((Ecore_Con *)obj);
777} 768}
778 769
779EOLIAN static void 770EOLIAN static void
@@ -803,7 +794,7 @@ EAPI int
803ecore_con_client_send(Ecore_Con *obj, const void *data, int size) 794ecore_con_client_send(Ecore_Con *obj, const void *data, int size)
804{ 795{
805 int ret; 796 int ret;
806 return eo_do_ret((Ecore_Con *)obj, ret, efl_network_base_send(data, size)); 797 return efl_network_base_send((Ecore_Con *)obj, data, size);
807} 798}
808 799
809EOLIAN static int 800EOLIAN static int
@@ -871,7 +862,7 @@ EAPI Eina_Bool
871ecore_con_client_connected_get(const Ecore_Con *obj) 862ecore_con_client_connected_get(const Ecore_Con *obj)
872{ 863{
873 Eina_Bool ret; 864 Eina_Bool ret;
874 return eo_do_ret((Ecore_Con *)obj, ret, efl_network_base_connected_get()); 865 return efl_network_base_connected_get((Ecore_Con *)obj);
875} 866}
876 867
877EOLIAN static void 868EOLIAN static void
@@ -885,7 +876,7 @@ _efl_network_client_efl_network_base_timeout_set(Eo *obj, Efl_Network_Client_Dat
885EAPI void 876EAPI void
886ecore_con_client_timeout_set(Ecore_Con *obj, double timeout) 877ecore_con_client_timeout_set(Ecore_Con *obj, double timeout)
887{ 878{
888 eo_do((Ecore_Con *)obj, efl_network_base_timeout_set(timeout)); 879 efl_network_base_timeout_set((Ecore_Con *)obj, timeout);
889} 880}
890 881
891EOLIAN static double 882EOLIAN static double
@@ -898,7 +889,7 @@ EAPI double
898ecore_con_client_timeout_get(const Ecore_Con *obj) 889ecore_con_client_timeout_get(const Ecore_Con *obj)
899{ 890{
900 double ret; 891 double ret;
901 return eo_do_ret((Ecore_Con *)obj, ret, efl_network_base_timeout_get()); 892 return efl_network_base_timeout_get((Ecore_Con *)obj);
902} 893}
903 894
904EAPI void * 895EAPI void *
@@ -950,7 +941,7 @@ EAPI const char *
950ecore_con_client_ip_get(const Ecore_Con *obj) 941ecore_con_client_ip_get(const Ecore_Con *obj)
951{ 942{
952 const char *ret; 943 const char *ret;
953 return eo_do_ret(obj, ret, efl_network_base_ip_get()); 944 return efl_network_base_ip_get(obj);
954} 945}
955 946
956EOLIAN static int 947EOLIAN static int
@@ -978,7 +969,7 @@ EAPI int
978ecore_con_client_port_get(const Ecore_Con *obj) 969ecore_con_client_port_get(const Ecore_Con *obj)
979{ 970{
980 int ret; 971 int ret;
981 return eo_do_ret((Ecore_Con *)obj, ret, efl_network_base_port_get()); 972 return efl_network_base_port_get((Ecore_Con *)obj);
982} 973}
983 974
984EOLIAN static double 975EOLIAN static double
@@ -991,7 +982,7 @@ EAPI double
991ecore_con_client_uptime_get(const Ecore_Con *obj) 982ecore_con_client_uptime_get(const Ecore_Con *obj)
992{ 983{
993 double ret; 984 double ret;
994 return eo_do_ret(obj, ret, efl_network_base_uptime_get()); 985 return efl_network_base_uptime_get(obj);
995} 986}
996 987
997EOLIAN static void 988EOLIAN static void
@@ -1003,14 +994,14 @@ _efl_network_client_efl_network_base_flush(Eo *obj, Efl_Network_Client_Data *cl
1003EAPI void 994EAPI void
1004ecore_con_client_flush(Ecore_Con *obj) 995ecore_con_client_flush(Ecore_Con *obj)
1005{ 996{
1006 eo_do((Ecore_Con *)obj, efl_network_base_flush()); 997 efl_network_base_flush((Ecore_Con *)obj);
1007} 998}
1008 999
1009EAPI int 1000EAPI int
1010ecore_con_server_fd_get(const Ecore_Con *obj) 1001ecore_con_server_fd_get(const Ecore_Con *obj)
1011{ 1002{
1012 int ret; 1003 int ret;
1013 return eo_do_ret((Ecore_Con *)obj, ret, efl_network_base_fd_get()); 1004 return efl_network_base_fd_get((Ecore_Con *)obj);
1014} 1005}
1015 1006
1016EOLIAN static int 1007EOLIAN static int
@@ -1031,7 +1022,7 @@ EAPI int
1031ecore_con_client_fd_get(const Ecore_Con *obj) 1022ecore_con_client_fd_get(const Ecore_Con *obj)
1032{ 1023{
1033 int ret; 1024 int ret;
1034 return eo_do_ret((Ecore_Con *)obj, ret, efl_network_base_fd_get()); 1025 return efl_network_base_fd_get((Ecore_Con *)obj);
1035} 1026}
1036 1027
1037/** 1028/**
@@ -1077,7 +1068,7 @@ ecore_con_event_server_add(Ecore_Con_Server *obj)
1077 if (svr->upgrade) ev = ECORE_CON_EVENT_SERVER_UPGRADE; 1068 if (svr->upgrade) ev = ECORE_CON_EVENT_SERVER_UPGRADE;
1078 ecore_event_add(ev, e, 1069 ecore_event_add(ev, e,
1079 _ecore_con_event_server_add_free, NULL); 1070 _ecore_con_event_server_add_free, NULL);
1080 eo_do(obj, eo_event_callback_call(EFL_NETWORK_BASE_EVENT_CONNECTION_UPGRADED, NULL)); 1071 eo_event_callback_call(obj, EFL_NETWORK_BASE_EVENT_CONNECTION_UPGRADED, NULL);
1081 _ecore_con_event_count++; 1072 _ecore_con_event_count++;
1082} 1073}
1083 1074
@@ -1156,7 +1147,7 @@ ecore_con_event_server_data(Ecore_Con_Server *obj, unsigned char *buf, int num,
1156 Ecore_Con_Event_Data_Received event_info = { NULL, 0 }; 1147 Ecore_Con_Event_Data_Received event_info = { NULL, 0 };
1157 event_info.data = e->data; 1148 event_info.data = e->data;
1158 event_info.size = e->size; 1149 event_info.size = e->size;
1159 eo_do(obj, eo_event_callback_call(EFL_NETWORK_BASE_EVENT_DATA_RECEIVED, &event_info)); 1150 eo_event_callback_call(obj, EFL_NETWORK_BASE_EVENT_DATA_RECEIVED, &event_info);
1160 } 1151 }
1161 _ecore_con_event_count++; 1152 _ecore_con_event_count++;
1162} 1153}
@@ -1181,7 +1172,7 @@ ecore_con_event_client_add(Ecore_Con_Client *obj)
1181 if (cl->upgrade) ev = ECORE_CON_EVENT_CLIENT_UPGRADE; 1172 if (cl->upgrade) ev = ECORE_CON_EVENT_CLIENT_UPGRADE;
1182 ecore_event_add(ev, e, 1173 ecore_event_add(ev, e,
1183 (Ecore_End_Cb)_ecore_con_event_client_add_free, cl->host_server); 1174 (Ecore_End_Cb)_ecore_con_event_client_add_free, cl->host_server);
1184 eo_do(obj, eo_event_callback_call(EFL_NETWORK_BASE_EVENT_CONNECTION_UPGRADED, NULL)); 1175 eo_event_callback_call(obj, EFL_NETWORK_BASE_EVENT_CONNECTION_UPGRADED, NULL);
1185 _ecore_con_event_count++; 1176 _ecore_con_event_count++;
1186} 1177}
1187 1178
@@ -1263,7 +1254,7 @@ ecore_con_event_client_data(Ecore_Con_Client *obj, unsigned char *buf, int num,
1263 Ecore_Con_Event_Data_Received event_info = { NULL, 0 }; 1254 Ecore_Con_Event_Data_Received event_info = { NULL, 0 };
1264 event_info.data = e->data; 1255 event_info.data = e->data;
1265 event_info.size = e->size; 1256 event_info.size = e->size;
1266 eo_do(obj, eo_event_callback_call(EFL_NETWORK_BASE_EVENT_DATA_RECEIVED, &event_info)); 1257 eo_event_callback_call(obj, EFL_NETWORK_BASE_EVENT_DATA_RECEIVED, &event_info);
1267 } 1258 }
1268 _ecore_con_event_count++; 1259 _ecore_con_event_count++;
1269} 1260}
@@ -1289,7 +1280,7 @@ _ecore_con_event_server_error(Ecore_Con_Server *obj, char *error, Eina_Bool dupl
1289 DBG("%s", error); 1280 DBG("%s", error);
1290 svr->event_count = eina_list_append(svr->event_count, e); 1281 svr->event_count = eina_list_append(svr->event_count, e);
1291 ecore_event_add(ECORE_CON_EVENT_SERVER_ERROR, e, (Ecore_End_Cb)_ecore_con_event_server_error_free, NULL); 1282 ecore_event_add(ECORE_CON_EVENT_SERVER_ERROR, e, (Ecore_End_Cb)_ecore_con_event_server_error_free, NULL);
1292 eo_do(obj, eo_event_callback_call(EFL_NETWORK_BASE_EVENT_CONNECTION_ERROR, e->error)); 1283 eo_event_callback_call(obj, EFL_NETWORK_BASE_EVENT_CONNECTION_ERROR, e->error);
1293 _ecore_con_event_count++; 1284 _ecore_con_event_count++;
1294} 1285}
1295 1286
@@ -1310,7 +1301,7 @@ ecore_con_event_client_error(Ecore_Con_Client *obj, const char *error)
1310 cl->event_count = eina_list_append(cl->event_count, e); 1301 cl->event_count = eina_list_append(cl->event_count, e);
1311 host_server->event_count = eina_list_append(host_server->event_count, e); 1302 host_server->event_count = eina_list_append(host_server->event_count, e);
1312 ecore_event_add(ECORE_CON_EVENT_CLIENT_ERROR, e, (Ecore_End_Cb)_ecore_con_event_client_error_free, cl->host_server); 1303 ecore_event_add(ECORE_CON_EVENT_CLIENT_ERROR, e, (Ecore_End_Cb)_ecore_con_event_client_error_free, cl->host_server);
1313 eo_do(obj, eo_event_callback_call(EFL_NETWORK_BASE_EVENT_CONNECTION_ERROR, e->error)); 1304 eo_event_callback_call(obj, EFL_NETWORK_BASE_EVENT_CONNECTION_ERROR, e->error);
1314 _ecore_con_event_count++; 1305 _ecore_con_event_count++;
1315} 1306}
1316 1307
@@ -1397,7 +1388,7 @@ _efl_network_server_eo_base_destructor(Eo *obj, Efl_Network_Server_Data *svr)
1397 servers = eina_list_remove(servers, obj); 1388 servers = eina_list_remove(servers, obj);
1398 svr->data = NULL; 1389 svr->data = NULL;
1399 1390
1400 eo_do_super(obj, EFL_NETWORK_SERVER_CLASS, eo_destructor()); 1391 eo_destructor(eo_super(obj, EFL_NETWORK_SERVER_CLASS));
1401end: 1392end:
1402 return; 1393 return;
1403} 1394}
@@ -1460,7 +1451,7 @@ _efl_network_client_eo_base_destructor(Eo *obj, Efl_Network_Client_Data *cl)
1460 eina_stringshare_del(cl->ip); 1451 eina_stringshare_del(cl->ip);
1461 cl->data = NULL; 1452 cl->data = NULL;
1462 1453
1463 eo_do_super(obj, EFL_NETWORK_CLIENT_CLASS, eo_destructor()); 1454 eo_destructor(eo_super(obj, EFL_NETWORK_CLIENT_CLASS));
1464} 1455}
1465 1456
1466static Eina_Bool 1457static Eina_Bool