summaryrefslogtreecommitdiff
path: root/legacy/ecore/src/lib/ecore_ipc/Ecore_Ipc.h
diff options
context:
space:
mode:
authorCarsten Haitzler <raster@rasterman.com>2005-04-09 00:07:32 +0000
committerCarsten Haitzler <raster@rasterman.com>2005-04-09 00:07:32 +0000
commitbe1463e33948ca1ac9bd8c82f873bca915fa2706 (patch)
tree16db16fe346ac3f5742ab210c46c217a9f865890 /legacy/ecore/src/lib/ecore_ipc/Ecore_Ipc.h
parent0a0201a6efa733debefc8280d8cecd69e82e8476 (diff)
patches - shorne
SVN revision: 14120
Diffstat (limited to '')
-rw-r--r--legacy/ecore/src/lib/ecore_ipc/Ecore_Ipc.h177
1 files changed, 176 insertions, 1 deletions
diff --git a/legacy/ecore/src/lib/ecore_ipc/Ecore_Ipc.h b/legacy/ecore/src/lib/ecore_ipc/Ecore_Ipc.h
index bd43673dc2..862c941ddb 100644
--- a/legacy/ecore/src/lib/ecore_ipc/Ecore_Ipc.h
+++ b/legacy/ecore/src/lib/ecore_ipc/Ecore_Ipc.h
@@ -26,12 +26,187 @@
26#ifdef __cplusplus 26#ifdef __cplusplus
27extern "C" { 27extern "C" {
28#endif 28#endif
29 29
30#ifndef _ECORE_IPC_PRIVATE_H 30#ifndef _ECORE_IPC_PRIVATE_H
31 typedef void Ecore_Ipc_Server; /**< An IPC connection handle */ 31 typedef void Ecore_Ipc_Server; /**< An IPC connection handle */
32 typedef void Ecore_Ipc_Client; /**< An IPC connection handle */ 32 typedef void Ecore_Ipc_Client; /**< An IPC connection handle */
33#endif 33#endif
34 34
35/**
36 * Macros used for generic data packing
37 */
38#ifdef WORDS_BIGENDIAN
39#define ECORE_IPC_SWAP2NET64(x) _ecore_ipc_swap_64(x)
40#define ECORE_IPC_SWAP2CPU64(x) _ecore_ipc_swap_64(x)
41#define ECORE_IPC_SWAP2NET32(x) _ecore_ipc_swap_32(x)
42#define ECORE_IPC_SWAP2CPU32(x) _ecore_ipc_swap_32(x)
43#define ECORE_IPC_SWAP2NET16(x) _ecore_ipc_swap_16(x)
44#define ECORE_IPC_SWAP2CPU16(x) _ecore_ipc_swap_16(x)
45#define ECORE_IPC_SWAP2NET8(x) (x)
46#define ECORE_IPC_SWAP2CPU8(x) (x)
47#else
48#define ECORE_IPC_SWAP2NET64(x) (x)
49#define ECORE_IPC_SWAP2CPU64(x) (x)
50#define ECORE_IPC_SWAP2NET32(x) (x)
51#define ECORE_IPC_SWAP2CPU32(x) (x)
52#define ECORE_IPC_SWAP2NET16(x) (x)
53#define ECORE_IPC_SWAP2CPU16(x) (x)
54#define ECORE_IPC_SWAP2NET8(x) (x)
55#define ECORE_IPC_SWAP2CPU8(x) (x)
56#endif
57
58/* 1, 2, 4 and 8 byte datatypes */
59/* unpacking */
60#define ECORE_IPC_GET64(v)\
61 { \
62 p->v = ECORE_IPC_SWAP2CPU64(*(long long *)(ptr)); \
63 ptr += 8; \
64 }
65#define ECORE_IPC_GET32(v)\
66 { \
67 p->v = ECORE_IPC_SWAP2CPU32(*(int *)(ptr)); \
68 ptr += 4; \
69 }
70#define ECORE_IPC_GET16(v)\
71 { \
72 p->v = ECORE_IPC_SWAP2CPU16(*(short *)(ptr)); \
73 ptr += 2; \
74 }
75#define ECORE_IPC_GET8(v) \
76 { \
77 p->v = ECORE_IPC_SWAP2CPU8(*(char *)(ptr)); \
78 ptr += 1; \
79 }
80/* packing */
81#define ECORE_IPC_PUT64(v)\
82 { \
83 *(long long *)(ptr) = ECORE_IPC_SWAP2NET64(p->v); \
84 ptr += 8; \
85 }
86#define ECORE_IPC_PUT32(v)\
87 { \
88 *(int *)(ptr) = ECORE_IPC_SWAP2NET32(p->v); \
89 ptr += 4; \
90 }
91#define ECORE_IPC_PUT16(v)\
92 { \
93 *(short *)(ptr) = ECORE_IPC_SWAP2NET16(p->v); \
94 ptr += 2; \
95 }
96#define ECORE_IPC_PUT8(v) \
97 { \
98 *(char *)(ptr) = ECORE_IPC_SWAP2NET8(p->v); \
99 ptr += 1; \
100 }
101/* padding data */
102#define ECORE_IPC_PAD8() ptr += 1
103#define ECORE_IPC_PAD16() ptr += 2
104#define ECORE_IPC_PAD32() ptr += 4
105#define ECORE_IPC_PAD64() ptr += 8
106
107/* counting data when encoding lists */
108#define ECORE_IPC_CNT8() len += 1
109#define ECORE_IPC_CNT16() len += 2
110#define ECORE_IPC_CNT32() len += 4
111#define ECORE_IPC_CNT64() len += 8
112
113/* strings */
114#define ECORE_IPC_CHEKS() if (*((unsigned char *)d + s - 1) != 0) return 0;
115#define ECORE_IPC_GETS(v) \
116 { \
117 if (ptr < ((unsigned char *)d + s)) \
118 { \
119 p->v = ptr; \
120 ptr += strlen(p->v) + 1; \
121 } \
122 }
123#define ECORE_IPC_PUTS(v, l)\
124 { \
125 strcpy(ptr, p->v); \
126 ptr += l + 1; \
127 }
128
129/* handy to calculate what sized block we need to alloc */
130#define ECORE_IPC_SLEN(l, v) ((l = strlen(p->v)) + 1)
131#define ECORE_IPC_CNTS(v) len += strlen(p->v) + 1
132
133/* saves typing function headers */
134#define ECORE_IPC_DEC_STRUCT_PROTO(x) static int x(void *d, int s, void *pp)
135#define ECORE_IPC_ENC_STRUCT_PROTO(x) static void *x(void *pp, int *s)
136#define ECORE_IPC_DEC_EVAS_LIST_PROTO(x) static Evas_List *x(void *d, int s)
137#define ECORE_IPC_ENC_EVAS_LIST_PROTO(x) static void *x(Evas_List *lp, int *s)
138
139/* decoder setup - saves typing. requires data packet of exact size, or fail */
140#define ECORE_IPC_DEC_STRUCT_HEAD_EXACT(typ, x) \
141 typ *p; \
142 unsigned char *ptr; \
143 p = (typ *)pp; \
144 if (!d) return 0; \
145 if (s != (x)) return 0; \
146 ptr = d;
147/* decoder setup - saves typing. requires data packet of a minimum size */
148#define ECORE_IPC_DEC_STRUCT_HEAD_MIN(typ, x) \
149 typ *p; \
150 unsigned char *ptr; \
151 p = (typ *)pp; \
152 if (!d) return 0; \
153 if (s < (x)) return 0; \
154 ptr = d;
155/* footer for the hell of it */
156#define ECORE_IPC_DEC_STRUCT_FOOT() return 1
157/* header for encoder - gives native strct type and size of flattened packet */
158#define ECORE_IPC_ENC_STRUCT_HEAD(typ, sz) \
159 typ *p; \
160 unsigned char *d, *ptr; \
161 int len; \
162 p = (typ *)pp; \
163 *s = 0; \
164 len = sz; \
165 d = malloc(len); \
166 if (!d) return NULL; \
167 *s = len; \
168 ptr = d;
169/* footer for the hell of it */
170#define ECORE_IPC_ENC_STRUCT_FOOT() return d
171
172#define ECORE_IPC_DEC_EVAS_LIST_HEAD(typ) \
173 unsigned char *ptr; \
174 Evas_List *l; \
175 typ *p; \
176 l = NULL; \
177 ptr = d; \
178 while(ptr < (unsigned char *)(d + s)) \
179 { \
180 p = malloc(sizeof(typ));
181
182#define ECORE_IPC_DEC_EVAS_LIST_FOOT() \
183 l = evas_list_append(l, p); \
184 } \
185 return l
186#define ECORE_IPC_ENC_EVAS_LIST_HEAD_START(typ) \
187 Evas_List *l; \
188 typ *p; \
189 unsigned char *d, *ptr; \
190 int len; \
191 *s = 0; \
192 len = 0; \
193 for (l = lp; l; l = l->next) \
194 { \
195 p = l->data;
196#define ECORE_IPC_ENC_EVAS_LIST_HEAD_FINISH() \
197 } \
198 d = malloc(len); \
199 if(!d) return NULL; \
200 *s = len; \
201 ptr = d; \
202 for (l = lp; l; l = l->next) \
203 { \
204 p = l->data;
205
206#define ECORE_IPC_ENC_EVAS_LIST_FOOT() \
207 } \
208 return d
209
35 typedef enum _Ecore_Ipc_Type 210 typedef enum _Ecore_Ipc_Type
36 { 211 {
37 ECORE_IPC_LOCAL_USER, 212 ECORE_IPC_LOCAL_USER,