6ad9c09069d627c705a97515e53f1c623fafbd5c
[framework/uifw/eet.git] / src / lib / Eet.h
1 #ifndef _EET_H
2 #define _EET_H
3
4 #include <stdlib.h>
5 #include <stdio.h>
6 #include <Eina.h>
7
8 #ifdef EAPI
9 # undef EAPI
10 #endif
11
12 #ifdef _WIN32
13 # ifdef EFL_EET_BUILD
14 #  ifdef DLL_EXPORT
15 #   define EAPI __declspec(dllexport)
16 #  else
17 #   define EAPI
18 #  endif /* ! DLL_EXPORT */
19 # else
20 #  define EAPI __declspec(dllimport)
21 # endif /* ! EFL_EET_BUILD */
22 #else
23 # ifdef __GNUC__
24 #  if __GNUC__ >= 4
25 #   define EAPI __attribute__ ((visibility("default")))
26 #  else
27 #   define EAPI
28 #  endif
29 # else
30 #  define EAPI
31 # endif
32 #endif /* ! _WIN32 */
33
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37
38   /**
39    * @file Eet.h
40    * @brief The file that provides the eet functions.
41    *
42    * This header provides the Eet management functions.
43    *
44    */
45
46   /**
47    * @defgroup Eet_Group Top level functions
48    * Functions that affect Eet as a whole.
49    *
50    * @{
51    */
52
53   /**
54    * @enum _Eet_Error
55    * All the error identifiers known by Eet.
56    */
57    typedef enum _Eet_Error
58      {
59        EET_ERROR_NONE, /**< No error, it's all fine! */
60        EET_ERROR_BAD_OBJECT, /**< Given object or handle is NULL or invalid */
61        EET_ERROR_EMPTY, /**< There was nothing to do */
62        EET_ERROR_NOT_WRITABLE, /**< Could not write to file or fine is #EET_FILE_MODE_READ */
63        EET_ERROR_OUT_OF_MEMORY, /**< Could not allocate memory */
64        EET_ERROR_WRITE_ERROR, /**< Failed to write data to destination */
65        EET_ERROR_WRITE_ERROR_FILE_TOO_BIG, /**< Failed to write file since it is too big */
66        EET_ERROR_WRITE_ERROR_IO_ERROR, /**< Failed to write since generic Input/Output error */
67        EET_ERROR_WRITE_ERROR_OUT_OF_SPACE, /**< Failed to write due out of space */
68        EET_ERROR_WRITE_ERROR_FILE_CLOSED, /**< Failed to write because file was closed */
69        EET_ERROR_MMAP_FAILED, /**< Could not mmap file */
70        EET_ERROR_X509_ENCODING_FAILED, /**< Could not encode using X509 */
71        EET_ERROR_SIGNATURE_FAILED, /**< Could not validate signature */
72        EET_ERROR_INVALID_SIGNATURE, /**< Signature is invalid */
73        EET_ERROR_NOT_SIGNED, /**< File or contents are not signed */
74        EET_ERROR_NOT_IMPLEMENTED, /**< Function is not implemented */
75        EET_ERROR_PRNG_NOT_SEEDED, /**< Could not introduce random seed */
76        EET_ERROR_ENCRYPT_FAILED, /**< Could not encrypt contents */
77        EET_ERROR_DECRYPT_FAILED /**< Could not decrypt contents */
78      } Eet_Error; /**< Eet error identifiers */
79
80   /**
81    * @}
82    */
83
84    /**
85     * Initialize the EET library.
86     *
87     * @return The new init count.
88     *
89     * @since 1.0.0
90     * @ingroup Eet_Group
91     */
92    EAPI int eet_init(void);
93
94    /**
95     * Shut down the EET library.
96     *
97     * @return The new init count.
98     *
99     * @since 1.0.0
100     * @ingroup Eet_Group
101     */
102    EAPI int eet_shutdown(void);
103
104    /**
105     * Clear eet cache
106     *
107     * Eet didn't free items by default. If you are under memory
108     * presure, just call this function to recall all memory that are
109     * not yet referenced anymore.  The cache take care of modification
110     * on disk.
111     *
112     * @since 1.0.0
113     * @ingroup Eet_Group
114     */
115    EAPI void eet_clearcache(void);
116
117
118   /**
119     * @defgroup Eet_File_Group Eet File Main Functions
120     *
121     * Functions to create, destroy and do basic manipulation of
122     * #Eet_File handles.
123     *
124     * @{
125     */
126
127   /**
128    * @enum _Eet_File_Mode
129    * Modes that a file can be opened.
130    */
131    typedef enum _Eet_File_Mode
132      {
133         EET_FILE_MODE_INVALID = -1,
134         EET_FILE_MODE_READ, /**< File is read-only. */
135         EET_FILE_MODE_WRITE, /**< File is write-only. */
136         EET_FILE_MODE_READ_WRITE /**< File is for both read and write */
137      } Eet_File_Mode; /**< Modes that a file can be opened. */
138
139   /**
140    * @typedef Eet_File
141    * Opaque handle that defines an Eet file (or memory).
142    *
143    * @see eet_open()
144    * @see eet_memopen_read()
145    * @see eet_close()
146    */
147    typedef struct _Eet_File Eet_File;
148
149   /**
150    * @typedef Eet_Dictionary
151    * Opaque handle that defines a file-backed (mmaped) dictionary of strings.
152    */
153    typedef struct _Eet_Dictionary Eet_Dictionary;
154
155
156   /**
157    * @}
158    */
159
160    /**
161     * Open an eet file on disk, and returns a handle to it.
162     * @param file The file path to the eet file. eg: @c "/tmp/file.eet".
163     * @param mode The mode for opening. Either #EET_FILE_MODE_READ,
164     *        #EET_FILE_MODE_WRITE or #EET_FILE_MODE_READ_WRITE.
165     * @return An opened eet file handle.
166     * @ingroup Eet_File_Group
167     *
168     * This function will open an exiting eet file for reading, and build
169     * the directory table in memory and return a handle to the file, if it
170     * exists and can be read, and no memory errors occur on the way, otherwise
171     * NULL will be returned.
172     *
173     * It will also open an eet file for writing. This will, if successful,
174     * delete the original file and replace it with a new empty file, till
175     * the eet file handle is closed or flushed. If it cannot be opened for
176     * writing or a memory error occurs, NULL is returned.
177     *
178     * You can also open the file for read/write. If you then write a key that
179     * does not exist it will be created, if the key exists it will be replaced
180     * by the new data.
181     *
182     * Example:
183     * @code
184     * #include <Eet.h>
185     * #include <stdio.h>
186     * #include <string.h>
187     *
188     * int
189     * main(int argc, char **argv)
190     * {
191     *   Eet_File *ef;
192     *   char buf[1024], *ret, **list;
193     *   int size, num, i;
194     *
195     *   eet_init();
196     *
197     *   strcpy(buf, "Here is a string of data to save!");
198     *
199     *   ef = eet_open("/tmp/my_file.eet", EET_FILE_MODE_WRITE);
200     *   if (!ef) return -1;
201     *   if (!eet_write(ef, "/key/to_store/at", buf, 1024, 1))
202     *     fprintf(stderr, "Error writing data!\n");
203     *   eet_close(ef);
204     *
205     *   ef = eet_open("/tmp/my_file.eet", EET_FILE_MODE_READ);
206     *   if (!ef) return -1;
207     *   list = eet_list(ef, "*", &num);
208     *   if (list)
209     *     {
210     *       for (i = 0; i < num; i++)
211     *         printf("Key stored: %s\n", list[i]);
212     *       free(list);
213     *     }
214     *   ret = eet_read(ef, "/key/to_store/at", &size);
215     *   if (ret)
216     *     {
217     *       printf("Data read (%i bytes):\n%s\n", size, ret);
218     *       free(ret);
219     *     }
220     *   eet_close(ef);
221     *
222     *   eet_shutdown();
223     *
224     *   return 0;
225     * }
226     * @endcode
227     *
228     * @since 1.0.0
229     */
230    EAPI Eet_File *eet_open(const char *file, Eet_File_Mode mode);
231
232    /**
233     * Open an eet file directly from a memory location. The data are not copied,
234     * so you must keep them around as long as the eet file is open. Their is
235     * currently no cache for this kind of Eet_File, so it's reopen every time
236     * you do use eet_memopen_read.
237     *
238     * @since 1.1.0
239     * @ingroup Eet_File_Group
240     */
241    EAPI Eet_File *eet_memopen_read(const void *data, size_t size);
242
243    /**
244     * Get the mode an Eet_File was opened with.
245     * @param ef A valid eet file handle.
246     * @return The mode ef was opened with.
247     *
248     * @since 1.0.0
249     * @ingroup Eet_File_Group
250     */
251    EAPI Eet_File_Mode eet_mode_get(Eet_File *ef);
252
253    /**
254     * Close an eet file handle and flush and writes pending.
255     * @param ef A valid eet file handle.
256     *
257     * This function will flush any pending writes to disk if the eet file
258     * was opened for write, and free all data associated with the file handle
259     * and file, and close the file.
260     *
261     * If the eet file handle is not valid nothing will be done.
262     *
263     * @since 1.0.0
264     * @ingroup Eet_File_Group
265     */
266    EAPI Eet_Error eet_close(Eet_File *ef);
267
268    /**
269     * Sync content of an eet file handle, flushing pending writes.
270     * @param ef A valid eet file handle.
271     *
272     * This function will flush any pending writes to disk. The eet file must
273     * be opened for write.
274     *
275     * If the eet file handle is not valid nothing will be done.
276     *
277     * @since 1.2.4
278     * @ingroup Eet_File_Group
279     */
280    EAPI Eet_Error eet_sync(Eet_File *ef);
281
282    /**
283     * Return a handle to the shared string dictionary of the Eet file
284     * @param ef A valid eet file handle.
285     * @return A handle to the dictionary of the file
286     *
287     * This function returns a handle to the dictionary of an Eet file whose
288     * handle is @p ef, if a dictionary exists. NULL is returned otherwise or
289     * if the file handle is known to be invalid.
290     *
291     * @see eet_dictionary_string_check() to know if given string came
292     *      from the dictionary or it was dynamically allocated using
293     *      the #Eet_Data_Descriptor_Class instructrions.
294     *
295     * @since 1.0.0
296     * @ingroup Eet_File_Group
297     */
298    EAPI Eet_Dictionary *eet_dictionary_get(Eet_File *ef);
299
300    /**
301     * Check if a given string comes from a given dictionary
302     * @param ed A valid dictionary handle
303     * @param string A valid 0 byte terminated C string
304     * @return 1 if it is in the dictionary, 0 otherwise
305     *
306     * This checks the given dictionary to see if the given string is actually
307     * inside that dictionary (i.e. comes from it) and returns 1 if it does.
308     * If the dictionary handle is invlide, the string is NULL or the string is
309     * not in the dictionary, 0 is returned.
310     *
311     * @since 1.0.0
312     * @ingroup Eet_File_Group
313     */
314    EAPI int eet_dictionary_string_check(Eet_Dictionary *ed, const char *string);
315
316    /**
317     * Read a specified entry from an eet file and return data
318     * @param ef A valid eet file handle opened for reading.
319     * @param name Name of the entry. eg: "/base/file_i_want".
320     * @param size_ret Number of bytes read from entry and returned.
321     * @return The data stored in that entry in the eet file.
322     *
323     * This function finds an entry in the eet file that is stored under the
324     * name specified, and returns that data, decompressed, if successful.
325     * NULL is returned if the lookup fails or if memory errors are
326     * encountered. It is the job of the calling program to call free() on
327     * the returned data. The number of bytes in the returned data chunk are
328     * placed in size_ret.
329     *
330     * If the eet file handle is not valid NULL is returned and size_ret is
331     * filled with 0.
332     *
333     * @see eet_read_cipher()
334     *
335     * @since 1.0.0
336     * @ingroup Eet_File_Group
337     */
338    EAPI void *eet_read(Eet_File *ef, const char *name, int *size_ret);
339
340    /**
341     * Read a specified entry from an eet file and return data
342     * @param ef A valid eet file handle opened for reading.
343     * @param name Name of the entry. eg: "/base/file_i_want".
344     * @param size_ret Number of bytes read from entry and returned.
345     * @return The data stored in that entry in the eet file.
346     *
347     * This function finds an entry in the eet file that is stored under the
348     * name specified, and returns that data if not compressed and successful.
349     * NULL is returned if the lookup fails or if memory errors are
350     * encountered or if the data is comrpessed. The calling program must never
351     * call free() on the returned data. The number of bytes in the returned
352     * data chunk are placed in size_ret.
353     *
354     * If the eet file handle is not valid NULL is returned and size_ret is
355     * filled with 0.
356     *
357     * @since 1.0.0
358     * @ingroup Eet_File_Group
359     */
360    EAPI const void *eet_read_direct(Eet_File *ef, const char *name, int *size_ret);
361
362    /**
363     * Write a specified entry to an eet file handle
364     * @param ef A valid eet file handle opened for writing.
365     * @param name Name of the entry. eg: "/base/file_i_want".
366     * @param data Pointer to the data to be stored.
367     * @param size Length in bytes in the data to be stored.
368     * @param compress Compression flags (1 == compress, 0 = don't compress).
369     * @return bytes written on successful write, 0 on failure.
370     *
371     * This function will write the specified chunk of data to the eet file
372     * and return greater than 0 on success. 0 will be returned on failure.
373     *
374     * The eet file handle must be a valid file handle for an eet file opened
375     * for writing. If it is not, 0 will be returned and no action will be
376     * performed.
377     *
378     * Name, and data must not be NULL, and size must be > 0. If these
379     * conditions are not met, 0 will be returned.
380     *
381     * The data will be copied (and optionally compressed) in ram, pending
382     * a flush to disk (it will stay in ram till the eet file handle is
383     * closed though).
384     *
385     * @see eet_write_cipher()
386     *
387     * @since 1.0.0
388     * @ingroup Eet_File_Group
389     */
390    EAPI int eet_write(Eet_File *ef, const char *name, const void *data, int size, int compress);
391
392    /**
393     * Delete a specified entry from an Eet file being written or re-written
394     * @param ef A valid eet file handle opened for writing.
395     * @param name Name of the entry. eg: "/base/file_i_want".
396     * @return Success or failure of the delete.
397     *
398     * This function will delete the specified chunk of data from the eet file
399     * and return greater than 0 on success. 0 will be returned on failure.
400     *
401     * The eet file handle must be a valid file handle for an eet file opened
402     * for writing. If it is not, 0 will be returned and no action will be
403     * performed.
404     *
405     * Name, must not be NULL, otherwise 0 will be returned.
406     *
407     * @since 1.0.0
408     * @ingroup Eet_File_Group
409     */
410    EAPI int eet_delete(Eet_File *ef, const char *name);
411
412    /**
413     * List all entries in eet file matching shell glob.
414     * @param ef A valid eet file handle.
415     * @param glob A shell glob to match against.
416     * @param count_ret Number of entries found to match.
417     * @return Pointer to an array of strings.
418     *
419     * This function will list all entries in the eet file matching the
420     * supplied shell glob and return an allocated list of their names, if
421     * there are any, and if no memory errors occur.
422     *
423     * The eet file handle must be valid and glob must not be NULL, or NULL
424     * will be returned and count_ret will be filled with 0.
425     *
426     * The calling program must call free() on the array returned, but NOT
427     * on the string pointers in the array. They are taken as read-only
428     * internals from the eet file handle. They are only valid as long as
429     * the file handle is not closed. When it is closed those pointers in the
430     * array are now not valid and should not be used.
431     *
432     * On success the array returned will have a list of string pointers
433     * that are the names of the entries that matched, and count_ret will have
434     * the number of entries in this array placed in it.
435     *
436     * Hint: an easy way to list all entries in an eet file is to use a glob
437     * value of "*".
438     *
439     * @since 1.0.0
440     * @ingroup Eet_File_Group
441     */
442    EAPI char **eet_list(Eet_File *ef, const char *glob, int *count_ret);
443
444    /**
445     * Return the number of entries in the specified eet file.
446     * @param ef A valid eet file handle.
447     * @return Number of entries in ef or -1 if the number of entries
448     *         cannot be read due to open mode restrictions.
449     *
450     * @since 1.0.0
451     * @ingroup Eet_File_Group
452     */
453    EAPI int eet_num_entries(Eet_File *ef);
454
455    /**
456     * @defgroup Eet_File_Cipher_Group Eet File Ciphered Main Functions
457     *
458     * Most of the @ref Eet_File_Group have alternative versions that
459     * accounts for ciphers to protect their content.
460     *
461     * @see @ref Eet_Cipher_Group
462     *
463     * @ingroup Eet_File_Group
464     */
465
466    /**
467     * Read a specified entry from an eet file and return data using a cipher.
468     * @param ef A valid eet file handle opened for reading.
469     * @param name Name of the entry. eg: "/base/file_i_want".
470     * @param size_ret Number of bytes read from entry and returned.
471     * @param cipher_key The key to use as cipher.
472     * @return The data stored in that entry in the eet file.
473     *
474     * This function finds an entry in the eet file that is stored under the
475     * name specified, and returns that data, decompressed, if successful.
476     * NULL is returned if the lookup fails or if memory errors are
477     * encountered. It is the job of the calling program to call free() on
478     * the returned data. The number of bytes in the returned data chunk are
479     * placed in size_ret.
480     *
481     * If the eet file handle is not valid NULL is returned and size_ret is
482     * filled with 0.
483     *
484     * @see eet_read()
485     *
486     * @since 1.0.0
487     * @ingroup Eet_File_Cipher_Group
488     */
489    EAPI void *eet_read_cipher(Eet_File *ef, const char *name, int *size_ret, const char *cipher_key);
490
491    /**
492     * Write a specified entry to an eet file handle using a cipher.
493     * @param ef A valid eet file handle opened for writing.
494     * @param name Name of the entry. eg: "/base/file_i_want".
495     * @param data Pointer to the data to be stored.
496     * @param size Length in bytes in the data to be stored.
497     * @param compress Compression flags (1 == compress, 0 = don't compress).
498     * @param cipher_key The key to use as cipher.
499     * @return bytes written on successful write, 0 on failure.
500     *
501     * This function will write the specified chunk of data to the eet file
502     * and return greater than 0 on success. 0 will be returned on failure.
503     *
504     * The eet file handle must be a valid file handle for an eet file opened
505     * for writing. If it is not, 0 will be returned and no action will be
506     * performed.
507     *
508     * Name, and data must not be NULL, and size must be > 0. If these
509     * conditions are not met, 0 will be returned.
510     *
511     * The data will be copied (and optionally compressed) in ram, pending
512     * a flush to disk (it will stay in ram till the eet file handle is
513     * closed though).
514     *
515     * @see eet_write()
516     *
517     * @since 1.0.0
518     * @ingroup Eet_File_Cipher_Group
519     */
520    EAPI int eet_write_cipher(Eet_File *ef, const char *name, const void *data, int size, int compress, const char *cipher_key);
521
522
523    /**
524     * @defgroup Eet_File_Image_Group Image Store and Load
525     *
526     * Eet efficiently stores and loads images, including alpha
527     * channels and lossy compressions.
528     */
529
530    /**
531     * Read just the header data for an image and dont decode the pixels.
532     * @param ef A valid eet file handle opened for reading.
533     * @param name Name of the entry. eg: "/base/file_i_want".
534     * @param w A pointer to the unsigned int to hold the width in pixels.
535     * @param h A pointer to the unsigned int to hold the height in pixels.
536     * @param alpha A pointer to the int to hold the alpha flag.
537     * @param compress A pointer to the int to hold the compression amount.
538     * @param quality A pointer to the int to hold the quality amount.
539     * @param lossy A pointer to the int to hold the lossiness flag.
540     * @return 1 on successfull decode, 0 otherwise
541     *
542     * This function reads an image from an eet file stored under the named
543     * key in the eet file and return a pointer to the decompressed pixel data.
544     *
545     * The other parameters of the image (width, height etc.) are placed into
546     * the values pointed to (they must be supplied). The pixel data is a linear
547     * array of pixels starting from the top-left of the image scanning row by
548     * row from left to right. Each pile is a 32bit value, with the high byte
549     * being the alpha channel, the next being red, then green, and the low byte
550     * being blue. The width and height are measured in pixels and will be
551     * greater than 0 when returned. The alpha flag is either 0 or 1. 0 denotes
552     * that the alpha channel is not used. 1 denotes that it is significant.
553     * Compress is filled with the compression value/amount the image was
554     * stored with. The quality value is filled with the quality encoding of
555     * the image file (0 - 100). The lossy flags is either 0 or 1 as to if
556     * the image was encoded lossily or not.
557     *
558     * On success the function returns 1 indicating the header was read and
559     * decoded properly, or 0 on failure.
560     *
561     * @see eet_data_image_header_read_cipher()
562     *
563     * @since 1.0.0
564     * @ingroup Eet_File_Image_Group
565     */
566    EAPI int eet_data_image_header_read(Eet_File *ef, const char *name, unsigned int *w, unsigned int *h, int *alpha, int *compress, int *quality, int *lossy);
567
568    /**
569     * Read image data from the named key in the eet file.
570     * @param ef A valid eet file handle opened for reading.
571     * @param name Name of the entry. eg: "/base/file_i_want".
572     * @param w A pointer to the unsigned int to hold the width in pixels.
573     * @param h A pointer to the unsigned int to hold the height in pixels.
574     * @param alpha A pointer to the int to hold the alpha flag.
575     * @param compress A pointer to the int to hold the compression amount.
576     * @param quality A pointer to the int to hold the quality amount.
577     * @param lossy A pointer to the int to hold the lossiness flag.
578     * @return The image pixel data decoded
579     *
580     * This function reads an image from an eet file stored under the named
581     * key in the eet file and return a pointer to the decompressed pixel data.
582     *
583     * The other parameters of the image (width, height etc.) are placed into
584     * the values pointed to (they must be supplied). The pixel data is a linear
585     * array of pixels starting from the top-left of the image scanning row by
586     * row from left to right. Each pile is a 32bit value, with the high byte
587     * being the alpha channel, the next being red, then green, and the low byte
588     * being blue. The width and height are measured in pixels and will be
589     * greater than 0 when returned. The alpha flag is either 0 or 1. 0 denotes
590     * that the alpha channel is not used. 1 denotes that it is significant.
591     * Compress is filled with the compression value/amount the image was
592     * stored with. The quality value is filled with the quality encoding of
593     * the image file (0 - 100). The lossy flags is either 0 or 1 as to if
594     * the image was encoded lossily or not.
595     *
596     * On success the function returns a pointer to the image data decoded. The
597     * calling application is responsible for calling free() on the image data
598     * when it is done with it. On failure NULL is returned and the parameter
599     * values may not contain any sensible data.
600     *
601     * @see eet_data_image_read_cipher()
602     *
603     * @since 1.0.0
604     * @ingroup Eet_File_Image_Group
605     */
606    EAPI void *eet_data_image_read(Eet_File *ef, const char *name, unsigned int *w, unsigned int *h, int *alpha, int *compress, int *quality, int *lossy);
607
608    /**
609     * Read image data from the named key in the eet file.
610     * @param ef A valid eet file handle opened for reading.
611     * @param name Name of the entry. eg: "/base/file_i_want".
612     * @param src_x The starting x coordinate from where to dump the stream.
613     * @param src_y The starting y coordinate from where to dump the stream.
614     * @param d A pointer to the pixel surface.
615     * @param w The expected width in pixels of the pixel surface to decode.
616     * @param h The expected height in pixels of the pixel surface to decode.
617     * @param row_stride The length of a pixels line in the destination surface.
618     * @param alpha A pointer to the int to hold the alpha flag.
619     * @param compress A pointer to the int to hold the compression amount.
620     * @param quality A pointer to the int to hold the quality amount.
621     * @param lossy A pointer to the int to hold the lossiness flag.
622     * @return 1 on success, 0 otherwise.
623     *
624     * This function reads an image from an eet file stored under the named
625     * key in the eet file and return a pointer to the decompressed pixel data.
626     *
627     * The other parameters of the image (width, height etc.) are placed into
628     * the values pointed to (they must be supplied). The pixel data is a linear
629     * array of pixels starting from the top-left of the image scanning row by
630     * row from left to right. Each pile is a 32bit value, with the high byte
631     * being the alpha channel, the next being red, then green, and the low byte
632     * being blue. The width and height are measured in pixels and will be
633     * greater than 0 when returned. The alpha flag is either 0 or 1. 0 denotes
634     * that the alpha channel is not used. 1 denotes that it is significant.
635     * Compress is filled with the compression value/amount the image was
636     * stored with. The quality value is filled with the quality encoding of
637     * the image file (0 - 100). The lossy flags is either 0 or 1 as to if
638     * the image was encoded lossily or not.
639     *
640     * On success the function returns 1, and 0 on failure. On failure the
641     * parameter values may not contain any sensible data.
642     *
643     * @see eet_data_image_read_to_surface_cipher()
644     *
645     * @since 1.0.2
646     * @ingroup Eet_File_Image_Group
647     */
648    EAPI int eet_data_image_read_to_surface(Eet_File *ef, const char *name, unsigned int src_x, unsigned int src_y, unsigned int *d, unsigned int w, unsigned int h, unsigned int row_stride, int *alpha, int *compress, int *quality, int *lossy);
649
650    /**
651     * Write image data to the named key in an eet file.
652     * @param ef A valid eet file handle opened for writing.
653     * @param name Name of the entry. eg: "/base/file_i_want".
654     * @param data A pointer to the image pixel data.
655     * @param w The width of the image in pixels.
656     * @param h The height of the image in pixels.
657     * @param alpha The alpha channel flag.
658     * @param compress The compression amount.
659     * @param quality The quality encoding amount.
660     * @param lossy The lossiness flag.
661     * @return Success if the data was encoded and written or not.
662     *
663     * This function takes image pixel data and encodes it in an eet file
664     * stored under the supplied name key, and returns how many bytes were
665     * actually written to encode the image data.
666     *
667     * The data expected is the same format as returned by eet_data_image_read.
668     * If this is not the case weird things may happen. Width and height must
669     * be between 1 and 8000 pixels. The alpha flags can be 0 or 1 (0 meaning
670     * the alpha values are not useful and 1 meaning they are). Compress can
671     * be from 0 to 9 (0 meaning no compression, 9 meaning full compression).
672     * This is only used if the image is not lossily encoded. Quality is used on
673     * lossy compression and should be a value from 0 to 100. The lossy flag
674     * can be 0 or 1. 0 means encode losslessly and 1 means to encode with
675     * image quality loss (but then have a much smaller encoding).
676     *
677     * On success this function returns the number of bytes that were required
678     * to encode the image data, or on failure it returns 0.
679     *
680     * @see eet_data_image_write_cipher()
681     *
682     * @since 1.0.0
683     * @ingroup Eet_File_Image_Group
684     */
685    EAPI int eet_data_image_write(Eet_File *ef, const char *name, const void *data, unsigned int w, unsigned int h, int alpha, int compress, int quality, int lossy);
686
687    /**
688     * Decode Image data header only to get information.
689     * @param data The encoded pixel data.
690     * @param size The size, in bytes, of the encoded pixel data.
691     * @param w A pointer to the unsigned int to hold the width in pixels.
692     * @param h A pointer to the unsigned int to hold the height in pixels.
693     * @param alpha A pointer to the int to hold the alpha flag.
694     * @param compress A pointer to the int to hold the compression amount.
695     * @param quality A pointer to the int to hold the quality amount.
696     * @param lossy A pointer to the int to hold the lossiness flag.
697     * @return 1 on success, 0 on failure.
698     *
699     * This function takes encoded pixel data and decodes it into raw RGBA
700     * pixels on success.
701     *
702     * The other parameters of the image (width, height etc.) are placed into
703     * the values pointed to (they must be supplied). The pixel data is a linear
704     * array of pixels starting from the top-left of the image scanning row by
705     * row from left to right. Each pixel is a 32bit value, with the high byte
706     * being the alpha channel, the next being red, then green, and the low byte
707     * being blue. The width and height are measured in pixels and will be
708     * greater than 0 when returned. The alpha flag is either 0 or 1. 0 denotes
709     * that the alpha channel is not used. 1 denotes that it is significant.
710     * Compress is filled with the compression value/amount the image was
711     * stored with. The quality value is filled with the quality encoding of
712     * the image file (0 - 100). The lossy flags is either 0 or 1 as to if
713     * the image was encoded lossily or not.
714     *
715     * On success the function returns 1 indicating the header was read and
716     * decoded properly, or 0 on failure.
717     *
718     * @see eet_data_image_header_decode_cipher()
719     *
720     * @since 1.0.0
721     * @ingroup Eet_File_Image_Group
722     */
723    EAPI int eet_data_image_header_decode(const void *data, int size, unsigned int *w, unsigned int *h, int *alpha, int *compress, int *quality, int *lossy);
724
725    /**
726     * Decode Image data into pixel data.
727     * @param data The encoded pixel data.
728     * @param size The size, in bytes, of the encoded pixel data.
729     * @param w A pointer to the unsigned int to hold the width in pixels.
730     * @param h A pointer to the unsigned int to hold the height in pixels.
731     * @param alpha A pointer to the int to hold the alpha flag.
732     * @param compress A pointer to the int to hold the compression amount.
733     * @param quality A pointer to the int to hold the quality amount.
734     * @param lossy A pointer to the int to hold the lossiness flag.
735     * @return The image pixel data decoded
736     *
737     * This function takes encoded pixel data and decodes it into raw RGBA
738     * pixels on success.
739     *
740     * The other parameters of the image (width, height etc.) are placed into
741     * the values pointed to (they must be supplied). The pixel data is a linear
742     * array of pixels starting from the top-left of the image scanning row by
743     * row from left to right. Each pixel is a 32bit value, with the high byte
744     * being the alpha channel, the next being red, then green, and the low byte
745     * being blue. The width and height are measured in pixels and will be
746     * greater than 0 when returned. The alpha flag is either 0 or 1. 0 denotes
747     * that the alpha channel is not used. 1 denotes that it is significant.
748     * Compress is filled with the compression value/amount the image was
749     * stored with. The quality value is filled with the quality encoding of
750     * the image file (0 - 100). The lossy flags is either 0 or 1 as to if
751     * the image was encoded lossily or not.
752     *
753     * On success the function returns a pointer to the image data decoded. The
754     * calling application is responsible for calling free() on the image data
755     * when it is done with it. On failure NULL is returned and the parameter
756     * values may not contain any sensible data.
757     *
758     * @see eet_data_image_decode_cipher()
759     *
760     * @since 1.0.0
761     * @ingroup Eet_File_Image_Group
762     */
763    EAPI void *eet_data_image_decode(const void *data, int size, unsigned int *w, unsigned int *h, int *alpha, int *compress, int *quality, int *lossy);
764
765    /**
766     * Decode Image data into pixel data.
767     * @param data The encoded pixel data.
768     * @param size The size, in bytes, of the encoded pixel data.
769     * @param src_x The starting x coordinate from where to dump the stream.
770     * @param src_y The starting y coordinate from where to dump the stream.
771     * @param d A pointer to the pixel surface.
772     * @param w The expected width in pixels of the pixel surface to decode.
773     * @param h The expected height in pixels of the pixel surface to decode.
774     * @param row_stride The length of a pixels line in the destination surface.
775     * @param alpha A pointer to the int to hold the alpha flag.
776     * @param compress A pointer to the int to hold the compression amount.
777     * @param quality A pointer to the int to hold the quality amount.
778     * @param lossy A pointer to the int to hold the lossiness flag.
779     * @return 1 on success, 0 otherwise.
780     *
781     * This function takes encoded pixel data and decodes it into raw RGBA
782     * pixels on success.
783     *
784     * The other parameters of the image (alpha, compress etc.) are placed into
785     * the values pointed to (they must be supplied). The pixel data is a linear
786     * array of pixels starting from the top-left of the image scanning row by
787     * row from left to right. Each pixel is a 32bit value, with the high byte
788     * being the alpha channel, the next being red, then green, and the low byte
789     * being blue. The width and height are measured in pixels and will be
790     * greater than 0 when returned. The alpha flag is either 0 or 1. 0 denotes
791     * that the alpha channel is not used. 1 denotes that it is significant.
792     * Compress is filled with the compression value/amount the image was
793     * stored with. The quality value is filled with the quality encoding of
794     * the image file (0 - 100). The lossy flags is either 0 or 1 as to if
795     * the image was encoded lossily or not.
796     *
797     * On success the function returns 1, and 0 on failure. On failure the
798     * parameter values may not contain any sensible data.
799     *
800     * @see eet_data_image_decode_to_surface_cipher()
801     *
802     * @since 1.0.2
803     * @ingroup Eet_File_Image_Group
804     */
805    EAPI int eet_data_image_decode_to_surface(const void *data, int size, unsigned int src_x, unsigned int src_y, unsigned int *d, unsigned int w, unsigned int h, unsigned int row_stride, int *alpha, int *compress, int *quality, int *lossy);
806
807    /**
808     * Encode image data for storage or transmission.
809     * @param data A pointer to the image pixel data.
810     * @param size_ret A pointer to an int to hold the size of the returned data.
811     * @param w The width of the image in pixels.
812     * @param h The height of the image in pixels.
813     * @param alpha The alpha channel flag.
814     * @param compress The compression amount.
815     * @param quality The quality encoding amount.
816     * @param lossy The lossiness flag.
817     * @return The encoded image data.
818     *
819     * This function stakes image pixel data and encodes it with compression and
820     * possible loss of quality (as a trade off for size) for storage or
821     * transmission to another system.
822     *
823     * The data expected is the same format as returned by eet_data_image_read.
824     * If this is not the case weird things may happen. Width and height must
825     * be between 1 and 8000 pixels. The alpha flags can be 0 or 1 (0 meaning
826     * the alpha values are not useful and 1 meaning they are). Compress can
827     * be from 0 to 9 (0 meaning no compression, 9 meaning full compression).
828     * This is only used if the image is not lossily encoded. Quality is used on
829     * lossy compression and should be a value from 0 to 100. The lossy flag
830     * can be 0 or 1. 0 means encode losslessly and 1 means to encode with
831     * image quality loss (but then have a much smaller encoding).
832     *
833     * On success this function returns a pointer to the encoded data that you
834     * can free with free() when no longer needed.
835     *
836     * @see eet_data_image_encode_cipher()
837     *
838     * @since 1.0.0
839     * @ingroup Eet_File_Image_Group
840     */
841    EAPI void *eet_data_image_encode(const void *data, int *size_ret, unsigned int w, unsigned int h, int alpha, int compress, int quality, int lossy);
842
843    /**
844     * @defgroup Eet_File_Image_Cipher_Group Image Store and Load using a Cipher
845     *
846     * Most of the @ref Eet_File_Image_Group have alternative versions
847     * that accounts for ciphers to protect their content.
848     *
849     * @see @ref Eet_Cipher_Group
850     *
851     * @ingroup Eet_File_Image_Group
852     */
853
854    /**
855     * Read just the header data for an image and dont decode the pixels using a cipher.
856     * @param ef A valid eet file handle opened for reading.
857     * @param name Name of the entry. eg: "/base/file_i_want".
858     * @param cipher_key The key to use as cipher.
859     * @param w A pointer to the unsigned int to hold the width in pixels.
860     * @param h A pointer to the unsigned int to hold the height in pixels.
861     * @param alpha A pointer to the int to hold the alpha flag.
862     * @param compress A pointer to the int to hold the compression amount.
863     * @param quality A pointer to the int to hold the quality amount.
864     * @param lossy A pointer to the int to hold the lossiness flag.
865     * @return 1 on successfull decode, 0 otherwise
866     *
867     * This function reads an image from an eet file stored under the named
868     * key in the eet file and return a pointer to the decompressed pixel data.
869     *
870     * The other parameters of the image (width, height etc.) are placed into
871     * the values pointed to (they must be supplied). The pixel data is a linear
872     * array of pixels starting from the top-left of the image scanning row by
873     * row from left to right. Each pile is a 32bit value, with the high byte
874     * being the alpha channel, the next being red, then green, and the low byte
875     * being blue. The width and height are measured in pixels and will be
876     * greater than 0 when returned. The alpha flag is either 0 or 1. 0 denotes
877     * that the alpha channel is not used. 1 denotes that it is significant.
878     * Compress is filled with the compression value/amount the image was
879     * stored with. The quality value is filled with the quality encoding of
880     * the image file (0 - 100). The lossy flags is either 0 or 1 as to if
881     * the image was encoded lossily or not.
882     *
883     * On success the function returns 1 indicating the header was read and
884     * decoded properly, or 0 on failure.
885     *
886     * @see eet_data_image_header_read()
887     *
888     * @since 1.0.0
889     * @ingroup Eet_File_Image_Cipher_Group
890     */
891    EAPI int eet_data_image_header_read_cipher(Eet_File *ef, const char *name, const char *cipher_key, unsigned int *w, unsigned int *h, int *alpha, int *compress, int *quality, int *lossy);
892
893    /**
894     * Read image data from the named key in the eet file using a cipher.
895     * @param ef A valid eet file handle opened for reading.
896     * @param name Name of the entry. eg: "/base/file_i_want".
897     * @param cipher_key The key to use as cipher.
898     * @param w A pointer to the unsigned int to hold the width in pixels.
899     * @param h A pointer to the unsigned int to hold the height in pixels.
900     * @param alpha A pointer to the int to hold the alpha flag.
901     * @param compress A pointer to the int to hold the compression amount.
902     * @param quality A pointer to the int to hold the quality amount.
903     * @param lossy A pointer to the int to hold the lossiness flag.
904     * @return The image pixel data decoded
905     *
906     * This function reads an image from an eet file stored under the named
907     * key in the eet file and return a pointer to the decompressed pixel data.
908     *
909     * The other parameters of the image (width, height etc.) are placed into
910     * the values pointed to (they must be supplied). The pixel data is a linear
911     * array of pixels starting from the top-left of the image scanning row by
912     * row from left to right. Each pile is a 32bit value, with the high byte
913     * being the alpha channel, the next being red, then green, and the low byte
914     * being blue. The width and height are measured in pixels and will be
915     * greater than 0 when returned. The alpha flag is either 0 or 1. 0 denotes
916     * that the alpha channel is not used. 1 denotes that it is significant.
917     * Compress is filled with the compression value/amount the image was
918     * stored with. The quality value is filled with the quality encoding of
919     * the image file (0 - 100). The lossy flags is either 0 or 1 as to if
920     * the image was encoded lossily or not.
921     *
922     * On success the function returns a pointer to the image data decoded. The
923     * calling application is responsible for calling free() on the image data
924     * when it is done with it. On failure NULL is returned and the parameter
925     * values may not contain any sensible data.
926     *
927     * @see eet_data_image_read()
928     *
929     * @since 1.0.0
930     * @ingroup Eet_File_Image_Cipher_Group
931     */
932    EAPI void *eet_data_image_read_cipher(Eet_File *ef, const char *name, const char *cipher_key, unsigned int *w, unsigned int *h, int *alpha, int *compress, int *quality, int *lossy);
933
934    /**
935     * Read image data from the named key in the eet file using a cipher.
936     * @param ef A valid eet file handle opened for reading.
937     * @param name Name of the entry. eg: "/base/file_i_want".
938     * @param cipher_key The key to use as cipher.
939     * @param src_x The starting x coordinate from where to dump the stream.
940     * @param src_y The starting y coordinate from where to dump the stream.
941     * @param d A pointer to the pixel surface.
942     * @param w The expected width in pixels of the pixel surface to decode.
943     * @param h The expected height in pixels of the pixel surface to decode.
944     * @param row_stride The length of a pixels line in the destination surface.
945     * @param alpha A pointer to the int to hold the alpha flag.
946     * @param compress A pointer to the int to hold the compression amount.
947     * @param quality A pointer to the int to hold the quality amount.
948     * @param lossy A pointer to the int to hold the lossiness flag.
949     * @return 1 on success, 0 otherwise.
950     *
951     * This function reads an image from an eet file stored under the named
952     * key in the eet file and return a pointer to the decompressed pixel data.
953     *
954     * The other parameters of the image (width, height etc.) are placed into
955     * the values pointed to (they must be supplied). The pixel data is a linear
956     * array of pixels starting from the top-left of the image scanning row by
957     * row from left to right. Each pile is a 32bit value, with the high byte
958     * being the alpha channel, the next being red, then green, and the low byte
959     * being blue. The width and height are measured in pixels and will be
960     * greater than 0 when returned. The alpha flag is either 0 or 1. 0 denotes
961     * that the alpha channel is not used. 1 denotes that it is significant.
962     * Compress is filled with the compression value/amount the image was
963     * stored with. The quality value is filled with the quality encoding of
964     * the image file (0 - 100). The lossy flags is either 0 or 1 as to if
965     * the image was encoded lossily or not.
966     *
967     * On success the function returns 1, and 0 on failure. On failure the
968     * parameter values may not contain any sensible data.
969     *
970     * @see eet_data_image_read_to_surface()
971     *
972     * @since 1.0.2
973     * @ingroup Eet_File_Image_Cipher_Group
974     */
975    EAPI int eet_data_image_read_to_surface_cipher(Eet_File *ef, const char *name, const char *cipher_key, unsigned int src_x, unsigned int src_y, unsigned int *d, unsigned int w, unsigned int h, unsigned int row_stride, int *alpha, int *compress, int *quality, int *lossy);
976
977    /**
978     * Write image data to the named key in an eet file using a cipher.
979     * @param ef A valid eet file handle opened for writing.
980     * @param name Name of the entry. eg: "/base/file_i_want".
981     * @param cipher_key The key to use as cipher.
982     * @param data A pointer to the image pixel data.
983     * @param w The width of the image in pixels.
984     * @param h The height of the image in pixels.
985     * @param alpha The alpha channel flag.
986     * @param compress The compression amount.
987     * @param quality The quality encoding amount.
988     * @param lossy The lossiness flag.
989     * @return Success if the data was encoded and written or not.
990     *
991     * This function takes image pixel data and encodes it in an eet file
992     * stored under the supplied name key, and returns how many bytes were
993     * actually written to encode the image data.
994     *
995     * The data expected is the same format as returned by eet_data_image_read.
996     * If this is not the case weird things may happen. Width and height must
997     * be between 1 and 8000 pixels. The alpha flags can be 0 or 1 (0 meaning
998     * the alpha values are not useful and 1 meaning they are). Compress can
999     * be from 0 to 9 (0 meaning no compression, 9 meaning full compression).
1000     * This is only used if the image is not lossily encoded. Quality is used on
1001     * lossy compression and should be a value from 0 to 100. The lossy flag
1002     * can be 0 or 1. 0 means encode losslessly and 1 means to encode with
1003     * image quality loss (but then have a much smaller encoding).
1004     *
1005     * On success this function returns the number of bytes that were required
1006     * to encode the image data, or on failure it returns 0.
1007     *
1008     * @see eet_data_image_write()
1009     *
1010     * @since 1.0.0
1011     * @ingroup Eet_File_Image_Cipher_Group
1012     */
1013    EAPI int eet_data_image_write_cipher(Eet_File *ef, const char *name, const char *cipher_key, const void *data, unsigned int w, unsigned int h, int alpha, int compress, int quality, int lossy);
1014
1015
1016    /**
1017     * Decode Image data header only to get information using a cipher.
1018     * @param data The encoded pixel data.
1019     * @param cipher_key The key to use as cipher.
1020     * @param size The size, in bytes, of the encoded pixel data.
1021     * @param w A pointer to the unsigned int to hold the width in pixels.
1022     * @param h A pointer to the unsigned int to hold the height in pixels.
1023     * @param alpha A pointer to the int to hold the alpha flag.
1024     * @param compress A pointer to the int to hold the compression amount.
1025     * @param quality A pointer to the int to hold the quality amount.
1026     * @param lossy A pointer to the int to hold the lossiness flag.
1027     * @return 1 on success, 0 on failure.
1028     *
1029     * This function takes encoded pixel data and decodes it into raw RGBA
1030     * pixels on success.
1031     *
1032     * The other parameters of the image (width, height etc.) are placed into
1033     * the values pointed to (they must be supplied). The pixel data is a linear
1034     * array of pixels starting from the top-left of the image scanning row by
1035     * row from left to right. Each pixel is a 32bit value, with the high byte
1036     * being the alpha channel, the next being red, then green, and the low byte
1037     * being blue. The width and height are measured in pixels and will be
1038     * greater than 0 when returned. The alpha flag is either 0 or 1. 0 denotes
1039     * that the alpha channel is not used. 1 denotes that it is significant.
1040     * Compress is filled with the compression value/amount the image was
1041     * stored with. The quality value is filled with the quality encoding of
1042     * the image file (0 - 100). The lossy flags is either 0 or 1 as to if
1043     * the image was encoded lossily or not.
1044     *
1045     * On success the function returns 1 indicating the header was read and
1046     * decoded properly, or 0 on failure.
1047     *
1048     * @see eet_data_image_header_decode()
1049     *
1050     * @since 1.0.0
1051     * @ingroup Eet_File_Image_Cipher_Group
1052     */
1053    EAPI int eet_data_image_header_decode_cipher(const void *data, const char *cipher_key, int size, unsigned int *w, unsigned int *h, int *alpha, int *compress, int *quality, int *lossy);
1054
1055    /**
1056     * Decode Image data into pixel data using a cipher.
1057     * @param data The encoded pixel data.
1058     * @param cipher_key The key to use as cipher.
1059     * @param size The size, in bytes, of the encoded pixel data.
1060     * @param w A pointer to the unsigned int to hold the width in pixels.
1061     * @param h A pointer to the unsigned int to hold the height in pixels.
1062     * @param alpha A pointer to the int to hold the alpha flag.
1063     * @param compress A pointer to the int to hold the compression amount.
1064     * @param quality A pointer to the int to hold the quality amount.
1065     * @param lossy A pointer to the int to hold the lossiness flag.
1066     * @return The image pixel data decoded
1067     *
1068     * This function takes encoded pixel data and decodes it into raw RGBA
1069     * pixels on success.
1070     *
1071     * The other parameters of the image (width, height etc.) are placed into
1072     * the values pointed to (they must be supplied). The pixel data is a linear
1073     * array of pixels starting from the top-left of the image scanning row by
1074     * row from left to right. Each pixel is a 32bit value, with the high byte
1075     * being the alpha channel, the next being red, then green, and the low byte
1076     * being blue. The width and height are measured in pixels and will be
1077     * greater than 0 when returned. The alpha flag is either 0 or 1. 0 denotes
1078     * that the alpha channel is not used. 1 denotes that it is significant.
1079     * Compress is filled with the compression value/amount the image was
1080     * stored with. The quality value is filled with the quality encoding of
1081     * the image file (0 - 100). The lossy flags is either 0 or 1 as to if
1082     * the image was encoded lossily or not.
1083     *
1084     * On success the function returns a pointer to the image data decoded. The
1085     * calling application is responsible for calling free() on the image data
1086     * when it is done with it. On failure NULL is returned and the parameter
1087     * values may not contain any sensible data.
1088     *
1089     * @see eet_data_image_decode()
1090     *
1091     * @since 1.0.0
1092     * @ingroup Eet_File_Image_Cipher_Group
1093     */
1094    EAPI void *eet_data_image_decode_cipher(const void *data, const char *cipher_key, int size, unsigned int *w, unsigned int *h, int *alpha, int *compress, int *quality, int *lossy);
1095
1096    /**
1097     * Decode Image data into pixel data using a cipher.
1098     * @param data The encoded pixel data.
1099     * @param cipher_key The key to use as cipher.
1100     * @param size The size, in bytes, of the encoded pixel data.
1101     * @param src_x The starting x coordinate from where to dump the stream.
1102     * @param src_y The starting y coordinate from where to dump the stream.
1103     * @param d A pointer to the pixel surface.
1104     * @param w The expected width in pixels of the pixel surface to decode.
1105     * @param h The expected height in pixels of the pixel surface to decode.
1106     * @param row_stride The length of a pixels line in the destination surface.
1107     * @param alpha A pointer to the int to hold the alpha flag.
1108     * @param compress A pointer to the int to hold the compression amount.
1109     * @param quality A pointer to the int to hold the quality amount.
1110     * @param lossy A pointer to the int to hold the lossiness flag.
1111     * @return 1 on success, 0 otherwise.
1112     *
1113     * This function takes encoded pixel data and decodes it into raw RGBA
1114     * pixels on success.
1115     *
1116     * The other parameters of the image (alpha, compress etc.) are placed into
1117     * the values pointed to (they must be supplied). The pixel data is a linear
1118     * array of pixels starting from the top-left of the image scanning row by
1119     * row from left to right. Each pixel is a 32bit value, with the high byte
1120     * being the alpha channel, the next being red, then green, and the low byte
1121     * being blue. The width and height are measured in pixels and will be
1122     * greater than 0 when returned. The alpha flag is either 0 or 1. 0 denotes
1123     * that the alpha channel is not used. 1 denotes that it is significant.
1124     * Compress is filled with the compression value/amount the image was
1125     * stored with. The quality value is filled with the quality encoding of
1126     * the image file (0 - 100). The lossy flags is either 0 or 1 as to if
1127     * the image was encoded lossily or not.
1128     *
1129     * On success the function returns 1, and 0 on failure. On failure the
1130     * parameter values may not contain any sensible data.
1131     *
1132     * @see eet_data_image_decode_to_surface()
1133     *
1134     * @since 1.0.2
1135     * @ingroup Eet_File_Image_Cipher_Group
1136     */
1137    EAPI int eet_data_image_decode_to_surface_cipher(const void *data, const char *cipher_key, int size, unsigned int src_x, unsigned int src_y, unsigned int *d, unsigned int w, unsigned int h, unsigned int row_stride, int *alpha, int *compress, int *quality, int *lossy);
1138
1139    /**
1140     * Encode image data for storage or transmission using a cipher.
1141     * @param data A pointer to the image pixel data.
1142     * @param cipher_key The key to use as cipher.
1143     * @param size_ret A pointer to an int to hold the size of the returned data.
1144     * @param w The width of the image in pixels.
1145     * @param h The height of the image in pixels.
1146     * @param alpha The alpha channel flag.
1147     * @param compress The compression amount.
1148     * @param quality The quality encoding amount.
1149     * @param lossy The lossiness flag.
1150     * @return The encoded image data.
1151     *
1152     * This function stakes image pixel data and encodes it with compression and
1153     * possible loss of quality (as a trade off for size) for storage or
1154     * transmission to another system.
1155     *
1156     * The data expected is the same format as returned by eet_data_image_read.
1157     * If this is not the case weird things may happen. Width and height must
1158     * be between 1 and 8000 pixels. The alpha flags can be 0 or 1 (0 meaning
1159     * the alpha values are not useful and 1 meaning they are). Compress can
1160     * be from 0 to 9 (0 meaning no compression, 9 meaning full compression).
1161     * This is only used if the image is not lossily encoded. Quality is used on
1162     * lossy compression and should be a value from 0 to 100. The lossy flag
1163     * can be 0 or 1. 0 means encode losslessly and 1 means to encode with
1164     * image quality loss (but then have a much smaller encoding).
1165     *
1166     * On success this function returns a pointer to the encoded data that you
1167     * can free with free() when no longer needed.
1168     *
1169     * @see eet_data_image_encode()
1170     *
1171     * @since 1.0.0
1172     * @ingroup Eet_File_Image_Cipher_Group
1173     */
1174    EAPI void *eet_data_image_encode_cipher(const void *data, const char *cipher_key, unsigned int w, unsigned int h, int alpha, int compress, int quality, int lossy, int *size_ret);
1175
1176
1177    /**
1178     * @defgroup Eet_Cipher_Group Cipher, Identity and Protection Mechanisms
1179     *
1180     * Eet allows one to protect entries of an #Eet_File
1181     * individually. This may be used to ensure data was not tampered or
1182     * that third party does not read your data.
1183     *
1184     * @see @ref Eet_File_Cipher_Group
1185     * @see @ref Eet_File_Image_Cipher_Group
1186     *
1187     * @{
1188     */
1189
1190    /**
1191     * @typedef Eet_Key
1192     * Opaque handle that defines an identity (also known as key)
1193     * in Eet's cipher system.
1194     */
1195    typedef struct _Eet_Key Eet_Key;
1196
1197    /**
1198     * @}
1199     */
1200
1201
1202    /**
1203     * Callback used to request if needed the password of a private key.
1204     *
1205     * @param buffer the buffer where to store the password.
1206     * @param size the maximum password size (size of buffer, including '@\0').
1207     * @param rwflag if the buffer is also readable or just writable.
1208     * @param data currently unused, may contain some context in future.
1209     * @return 1 on success and password was set to @p buffer, 0 on failure.
1210     *
1211     * @since 1.2.0
1212     * @ingroup Eet_Cipher_Group
1213     */
1214    typedef int (*Eet_Key_Password_Callback)(char *buffer, int size, int rwflag, void *data);
1215
1216    /**
1217     * Create an Eet_Key needed for signing an eet file.
1218     *
1219     * The certificate should provide the public that match the private key.
1220     * No verification is done to ensure that.
1221     *
1222     * @param certificate_file The file where to find the certificate.
1223     * @param private_key_file The file that contains the private key.
1224     * @param cb Function to callback if password is required to unlock
1225     *        private key.
1226     * @return A key handle to use, or @c NULL on failure.
1227     *
1228     * @see eet_identity_close()
1229     *
1230     * @since 1.2.0
1231     * @ingroup Eet_Cipher_Group
1232     */
1233    EAPI Eet_Key* eet_identity_open(const char *certificate_file, const char *private_key_file, Eet_Key_Password_Callback cb);
1234
1235    /**
1236     * Close and release all ressource used by an Eet_Key.  An
1237     * reference counter prevent it from being freed until all file
1238     * using it are also closed.
1239     *
1240     * @param key the key handle to close and free resources.
1241     *
1242     * @since 1.2.0
1243     * @ingroup Eet_Cipher_Group
1244     */
1245    EAPI void eet_identity_close(Eet_Key *key);
1246
1247    /**
1248     * Set a key to sign a file
1249     *
1250     * @param ef the file to set the identity.
1251     * @param key the key handle to set as identity.
1252     * @return #EET_ERROR_BAD_OBJECT if @p ef is invalid or
1253     *         #EET_ERROR_NONE on success.
1254     *
1255     * @since 1.2.0
1256     * @ingroup Eet_Cipher_Group
1257     */
1258    EAPI Eet_Error eet_identity_set(Eet_File *ef, Eet_Key *key);
1259
1260    /**
1261     * Display both private and public key of an Eet_Key.
1262     *
1263     * @param key the handle to print.
1264     * @param out where to print.
1265     *
1266     * @since 1.2.0
1267     * @ingroup Eet_Cipher_Group
1268     */
1269    EAPI void eet_identity_print(Eet_Key *key, FILE *out);
1270
1271    /**
1272     * Get the x509 der certificate associated with an Eet_File. Will return NULL
1273     * if the file is not signed.
1274     *
1275     * @param ef The file handle to query.
1276     * @param der_length The length of returned data, may be @c NULL.
1277     * @return the x509 certificate or @c NULL on error.
1278     *
1279     * @since 1.2.0
1280     * @ingroup Eet_Cipher_Group
1281     */
1282    EAPI const void *eet_identity_x509(Eet_File *ef, int *der_length);
1283
1284    /**
1285     * Get the raw signature associated with an Eet_File. Will return NULL
1286     * if the file is not signed.
1287     *
1288     * @param ef The file handle to query.
1289     * @param signature_length The length of returned data, may be @c NULL.
1290     * @return the raw signature or @c NULL on error.
1291     *
1292     * @ingroup Eet_Cipher_Group
1293     */
1294    EAPI const void *eet_identity_signature(Eet_File *ef, int *signature_length);
1295
1296    /**
1297     * Get the SHA1 associated with a file. Could be the one used to
1298     * sign the data or if the data where not signed, it will be the
1299     * SHA1 of the file.
1300     *
1301     * @param ef The file handle to query.
1302     * @param sha1_length The length of returned data, may be @c NULL.
1303     * @return the associated SHA1 or @c NULL on error.
1304     *
1305     * @since 1.2.0
1306     * @ingroup Eet_Cipher_Group
1307     */
1308    EAPI const void *eet_identity_sha1(Eet_File *ef, int *sha1_length);
1309
1310    /**
1311     * Display the x509 der certificate to out.
1312     *
1313     * @param certificate the x509 certificate to print
1314     * @param der_length The length the certificate.
1315     * @param out where to print.
1316     *
1317     * @since 1.2.0
1318     * @ingroup Eet_Cipher_Group
1319     */
1320    EAPI void eet_identity_certificate_print(const unsigned char *certificate, int der_length, FILE *out);
1321
1322
1323    /**
1324     * @defgroup Eet_Data_Group Eet Data Serialization
1325     *
1326     * Convenience functions to serialize and parse complex data
1327     * structures to binary blobs.
1328     *
1329     * While Eet core just handles binary blobs, it is often required
1330     * to save some structured data of different types, such as
1331     * strings, integers, lists, hashes and so on.
1332     *
1333     * Eet can serialize and then parse data types given some
1334     * construction instructions. These are defined in two levels:
1335     *
1336     * - #Eet_Data_Descriptor_Class to tell generic memory handling,
1337     *   such as the size of the type, how to allocate memory, strings,
1338     *   lists, hashes and so on.
1339     *
1340     * - #Eet_Data_Descriptor to tell inside such type, the members and
1341     *   their offsets inside the memory blob, their types and
1342     *   names. These members can be simple types or other
1343     *   #Eet_Data_Descriptor, allowing hierarchical types to be
1344     *   defined.
1345     *
1346     * Given that C provides no introspection, this process can be
1347     * quite cumbersome, so we provide lots of macros and convenience
1348     * functions to aid creating the types.
1349     *
1350     * Example:
1351     *
1352     * @code
1353     * #include <Eet.h>
1354     * #include <Evas.h>
1355     *
1356     * typedef struct _blah2
1357     * {
1358     *    char *string;
1359     * } Blah2;
1360     *
1361     * typedef struct _blah3
1362     * {
1363     *    char *string;
1364     * } Blah3;
1365     *
1366     * typedef struct _blah
1367     * {
1368     *    char character;
1369     *    short sixteen;
1370     *    int integer;
1371     *    long long lots;
1372     *    float floating;
1373     *    double floating_lots;
1374     *    char *string;
1375     *    Blah2 *blah2;
1376     *    Eina_List *blah3;
1377     * } Blah;
1378     *
1379     * int
1380     * main(int argc, char **argv)
1381     * {
1382     *    Blah blah;
1383     *    Blah2 blah2;
1384     *    Blah3 blah3;
1385     *    Eet_Data_Descriptor *edd, *edd2, *edd3;
1386     *    Eet_Data_Descriptor_Class eddc, eddc2, eddc3;
1387     *    void *data;
1388     *    int size;
1389     *    FILE *f;
1390     *    Blah *blah_in;
1391     *
1392     *    eet_init();
1393     *
1394     *    EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(&eddc3, Blah3);
1395     *    edd3 = eet_data_descriptor_stream_new(&eddc3);
1396     *    EET_DATA_DESCRIPTOR_ADD_BASIC(edd3, Blah3, "string3", string, EET_T_STRING);
1397     *
1398     *    EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(&eddc2, Blah2);
1399     *    edd2 = eet_data_descriptor_stream_new(&eddc2);
1400     *    EET_DATA_DESCRIPTOR_ADD_BASIC(edd2, Blah2, "string2", string, EET_T_STRING);
1401     *
1402     *    EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(&eddc, Blah);
1403     *    edd = eet_data_descriptor_stream_new(&eddc);
1404     *    EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Blah, "character", character, EET_T_CHAR);
1405     *    EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Blah, "sixteen", sixteen, EET_T_SHORT);
1406     *    EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Blah, "integer", integer, EET_T_INT);
1407     *    EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Blah, "lots", lots, EET_T_LONG_LONG);
1408     *    EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Blah, "floating", floating, EET_T_FLOAT);
1409     *    EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Blah, "floating_lots", floating_lots, EET_T_DOUBLE);
1410     *    EET_DATA_DESCRIPTOR_ADD_BASIC(edd, Blah, "string", string, EET_T_STRING);
1411     *    EET_DATA_DESCRIPTOR_ADD_SUB(edd, Blah, "blah2", blah2, edd2);
1412     *    EET_DATA_DESCRIPTOR_ADD_LIST(edd, Blah, "blah3", blah3, edd3);
1413     *
1414     *    blah3.string = "PANTS";
1415     *
1416     *    blah2.string = "subtype string here!";
1417     *
1418     *    blah.character = '7';
1419     *    blah.sixteen = 0x7777;
1420     *    blah.integer = 0xc0def00d;
1421     *    blah.lots = 0xdeadbeef31337777;
1422     *    blah.floating = 3.141592654;
1423     *    blah.floating_lots = 0.777777777777777;
1424     *    blah.string = "bite me like a turnip";
1425     *    blah.blah2 = &blah2;
1426     *    blah.blah3 = eina_list_append(NULL, &blah3);
1427     *    blah.blah3 = eina_list_append(blah.blah3, &blah3);
1428     *    blah.blah3 = eina_list_append(blah.blah3, &blah3);
1429     *    blah.blah3 = eina_list_append(blah.blah3, &blah3);
1430     *    blah.blah3 = eina_list_append(blah.blah3, &blah3);
1431     *    blah.blah3 = eina_list_append(blah.blah3, &blah3);
1432     *    blah.blah3 = eina_list_append(blah.blah3, &blah3);
1433     *
1434     *    data = eet_data_descriptor_encode(edd, &blah, &size);
1435     *    printf("-----DECODING\n");
1436     *    blah_in = eet_data_descriptor_decode(edd, data, size);
1437     *
1438     *    printf("-----DECODED!\n");
1439     *    printf("%c\n", blah_in->character);
1440     *    printf("%x\n", (int)blah_in->sixteen);
1441     *    printf("%x\n", blah_in->integer);
1442     *    printf("%lx\n", blah_in->lots);
1443     *    printf("%f\n", (double)blah_in->floating);
1444     *    printf("%f\n", (double)blah_in->floating_lots);
1445     *    printf("%s\n", blah_in->string);
1446     *    printf("%p\n", blah_in->blah2);
1447     *    printf("  %s\n", blah_in->blah2->string);
1448     *      {
1449     *         Eina_List *l;
1450     *         Blah3 *blah3_in;
1451     *
1452     *         EINA_LIST_FOREACH(blah_in->blah3, l, blah3_in)
1453     *           {
1454     *              printf("%p\n", blah3_in);
1455     *              printf("  %s\n", blah3_in->string);
1456     *           }
1457     *      }
1458     *    eet_data_descriptor_free(edd);
1459     *    eet_data_descriptor_free(edd2);
1460     *    eet_data_descriptor_free(edd3);
1461     *
1462     *    eet_shutdown();
1463     *
1464     *   return 0;
1465     * }
1466     * @endcode
1467     *
1468     * @{
1469     */
1470 #define EET_T_UNKNOW            0 /**< Unknown data encoding type */
1471 #define EET_T_CHAR              1 /**< Data type: char */
1472 #define EET_T_SHORT             2 /**< Data type: short */
1473 #define EET_T_INT               3 /**< Data type: int */
1474 #define EET_T_LONG_LONG         4 /**< Data type: long long */
1475 #define EET_T_FLOAT             5 /**< Data type: float */
1476 #define EET_T_DOUBLE            6 /**< Data type: double */
1477 #define EET_T_UCHAR             7 /**< Data type: unsigned char */
1478 #define EET_T_USHORT            8 /**< Data type: unsigned short */
1479 #define EET_T_UINT              9 /**< Data type: unsigned int */
1480 #define EET_T_ULONG_LONG        10 /**< Data type: unsigned long long */
1481 #define EET_T_STRING            11 /**< Data type: char * */
1482 #define EET_T_INLINED_STRING    12 /**< Data type: char * (but compressed inside the resulting eet) */
1483 #define EET_T_NULL              13 /**< Data type: (void *) (only use it if you know why) */
1484 #define EET_T_F32P32            14 /**< Data type: fixed point 32.32 */
1485 #define EET_T_F16P16            15 /**< Data type: fixed point 16.16 */
1486 #define EET_T_F8P24             16 /**< Data type: fixed point 8.24 */
1487 #define EET_T_LAST              18 /**< Last data type */
1488
1489 #define EET_G_UNKNOWN    100 /**< Unknown group data encoding type */
1490 #define EET_G_ARRAY      101 /**< Fixed size array group type */
1491 #define EET_G_VAR_ARRAY  102 /**< Variable size array group type */
1492 #define EET_G_LIST       103 /**< Linked list group type */
1493 #define EET_G_HASH       104 /**< Hash table group type */
1494 #define EET_G_UNION      105 /**< Union group type */
1495 #define EET_G_VARIANT    106 /**< Selectable subtype group */
1496 #define EET_G_LAST       107 /**< Last group type */
1497
1498 #define EET_I_LIMIT      128 /**< Other type exist but are reserved for internal purpose. */
1499
1500    /**
1501     * @typedef Eet_Data_Descriptor
1502     *
1503     * Opaque handle that have information on a type members.
1504     *
1505     * The members are added by means of
1506     * EET_DATA_DESCRIPTOR_ADD_BASIC(), EET_DATA_DESCRIPTOR_ADD_SUB(),
1507     * EET_DATA_DESCRIPTOR_ADD_LIST(), EET_DATA_DESCRIPTOR_ADD_HASH()
1508     * or eet_data_descriptor_element_add().
1509     *
1510     * @see eet_data_descriptor_stream_new()
1511     * @see eet_data_descriptor_file_new()
1512     * @see eet_data_descriptor_free()
1513     */
1514    typedef struct _Eet_Data_Descriptor       Eet_Data_Descriptor;
1515
1516    /**
1517     * @def EET_DATA_DESCRIPTOR_CLASS_VERSION
1518     * The version of #Eet_Data_Descriptor_Class at the time of the
1519     * distribution of the sources. One should define this to its
1520     * version member so it is compatible with abi changes, or at least
1521     * will not crash with them.
1522     */
1523 #define EET_DATA_DESCRIPTOR_CLASS_VERSION 3
1524
1525   /**
1526    * @typedef Eet_Data_Descriptor_Class
1527    *
1528    * Instructs Eet about memory management for different needs under
1529    * serialization and parse process.
1530    */
1531    typedef struct _Eet_Data_Descriptor_Class Eet_Data_Descriptor_Class;
1532
1533    /**
1534     * @struct _Eet_Data_Descriptor_Class
1535     *
1536     * Instructs Eet about memory management for different needs under
1537     * serialization and parse process.
1538     *
1539     * If using Eina data types, it is advised to use the helpers
1540     * EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET() and
1541     * EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET().
1542     */
1543    struct _Eet_Data_Descriptor_Class
1544      {
1545         int         version; /**< ABI version as #EET_DATA_DESCRIPTOR_CLASS_VERSION */
1546         const char *name; /**< Name of data type to be serialized */
1547         int         size; /**< Size in bytes of data type to be serialized */
1548         struct {
1549            void   *(*mem_alloc) (size_t size); /**< how to allocate memory (usually malloc()) */
1550            void    (*mem_free) (void *mem); /**< how to free memory (usually free()) */
1551            char   *(*str_alloc) (const char *str); /**< how to allocate a string */
1552            void    (*str_free) (const char *str); /**< how to free a string */
1553            void   *(*list_next) (void *l); /**< how to iterate to the next element of a list. Receives and should return the list node. */
1554            void   *(*list_append) (void *l, void *d); /**< how to append data @p d to list which head node is @p l */
1555            void   *(*list_data) (void *l); /**< retrieves the data from node @p l */
1556            void   *(*list_free) (void *l); /**< free all the nodes from the list which head node is @p l */
1557            void    (*hash_foreach) (void *h, int (*func) (void *h, const char *k, void *dt, void *fdt), void *fdt); /**< iterates over all elements in the hash @p h in no specific order */
1558            void   *(*hash_add) (void *h, const char *k, void *d); /**< add a new data @p d as key @p k in hash @p h */
1559            void    (*hash_free) (void *h); /**< free all entries from the hash @p h */
1560            char   *(*str_direct_alloc) (const char *str); /**< how to allocate a string directly from file backed/mmaped region pointed by @p str */
1561            void    (*str_direct_free) (const char *str); /**< how to free a string returned by str_direct_alloc */
1562
1563            const char *(*type_get) (const void *data, Eina_Bool *unknow); /**< convert any kind of data type to a name that define an Eet_Data_Element. */
1564            Eina_Bool  (*type_set) (const char *type, void *data, Eina_Bool unknow); /**< set the type at a particular adress */
1565         } func;
1566      };
1567
1568    /**
1569     * @}
1570     */
1571
1572    /**
1573     * Create a new empty data structure descriptor.
1574     * @param name The string name of this data structure (most be a
1575     *        global constant and never change).
1576     * @param size The size of the struct (in bytes).
1577     * @param func_list_next The function to get the next list node.
1578     * @param func_list_append The function to append a member to a list.
1579     * @param func_list_data The function to get the data from a list node.
1580     * @param func_list_free The function to free an entire linked list.
1581     * @param func_hash_foreach The function to iterate through all
1582     *        hash table entries.
1583     * @param func_hash_add The function to add a member to a hash table.
1584     * @param func_hash_free The function to free an entire hash table.
1585     * @return A new empty data descriptor.
1586     *
1587     * This function creates a new data descriptore and returns a handle to the
1588     * new data descriptor. On creation it will be empty, containing no contents
1589     * describing anything other than the shell of the data structure.
1590     *
1591     * You add structure members to the data descriptor using the macros
1592     * EET_DATA_DESCRIPTOR_ADD_BASIC(), EET_DATA_DESCRIPTOR_ADD_SUB() and
1593     * EET_DATA_DESCRIPTOR_ADD_LIST(), depending on what type of member you are
1594     * adding to the description.
1595     *
1596     * Once you have described all the members of a struct you want loaded, or
1597     * saved eet can load and save those members for you, encode them into
1598     * endian-independant serialised data chunks for transmission across a
1599     * a network or more.
1600     *
1601     * The function pointers to the list and hash table functions are only
1602     * needed if you use those data types, else you can pass NULL instead.
1603     *
1604     * @since 1.0.0
1605     * @ingroup Eet_Data_Group
1606     *
1607     * @deprecated use eet_data_descriptor_stream_new() or
1608     *             eet_data_descriptor_file_new()
1609     */
1610    EINA_DEPRECATED EAPI Eet_Data_Descriptor *eet_data_descriptor_new(const char *name, int size, void *(*func_list_next) (void *l), void *(*func_list_append) (void *l, void *d), void *(*func_list_data) (void *l), void *(*func_list_free) (void *l), void  (*func_hash_foreach) (void *h, int (*func) (void *h, const char *k, void *dt, void *fdt), void *fdt), void *(*func_hash_add) (void *h, const char *k, void *d), void  (*func_hash_free) (void *h));
1611    /*
1612     * FIXME:
1613     *
1614     * moving to this api from the old above. this will break things when the
1615     * move happens - but be warned
1616     */
1617    EINA_DEPRECATED EAPI Eet_Data_Descriptor *eet_data_descriptor2_new(const Eet_Data_Descriptor_Class *eddc);
1618    EINA_DEPRECATED EAPI Eet_Data_Descriptor *eet_data_descriptor3_new(const Eet_Data_Descriptor_Class *eddc);
1619
1620    /**
1621     * This function creates a new data descriptore and returns a handle to the
1622     * new data descriptor. On creation it will be empty, containing no contents
1623     * describing anything other than the shell of the data structure.
1624     * @param eddc The data descriptor to free.
1625     *
1626     * You add structure members to the data descriptor using the macros
1627     * EET_DATA_DESCRIPTOR_ADD_BASIC(), EET_DATA_DESCRIPTOR_ADD_SUB() and
1628     * EET_DATA_DESCRIPTOR_ADD_LIST(), depending on what type of member you are
1629     * adding to the description.
1630     *
1631     * Once you have described all the members of a struct you want loaded, or
1632     * saved eet can load and save those members for you, encode them into
1633     * endian-independant serialised data chunks for transmission across a
1634     * a network or more.
1635     *
1636     * This function specially ignore str_direct_alloc and str_direct_free. It
1637     * is usefull when the eet_data you are reading don't have a dictionnary
1638     * like network stream or ipc. It also mean that all string will be allocated
1639     * and duplicated in memory.
1640     *
1641     * @since 1.2.3
1642     * @ingroup Eet_Data_Group
1643     */
1644    EAPI Eet_Data_Descriptor *eet_data_descriptor_stream_new(const Eet_Data_Descriptor_Class *eddc);
1645
1646    /**
1647     * This function creates a new data descriptore and returns a handle to the
1648     * new data descriptor. On creation it will be empty, containing no contents
1649     * describing anything other than the shell of the data structure.
1650     * @param eddc The data descriptor to free.
1651     *
1652     * You add structure members to the data descriptor using the macros
1653     * EET_DATA_DESCRIPTOR_ADD_BASIC(), EET_DATA_DESCRIPTOR_ADD_SUB() and
1654     * EET_DATA_DESCRIPTOR_ADD_LIST(), depending on what type of member you are
1655     * adding to the description.
1656     *
1657     * Once you have described all the members of a struct you want loaded, or
1658     * saved eet can load and save those members for you, encode them into
1659     * endian-independant serialised data chunks for transmission across a
1660     * a network or more.
1661     *
1662     * This function use str_direct_alloc and str_direct_free. It is
1663     * usefull when the eet_data you are reading come from a file and
1664     * have a dictionnary. This will reduce memory use, improve the
1665     * possibility for the OS to page this string out. But be carrefull
1666     * all EET_T_STRING are pointer to a mmapped area and it will point
1667     * to nowhere if you close the file. So as long as you use this
1668     * strings, you need to have the Eet_File open.
1669     *
1670     * @since 1.2.3
1671     * @ingroup Eet_Data_Group
1672     */
1673    EAPI Eet_Data_Descriptor *eet_data_descriptor_file_new(const Eet_Data_Descriptor_Class *eddc);
1674
1675    /**
1676     * This function is an helper that set all the parameter of an
1677     * Eet_Data_Descriptor_Class correctly when you use Eina data type
1678     * with a stream.
1679     * @param eddc The Eet_Data_Descriptor_Class you want to set.
1680     * @param name The name of the structure described by this class.
1681     * @param size The size of the structure described by this class.
1682     * @return EINA_TRUE if the structure was correctly set (The only
1683     *         reason that could make it fail is if you did give wrong
1684     *         parameter).
1685     *
1686     * @since 1.2.3
1687     * @ingroup Eet_Data_Group
1688     */
1689    EAPI Eina_Bool eet_eina_stream_data_descriptor_class_set(Eet_Data_Descriptor_Class *eddc, const char *name, int size);
1690
1691    /**
1692     * This macro is an helper that set all the parameter of an
1693     * Eet_Data_Descriptor_Class correctly when you use Eina data type
1694     * with stream.
1695     * @param Clas The Eet_Data_Descriptor_Class you want to set.
1696     * @param Type The type of the structure described by this class.
1697     * @return EINA_TRUE if the structure was correctly set (The only
1698     *         reason that could make it fail is if you did give wrong
1699     *         parameter).
1700     *
1701     * @since 1.2.3
1702     * @ingroup Eet_Data_Group
1703     */
1704 #define EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(Clas, Type) (eet_eina_stream_data_descriptor_class_set(Clas, #Type , sizeof (Type)))
1705
1706    /**
1707     * This function is an helper that set all the parameter of an
1708     * Eet_Data_Descriptor_Class correctly when you use Eina data type
1709     * with a file.
1710     * @param eddc The Eet_Data_Descriptor_Class you want to set.
1711     * @param name The name of the structure described by this class.
1712     * @param size The size of the structure described by this class.
1713     * @return EINA_TRUE if the structure was correctly set (The only
1714     *         reason that could make it fail is if you did give wrong
1715     *         parameter).
1716     *
1717     * @since 1.2.3
1718     * @ingroup Eet_Data_Group
1719     */
1720    EAPI Eina_Bool eet_eina_file_data_descriptor_class_set(Eet_Data_Descriptor_Class *eddc, const char *name, int size);
1721
1722    /**
1723     * This macro is an helper that set all the parameter of an
1724     * Eet_Data_Descriptor_Class correctly when you use Eina data type
1725     * with file.
1726     * @param Clas The Eet_Data_Descriptor_Class you want to set.
1727     * @param Type The type of the structure described by this class.
1728     * @return EINA_TRUE if the structure was correctly set (The only
1729     *         reason that could make it fail is if you did give wrong
1730     *         parameter).
1731     *
1732     * @since 1.2.3
1733     * @ingroup Eet_Data_Group
1734     */
1735 #define EET_EINA_FILE_DATA_DESCRIPTOR_CLASS_SET(Clas, Type) (eet_eina_file_data_descriptor_class_set(Clas, #Type , sizeof (Type)))
1736
1737    /**
1738     * This function frees a data descriptor when it is not needed anymore.
1739     * @param edd The data descriptor to free.
1740     *
1741     * This function takes a data descriptor handle as a parameter and frees all
1742     * data allocated for the data descriptor and the handle itself. After this
1743     * call the descriptor is no longer valid.
1744     *
1745     * @since 1.0.0
1746     * @ingroup Eet_Data_Group
1747     */
1748    EAPI void eet_data_descriptor_free(Eet_Data_Descriptor *edd);
1749
1750    /**
1751     * This function is an internal used by macros.
1752     *
1753     * This function is used by macros EET_DATA_DESCRIPTOR_ADD_BASIC(),
1754     * EET_DATA_DESCRIPTOR_ADD_SUB() and EET_DATA_DESCRIPTOR_ADD_LIST(). It is
1755     * complex to use by hand and should be left to be used by the macros, and
1756     * thus is not documented.
1757     *
1758     * @param edd The data descriptor handle to add element (member).
1759     * @param name The name of element to be serialized.
1760     * @param type The type of element to be serialized, like
1761     *        #EET_T_INT. If #EET_T_UNKNOW, then it is considered to be a
1762     *        group, list or hash.
1763     * @param group_type If element type is #EET_T_UNKNOW, then the @p
1764     *        group_type will speficy if it is a list (#EET_G_LIST),
1765     *        array (#EET_G_ARRAY) and so on. If #EET_G_UNKNOWN, then
1766     *        the member is a subtype (pointer to another type defined by
1767     *        another #Eet_Data_Descriptor).
1768     * @param offset byte offset inside the source memory to be serialized.
1769     * @param count number of elements (if #EET_G_ARRAY or #EET_G_VAR_ARRAY).
1770     * @param counter_name variable that defines the name of number of elements.
1771     * @param subtype If contains a subtype, then its data descriptor.
1772     *
1773     * @since 1.0.0
1774     * @ingroup Eet_Data_Group
1775     */
1776    EAPI void eet_data_descriptor_element_add(Eet_Data_Descriptor *edd, const char *name, int type, int group_type, int offset, /* int count_offset,  */int count, const char *counter_name, Eet_Data_Descriptor *subtype);
1777
1778    /**
1779     * Read a data structure from an eet file and decodes it.
1780     * @param ef The eet file handle to read from.
1781     * @param edd The data descriptor handle to use when decoding.
1782     * @param name The key the data is stored under in the eet file.
1783     * @return A pointer to the decoded data structure.
1784     *
1785     * This function decodes a data structure stored in an eet file, returning
1786     * a pointer to it if it decoded successfully, or NULL on failure. This
1787     * can save a programmer dozens of hours of work in writing configuration
1788     * file parsing and writing code, as eet does all that work for the program
1789     * and presents a program-friendly data structure, just as the programmer
1790     * likes. Eet can handle members being added or deleted from the data in
1791     * storage and safely zero-fills unfilled members if they were not found
1792     * in the data. It checks sizes and headers whenever it reads data, allowing
1793     * the programmer to not worry about corrupt data.
1794     *
1795     * Once a data structure has been described by the programmer with the
1796     * fields they wish to save or load, storing or retrieving a data structure
1797     * from an eet file, or from a chunk of memory is as simple as a single
1798     * function call.
1799     *
1800     * @see eet_data_read_cipher()
1801     *
1802     * @since 1.0.0
1803     * @ingroup Eet_Data_Group
1804     */
1805    EAPI void *eet_data_read(Eet_File *ef, Eet_Data_Descriptor *edd, const char *name);
1806
1807    /**
1808     * Write a data structure from memory and store in an eet file.
1809     * @param ef The eet file handle to write to.
1810     * @param edd The data descriptor to use when encoding.
1811     * @param name The key to store the data under in the eet file.
1812     * @param data A pointer to the data structure to ssave and encode.
1813     * @param compress Compression flags for storage.
1814     * @return bytes written on successful write, 0 on failure.
1815     *
1816     * This function is the reverse of eet_data_read(), saving a data structure
1817     * to an eet file.
1818     *
1819     * @see eet_data_write_cipher()
1820     *
1821     * @since 1.0.0
1822     * @ingroup Eet_Data_Group
1823     */
1824    EAPI int eet_data_write(Eet_File *ef, Eet_Data_Descriptor *edd, const char *name, const void *data, int compress);
1825
1826    /**
1827     * Dump an eet encoded data structure into ascii text
1828     * @param data_in The pointer to the data to decode into a struct.
1829     * @param size_in The size of the data pointed to in bytes.
1830     * @param dumpfunc The function to call passed a string when new
1831     *        data is converted to text
1832     * @param dumpdata The data to pass to the @p dumpfunc callback.
1833     * @return 1 on success, 0 on failure
1834     *
1835     * This function will take a chunk of data encoded by
1836     * eet_data_descriptor_encode() and convert it into human readable
1837     * ascii text.  It does this by calling the @p dumpfunc callback
1838     * for all new text that is generated. This callback should append
1839     * to any existing text buffer and will be passed the pointer @p
1840     * dumpdata as a parameter as well as a string with new text to be
1841     * appended.
1842     *
1843     * Example:
1844     *
1845     * @code
1846     * void output(void *data, const char *string)
1847     * {
1848     *   printf("%s", string);
1849     * }
1850     *
1851     * void dump(const char *file)
1852     * {
1853     *   FILE *f;
1854     *   int len;
1855     *   void *data;
1856     *
1857     *   f = fopen(file, "r");
1858     *   fseek(f, 0, SEEK_END);
1859     *   len = ftell(f);
1860     *   rewind(f);
1861     *   data = malloc(len);
1862     *   fread(data, len, 1, f);
1863     *   fclose(f);
1864     *   eet_data_text_dump(data, len, output, NULL);
1865     * }
1866     * @endcode
1867     *
1868     * @see eet_data_text_dump_cipher()
1869     *
1870     * @since 1.0.0
1871     * @ingroup Eet_Data_Group
1872     */
1873    EAPI int eet_data_text_dump(const void *data_in, int size_in, void (*dumpfunc) (void *data, const char *str), void *dumpdata);
1874
1875    /**
1876     * Take an ascii encoding from eet_data_text_dump() and re-encode in binary.
1877     * @param text The pointer to the string data to parse and encode.
1878     * @param textlen The size of the string in bytes (not including 0
1879     *        byte terminator).
1880     * @param size_ret This gets filled in with the encoded data blob
1881     *        size in bytes.
1882     * @return The encoded data on success, NULL on failure.
1883     *
1884     * This function will parse the string pointed to by @p text and return
1885     * an encoded data lump the same way eet_data_descriptor_encode() takes an
1886     * in-memory data struct and encodes into a binary blob. @p text is a normal
1887     * C string.
1888     *
1889     * @see eet_data_text_undump_cipher()
1890     *
1891     * @since 1.0.0
1892     * @ingroup Eet_Data_Group
1893     */
1894    EAPI void *eet_data_text_undump(const char *text, int textlen, int *size_ret);
1895
1896    /**
1897     * Dump an eet encoded data structure from an eet file into ascii text
1898     * @param ef A valid eet file handle.
1899     * @param name Name of the entry. eg: "/base/file_i_want".
1900     * @param dumpfunc The function to call passed a string when new
1901     *        data is converted to text
1902     * @param dumpdata The data to pass to the @p dumpfunc callback.
1903     * @return 1 on success, 0 on failure
1904     *
1905     * This function will take an open and valid eet file from
1906     * eet_open() request the data encoded by
1907     * eet_data_descriptor_encode() corresponding to the key @p name
1908     * and convert it into human readable ascii text. It does this by
1909     * calling the @p dumpfunc callback for all new text that is
1910     * generated. This callback should append to any existing text
1911     * buffer and will be passed the pointer @p dumpdata as a parameter
1912     * as well as a string with new text to be appended.
1913     *
1914     * @see eet_data_dump_cipher()
1915     *
1916     * @since 1.0.0
1917     * @ingroup Eet_Data_Group
1918     */
1919    EAPI int eet_data_dump(Eet_File *ef, const char *name, void (*dumpfunc) (void *data, const char *str), void *dumpdata);
1920
1921    /**
1922     * Take an ascii encoding from eet_data_dump() and re-encode in binary.
1923     * @param ef A valid eet file handle.
1924     * @param name Name of the entry. eg: "/base/file_i_want".
1925     * @param text The pointer to the string data to parse and encode.
1926     * @param textlen The size of the string in bytes (not including 0
1927     *        byte terminator).
1928     * @param compress Compression flags (1 == compress, 0 = don't compress).
1929     * @return 1 on success, 0 on failure
1930     *
1931     * This function will parse the string pointed to by @p text,
1932     * encode it the same way eet_data_descriptor_encode() takes an
1933     * in-memory data struct and encodes into a binary blob.
1934     *
1935     * The data (optionally compressed) will be in ram, pending a flush to
1936     * disk (it will stay in ram till the eet file handle is closed though).
1937     *
1938     * @see eet_data_undump_cipher()
1939     *
1940     * @since 1.0.0
1941     * @ingroup Eet_Data_Group
1942     */
1943    EAPI int eet_data_undump(Eet_File *ef, const char *name, const char *text, int textlen, int compress);
1944
1945    /**
1946     * Decode a data structure from an arbitary location in memory.
1947     * @param edd The data  descriptor to use when decoding.
1948     * @param data_in The pointer to the data to decode into a struct.
1949     * @param size_in The size of the data pointed to in bytes.
1950     * @return NULL on failure, or a valid decoded struct pointer on success.
1951     *
1952     * This function will decode a data structure that has been encoded using
1953     * eet_data_descriptor_encode(), and return a data structure with all its
1954     * elements filled out, if successful, or NULL on failure.
1955     *
1956     * The data to be decoded is stored at the memory pointed to by @p data_in,
1957     * and is described by the descriptor pointed to by @p edd. The data size is
1958     * passed in as the value to @p size_in, ande must be greater than 0 to
1959     * succeed.
1960     *
1961     * This function is useful for decoding data structures delivered to the
1962     * application by means other than an eet file, such as an IPC or socket
1963     * connection, raw files, shared memory etc.
1964     *
1965     * Please see eet_data_read() for more information.
1966     *
1967     * @see eet_data_descriptor_decode_cipher()
1968     *
1969     * @since 1.0.0
1970     * @ingroup Eet_Data_Group
1971     */
1972    EAPI void *eet_data_descriptor_decode(Eet_Data_Descriptor *edd, const void *data_in, int size_in);
1973
1974    /**
1975     * Encode a dsata struct to memory and return that encoded data.
1976     * @param edd The data  descriptor to use when encoding.
1977     * @param data_in The pointer to the struct to encode into data.
1978     * @param size_ret pointer to the an int to be filled with the decoded size.
1979     * @return NULL on failure, or a valid encoded data chunk on success.
1980     *
1981     * This function takes a data structutre in memory and encodes it into a
1982     * serialised chunk of data that can be decoded again by
1983     * eet_data_descriptor_decode(). This is useful for being able to transmit
1984     * data structures across sockets, pipes, IPC or shared file mechanisms,
1985     * without having to worry about memory space, machine type, endianess etc.
1986     *
1987     * The parameter @p edd must point to a valid data descriptor, and
1988     * @p data_in must point to the right data structure to encode. If not, the
1989     * encoding may fail.
1990     *
1991     * On success a non NULL valid pointer is returned and what @p size_ret
1992     * points to is set to the size of this decoded data, in bytes. When the
1993     * encoded data is no longer needed, call free() on it. On failure NULL is
1994     * returned and what @p size_ret points to is set to 0.
1995     *
1996     * Please see eet_data_write() for more information.
1997     *
1998     * @see eet_data_descriptor_encode_cipher()
1999     *
2000     * @since 1.0.0
2001     * @ingroup Eet_Data_Group
2002     */
2003    EAPI void *eet_data_descriptor_encode(Eet_Data_Descriptor *edd, const void *data_in, int *size_ret);
2004
2005    /**
2006     * Add a basic data element to a data descriptor.
2007     * @param edd The data descriptor to add the type to.
2008     * @param struct_type The type of the struct.
2009     * @param name The string name to use to encode/decode this member
2010     *        (must be a constant global and never change).
2011     * @param member The struct member itself to be encoded.
2012     * @param type The type of the member to encode.
2013     *
2014     * This macro is a convenience macro provided to add a member to
2015     * the data descriptor @p edd. The type of the structure is
2016     * provided as the @p struct_type parameter (for example: struct
2017     * my_struct). The @p name parameter defines a string that will be
2018     * used to uniquely name that member of the struct (it is suggested
2019     * to use the struct member itself).  The @p member parameter is
2020     * the actual struct member itself (for eet_dictionary_string_check
2021     * example: values), and @p type is the basic data type of the
2022     * member which must be one of: EET_T_CHAR, EET_T_SHORT, EET_T_INT,
2023     * EET_T_LONG_LONG, EET_T_FLOAT, EET_T_DOUBLE, EET_T_UCHAR,
2024     * EET_T_USHORT, EET_T_UINT, EET_T_ULONG_LONG or EET_T_STRING.
2025     *
2026     * @since 1.0.0
2027     * @ingroup Eet_Data_Group
2028     */
2029 #define EET_DATA_DESCRIPTOR_ADD_BASIC(edd, struct_type, name, member, type) \
2030      { \
2031         struct_type ___ett; \
2032         \
2033         eet_data_descriptor_element_add(edd, name, type, EET_G_UNKNOWN, \
2034                                         (char *)(&(___ett.member)) - (char *)(&(___ett)), \
2035                                         0, /* 0,  */NULL, NULL); \
2036      }
2037
2038    /**
2039     * Add a sub-element type to a data descriptor
2040     * @param edd The data descriptor to add the type to.
2041     * @param struct_type The type of the struct.
2042     * @param name The string name to use to encode/decode this member
2043     *        (must be a constant global and never change).
2044     * @param member The struct member itself to be encoded.
2045     * @param subtype The type of sub-type struct to add.
2046     *
2047     * This macro lets you easily add a sub-type (a struct that's pointed to
2048     * by this one). All the parameters are the same as for
2049     * EET_DATA_DESCRIPTOR_ADD_BASIC(), with the @p subtype being the exception.
2050     * This must be the data descriptor of the struct that is pointed to by
2051     * this element.
2052     *
2053     * @since 1.0.0
2054     * @ingroup Eet_Data_Group
2055     */
2056 #define EET_DATA_DESCRIPTOR_ADD_SUB(edd, struct_type, name, member, subtype) \
2057      { \
2058         struct_type ___ett; \
2059         \
2060         eet_data_descriptor_element_add(edd, name, EET_T_UNKNOW, EET_G_UNKNOWN, \
2061                                         (char *)(&(___ett.member)) - (char *)(&(___ett)), \
2062                                         0, /* 0,  */NULL, subtype); \
2063      }
2064
2065    /**
2066     * Add a linked list type to a data descriptor
2067     * @param edd The data descriptor to add the type to.
2068     * @param struct_type The type of the struct.
2069     * @param name The string name to use to encode/decode this member
2070     *        (must be a constant global and never change).
2071     * @param member The struct member itself to be encoded.
2072     * @param subtype The type of linked list member to add.
2073     *
2074     * This macro lets you easily add a linked list of other data types. All the
2075     * parameters are the same as for EET_DATA_DESCRIPTOR_ADD_BASIC(), with the
2076     * @p subtype being the exception. This must be the data descriptor of the
2077     * element that is in each member of the linked list to be stored.
2078     *
2079     * @since 1.0.0
2080     * @ingroup Eet_Data_Group
2081     */
2082 #define EET_DATA_DESCRIPTOR_ADD_LIST(edd, struct_type, name, member, subtype) \
2083      { \
2084         struct_type ___ett; \
2085         \
2086         eet_data_descriptor_element_add(edd, name, EET_T_UNKNOW, EET_G_LIST, \
2087                                         (char *)(&(___ett.member)) - (char *)(&(___ett)), \
2088                                         0, /* 0,  */NULL, subtype); \
2089      }
2090
2091    /**
2092     * Add a hash type to a data descriptor
2093     * @param edd The data descriptor to add the type to.
2094     * @param struct_type The type of the struct.
2095     * @param name The string name to use to encode/decode this member
2096     *        (must be a constant global and never change).
2097     * @param member The struct member itself to be encoded.
2098     * @param subtype The type of hash member to add.
2099     *
2100     * This macro lets you easily add a hash of other data types. All the
2101     * parameters are the same as for EET_DATA_DESCRIPTOR_ADD_BASIC(), with the
2102     * @p subtype being the exception. This must be the data descriptor of the
2103     * element that is in each member of the hash to be stored.
2104     *
2105     * @since 1.0.0
2106     * @ingroup Eet_Data_Group
2107     */
2108 #define EET_DATA_DESCRIPTOR_ADD_HASH(edd, struct_type, name, member, subtype) \
2109      { \
2110         struct_type ___ett; \
2111         \
2112         eet_data_descriptor_element_add(edd, name, EET_T_UNKNOW, EET_G_HASH, \
2113                                         (char *)(&(___ett.member)) - (char *)(&(___ett)), \
2114                                         0, /* 0,  */NULL, subtype); \
2115      }
2116
2117    /**
2118     * Add a fixed size array type to a data descriptor
2119     * @param edd The data descriptor to add the type to.
2120     * @param struct_type The type of the struct.
2121     * @param name The string name to use to encode/decode this member
2122     *        (must be a constant global and never change).
2123     * @param member The struct member itself to be encoded.
2124     * @param subtype The type of hash member to add.
2125     *
2126     * This macro lets you easily add a fixed size array of other data
2127     * types. All the parameters are the same as for
2128     * EET_DATA_DESCRIPTOR_ADD_BASIC(), with the @p subtype being the
2129     * exception. This must be the data descriptor of the element that
2130     * is in each member of the hash to be stored.
2131     *
2132     * @since 1.0.2
2133     * @ingroup Eet_Data_Group
2134     */
2135 #define EET_DATA_DESCRIPTOR_ADD_ARRAY(edd, struct_type, name, member, subtype) \
2136      { \
2137         struct_type ___ett; \
2138         \
2139         eet_data_descriptor_element_add(edd, name, EET_T_UNKNOW, EET_G_ARRAY, \
2140                                         (char *)(&(___ett.member)) - (char *)(&(___ett)), \
2141                                         /* 0,  */sizeof(___ett.member)/sizeof(___ett.member[0]), NULL, subtype); \
2142      }
2143
2144    /**
2145     * Add a variable size array type to a data descriptor
2146     * @param edd The data descriptor to add the type to.
2147     * @param struct_type The type of the struct.
2148     * @param name The string name to use to encode/decode this member
2149     *        (must be a constant global and never change).
2150     * @param member The struct member itself to be encoded.
2151     * @param subtype The type of hash member to add.
2152     *
2153     * This macro lets you easily add a fixed size array of other data
2154     * types. All the parameters are the same as for
2155     * EET_DATA_DESCRIPTOR_ADD_BASIC(), with the @p subtype being the
2156     * exception. This must be the data descriptor of the element that
2157     * is in each member of the hash to be stored.
2158     *
2159     * @since 1.0.2
2160     * @ingroup Eet_Data_Group
2161     */
2162 #define EET_DATA_DESCRIPTOR_ADD_VAR_ARRAY(edd, struct_type, name, member, subtype) \
2163      { \
2164         struct_type ___ett; \
2165         \
2166         eet_data_descriptor_element_add(edd, name, EET_T_UNKNOW, EET_G_VAR_ARRAY, \
2167                                         (char *)(&(___ett.member)) - (char *)(&(___ett)), \
2168                                         (char *)(&(___ett.member ## _count)) - (char *)(&(___ett)), /* 0,  */NULL, subtype); \
2169      }
2170
2171    /**
2172     * Add an union type to a data descriptor
2173     * @param edd The data descriptor to add the type to.
2174     * @param struct_type The type of the struct.
2175     * @param name The string name to use to encode/decode this member
2176     *        (must be a constant global and never change).
2177     * @param member The struct member itself to be encoded.
2178     * @param type_member The member that give hints on what is in the union.
2179     * @param unified_type Describe all possible type the union could handle.
2180     *
2181     * This macro lets you easily add an union with a member that specify what is inside.
2182     * The @p unified_type is an Eet_Data_Descriptor, but only the entry that match the name
2183     * returned by type_get will be used for each serialized data. The type_get and type_set
2184     * callback of unified_type should be defined.
2185     *
2186     * @since 1.2.4
2187     * @ingroup Eet_Data_Group
2188     * @see Eet_Data_Descriptor_Class
2189     */
2190 #define EET_DATA_DESCRIPTOR_ADD_UNION(edd, struct_type, name, member, type_member, unified_type) \
2191      { \
2192         struct_type ___ett;                     \
2193         \
2194         eet_data_descriptor_element_add(edd, name, EET_T_UNKNOW, EET_G_UNION, \
2195                                         (char *) (&(___ett.member)) - (char *)(&(___ett)), \
2196                                         (char *) (&(___ett.type_member)) - (char *)(&(___ett)), \
2197                                         NULL, unified_type); \
2198      }
2199
2200    /**
2201     * Add a automatically selectable type to a data descriptor
2202     * @param edd The data descriptor to add the type to.
2203     * @param struct_type The type of the struct.
2204     * @param name The string name to use to encode/decode this member
2205     *        (must be a constant global and never change).
2206     * @param member The struct member itself to be encoded.
2207     * @param type_member The member that give hints on what is in the union.
2208     * @param unified_type Describe all possible type the union could handle.
2209     *
2210     * This macro lets you easily define what the content of @p member points to depending of
2211     * the content of @p type_member. The type_get and type_set callback of unified_type should
2212     * be defined. If the the type is not know at the time of restoring it, eet will still call
2213     * type_set of @p unified_type but the pointer will be set to a serialized binary representation
2214     * of what eet know. This make it possible, to save this pointer again by just returning the string
2215     * given previously and telling it by setting unknow to EINA_TRUE.
2216     *
2217     * @since 1.2.4
2218     * @ingroup Eet_Data_Group
2219     * @see Eet_Data_Descriptor_Class
2220     */
2221 #define EET_DATA_DESCRIPTOR_ADD_VARIANT(edd, struct_type, name, member, type_member, unified_type) \
2222      { \
2223         struct_type ___ett;                     \
2224         \
2225         eet_data_descriptor_element_add(edd, name, EET_T_UNKNOW, EET_G_VARIANT, \
2226                                         (char *) (&(___ett.member)) - (char *)(&(___ett)), \
2227                                         (char *) (&(___ett.type_member)) - (char *)(&(___ett)), \
2228                                         NULL, unified_type); \
2229      }
2230
2231    /**
2232     * Add a mapping to a data descriptor that will be used by union, variant or inherited type
2233     * @param unified_type The data descriptor to add the mapping to.
2234     * @param name The string name to get/set type.
2235     * @param subtype The matching data descriptor.
2236     *
2237     * @since 1.2.4
2238     * @ingroup Eet_Data_Group
2239     * @see Eet_Data_Descriptor_Class
2240     */
2241 #define EET_DATA_DESCRIPTOR_ADD_MAPPING(unified_type, name, subtype) \
2242   eet_data_descriptor_element_add(unified_type, name, EET_T_UNKNOW, EET_G_UNKNOWN, 0, 0, NULL, subtype);
2243
2244    /**
2245     * @defgroup Eet_Data_Cipher_Group Eet Data Serialization using A Ciphers
2246     *
2247     * Most of the @ref Eet_Data_Group have alternative versions that
2248     * accounts for ciphers to protect their content.
2249     *
2250     * @see @ref Eet_Cipher_Group
2251     *
2252     * @ingroup Eet_Data_Group
2253     */
2254
2255    /**
2256     * Read a data structure from an eet file and decodes it using a cipher.
2257     * @param ef The eet file handle to read from.
2258     * @param edd The data descriptor handle to use when decoding.
2259     * @param name The key the data is stored under in the eet file.
2260     * @param cipher_key The key to use as cipher.
2261     * @return A pointer to the decoded data structure.
2262     *
2263     * This function decodes a data structure stored in an eet file, returning
2264     * a pointer to it if it decoded successfully, or NULL on failure. This
2265     * can save a programmer dozens of hours of work in writing configuration
2266     * file parsing and writing code, as eet does all that work for the program
2267     * and presents a program-friendly data structure, just as the programmer
2268     * likes. Eet can handle members being added or deleted from the data in
2269     * storage and safely zero-fills unfilled members if they were not found
2270     * in the data. It checks sizes and headers whenever it reads data, allowing
2271     * the programmer to not worry about corrupt data.
2272     *
2273     * Once a data structure has been described by the programmer with the
2274     * fields they wish to save or load, storing or retrieving a data structure
2275     * from an eet file, or from a chunk of memory is as simple as a single
2276     * function call.
2277     *
2278     * @see eet_data_read()
2279     *
2280     * @since 1.0.0
2281     * @ingroup Eet_Data_Cipher_Group
2282     */
2283    EAPI void *eet_data_read_cipher(Eet_File *ef, Eet_Data_Descriptor *edd, const char *name, const char *cipher_key);
2284
2285    /**
2286     * Write a data structure from memory and store in an eet file
2287     * using a cipher.
2288     * @param ef The eet file handle to write to.
2289     * @param edd The data descriptor to use when encoding.
2290     * @param name The key to store the data under in the eet file.
2291     * @param cipher_key The key to use as cipher.
2292     * @param data A pointer to the data structure to ssave and encode.
2293     * @param compress Compression flags for storage.
2294     * @return bytes written on successful write, 0 on failure.
2295     *
2296     * This function is the reverse of eet_data_read(), saving a data structure
2297     * to an eet file.
2298     *
2299     * @see eet_data_write_cipher()
2300     *
2301     * @since 1.0.0
2302     * @ingroup Eet_Data_Cipher_Group
2303     */
2304    EAPI int eet_data_write_cipher(Eet_File *ef, Eet_Data_Descriptor *edd, const char *name, const char *cipher_key, const void *data, int compress);
2305
2306    /**
2307     * Dump an eet encoded data structure into ascii text using a cipher.
2308     * @param data_in The pointer to the data to decode into a struct.
2309     * @param cipher_key The key to use as cipher.
2310     * @param size_in The size of the data pointed to in bytes.
2311     * @param dumpfunc The function to call passed a string when new
2312     *        data is converted to text
2313     * @param dumpdata The data to pass to the @p dumpfunc callback.
2314     * @return 1 on success, 0 on failure
2315     *
2316     * This function will take a chunk of data encoded by
2317     * eet_data_descriptor_encode() and convert it into human readable
2318     * ascii text.  It does this by calling the @p dumpfunc callback
2319     * for all new text that is generated. This callback should append
2320     * to any existing text buffer and will be passed the pointer @p
2321     * dumpdata as a parameter as well as a string with new text to be
2322     * appended.
2323     *
2324     * Example:
2325     *
2326     * @code
2327     * void output(void *data, const char *string)
2328     * {
2329     *   printf("%s", string);
2330     * }
2331     *
2332     * void dump(const char *file)
2333     * {
2334     *   FILE *f;
2335     *   int len;
2336     *   void *data;
2337     *
2338     *   f = fopen(file, "r");
2339     *   fseek(f, 0, SEEK_END);
2340     *   len = ftell(f);
2341     *   rewind(f);
2342     *   data = malloc(len);
2343     *   fread(data, len, 1, f);
2344     *   fclose(f);
2345     *   eet_data_text_dump_cipher(data, cipher_key, len, output, NULL);
2346     * }
2347     * @endcode
2348     *
2349     * @see eet_data_text_dump()
2350     *
2351     * @since 1.0.0
2352     * @ingroup Eet_Data_Cipher_Group
2353     */
2354    EAPI int eet_data_text_dump_cipher(const void *data_in, const char *cipher_key, int size_in, void (*dumpfunc) (void *data, const char *str), void *dumpdata);
2355
2356    /**
2357     * Take an ascii encoding from eet_data_text_dump() and re-encode
2358     * in binary using a cipher.
2359     * @param text The pointer to the string data to parse and encode.
2360     * @param cipher_key The key to use as cipher.
2361     * @param textlen The size of the string in bytes (not including 0
2362     *        byte terminator).
2363     * @param size_ret This gets filled in with the encoded data blob
2364     *        size in bytes.
2365     * @return The encoded data on success, NULL on failure.
2366     *
2367     * This function will parse the string pointed to by @p text and return
2368     * an encoded data lump the same way eet_data_descriptor_encode() takes an
2369     * in-memory data struct and encodes into a binary blob. @p text is a normal
2370     * C string.
2371     *
2372     * @see eet_data_text_undump()
2373     *
2374     * @since 1.0.0
2375     * @ingroup Eet_Data_Cipher_Group
2376     */
2377    EAPI void *eet_data_text_undump_cipher(const char *text, const char *cipher_key, int textlen, int *size_ret);
2378
2379    /**
2380     * Dump an eet encoded data structure from an eet file into ascii
2381     * text using a cipher.
2382     * @param ef A valid eet file handle.
2383     * @param name Name of the entry. eg: "/base/file_i_want".
2384     * @param cipher_key The key to use as cipher.
2385     * @param dumpfunc The function to call passed a string when new
2386     *        data is converted to text
2387     * @param dumpdata The data to pass to the @p dumpfunc callback.
2388     * @return 1 on success, 0 on failure
2389     *
2390     * This function will take an open and valid eet file from
2391     * eet_open() request the data encoded by
2392     * eet_data_descriptor_encode() corresponding to the key @p name
2393     * and convert it into human readable ascii text. It does this by
2394     * calling the @p dumpfunc callback for all new text that is
2395     * generated. This callback should append to any existing text
2396     * buffer and will be passed the pointer @p dumpdata as a parameter
2397     * as well as a string with new text to be appended.
2398     *
2399     * @see eet_data_dump()
2400     *
2401     * @since 1.0.0
2402     * @ingroup Eet_Data_Cipher_Group
2403     */
2404    EAPI int eet_data_dump_cipher(Eet_File *ef, const char *name, const char *cipher_key, void (*dumpfunc) (void *data, const char *str), void *dumpdata);
2405
2406    /**
2407     * Take an ascii encoding from eet_data_dump() and re-encode in
2408     * binary using a cipher.
2409     * @param ef A valid eet file handle.
2410     * @param name Name of the entry. eg: "/base/file_i_want".
2411     * @param cipher_key The key to use as cipher.
2412     * @param text The pointer to the string data to parse and encode.
2413     * @param textlen The size of the string in bytes (not including 0
2414     *        byte terminator).
2415     * @param compress Compression flags (1 == compress, 0 = don't compress).
2416     * @return 1 on success, 0 on failure
2417     *
2418     * This function will parse the string pointed to by @p text,
2419     * encode it the same way eet_data_descriptor_encode() takes an
2420     * in-memory data struct and encodes into a binary blob.
2421     *
2422     * The data (optionally compressed) will be in ram, pending a flush to
2423     * disk (it will stay in ram till the eet file handle is closed though).
2424     *
2425     * @see eet_data_undump()
2426     *
2427     * @since 1.0.0
2428     * @ingroup Eet_Data_Cipher_Group
2429     */
2430    EAPI int eet_data_undump_cipher(Eet_File *ef, const char *name, const char *cipher_key, const char *text, int textlen, int compress);
2431
2432    /**
2433     * Decode a data structure from an arbitary location in memory
2434     * using a cipher.
2435     * @param edd The data  descriptor to use when decoding.
2436     * @param data_in The pointer to the data to decode into a struct.
2437     * @param cipher_key The key to use as cipher.
2438     * @param size_in The size of the data pointed to in bytes.
2439     * @return NULL on failure, or a valid decoded struct pointer on success.
2440     *
2441     * This function will decode a data structure that has been encoded using
2442     * eet_data_descriptor_encode(), and return a data structure with all its
2443     * elements filled out, if successful, or NULL on failure.
2444     *
2445     * The data to be decoded is stored at the memory pointed to by @p data_in,
2446     * and is described by the descriptor pointed to by @p edd. The data size is
2447     * passed in as the value to @p size_in, ande must be greater than 0 to
2448     * succeed.
2449     *
2450     * This function is useful for decoding data structures delivered to the
2451     * application by means other than an eet file, such as an IPC or socket
2452     * connection, raw files, shared memory etc.
2453     *
2454     * Please see eet_data_read() for more information.
2455     *
2456     * @see eet_data_descriptor_decode()
2457     *
2458     * @since 1.0.0
2459     * @ingroup Eet_Data_Cipher_Group
2460     */
2461    EAPI void *eet_data_descriptor_decode_cipher(Eet_Data_Descriptor *edd, const void *data_in, const char *cipher_key, int size_in);
2462
2463    /**
2464     * Encode a data struct to memory and return that encoded data
2465     * using a cipher.
2466     * @param edd The data  descriptor to use when encoding.
2467     * @param data_in The pointer to the struct to encode into data.
2468     * @param cipher_key The key to use as cipher.
2469     * @param size_ret pointer to the an int to be filled with the decoded size.
2470     * @return NULL on failure, or a valid encoded data chunk on success.
2471     *
2472     * This function takes a data structutre in memory and encodes it into a
2473     * serialised chunk of data that can be decoded again by
2474     * eet_data_descriptor_decode(). This is useful for being able to transmit
2475     * data structures across sockets, pipes, IPC or shared file mechanisms,
2476     * without having to worry about memory space, machine type, endianess etc.
2477     *
2478     * The parameter @p edd must point to a valid data descriptor, and
2479     * @p data_in must point to the right data structure to encode. If not, the
2480     * encoding may fail.
2481     *
2482     * On success a non NULL valid pointer is returned and what @p size_ret
2483     * points to is set to the size of this decoded data, in bytes. When the
2484     * encoded data is no longer needed, call free() on it. On failure NULL is
2485     * returned and what @p size_ret points to is set to 0.
2486     *
2487     * Please see eet_data_write() for more information.
2488     *
2489     * @see eet_data_descriptor_encode()
2490     *
2491     * @since 1.0.0
2492     * @ingroup Eet_Data_Cipher_Group
2493     */
2494    EAPI void *eet_data_descriptor_encode_cipher(Eet_Data_Descriptor *edd, const void *data_in, const char *cipher_key, int *size_ret);
2495
2496   /**
2497    * @defgroup Eet_Node_Group Low-level Serialization Structures.
2498    *
2499    * Functions that create, destroy and manipulate serialization nodes
2500    * used by @ref Eet_Data_Group.
2501    *
2502    * @{
2503    */
2504
2505   /**
2506    * @typedef Eet_Node
2507    * Opaque handle to manage serialization node.
2508    */
2509    typedef struct _Eet_Node                  Eet_Node;
2510
2511   /**
2512    * @typedef Eet_Node_Data
2513    * Contains an union that can fit any kind of node.
2514    */
2515    typedef struct _Eet_Node_Data             Eet_Node_Data;
2516
2517   /**
2518    * @struct _Eet_Node_Data
2519    * Contains an union that can fit any kind of node.
2520    */
2521    struct _Eet_Node_Data
2522    {
2523       union {
2524          char c;
2525          short s;
2526          int i;
2527          long long l;
2528          float f;
2529          double d;
2530          unsigned char uc;
2531          unsigned short us;
2532          unsigned int ui;
2533          unsigned long long ul;
2534          const char *str;
2535       } value;
2536    };
2537
2538   /**
2539    * @}
2540    */
2541
2542   /**
2543    * TODO FIX ME
2544    * @ingroup Eet_Node_Group
2545    */
2546    EAPI Eet_Node *eet_node_char_new(const char *name, char c);
2547
2548   /**
2549    * TODO FIX ME
2550    * @ingroup Eet_Node_Group
2551    */
2552    EAPI Eet_Node *eet_node_short_new(const char *name, short s);
2553
2554   /**
2555    * TODO FIX ME
2556    * @ingroup Eet_Node_Group
2557    */
2558    EAPI Eet_Node *eet_node_int_new(const char *name, int i);
2559
2560   /**
2561    * TODO FIX ME
2562    * @ingroup Eet_Node_Group
2563    */
2564    EAPI Eet_Node *eet_node_long_long_new(const char *name, long long l);
2565
2566   /**
2567    * TODO FIX ME
2568    * @ingroup Eet_Node_Group
2569    */
2570    EAPI Eet_Node *eet_node_float_new(const char *name, float f);
2571
2572   /**
2573    * TODO FIX ME
2574    * @ingroup Eet_Node_Group
2575    */
2576    EAPI Eet_Node *eet_node_double_new(const char *name, double d);
2577
2578   /**
2579    * TODO FIX ME
2580    * @ingroup Eet_Node_Group
2581    */
2582    EAPI Eet_Node *eet_node_unsigned_char_new(const char *name, unsigned char uc);
2583
2584   /**
2585    * TODO FIX ME
2586    * @ingroup Eet_Node_Group
2587    */
2588    EAPI Eet_Node *eet_node_unsigned_short_new(const char *name, unsigned short us);
2589
2590   /**
2591    * TODO FIX ME
2592    * @ingroup Eet_Node_Group
2593    */
2594    EAPI Eet_Node *eet_node_unsigned_int_new(const char *name, unsigned int ui);
2595
2596   /**
2597    * TODO FIX ME
2598    * @ingroup Eet_Node_Group
2599    */
2600    EAPI Eet_Node *eet_node_unsigned_long_long_new(const char *name, unsigned long long l);
2601
2602   /**
2603    * TODO FIX ME
2604    * @ingroup Eet_Node_Group
2605    */
2606    EAPI Eet_Node *eet_node_string_new(const char *name, const char *str);
2607
2608   /**
2609    * TODO FIX ME
2610    * @ingroup Eet_Node_Group
2611    */
2612    EAPI Eet_Node *eet_node_inlined_string_new(const char *name, const char *str);
2613
2614   /**
2615    * TODO FIX ME
2616    * @ingroup Eet_Node_Group
2617    */
2618    EAPI Eet_Node *eet_node_null_new(const char *name);
2619
2620   /**
2621    * TODO FIX ME
2622    * @ingroup Eet_Node_Group
2623    */
2624    EAPI Eet_Node *eet_node_list_new(const char *name, Eina_List *nodes);
2625
2626   /**
2627    * TODO FIX ME
2628    * @ingroup Eet_Node_Group
2629    */
2630    EAPI Eet_Node *eet_node_array_new(const char *name, int count, Eina_List *nodes);
2631
2632   /**
2633    * TODO FIX ME
2634    * @ingroup Eet_Node_Group
2635    */
2636    EAPI Eet_Node *eet_node_var_array_new(const char *name, Eina_List *nodes);
2637
2638   /**
2639    * TODO FIX ME
2640    * @ingroup Eet_Node_Group
2641    */
2642    EAPI Eet_Node *eet_node_hash_new(const char *name, const char *key, Eet_Node *node);
2643
2644   /**
2645    * TODO FIX ME
2646    * @ingroup Eet_Node_Group
2647    */
2648    EAPI Eet_Node *eet_node_struct_new(const char *name, Eina_List *nodes);
2649
2650   /**
2651    * TODO FIX ME
2652    * @ingroup Eet_Node_Group
2653    */
2654    EAPI Eet_Node *eet_node_struct_child_new(const char *parent, Eet_Node *child);
2655
2656
2657   /**
2658    * TODO FIX ME
2659    * @ingroup Eet_Node_Group
2660    */
2661    EAPI void eet_node_list_append(Eet_Node *parent, const char *name, Eet_Node *child);
2662
2663   /**
2664    * TODO FIX ME
2665    * @ingroup Eet_Node_Group
2666    */
2667    EAPI void eet_node_struct_append(Eet_Node *parent, const char *name, Eet_Node *child);
2668
2669   /**
2670    * TODO FIX ME
2671    * @ingroup Eet_Node_Group
2672    */
2673    EAPI void eet_node_hash_add(Eet_Node *parent, const char *name, const char *key, Eet_Node *child);
2674
2675
2676   /**
2677    * TODO FIX ME
2678    * @ingroup Eet_Node_Group
2679    */
2680    EAPI void eet_node_dump(Eet_Node *n, int dumplevel, void (*dumpfunc) (void *data, const char *str), void *dumpdata);
2681
2682   /**
2683    * TODO FIX ME
2684    * @ingroup Eet_Node_Group
2685    */
2686    EAPI void eet_node_del(Eet_Node *n);
2687
2688   /**
2689    * TODO FIX ME
2690    * @ingroup Eet_Node_Group
2691    */
2692    EAPI void *eet_data_node_encode_cipher(Eet_Node *node, const char *cipher_key, int *size_ret);
2693
2694   /**
2695    * TODO FIX ME
2696    * @ingroup Eet_Node_Group
2697    */
2698    EAPI Eet_Node *eet_data_node_decode_cipher(const void *data_in, const char *cipher_key, int size_in);
2699
2700   /**
2701    * TODO FIX ME
2702    * @ingroup Eet_Node_Group
2703    */
2704    EAPI Eet_Node *eet_data_node_read_cipher(Eet_File *ef, const char *name, const char *cipher_key);
2705
2706   /**
2707    * TODO FIX ME
2708    * @ingroup Eet_Node_Group
2709    */
2710    EAPI int eet_data_node_write_cipher(Eet_File *ef, const char *name, const char *cipher_key, Eet_Node *node, int compress);
2711
2712   /* EXPERIMENTAL: THIS API MAY CHANGE IN THE FUTURE, USE IT ONLY IF YOU KNOW WHAT YOU ARE DOING. */
2713
2714   /**
2715    * @typedef Eet_Node_Walk
2716    * Describes how to walk trees of #Eet_Node.
2717    */
2718    typedef struct _Eet_Node_Walk             Eet_Node_Walk;
2719
2720   /**
2721    * @struct _Eet_Node_Walk
2722    * Describes how to walk trees of #Eet_Node.
2723    */
2724    struct _Eet_Node_Walk
2725    {
2726       void *(*struct_alloc)(const char *type, void *user_data);
2727       void (*struct_add)(void *parent, const char *name, void *child, void *user_data);
2728       void *(*array)(Eina_Bool variable, const char *name, int count, void *user_data);
2729       void (*insert)(void *array, int index, void *child, void *user_data);
2730       void *(*list)(const char *name, void *user_data);
2731       void (*append)(void *list, void *child, void *user_data);
2732       void *(*hash)(void *parent, const char *name, const char *key, void *value, void *user_data);
2733       void *(*simple)(int type, Eet_Node_Data *data, void *user_data);
2734    };
2735
2736    EAPI void *eet_node_walk(void *parent, const char *name, Eet_Node *root, Eet_Node_Walk *cb, void *user_data);
2737
2738   /*******/
2739
2740   /**
2741    * @defgroup Eet_Connection_Group Helper function to use eet over a network link
2742    *
2743    * Function that reconstruct and prepare packet of @ref Eet_Data_Group to be send.
2744    *
2745    */
2746
2747   /**
2748    * @typedef Eet_Connection
2749    * Opaque handle to track paquet for a specific connection.
2750    *
2751    * @ingroup Eet_Connection_Group
2752    */
2753    typedef struct _Eet_Connection Eet_Connection;
2754
2755   /**
2756    * @typedef Eet_Read_Cb
2757    * Called back when an @ref Eet_Data_Group has been received completly and could be used.
2758    *
2759    * @ingroup Eet_Connection_Group
2760    */
2761    typedef Eina_Bool Eet_Read_Cb(const void *eet_data, size_t size, void *user_data);
2762
2763   /**
2764    * @typedef Eet_Write_Cb
2765    * Called back when a packet containing @ref Eet_Data_Group data is ready to be send.
2766    *
2767    * @ingroup Eet_Connection_Group
2768    */
2769    typedef Eina_Bool Eet_Write_Cb(const void *data, size_t size, void *user_data);
2770
2771   /**
2772    * Instanciate a new connection to track.
2773    * @oaram eet_read_cb Function to call when one Eet_Data packet has been fully assemble.
2774    * @param eet_write_cb Function to call when one Eet_Data packet is ready to be send over the wire.
2775    * @param user_data Pointer provided to both functions to be used as a context handler.
2776    * @return NULL on failure, or a valid Eet_Connection handler.
2777    *
2778    * For every connection to track you will need a separate Eet_Connection provider.
2779    *
2780    * @since 1.2.4
2781    * @ingroup Eet_Connection_Group
2782    */
2783    Eet_Connection *eet_connection_new(Eet_Read_Cb *eet_read_cb, Eet_Write_Cb *eet_write_cb, const void *user_data);
2784
2785   /**
2786    * Process a raw packet received over the link
2787    * @oaram conn Connection handler to track.
2788    * @param data Raw data packet.
2789    * @param size The size of that packet.
2790    * @return 0 on complete success, any other value indicate where in the stream it got wrong (It could be before that packet).
2791    *
2792    * Every time you receive a packet related to your connection, you should pass
2793    * it to that function so that it could process and assemble packet has you
2794    * receive it. It will automatically call Eet_Read_Cb when one is fully received.
2795    *
2796    * @since 1.2.4
2797    * @ingroup Eet_Connection_Group
2798    */
2799    int eet_connection_received(Eet_Connection *conn, const void *data, size_t size);
2800
2801   /**
2802    * Convert a complex structure and prepare it to be send.
2803    * @oaram conn Connection handler to track.
2804    * @param edd The data descriptor to use when encoding.
2805    * @param data_in The pointer to the struct to encode into data.
2806    * @param cipher_key The key to use as cipher.
2807    * @return EINA_TRUE if the data where correctly send, EINA_FALSE if they don't.
2808    *
2809    * This function serialize data_in with edd, assemble the packet and call
2810    * Eet_Write_Cb when ready. The data passed Eet_Write_Cb are temporary allocated
2811    * and will vanish just after the return of the callback.
2812    *
2813    * @see eet_data_descriptor_encode_cipher
2814    *
2815    * @since 1.2.4
2816    * @ingroup Eet_Connection_Group
2817    */
2818    Eina_Bool eet_connection_send(Eet_Connection *conn, Eet_Data_Descriptor *edd, const void *data_in, const char *cipher_key);
2819
2820   /**
2821    * Convert a Eet_Node tree and prepare it to be send.
2822    * @oaram conn Connection handler to track.
2823    * @param node The data tree to use when encoding.
2824    * @param cipher_key The key to use as cipher.
2825    * @return EINA_TRUE if the data where correctly send, EINA_FALSE if they don't.
2826    *
2827    * This function serialize node, assemble the packet and call
2828    * Eet_Write_Cb when ready. The data passed Eet_Write_Cb are temporary allocated
2829    * and will vanish just after the return of the callback.
2830    *
2831    * @see eet_data_node_encode_cipher
2832    *
2833    * @since 1.2.4
2834    * @ingroup Eet_Connection_Group
2835    */
2836    Eina_Bool eet_connection_node_send(Eet_Connection *conn, Eet_Node *node, const char *cipher_key);
2837
2838   /**
2839    * Close a connection and lost its track.
2840    * @oaram conn Connection handler to close.
2841    * @param on_going Signal if a partial packet wasn't completed.
2842    * @return the user_data passed to both callback.
2843    *
2844    * @since 1.2.4
2845    * @ingroup Eet_Connection_Group
2846    */
2847    void *eet_connection_close(Eet_Connection *conn, Eina_Bool *on_going);
2848
2849 /***************************************************************************/
2850
2851 #ifdef __cplusplus
2852 }
2853 #endif
2854
2855 #endif