summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Hacohen <tom@stosb.com>2014-08-22 11:11:41 +0100
committerTom Hacohen <tom@stosb.com>2014-08-22 17:00:49 +0100
commit218e76fd30835b99ef1d76294f7167e6e9789df7 (patch)
tree4fec5ebce96e867bf8a0d9dca634af783da45214
parentc562b3858858b6443049dd3150bd3c3be76c9bb1 (diff)
Ecore con: Start migration to eo.
-rw-r--r--src/Makefile.am4
-rw-r--r--src/Makefile_Ecore_Con.am17
-rw-r--r--src/lib/ecore_con/Ecore_Con.h30
-rw-r--r--src/lib/ecore_con/Ecore_Con_Eo.h1
-rw-r--r--src/lib/ecore_con/Ecore_Con_Legacy.h1
-rw-r--r--src/lib/ecore_con/ecore_con.c7
-rw-r--r--src/lib/ecore_con/ecore_con.eo166
7 files changed, 199 insertions, 27 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 6c5e02b3d4..689a55fa69 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -7,7 +7,9 @@ EOLIAN_FLAGS = \
7 -I$(srcdir)/lib/evas/canvas \ 7 -I$(srcdir)/lib/evas/canvas \
8 -I$(srcdir)/lib/edje \ 8 -I$(srcdir)/lib/edje \
9 -I$(srcdir)/lib/efl/interfaces \ 9 -I$(srcdir)/lib/efl/interfaces \
10 -I$(srcdir)/lib/ecore_audio 10 -I$(srcdir)/lib/ecore_audio \
11 -I$(srcdir)/lib/ecore \
12 -I$(srcdir)/lib/ecore_con
11 13
12ELUA_GEN_FLAGS = 14ELUA_GEN_FLAGS =
13 15
diff --git a/src/Makefile_Ecore_Con.am b/src/Makefile_Ecore_Con.am
index 9a5c2e88ab..5fa1d7ba90 100644
--- a/src/Makefile_Ecore_Con.am
+++ b/src/Makefile_Ecore_Con.am
@@ -1,13 +1,30 @@
1 1
2### Library 2### Library
3 3
4BUILT_SOURCES += \
5 lib/ecore_con/ecore_con.eo.c \
6 lib/ecore_con/ecore_con.eo.h \
7 lib/ecore_con/ecore_con.eo.legacy.h
8
9ecoreconeolianfilesdir = $(datadir)/eolian/include/ecore-@VMAJ@
10ecoreconeolianfiles_DATA = \
11 lib/ecore_con/ecore_con.eo
12
13EXTRA_DIST += \
14 ${ecoreconeolianfiles_DATA}
15
4lib_LTLIBRARIES += lib/ecore_con/libecore_con.la 16lib_LTLIBRARIES += lib/ecore_con/libecore_con.la
5 17
6installed_ecoreconmainheadersdir = $(includedir)/ecore-con-@VMAJ@ 18installed_ecoreconmainheadersdir = $(includedir)/ecore-con-@VMAJ@
7dist_installed_ecoreconmainheaders_DATA = \ 19dist_installed_ecoreconmainheaders_DATA = \
8lib/ecore_con/Ecore_Con.h \ 20lib/ecore_con/Ecore_Con.h \
21lib/ecore_con/Ecore_Con_Legacy.h \
22lib/ecore_con/Ecore_Con_Eo.h \
9lib/ecore_con/Ecore_Con_Eet.h 23lib/ecore_con/Ecore_Con_Eet.h
10 24
25nodist_installed_ecoreconmainheaders_DATA = \
26 lib/ecore_con/ecore_con.eo.h
27
11lib_ecore_con_libecore_con_la_SOURCES = \ 28lib_ecore_con_libecore_con_la_SOURCES = \
12lib/ecore_con/ecore_con_alloc.c \ 29lib/ecore_con/ecore_con_alloc.c \
13lib/ecore_con/ecore_con.c \ 30lib/ecore_con/ecore_con.c \
diff --git a/src/lib/ecore_con/Ecore_Con.h b/src/lib/ecore_con/Ecore_Con.h
index a75c8105ad..cea43437e4 100644
--- a/src/lib/ecore_con/Ecore_Con.h
+++ b/src/lib/ecore_con/Ecore_Con.h
@@ -9,6 +9,7 @@
9# include <netdb.h> 9# include <netdb.h>
10#endif 10#endif
11#include <Eina.h> 11#include <Eina.h>
12#include <Eo.h>
12 13
13#ifdef EAPI 14#ifdef EAPI
14# undef EAPI 15# undef EAPI
@@ -686,28 +687,6 @@ EAPI int ecore_con_init(void);
686EAPI int ecore_con_shutdown(void); 687EAPI int ecore_con_shutdown(void);
687 688
688/** 689/**
689 * Do an asynchronous DNS lookup.
690 *
691 * @param name IP address or server name to translate.
692 * @param done_cb Callback to notify when done.
693 * @param data User data to be given to done_cb.
694 * @return @c EINA_TRUE if the request did not fail to be set up, @c EINA_FALSE
695 * if it failed.
696 *
697 * This function performs a DNS lookup on the hostname specified by @p name,
698 * then calls @p done_cb with the result and the @p data given as parameter.
699 * The result will be given to the @p done_cb as follows:
700 * @li @c canonname - the canonical name of the address
701 * @li @c ip - the resolved ip address
702 * @li @c addr - a pointer to the socket address
703 * @li @c addrlen - the length of the socket address, in bytes
704 * @li @c data - the data pointer given as parameter to ecore_con_lookup()
705 */
706EAPI Eina_Bool ecore_con_lookup(const char *name,
707 Ecore_Con_Dns_Cb done_cb,
708 const void *data);
709
710/**
711 * @} 690 * @}
712 */ 691 */
713 692
@@ -1950,6 +1929,13 @@ EAPI int ecore_con_url_status_code_get(Ecore_Con_Url *url_con);
1950 * @} 1929 * @}
1951 */ 1930 */
1952 1931
1932#ifndef EFL_NOLEGACY_API_SUPPORT
1933#include "Ecore_Con_Legacy.h"
1934#endif
1935#ifdef EFL_EO_API_SUPPORT
1936#include "Ecore_Con_Eo.h"
1937#endif
1938
1953#ifdef __cplusplus 1939#ifdef __cplusplus
1954} 1940}
1955#endif 1941#endif
diff --git a/src/lib/ecore_con/Ecore_Con_Eo.h b/src/lib/ecore_con/Ecore_Con_Eo.h
new file mode 100644
index 0000000000..b5d6095777
--- /dev/null
+++ b/src/lib/ecore_con/Ecore_Con_Eo.h
@@ -0,0 +1 @@
#include "ecore_con.eo.h"
diff --git a/src/lib/ecore_con/Ecore_Con_Legacy.h b/src/lib/ecore_con/Ecore_Con_Legacy.h
new file mode 100644
index 0000000000..378bbba1dd
--- /dev/null
+++ b/src/lib/ecore_con/Ecore_Con_Legacy.h
@@ -0,0 +1 @@
#include "ecore_con.eo.legacy.h"
diff --git a/src/lib/ecore_con/ecore_con.c b/src/lib/ecore_con/ecore_con.c
index 22dd887dc1..a30267299d 100644
--- a/src/lib/ecore_con/ecore_con.c
+++ b/src/lib/ecore_con/ecore_con.c
@@ -269,10 +269,8 @@ ecore_con_shutdown(void)
269 return _ecore_con_init_count; 269 return _ecore_con_init_count;
270} 270}
271 271
272EAPI Eina_Bool 272EOLIAN static Eina_Bool
273ecore_con_lookup(const char *name, 273_ecore_con_lookup(Eo *obj EINA_UNUSED, void *pd EINA_UNUSED, const char *name, Ecore_Con_Dns_Cb done_cb, const void *data)
274 Ecore_Con_Dns_Cb done_cb,
275 const void *data)
276{ 274{
277 Ecore_Con_Server *svr; 275 Ecore_Con_Server *svr;
278 Ecore_Con_Lookup *lk; 276 Ecore_Con_Lookup *lk;
@@ -2725,3 +2723,4 @@ _ecore_con_lookup_done(void *data,
2725 free(svr); 2723 free(svr);
2726} 2724}
2727 2725
2726#include "ecore_con.eo.c"
diff --git a/src/lib/ecore_con/ecore_con.eo b/src/lib/ecore_con/ecore_con.eo
new file mode 100644
index 0000000000..8a685dee6a
--- /dev/null
+++ b/src/lib/ecore_con/ecore_con.eo
@@ -0,0 +1,166 @@
1abstract Ecore.Con (Eo.Base) {
2 eo_prefix: ecore_con_obj;
3 data: null;
4 properties {
5 ip {
6 /**
7 * Control the IP address of a server that has been connected to.
8 *
9 * The param is a pointer to an internal string that contains the IP address of
10 * the connected server in the form "XXX.YYY.ZZZ.AAA" IP notation.
11 * This string should not be modified or trusted to stay valid after
12 * deletion for the @p svr object. If no IP is known @c NULL is
13 * returned.
14 */
15 get {
16 legacy: null;
17 }
18 values {
19 const(char)* ip; /*@ The IP address */
20 }
21 }
22 uptime {
23 /*@
24 * @brief Check how long the object has been connected
25 *
26 * This function is used to find out how long a client has been connected for.
27 */
28 get {
29 legacy: null;
30 }
31 values {
32 double uptime; /*@ The total time, in seconds, that the object has been connected. */
33 }
34 }
35 port {
36 /*@
37 * @brief Return the port that the obj is connected to
38 *
39 */
40 get {
41 legacy: null;
42 }
43 values {
44 int port; /*@ The The port that obj is connected to, or -1 on error. */
45 }
46 }
47 fd {
48 /*@
49 * Get the fd that the server is connected to
50 *
51 * This function returns the fd which is used by the underlying server connection.
52 * It should not be tampered with unless you REALLY know what you are doing.
53 * @note This function is only valid for servers created with ecore_con_server_connect()
54 * @warning Seriously. Don't use this unless you know what you are doing.
55 * @since 1.1
56 */
57 get {
58 legacy: null;
59 }
60 values {
61 int fd; /*@ The fd, or -1 on failure. */
62 }
63 }
64 connected {
65 /*@
66 * Returns whether the client is still connected
67 */
68 get {
69 legacy: null;
70 }
71 values {
72 bool connected; /*@ Returns True if connected, False otherwise. */
73 }
74 }
75 timeout {
76 /*@
77 * Control the default time after which an inactive client will be disconnected
78 *
79 * This function is used by the server to set the default idle timeout on
80 * clients. If the any of the clients becomes idle for a time higher than this
81 * value, it will be disconnected. A value of < 1 disables the idle timeout.
82 *
83 * This timeout is not affected by the one set by
84 * ecore_con_client_timeout_set(). A client will be disconnected whenever the
85 * client or the server timeout is reached. That means, the lower timeout value
86 * will be used for that client if ecore_con_client_timeout_set() is used on it.
87 */
88 set {
89 legacy: null;
90 }
91 get {
92 legacy: null;
93 }
94 values {
95 double timeout; /*@ The timeout, in seconds, to disconnect after. */
96 }
97 }
98 }
99 methods {
100 flush {
101 /*@
102 * Flushes all pending data to the given server.
103 *
104 * This function will block until all data is sent to the server.
105 */
106 legacy: null;
107 }
108 send {
109 /**
110 * Sends the given data to the given server.
111 *
112 * This function will send the given data to the server as soon as the program
113 * is back to the main loop. Thus, this function returns immediately
114 * (non-blocking). If the data needs to be sent @b now, call
115 * ecore_con_server_flush() after this one.
116 *
117 * @see ecore_con_client_send()
118 * @see ecore_con_server_flush()
119 */
120 legacy: null;
121
122 params {
123 const(void)* data; /*@ The given data */
124 int size; /*@ Length of the data, in bytes. */
125 }
126 return: int; /*@ The number of bytes sent. @c 0 will be returned if there is an error. */
127 }
128 lookup @class {
129 /*@
130 * Do an asynchronous DNS lookup.
131 *
132 * @param name IP address or server name to translate.
133 * @param done_cb Callback to notify when done.
134 * @param data User data to be given to done_cb.
135 * @return @c EINA_TRUE if the request did not fail to be set up, @c EINA_FALSE
136 * if it failed.
137 *
138 * This function performs a DNS lookup on the hostname specified by @p name,
139 * then calls @p done_cb with the result and the @p data given as parameter.
140 * The result will be given to the @p done_cb as follows:
141 * @li @c canonname - the canonical name of the address
142 * @li @c ip - the resolved ip address
143 * @li @c addr - a pointer to the socket address
144 * @li @c addrlen - the length of the socket address, in bytes
145 * @li @c data - the data pointer given as parameter to ecore_con_lookup()
146 */
147 params {
148 const(char)* name @nonull; /*@ Hostname to lookup. */
149 Ecore_Con_Dns_Cb done_cb; /*@ The callback to be called wehn lookup is done. */
150 const(void)* data; /*@ User data for the callback. */
151 }
152 return: bool;
153 }
154 }
155 implements {
156 virtual.ip.get;
157 virtual.uptime.get;
158 virtual.port.get;
159 virtual.fd.get;
160 virtual.connected.get;
161 virtual.timeout.set;
162 virtual.timeout.get;
163 virtual.flush;
164 virtual.send;
165 }
166}