diff options
author | David Walter Seikel | 2013-01-13 17:29:19 +1000 |
---|---|---|
committer | David Walter Seikel | 2013-01-13 17:29:19 +1000 |
commit | 07274513e984f0b5544586c74508ccd16e7dcafa (patch) | |
tree | b32ff2a9136fbc1a4a6a0ed1e4d79cde0f5f16d9 /libraries/ecore/src/lib/ecore_ipc/Ecore_Ipc.h | |
parent | Added Irrlicht 1.8, but without all the Windows binaries. (diff) | |
download | SledjHamr-07274513e984f0b5544586c74508ccd16e7dcafa.zip SledjHamr-07274513e984f0b5544586c74508ccd16e7dcafa.tar.gz SledjHamr-07274513e984f0b5544586c74508ccd16e7dcafa.tar.bz2 SledjHamr-07274513e984f0b5544586c74508ccd16e7dcafa.tar.xz |
Remove EFL, since it's been released now.
Diffstat (limited to '')
-rw-r--r-- | libraries/ecore/src/lib/ecore_ipc/Ecore_Ipc.h | 325 |
1 files changed, 0 insertions, 325 deletions
diff --git a/libraries/ecore/src/lib/ecore_ipc/Ecore_Ipc.h b/libraries/ecore/src/lib/ecore_ipc/Ecore_Ipc.h deleted file mode 100644 index 40ae621..0000000 --- a/libraries/ecore/src/lib/ecore_ipc/Ecore_Ipc.h +++ /dev/null | |||
@@ -1,325 +0,0 @@ | |||
1 | #ifndef _ECORE_IPC_H | ||
2 | #define _ECORE_IPC_H | ||
3 | |||
4 | #ifdef EAPI | ||
5 | # undef EAPI | ||
6 | #endif | ||
7 | |||
8 | #ifdef _WIN32 | ||
9 | # ifdef EFL_ECORE_IPC_BUILD | ||
10 | # ifdef DLL_EXPORT | ||
11 | # define EAPI __declspec(dllexport) | ||
12 | # else | ||
13 | # define EAPI | ||
14 | # endif | ||
15 | # else | ||
16 | # define EAPI __declspec(dllimport) | ||
17 | # endif | ||
18 | #else | ||
19 | # ifdef __GNUC__ | ||
20 | # if __GNUC__ >= 4 | ||
21 | # define EAPI __attribute__ ((visibility("default"))) | ||
22 | # else | ||
23 | # define EAPI | ||
24 | # endif | ||
25 | # else | ||
26 | # define EAPI | ||
27 | # endif | ||
28 | #endif | ||
29 | |||
30 | /** | ||
31 | * @file Ecore_Ipc.h | ||
32 | * @brief Ecore inter-process communication functions. | ||
33 | */ | ||
34 | |||
35 | #ifdef __cplusplus | ||
36 | extern "C" { | ||
37 | #endif | ||
38 | |||
39 | typedef struct _Ecore_Ipc_Server Ecore_Ipc_Server; /**< An IPC connection handle */ | ||
40 | typedef struct _Ecore_Ipc_Client Ecore_Ipc_Client; /**< An IPC connection handle */ | ||
41 | |||
42 | EAPI unsigned short _ecore_ipc_swap_16(unsigned short v); | ||
43 | EAPI unsigned int _ecore_ipc_swap_32(unsigned int v); | ||
44 | EAPI unsigned long long _ecore_ipc_swap_64(unsigned long long v); | ||
45 | |||
46 | #ifdef WORDS_BIGENDIAN | ||
47 | #define ECORE_IPC_SWAP2NET64(x) _ecore_ipc_swap_64(x) | ||
48 | #define ECORE_IPC_SWAP2CPU64(x) _ecore_ipc_swap_64(x) | ||
49 | #define ECORE_IPC_SWAP2NET32(x) _ecore_ipc_swap_32(x) | ||
50 | #define ECORE_IPC_SWAP2CPU32(x) _ecore_ipc_swap_32(x) | ||
51 | #define ECORE_IPC_SWAP2NET16(x) _ecore_ipc_swap_16(x) | ||
52 | #define ECORE_IPC_SWAP2CPU16(x) _ecore_ipc_swap_16(x) | ||
53 | #define ECORE_IPC_SWAP2NET8(x) (x) | ||
54 | #define ECORE_IPC_SWAP2CPU8(x) (x) | ||
55 | #else | ||
56 | #define ECORE_IPC_SWAP2NET64(x) (x) | ||
57 | #define ECORE_IPC_SWAP2CPU64(x) (x) | ||
58 | #define ECORE_IPC_SWAP2NET32(x) (x) | ||
59 | #define ECORE_IPC_SWAP2CPU32(x) (x) | ||
60 | #define ECORE_IPC_SWAP2NET16(x) (x) | ||
61 | #define ECORE_IPC_SWAP2CPU16(x) (x) | ||
62 | #define ECORE_IPC_SWAP2NET8(x) (x) | ||
63 | #define ECORE_IPC_SWAP2CPU8(x) (x) | ||
64 | #endif | ||
65 | |||
66 | /* 1, 2, 4 and 8 byte datatypes */ | ||
67 | /* unpacking */ | ||
68 | #define ECORE_IPC_GET64(v)\ | ||
69 | { \ | ||
70 | p->v = ECORE_IPC_SWAP2CPU64(*(long long *)(ptr)); \ | ||
71 | ptr += 8; \ | ||
72 | } | ||
73 | #define ECORE_IPC_GET32(v)\ | ||
74 | { \ | ||
75 | p->v = ECORE_IPC_SWAP2CPU32(*(int *)(ptr)); \ | ||
76 | ptr += 4; \ | ||
77 | } | ||
78 | #define ECORE_IPC_GET16(v)\ | ||
79 | { \ | ||
80 | p->v = ECORE_IPC_SWAP2CPU16(*(short *)(ptr)); \ | ||
81 | ptr += 2; \ | ||
82 | } | ||
83 | #define ECORE_IPC_GET8(v) \ | ||
84 | { \ | ||
85 | p->v = ECORE_IPC_SWAP2CPU8(*(char *)(ptr)); \ | ||
86 | ptr += 1; \ | ||
87 | } | ||
88 | /* packing */ | ||
89 | #define ECORE_IPC_PUT64(v)\ | ||
90 | { \ | ||
91 | *(long long *)(ptr) = ECORE_IPC_SWAP2NET64(p->v); \ | ||
92 | ptr += 8; \ | ||
93 | } | ||
94 | #define ECORE_IPC_PUT32(v)\ | ||
95 | { \ | ||
96 | *(int *)(ptr) = ECORE_IPC_SWAP2NET32(p->v); \ | ||
97 | ptr += 4; \ | ||
98 | } | ||
99 | #define ECORE_IPC_PUT16(v)\ | ||
100 | { \ | ||
101 | *(short *)(ptr) = ECORE_IPC_SWAP2NET16(p->v); \ | ||
102 | ptr += 2; \ | ||
103 | } | ||
104 | #define ECORE_IPC_PUT8(v) \ | ||
105 | { \ | ||
106 | *(char *)(ptr) = ECORE_IPC_SWAP2NET8(p->v); \ | ||
107 | ptr += 1; \ | ||
108 | } | ||
109 | /* padding data */ | ||
110 | #define ECORE_IPC_PAD8() ptr += 1 | ||
111 | #define ECORE_IPC_PAD16() ptr += 2 | ||
112 | #define ECORE_IPC_PAD32() ptr += 4 | ||
113 | #define ECORE_IPC_PAD64() ptr += 8 | ||
114 | |||
115 | /* counting data when encoding lists */ | ||
116 | #define ECORE_IPC_CNT8() len += 1 | ||
117 | #define ECORE_IPC_CNT16() len += 2 | ||
118 | #define ECORE_IPC_CNT32() len += 4 | ||
119 | #define ECORE_IPC_CNT64() len += 8 | ||
120 | |||
121 | /* strings */ | ||
122 | #define ECORE_IPC_CHEKS() if (*((unsigned char *)d + s - 1) != 0) return 0; | ||
123 | #define ECORE_IPC_GETS(v) \ | ||
124 | { \ | ||
125 | if (ptr < ((unsigned char *)d + s)) \ | ||
126 | { \ | ||
127 | p->v = (char *)ptr; \ | ||
128 | ptr += strlen(p->v) + 1; \ | ||
129 | } \ | ||
130 | } | ||
131 | #define ECORE_IPC_PUTS(v, l)\ | ||
132 | { \ | ||
133 | strcpy((char *)ptr, p->v); \ | ||
134 | ptr += l + 1; \ | ||
135 | } | ||
136 | |||
137 | /* handy to calculate what sized block we need to alloc */ | ||
138 | #define ECORE_IPC_SLEN(l, v) ((l = strlen(p->v)) + 1) | ||
139 | #define ECORE_IPC_CNTS(v) len += strlen(p->v) + 1 | ||
140 | |||
141 | /* saves typing function headers */ | ||
142 | #define ECORE_IPC_DEC_STRUCT_PROTO(x) static int x(void *d, int s, void *pp) | ||
143 | #define ECORE_IPC_ENC_STRUCT_PROTO(x) static void *x(void *pp, int *s) | ||
144 | #define ECORE_IPC_DEC_EINA_LIST_PROTO(x) static Eina_List *x(void *d, int s) | ||
145 | #define ECORE_IPC_ENC_EINA_LIST_PROTO(x) static void *x(Eina_List *lp, int *s) | ||
146 | |||
147 | |||
148 | /* decoder setup - saves typing. requires data packet of exact size, or fail */ | ||
149 | #define ECORE_IPC_DEC_STRUCT_HEAD_EXACT(typ, x) \ | ||
150 | typ *p; \ | ||
151 | unsigned char *ptr; \ | ||
152 | p = (typ *)pp; \ | ||
153 | if (!d) return 0; if (s != (x)) return 0; \ | ||
154 | ptr = d; | ||
155 | /* decoder setup - saves typing. requires data packet of a minimum size */ | ||
156 | #define ECORE_IPC_DEC_STRUCT_HEAD_MIN(typ, x) \ | ||
157 | typ *p; \ | ||
158 | unsigned char *ptr; \ | ||
159 | p = (typ *)pp; \ | ||
160 | if (!d) return 0; if (s < (x)) return 0; \ | ||
161 | ptr = d; | ||
162 | /* footer for the hell of it */ | ||
163 | #define ECORE_IPC_DEC_STRUCT_FOOT() return 1 | ||
164 | /* header for encoder - gives native strct type and size of flattened packet */ | ||
165 | #define ECORE_IPC_ENC_STRUCT_HEAD(typ, sz) \ | ||
166 | typ *p; \ | ||
167 | unsigned char *d, *ptr; \ | ||
168 | int len; \ | ||
169 | *s = 0; \ | ||
170 | if(!pp) return NULL; \ | ||
171 | p = (typ *)pp; \ | ||
172 | len = sz; \ | ||
173 | d = malloc(len); \ | ||
174 | if (!d) return NULL; \ | ||
175 | *s = len; \ | ||
176 | ptr = d; | ||
177 | /* footer for the hell of it */ | ||
178 | #define ECORE_IPC_ENC_STRUCT_FOOT() return d | ||
179 | |||
180 | #define ECORE_IPC_DEC_EINA_LIST_HEAD(typ) \ | ||
181 | unsigned char *ptr; \ | ||
182 | Eina_List *l; \ | ||
183 | typ *p; \ | ||
184 | l = NULL; \ | ||
185 | ptr = d; \ | ||
186 | while(ptr < (unsigned char *)(d + s)) \ | ||
187 | { \ | ||
188 | p = malloc(sizeof(typ)); | ||
189 | |||
190 | #define ECORE_IPC_DEC_EINA_LIST_FOOT() \ | ||
191 | l = eina_list_append(l, p); \ | ||
192 | } \ | ||
193 | return l | ||
194 | #define ECORE_IPC_ENC_EINA_LIST_HEAD_START(typ) \ | ||
195 | Eina_List *l; \ | ||
196 | typ *p; \ | ||
197 | unsigned char *d, *ptr; \ | ||
198 | int len; \ | ||
199 | *s = 0; \ | ||
200 | len = 0; \ | ||
201 | for (l = lp; l; l = l->next) \ | ||
202 | { \ | ||
203 | p = l->data; | ||
204 | #define ECORE_IPC_ENC_EINA_LIST_HEAD_FINISH() \ | ||
205 | } \ | ||
206 | d = malloc(len); \ | ||
207 | if(!d) return NULL; \ | ||
208 | *s = len; \ | ||
209 | ptr = d; \ | ||
210 | for (l = lp; l; l = l->next) \ | ||
211 | { \ | ||
212 | p = l->data; | ||
213 | |||
214 | #define ECORE_IPC_ENC_EINA_LIST_FOOT() \ | ||
215 | } \ | ||
216 | return d | ||
217 | |||
218 | typedef enum _Ecore_Ipc_Type | ||
219 | { | ||
220 | ECORE_IPC_LOCAL_USER, | ||
221 | ECORE_IPC_LOCAL_SYSTEM, | ||
222 | ECORE_IPC_REMOTE_SYSTEM, | ||
223 | ECORE_IPC_USE_SSL = 16 | ||
224 | } Ecore_Ipc_Type; | ||
225 | |||
226 | typedef struct _Ecore_Ipc_Event_Client_Add Ecore_Ipc_Event_Client_Add; | ||
227 | typedef struct _Ecore_Ipc_Event_Client_Del Ecore_Ipc_Event_Client_Del; | ||
228 | typedef struct _Ecore_Ipc_Event_Server_Add Ecore_Ipc_Event_Server_Add; | ||
229 | typedef struct _Ecore_Ipc_Event_Server_Del Ecore_Ipc_Event_Server_Del; | ||
230 | typedef struct _Ecore_Ipc_Event_Client_Data Ecore_Ipc_Event_Client_Data; | ||
231 | typedef struct _Ecore_Ipc_Event_Server_Data Ecore_Ipc_Event_Server_Data; | ||
232 | |||
233 | struct _Ecore_Ipc_Event_Client_Add | ||
234 | { | ||
235 | Ecore_Ipc_Client *client; | ||
236 | }; | ||
237 | |||
238 | struct _Ecore_Ipc_Event_Client_Del | ||
239 | { | ||
240 | Ecore_Ipc_Client *client; | ||
241 | }; | ||
242 | |||
243 | struct _Ecore_Ipc_Event_Server_Add | ||
244 | { | ||
245 | Ecore_Ipc_Server *server; | ||
246 | }; | ||
247 | |||
248 | struct _Ecore_Ipc_Event_Server_Del | ||
249 | { | ||
250 | Ecore_Ipc_Server *server; | ||
251 | }; | ||
252 | |||
253 | struct _Ecore_Ipc_Event_Client_Data | ||
254 | { | ||
255 | Ecore_Ipc_Client *client; | ||
256 | /* FIXME: this needs to become an ipc message */ | ||
257 | int major; | ||
258 | int minor; | ||
259 | int ref; | ||
260 | int ref_to; | ||
261 | int response; | ||
262 | void *data; | ||
263 | int size; | ||
264 | }; | ||
265 | |||
266 | struct _Ecore_Ipc_Event_Server_Data | ||
267 | { | ||
268 | Ecore_Ipc_Server *server; | ||
269 | /* FIXME: this needs to become an ipc message */ | ||
270 | int major; | ||
271 | int minor; | ||
272 | int ref; | ||
273 | int ref_to; | ||
274 | int response; | ||
275 | void *data; | ||
276 | int size; | ||
277 | }; | ||
278 | |||
279 | EAPI extern int ECORE_IPC_EVENT_CLIENT_ADD; | ||
280 | EAPI extern int ECORE_IPC_EVENT_CLIENT_DEL; | ||
281 | EAPI extern int ECORE_IPC_EVENT_SERVER_ADD; | ||
282 | EAPI extern int ECORE_IPC_EVENT_SERVER_DEL; | ||
283 | EAPI extern int ECORE_IPC_EVENT_CLIENT_DATA; | ||
284 | EAPI extern int ECORE_IPC_EVENT_SERVER_DATA; | ||
285 | |||
286 | EAPI int ecore_ipc_init(void); | ||
287 | EAPI int ecore_ipc_shutdown(void); | ||
288 | |||
289 | /* FIXME: need to add protocol type parameter */ | ||
290 | EAPI Ecore_Ipc_Server *ecore_ipc_server_add(Ecore_Ipc_Type type, const char *name, int port, const void *data); | ||
291 | |||
292 | /* FIXME: need to add protocol type parameter */ | ||
293 | EAPI Ecore_Ipc_Server *ecore_ipc_server_connect(Ecore_Ipc_Type type, char *name, int port, const void *data); | ||
294 | EAPI void *ecore_ipc_server_del(Ecore_Ipc_Server *svr); | ||
295 | EAPI void *ecore_ipc_server_data_get(Ecore_Ipc_Server *svr); | ||
296 | EAPI Eina_Bool ecore_ipc_server_connected_get(Ecore_Ipc_Server *svr); | ||
297 | EAPI Eina_List *ecore_ipc_server_clients_get(Ecore_Ipc_Server *svr); | ||
298 | /* FIXME: this needs to become an ipc message */ | ||
299 | EAPI int ecore_ipc_server_send(Ecore_Ipc_Server *svr, int major, int minor, int ref, int ref_to, int response, const void *data, int size); | ||
300 | EAPI void ecore_ipc_server_client_limit_set(Ecore_Ipc_Server *svr, int client_limit, char reject_excess_clients); | ||
301 | EAPI void ecore_ipc_server_data_size_max_set(Ecore_Ipc_Server *srv, int size); | ||
302 | EAPI int ecore_ipc_server_data_size_max_get(Ecore_Ipc_Server *srv); | ||
303 | EAPI const char *ecore_ipc_server_ip_get(Ecore_Ipc_Server *svr); | ||
304 | EAPI void ecore_ipc_server_flush(Ecore_Ipc_Server *svr); | ||
305 | |||
306 | /* FIXME: this needs to become an ipc message */ | ||
307 | EAPI int ecore_ipc_client_send(Ecore_Ipc_Client *cl, int major, int minor, int ref, int ref_to, int response, const void *data, int size); | ||
308 | EAPI Ecore_Ipc_Server *ecore_ipc_client_server_get(Ecore_Ipc_Client *cl); | ||
309 | EAPI void *ecore_ipc_client_del(Ecore_Ipc_Client *cl); | ||
310 | EAPI void ecore_ipc_client_data_set(Ecore_Ipc_Client *cl, const void *data); | ||
311 | EAPI void *ecore_ipc_client_data_get(Ecore_Ipc_Client *cl); | ||
312 | EAPI void ecore_ipc_client_data_size_max_set(Ecore_Ipc_Client *cl, int size); | ||
313 | EAPI int ecore_ipc_client_data_size_max_get(Ecore_Ipc_Client *cl); | ||
314 | EAPI const char *ecore_ipc_client_ip_get(Ecore_Ipc_Client *cl); | ||
315 | EAPI void ecore_ipc_client_flush(Ecore_Ipc_Client *cl); | ||
316 | |||
317 | EAPI int ecore_ipc_ssl_available_get(void); | ||
318 | /* FIXME: need to add a callback to "ok" large ipc messages greater than */ | ||
319 | /* a certain size (seurity/DOS attack safety) */ | ||
320 | |||
321 | #ifdef __cplusplus | ||
322 | } | ||
323 | #endif | ||
324 | |||
325 | #endif | ||