summaryrefslogtreecommitdiff
path: root/src/lib/ecore_con/ecore_con_base.eo
diff options
context:
space:
mode:
authorTom Hacohen <tom@stosb.com>2014-08-22 17:31:33 +0100
committerTom Hacohen <tom@stosb.com>2014-08-22 17:37:56 +0100
commit974e3afabca3e2f740cae4b2bb9fbd02600d648e (patch)
tree6931d78a3916b36beda7f7d54745dd9c31dbc48e /src/lib/ecore_con/ecore_con_base.eo
parent9a8a416325708feffb21f719914775d2f748f099 (diff)
Ecore con: Rename to Ecore.Con.Base for the C++ bindings.
Diffstat (limited to 'src/lib/ecore_con/ecore_con_base.eo')
-rw-r--r--src/lib/ecore_con/ecore_con_base.eo195
1 files changed, 195 insertions, 0 deletions
diff --git a/src/lib/ecore_con/ecore_con_base.eo b/src/lib/ecore_con/ecore_con_base.eo
new file mode 100644
index 0000000..28afd15
--- /dev/null
+++ b/src/lib/ecore_con/ecore_con_base.eo
@@ -0,0 +1,195 @@
1abstract Ecore.Con.Base (Eo.Base) {
2 legacy_prefix: ecore_con;
3 eo_prefix: ecore_con_obj;
4 data: null;
5 properties {
6 ip {
7 /**
8 * Control the IP address of a server that has been connected to.
9 *
10 * The param is a pointer to an internal string that contains the IP address of
11 * the connected server in the form "XXX.YYY.ZZZ.AAA" IP notation.
12 * This string should not be modified or trusted to stay valid after
13 * deletion for the @p svr object. If no IP is known @c NULL is
14 * returned.
15 */
16 get {
17 legacy: null;
18 }
19 values {
20 const(char)* ip; /*@ The IP address */
21 }
22 }
23 uptime {
24 /*@
25 * @brief Check how long the object has been connected
26 *
27 * This function is used to find out how long a client has been connected for.
28 */
29 get {
30 legacy: null;
31 }
32 values {
33 double uptime; /*@ The total time, in seconds, that the object has been connected. */
34 }
35 }
36 port {
37 /*@
38 * @brief Return the port that the obj is connected to
39 *
40 */
41 get {
42 legacy: null;
43 }
44 values {
45 int port; /*@ The The port that obj is connected to, or -1 on error. */
46 }
47 }
48 fd {
49 /*@
50 * Get the fd that the server is connected to
51 *
52 * This function returns the fd which is used by the underlying server connection.
53 * It should not be tampered with unless you REALLY know what you are doing.
54 * @note This function is only valid for servers created with ecore_con_server_connect()
55 * @warning Seriously. Don't use this unless you know what you are doing.
56 * @since 1.1
57 */
58 get {
59 legacy: null;
60 }
61 values {
62 int fd; /*@ The fd, or -1 on failure. */
63 }
64 }
65 connected {
66 /*@
67 * Returns whether the client is still connected
68 */
69 get {
70 legacy: null;
71 }
72 values {
73 bool connected; /*@ Returns True if connected, False otherwise. */
74 }
75 }
76 timeout {
77 /*@
78 * Control the default time after which an inactive client will be disconnected
79 *
80 * This function is used by the server to set the default idle timeout on
81 * clients. If the any of the clients becomes idle for a time higher than this
82 * value, it will be disconnected. A value of < 1 disables the idle timeout.
83 *
84 * This timeout is not affected by the one set by
85 * ecore_con_client_timeout_set(). A client will be disconnected whenever the
86 * client or the server timeout is reached. That means, the lower timeout value
87 * will be used for that client if ecore_con_client_timeout_set() is used on it.
88 */
89 set {
90 legacy: null;
91 }
92 get {
93 legacy: null;
94 }
95 values {
96 double timeout; /*@ The timeout, in seconds, to disconnect after. */
97 }
98 }
99 }
100 methods {
101 flush {
102 /*@
103 * Flushes all pending data to the given server.
104 *
105 * This function will block until all data is sent to the server.
106 */
107 legacy: null;
108 }
109 send {
110 /**
111 * Sends the given data to the given server.
112 *
113 * This function will send the given data to the server as soon as the program
114 * is back to the main loop. Thus, this function returns immediately
115 * (non-blocking). If the data needs to be sent @b now, call
116 * ecore_con_server_flush() after this one.
117 *
118 * @see ecore_con_client_send()
119 * @see ecore_con_server_flush()
120 */
121 legacy: null;
122
123 params {
124 const(void)* data; /*@ The given data */
125 int size; /*@ Length of the data, in bytes. */
126 }
127 return: int; /*@ The number of bytes sent. @c 0 will be returned if there is an error. */
128 }
129 lookup @class {
130 /*@
131 * Do an asynchronous DNS lookup.
132 *
133 * @param name IP address or server name to translate.
134 * @param done_cb Callback to notify when done.
135 * @param data User data to be given to done_cb.
136 * @return @c EINA_TRUE if the request did not fail to be set up, @c EINA_FALSE
137 * if it failed.
138 *
139 * This function performs a DNS lookup on the hostname specified by @p name,
140 * then calls @p done_cb with the result and the @p data given as parameter.
141 * The result will be given to the @p done_cb as follows:
142 * @li @c canonname - the canonical name of the address
143 * @li @c ip - the resolved ip address
144 * @li @c addr - a pointer to the socket address
145 * @li @c addrlen - the length of the socket address, in bytes
146 * @li @c data - the data pointer given as parameter to ecore_con_lookup()
147 */
148 params {
149 const(char)* name @nonull; /*@ Hostname to lookup. */
150 Ecore_Con_Dns_Cb done_cb; /*@ The callback to be called wehn lookup is done. */
151 const(void)* data; /*@ User data for the callback. */
152 }
153 return: bool;
154 }
155 }
156 implements {
157 virtual.ip.get;
158 virtual.uptime.get;
159 virtual.port.get;
160 virtual.fd.get;
161 virtual.connected.get;
162 virtual.timeout.set;
163 virtual.timeout.get;
164 virtual.flush;
165 virtual.send;
166 }
167 events {
168 data,received: Ecore_Con_Event_Data_Received;
169 connection,upgraded;
170 connection,error: const(char) *;
171 }
172}
173
174/* FIXME: Should actually be a binbuf. */
175type Ecore_Con_Event_Data_Received: struct {
176 data: void *; /*@ The data thet got sent. */
177 size: int; /*@ The length of the data sent. */
178};
179
180type Ecore_Con_Dns_Cb: func void (const(char) *,
181 const(char) *,
182 struct sockaddr *,
183 int,
184 void *);
185
186/* FIXME: Ecore_Con_Dns_Cb should be like this:
187type Ecore_Con_Dns_Cb: func void (const(char) *canonname,
188 const(char) *ip,
189 struct sockaddr *addr,
190 int addrlen,
191 void *data);
192
193
194* Add events
195*/