diff options
author | Josh MacDonald <josh.macdonald@gmail.com> | 2016-02-26 21:43:58 -0800 |
---|---|---|
committer | Josh MacDonald <josh.macdonald@gmail.com> | 2016-02-26 21:43:58 -0800 |
commit | d594fbe514e2a381541a510fe01041e546f56a67 (patch) | |
tree | 316072f34cf7dc94518ec14a8d955d57c20d65b7 /xdelta1/libedsio/edsio.h | |
parent | 81aebf78ae67c29f528088d65743643e5355e3d3 (diff) |
Remove xdelta1 from this repo
Diffstat (limited to 'xdelta1/libedsio/edsio.h')
-rw-r--r-- | xdelta1/libedsio/edsio.h | 531 |
1 files changed, 0 insertions, 531 deletions
diff --git a/xdelta1/libedsio/edsio.h b/xdelta1/libedsio/edsio.h deleted file mode 100644 index 98f899e..0000000 --- a/xdelta1/libedsio/edsio.h +++ /dev/null | |||
@@ -1,531 +0,0 @@ | |||
1 | /* -*-Mode: C;-*- | ||
2 | * $Id: edsio.h 1.1 Sun, 28 Jan 2007 10:02:26 -0800 jmacd $ | ||
3 | * | ||
4 | * Copyright (C) 1998, 1999, Josh MacDonald. | ||
5 | * All Rights Reserved. | ||
6 | * | ||
7 | * Author: Josh MacDonald <jmacd@CS.Berkeley.EDU> | ||
8 | */ | ||
9 | |||
10 | #ifndef _EDSIO_H_ | ||
11 | #define _EDSIO_H_ | ||
12 | |||
13 | #ifdef __cplusplus | ||
14 | extern "C" { | ||
15 | #endif | ||
16 | |||
17 | #ifdef HAVE_CONFIG_H | ||
18 | #include <config.h> | ||
19 | #endif | ||
20 | |||
21 | #include <stdlib.h> | ||
22 | #include <string.h> | ||
23 | #include <glib.h> | ||
24 | |||
25 | typedef struct _SerialSource SerialSource; | ||
26 | typedef struct _SerialSink SerialSink; | ||
27 | typedef gint32 SerialType; | ||
28 | typedef struct _HandleFuncTable HandleFuncTable; | ||
29 | typedef struct _PropTest PropTest; | ||
30 | typedef struct _FileHandle FileHandle; | ||
31 | typedef struct _AllocList AllocList; | ||
32 | |||
33 | struct _FileHandle { | ||
34 | const HandleFuncTable* table; | ||
35 | |||
36 | /* This is an opaque type, feel free to define your own, just make | ||
37 | * sure that the first field of yours is one of these, and that you | ||
38 | * supply a table. */ | ||
39 | }; | ||
40 | |||
41 | #define EDSIO_LIBRARY_OFFSET_BITS 8 | ||
42 | #define EDSIO_LIBRARY_OFFSET_MASK 0xff | ||
43 | |||
44 | #include "edsio_edsio.h" | ||
45 | |||
46 | #define ST_Error -1 | ||
47 | #define ST_IncorrectType -2 | ||
48 | #define ST_NotFound -3 | ||
49 | |||
50 | #define ALIGN_8(v) if (((v) % 8) != 0) { (v) += 8; (v) &= ~7; } | ||
51 | |||
52 | /* This serves as a virtual table for I/O to the FileHandle */ | ||
53 | struct _HandleFuncTable | ||
54 | { | ||
55 | gssize (* table_handle_length) (FileHandle *fh); | ||
56 | gssize (* table_handle_pages) (FileHandle *fh); | ||
57 | gssize (* table_handle_pagesize) (FileHandle *fh); | ||
58 | gssize (* table_handle_map_page) (FileHandle *fh, guint pgno, const guint8** mem); | ||
59 | gboolean (* table_handle_unmap_page) (FileHandle *fh, guint pgno, const guint8** mem); | ||
60 | const guint8* (* table_handle_checksum_md5) (FileHandle *fh); | ||
61 | gboolean (* table_handle_close) (FileHandle *fh, gint flags); | ||
62 | gboolean (* table_handle_write) (FileHandle *fh, const guint8 *buf, gsize nbyte); | ||
63 | gboolean (* table_handle_copy) (FileHandle *from, FileHandle *to, guint off, guint len); | ||
64 | gboolean (* table_handle_getui) (FileHandle *fh, guint32* i); | ||
65 | gboolean (* table_handle_putui) (FileHandle *fh, guint32 i); | ||
66 | gssize (* table_handle_read) (FileHandle *fh, guint8 *buf, gsize nbyte); | ||
67 | const gchar* (* table_handle_name) (FileHandle *fh); /* user must free */ | ||
68 | }; | ||
69 | |||
70 | struct _AllocList { | ||
71 | AllocList *next; | ||
72 | void *ptr; | ||
73 | }; | ||
74 | |||
75 | struct _SerialSource { | ||
76 | /* Internal variables: don't touch. */ | ||
77 | AllocList *alloc_list; | ||
78 | |||
79 | /* These are setup by init. | ||
80 | */ | ||
81 | SerialType (* source_type) (SerialSource* source, gboolean set_allocation); | ||
82 | gboolean (* source_close) (SerialSource* source); | ||
83 | gboolean (* source_read) (SerialSource* source, guint8 *ptr, guint32 len); | ||
84 | void (* source_free) (SerialSource* source); | ||
85 | |||
86 | /* These may be NULL | ||
87 | */ | ||
88 | void* (* salloc_func) (SerialSource* source, | ||
89 | guint32 len); | ||
90 | void (* sfree_func) (SerialSource* source, | ||
91 | void* ptr); | ||
92 | |||
93 | /* Public functions, defaulted, but may be over-ridden | ||
94 | * before calls to unserialize. | ||
95 | */ | ||
96 | gboolean (* next_bytes_known) (SerialSource* source, guint8 *ptr, guint32 len); | ||
97 | gboolean (* next_bytes) (SerialSource* source, const guint8 **ptr, guint32 *len); | ||
98 | gboolean (* next_uint) (SerialSource* source, guint32 *ptr); | ||
99 | gboolean (* next_uint32) (SerialSource* source, guint32 *ptr); | ||
100 | gboolean (* next_uint16) (SerialSource* source, guint16 *ptr); | ||
101 | gboolean (* next_uint8) (SerialSource* source, guint8 *ptr); | ||
102 | gboolean (* next_bool) (SerialSource* source, gboolean *ptr); | ||
103 | gboolean (* next_string) (SerialSource* source, const char **ptr); | ||
104 | }; | ||
105 | |||
106 | struct _SerialSink { | ||
107 | |||
108 | /* These are setup by init. | ||
109 | */ | ||
110 | gboolean (* sink_type) (SerialSink* sink, SerialType type, guint32 mem_size, gboolean set_allocation); | ||
111 | gboolean (* sink_close) (SerialSink* sink); | ||
112 | gboolean (* sink_write) (SerialSink* sink, const guint8 *ptr, guint32 len); | ||
113 | void (* sink_free) (SerialSink* sink); | ||
114 | |||
115 | /* This may be null, called after each object is serialized. */ | ||
116 | gboolean (* sink_quantum) (SerialSink* sink); | ||
117 | |||
118 | /* Public functions, defaulted, but may be over-ridden | ||
119 | * before calls to serialize. | ||
120 | */ | ||
121 | gboolean (* next_bytes_known) (SerialSink* sink, const guint8 *ptr, guint32 len); | ||
122 | gboolean (* next_bytes) (SerialSink* sink, const guint8 *ptr, guint32 len); | ||
123 | gboolean (* next_uint) (SerialSink* sink, guint32 ptr); | ||
124 | gboolean (* next_uint32) (SerialSink* sink, guint32 ptr); | ||
125 | gboolean (* next_uint16) (SerialSink* sink, guint16 ptr); | ||
126 | gboolean (* next_uint8) (SerialSink* sink, guint8 ptr); | ||
127 | gboolean (* next_bool) (SerialSink* sink, gboolean ptr); | ||
128 | gboolean (* next_string) (SerialSink* sink, const char *ptr); | ||
129 | }; | ||
130 | |||
131 | void serializeio_initialize_type (const char* name, | ||
132 | guint32 val, | ||
133 | gboolean (*unserialize_func) (), | ||
134 | gboolean (*serialize_func) (), | ||
135 | guint (*count_func) (), | ||
136 | void (*print_func) ()); | ||
137 | |||
138 | const char* serializeio_generic_type_to_string (SerialType type); | ||
139 | void serializeio_generic_print (SerialType type, void* object, guint indent_spaces); | ||
140 | |||
141 | gboolean serializeio_serialize_generic (SerialSink *sink, | ||
142 | SerialType object_type, | ||
143 | void *object); | ||
144 | |||
145 | gboolean serializeio_serialize_generic_internal (SerialSink *sink, | ||
146 | SerialType object_type, | ||
147 | void *object, | ||
148 | gboolean set_allocation); | ||
149 | |||
150 | guint serializeio_generic_count (SerialType object_type, | ||
151 | void *object); | ||
152 | |||
153 | gboolean serializeio_unserialize_generic (SerialSource *source, | ||
154 | SerialType *object_type, | ||
155 | void **object); | ||
156 | |||
157 | gboolean serializeio_unserialize_generic_internal (SerialSource *source, | ||
158 | SerialType *object_type, | ||
159 | void **object, | ||
160 | gboolean set_allocation); | ||
161 | |||
162 | gboolean serializeio_unserialize_generic_acceptable (SerialSource* source, | ||
163 | guint32 acceptable, | ||
164 | SerialType *object_type, | ||
165 | void **object); | ||
166 | |||
167 | void serializeio_sink_init (SerialSink* sink, | ||
168 | gboolean (* sink_type) (SerialSink* sink, | ||
169 | SerialType type, | ||
170 | guint32 mem_size, | ||
171 | gboolean set_allocation), | ||
172 | gboolean (* sink_close) (SerialSink* sink), | ||
173 | gboolean (* sink_write) (SerialSink* sink, | ||
174 | const guint8 *ptr, | ||
175 | guint32 len), | ||
176 | void (* sink_free) (SerialSink* sink), | ||
177 | gboolean (* sink_quantum) (SerialSink* sink)); | ||
178 | |||
179 | void serializeio_source_init (SerialSource* source, | ||
180 | SerialType (* source_type) (SerialSource* source, | ||
181 | gboolean set_allocation), | ||
182 | gboolean (* source_close) (SerialSource* source), | ||
183 | gboolean (* source_read) (SerialSource* source, | ||
184 | guint8 *ptr, | ||
185 | guint32 len), | ||
186 | void (* source_free) (SerialSource* source), | ||
187 | void* (* salloc_func) (SerialSource* source, | ||
188 | guint32 len), | ||
189 | void (* sfree_func) (SerialSource* source, | ||
190 | void* ptr)); | ||
191 | |||
192 | /* This function is internal, don't use. */ | ||
193 | void* serializeio_source_alloc (SerialSource* source, | ||
194 | guint32 len); | ||
195 | |||
196 | SerialSink* serializeio_gzip_sink (SerialSink* sink); | ||
197 | SerialSource* serializeio_gzip_source (SerialSource* source); | ||
198 | |||
199 | SerialSink* serializeio_checksum_sink (SerialSink* sink); | ||
200 | SerialSource* serializeio_checksum_source (SerialSource* source); | ||
201 | |||
202 | SerialSink* serializeio_base64_sink (SerialSink* sink); | ||
203 | SerialSource* serializeio_base64_source (SerialSource* source); | ||
204 | |||
205 | SerialSource* handle_source (FileHandle *fh); | ||
206 | SerialSink* handle_sink (FileHandle *fh, | ||
207 | gpointer data1, | ||
208 | gpointer data2, | ||
209 | gpointer data3, | ||
210 | gboolean (* cont_onclose) (gpointer data1, gpointer data2, gpointer data3)); | ||
211 | |||
212 | gboolean unserialize_uint (SerialSource *source, guint32** x); | ||
213 | gboolean serialize_uint_obj (SerialSink *sink, guint32* x); | ||
214 | |||
215 | gboolean unserialize_string (SerialSource *source, const char** x); | ||
216 | gboolean serialize_string_obj (SerialSink *sink, const char* x); | ||
217 | |||
218 | /* These are a bit odd, and edsio_property_bytes_{g,s}etter account for it. | ||
219 | * Try not to use yourself. */ | ||
220 | gboolean unserialize_bytes (SerialSource *source, SerialEdsioBytes** x); | ||
221 | gboolean serialize_bytes_obj (SerialSink *sink, SerialEdsioBytes *x); | ||
222 | |||
223 | /* Event delivery | ||
224 | */ | ||
225 | |||
226 | enum _EventLevel | ||
227 | { | ||
228 | EL_Information = 1<<0, | ||
229 | EL_Warning = 1<<5, | ||
230 | EL_Error = 1<<10, | ||
231 | EL_InternalError = 1<<15, | ||
232 | EL_FatalError = 1<<20 | ||
233 | }; | ||
234 | |||
235 | typedef enum _EventLevel EventLevel; | ||
236 | |||
237 | enum _EventFlags | ||
238 | { | ||
239 | EF_None = 1<<0, | ||
240 | EF_OpenSSL = 1<<1 | ||
241 | }; | ||
242 | |||
243 | typedef enum _EventFlags EventFlags; | ||
244 | |||
245 | const char* eventdelivery_int_to_string (int x); | ||
246 | const char* eventdelivery_string_to_string (const char* x); | ||
247 | const char* eventdelivery_source_to_string (SerialSource* x); | ||
248 | const char* eventdelivery_sink_to_string (SerialSink* x); | ||
249 | const char* eventdelivery_handle_to_string (FileHandle* x); | ||
250 | |||
251 | void serializeio_print_bytes (const guint8* buf, guint len); | ||
252 | |||
253 | /* Event delivery privates | ||
254 | */ | ||
255 | |||
256 | typedef struct _GenericEventDef GenericEventDef; | ||
257 | typedef struct _GenericEvent GenericEvent; | ||
258 | |||
259 | struct _GenericEvent | ||
260 | { | ||
261 | gint code; | ||
262 | const char* srcfile; | ||
263 | guint srcline; | ||
264 | }; | ||
265 | |||
266 | GenericEventDef* eventdelivery_event_lookup (gint code); | ||
267 | |||
268 | void eventdelivery_event_deliver (GenericEvent* e); | ||
269 | |||
270 | typedef gboolean (* ErrorDeliveryFunc) (GenericEvent* ev, GenericEventDef* def, const char* message); | ||
271 | |||
272 | void eventdelivery_event_watch_all (ErrorDeliveryFunc func); | ||
273 | |||
274 | void eventdelivery_initialize_event_def (gint code, | ||
275 | gint level, | ||
276 | gint flags, | ||
277 | const char* name, | ||
278 | const char* oneline, | ||
279 | const char * (* field_to_string) (GenericEvent* ev, gint field)); | ||
280 | |||
281 | const char* eventdelivery_ssl_errors_to_string (void); | ||
282 | |||
283 | struct _GenericEventDef | ||
284 | { | ||
285 | gint code; | ||
286 | gint level; | ||
287 | gint flags; | ||
288 | const char *name; | ||
289 | const char *oneline; | ||
290 | |||
291 | const char * (* field_to_string) (GenericEvent* ev, gint field); | ||
292 | }; | ||
293 | |||
294 | /* MD5.H - header file for MD5C.C */ | ||
295 | |||
296 | /* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All | ||
297 | rights reserved. | ||
298 | |||
299 | License to copy and use this software is granted provided that it | ||
300 | is identified as the "RSA Data Security, Inc. MD5 Message-Digest | ||
301 | Algorithm" in all material mentioning or referencing this software | ||
302 | or this function. | ||
303 | |||
304 | License is also granted to make and use derivative works provided | ||
305 | that such works are identified as "derived from the RSA Data | ||
306 | Security, Inc. MD5 Message-Digest Algorithm" in all material | ||
307 | mentioning or referencing the derived work. | ||
308 | |||
309 | RSA Data Security, Inc. makes no representations concerning either | ||
310 | the merchantability of this software or the suitability of this | ||
311 | software for any particular purpose. It is provided "as is" | ||
312 | without express or implied warranty of any kind. | ||
313 | |||
314 | These notices must be retained in any copies of any part of this | ||
315 | documentation and/or software. | ||
316 | */ | ||
317 | |||
318 | /* MD5 context. */ | ||
319 | typedef struct { | ||
320 | guint32 state[4]; /* state (ABCD) */ | ||
321 | guint32 count[2]; /* number of bits, modulo 2^64 (lsb first) */ | ||
322 | guint8 buffer[64]; /* input buffer */ | ||
323 | } EdsioMD5Ctx; | ||
324 | |||
325 | void edsio_md5_init (EdsioMD5Ctx *); | ||
326 | void edsio_md5_update (EdsioMD5Ctx *, const guint8 *, guint); | ||
327 | void edsio_md5_final (guint8*, EdsioMD5Ctx *); | ||
328 | |||
329 | gint edsio_md5_equal (gconstpointer v, | ||
330 | gconstpointer v2); | ||
331 | guint edsio_md5_hash (gconstpointer v); | ||
332 | |||
333 | void edsio_md5_to_string (const guint8* md5, char buf[33]); | ||
334 | gboolean edsio_md5_from_string (guint8* md5, const char buf[33]); | ||
335 | |||
336 | /* NIST Secure Hash Algorithm */ | ||
337 | /* heavily modified from Peter C. Gutmann's implementation */ | ||
338 | /* then taken from from Uwe Hollerbach, */ | ||
339 | /* and then modified a little by Josh MacDonald. */ | ||
340 | |||
341 | /* This code is in the public domain */ | ||
342 | |||
343 | typedef struct { | ||
344 | guint32 digest[5]; /* message digest */ | ||
345 | guint32 count_lo, count_hi; /* 64-bit bit count */ | ||
346 | guint32 data[16]; /* SHA data buffer */ | ||
347 | int local; /* unprocessed amount in data */ | ||
348 | } EdsioSHACtx; | ||
349 | |||
350 | void edsio_sha_init (EdsioSHACtx *); | ||
351 | void edsio_sha_update (EdsioSHACtx *, const guint8 *, guint); | ||
352 | void edsio_sha_final (guint8 *, EdsioSHACtx *); | ||
353 | |||
354 | gint edsio_sha_equal (gconstpointer v, | ||
355 | gconstpointer v2); | ||
356 | guint edsio_sha_hash (gconstpointer v); | ||
357 | |||
358 | /* Misc stuff. | ||
359 | */ | ||
360 | |||
361 | /* These raise an error if errmsg is non-null. The errmsg should | ||
362 | * be something like "Invalid port number". See edsio.ser for the | ||
363 | * format. | ||
364 | */ | ||
365 | gboolean strtosi_checked (const char* str, gint32* i, const char* errmsg); | ||
366 | gboolean strtoss_checked (const char* str, gint16* s, const char* errmsg); | ||
367 | |||
368 | gboolean strtoui_checked (const char* str, guint32* i, const char* errmsg); | ||
369 | gboolean strtous_checked (const char* str, guint16* i, const char* errmsg); | ||
370 | |||
371 | const char* edsio_intern_string (const char* str); | ||
372 | |||
373 | GByteArray* edsio_base64_encode_region (const guint8* data, guint data_len); | ||
374 | GByteArray* edsio_base64_decode_region (const guint8* data, guint data_len); | ||
375 | gboolean edsio_base64_encode_region_into (const guint8* data, guint data_len, guint8* out, guint *out_len); | ||
376 | gboolean edsio_base64_decode_region_into (const guint8* data, guint data_len, guint8* out, guint *out_len); | ||
377 | |||
378 | gchar* edsio_time_to_iso8601 (SerialGenericTime* time); | ||
379 | gchar* edsio_time_t_to_iso8601 (GTime time); | ||
380 | gboolean edsio_time_of_day (SerialGenericTime* time); | ||
381 | |||
382 | enum _SimpleBufferFlags { | ||
383 | SBF_None = 0, | ||
384 | SBF_Compress = 1 << 0, | ||
385 | SBF_Checksum = 1 << 1, | ||
386 | SBF_Base64 = 1 << 2 | ||
387 | }; | ||
388 | |||
389 | typedef enum _SimpleBufferFlags SimpleBufferFlags; | ||
390 | |||
391 | SerialSource* edsio_simple_source (const guint8* data, guint len, guint flags); | ||
392 | SerialSink* edsio_simple_sink (gpointer data, | ||
393 | guint flags, | ||
394 | gboolean free_result, | ||
395 | void (* success) (gpointer data, GByteArray* result), | ||
396 | GByteArray **result); | ||
397 | |||
398 | gboolean edsio_library_check (guint32 number); | ||
399 | void edsio_library_register (guint32 number, const char*name); | ||
400 | |||
401 | /* (Persistent) Property stuff. | ||
402 | */ | ||
403 | |||
404 | enum _PropertyFlags { | ||
405 | PF_None = 0, | ||
406 | PF_Persistent = 1 | ||
407 | }; | ||
408 | |||
409 | typedef enum _PropertyFlags PropertyFlags; | ||
410 | |||
411 | typedef struct _EdsioProperty EdsioProperty; | ||
412 | typedef union _EdsioPropertyEntry EdsioPropertyEntry; | ||
413 | typedef struct _EdsioGenericProperty EdsioGenericProperty; | ||
414 | |||
415 | typedef void (* PropFreeFunc) (gpointer obj); | ||
416 | typedef gboolean (* PropGSFunc) (/*gpointer obj, GHashTable** obj_table, EdsioProperty* prop, ... */); | ||
417 | typedef gboolean (* PropSerialize) (/*SerialSink* sink, ... */); | ||
418 | typedef gboolean (* PropUnserialize) (/*SerialSource* source, ... */); | ||
419 | |||
420 | typedef GHashTable** (* PropertyTableFunc) (gpointer obj); | ||
421 | typedef SerialSource* (* PersistSourceFunc) (gpointer obj, const char* prop_name); | ||
422 | typedef SerialSink* (* PersistSinkFunc) (gpointer obj, const char* prop_name); | ||
423 | typedef gboolean (* PersistIssetFunc) (gpointer obj, const char* prop_name); | ||
424 | typedef gboolean (* PersistUnsetFunc) (gpointer obj, const char* prop_name); | ||
425 | |||
426 | void edsio_initialize_property_type (const char* t, PropFreeFunc freer, PropGSFunc getter, PropGSFunc setter, PropSerialize ser, PropUnserialize unser); | ||
427 | void edsio_initialize_host_type (const char* ph, | ||
428 | PropertyTableFunc ptable, | ||
429 | PersistSourceFunc source, | ||
430 | PersistSinkFunc sink, | ||
431 | PersistIssetFunc isset, | ||
432 | PersistUnsetFunc unset); | ||
433 | |||
434 | gboolean edsio_property_isset (const char* ph, const char* t, guint32 code, gpointer obj); | ||
435 | gboolean edsio_property_unset (const char* ph, const char* t, guint32 code, gpointer obj); | ||
436 | |||
437 | PropGSFunc edsio_property_getter (const char* ph, const char* t, guint32 code, EdsioProperty** prop); | ||
438 | PropGSFunc edsio_property_setter (const char* ph, const char* t, guint32 code, EdsioProperty** prop); | ||
439 | |||
440 | void edsio_property_uint_free (gpointer obj); | ||
441 | gboolean edsio_property_uint_getter (gpointer obj, EdsioProperty* ep, guint32* get); | ||
442 | gboolean edsio_property_uint_setter (gpointer obj, EdsioProperty* ep, guint32 set); | ||
443 | |||
444 | void edsio_property_string_free (gpointer obj); | ||
445 | gboolean edsio_property_string_getter (gpointer obj, EdsioProperty* ep, const char** get); | ||
446 | gboolean edsio_property_string_setter (gpointer obj, EdsioProperty* ep, const char* set); | ||
447 | |||
448 | void edsio_property_bytes_free (gpointer obj); | ||
449 | gboolean edsio_property_bytes_getter (gpointer obj, EdsioProperty* ep, guint8** get, guint32 *get_len); | ||
450 | gboolean edsio_property_bytes_setter (gpointer obj, EdsioProperty* ep, guint8* set, guint32 set_len); | ||
451 | |||
452 | void edsio_property_vptr_free (gpointer obj); | ||
453 | gboolean edsio_property_vptr_getter (gpointer obj, EdsioProperty* ep, void** get); | ||
454 | gboolean edsio_property_vptr_setter (gpointer obj, EdsioProperty* ep, void* set); | ||
455 | |||
456 | EdsioPropertyEntry* edsio_property_get (gpointer obj, EdsioProperty* ep); | ||
457 | gboolean edsio_property_set (gpointer obj, EdsioProperty* ep, EdsioPropertyEntry* set); | ||
458 | |||
459 | gboolean edsio_new_property (const char* name, const char* ph, const char* t, guint32 flags, EdsioGenericProperty* prop); | ||
460 | |||
461 | /* Testing... | ||
462 | */ | ||
463 | |||
464 | #define DEBUG_LIBEDSIO | ||
465 | |||
466 | #ifdef DEBUG_LIBEDSIO | ||
467 | struct _PropTest | ||
468 | { | ||
469 | GHashTable* _edsio_property_table; | ||
470 | |||
471 | GHashTable* ptable; | ||
472 | |||
473 | const char* kludge; | ||
474 | }; | ||
475 | |||
476 | GHashTable** edsio_proptest_property_table (PropTest *pt); | ||
477 | SerialSource* edsio_persist_proptest_source (PropTest *pt, const char* prop_name); | ||
478 | SerialSink* edsio_persist_proptest_sink (PropTest *pt, const char* prop_name); | ||
479 | gboolean edsio_persist_proptest_isset (PropTest *pt, const char* prop_name); | ||
480 | gboolean edsio_persist_proptest_unset (PropTest *pt, const char* prop_name); | ||
481 | |||
482 | #endif | ||
483 | |||
484 | /* Missing glib stuff | ||
485 | */ | ||
486 | |||
487 | typedef struct _GQueue GQueue; | ||
488 | |||
489 | struct _GQueue | ||
490 | { | ||
491 | GList *list; | ||
492 | GList *list_end; | ||
493 | guint list_size; | ||
494 | }; | ||
495 | |||
496 | /* Queues | ||
497 | */ | ||
498 | |||
499 | GQueue * g_queue_new (void); | ||
500 | void g_queue_free (GQueue *q); | ||
501 | guint g_queue_get_size (GQueue *q); | ||
502 | void g_queue_push_front (GQueue *q, gpointer data); | ||
503 | void g_queue_push_back (GQueue *q, gpointer data); | ||
504 | gpointer g_queue_pop_front (GQueue *q); | ||
505 | gpointer g_queue_pop_back (GQueue *q); | ||
506 | |||
507 | #define g_queue_empty(queue) \ | ||
508 | ((((GQueue *)(queue)) && ((GQueue *)(queue))->list) ? FALSE : TRUE) | ||
509 | |||
510 | #define g_queue_peek_front(queue) \ | ||
511 | ((((GQueue *)(queue)) && ((GQueue *)(queue))->list) ? \ | ||
512 | ((GQueue *)(queue))->list->data : NULL) | ||
513 | |||
514 | #define g_queue_peek_back(queue) \ | ||
515 | ((((GQueue *)(queue)) && ((GQueue *)(queue))->list_end) ? \ | ||
516 | ((GQueue *)(queue))->list_end->data : NULL) | ||
517 | |||
518 | #define g_queue_index(queue,ptr) \ | ||
519 | ((((GQueue *)(queue)) && ((GQueue *)(queue))->list) ? \ | ||
520 | g_list_index (((GQueue *)(queue))->list, (ptr)) : -1) | ||
521 | |||
522 | #define g_queue_push g_queue_push_back | ||
523 | #define g_queue_pop g_queue_pop_front | ||
524 | #define g_queue_peek g_queue_peek_front | ||
525 | |||
526 | |||
527 | #ifdef __cplusplus | ||
528 | } | ||
529 | #endif | ||
530 | |||
531 | #endif /* _EDSIO_H_ */ | ||