Eet.h   Eet.h 
#ifndef _EET_H #ifndef _EET_H
#define _EET_H #define _EET_H
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h>
#ifdef EAPI #ifdef EAPI
# undef EAPI # undef EAPI
#endif #endif
#ifdef _WIN32 #ifdef _WIN32
# ifdef EFL_EET_BUILD # ifdef EFL_EET_BUILD
# ifdef DLL_EXPORT # ifdef DLL_EXPORT
# define EAPI __declspec(dllexport) # define EAPI __declspec(dllexport)
# else # else
skipping to change at line 89 skipping to change at line 90
{ {
EET_ERROR_NONE, EET_ERROR_NONE,
EET_ERROR_BAD_OBJECT, EET_ERROR_BAD_OBJECT,
EET_ERROR_EMPTY, EET_ERROR_EMPTY,
EET_ERROR_NOT_WRITABLE, EET_ERROR_NOT_WRITABLE,
EET_ERROR_OUT_OF_MEMORY, EET_ERROR_OUT_OF_MEMORY,
EET_ERROR_WRITE_ERROR, EET_ERROR_WRITE_ERROR,
EET_ERROR_WRITE_ERROR_FILE_TOO_BIG, EET_ERROR_WRITE_ERROR_FILE_TOO_BIG,
EET_ERROR_WRITE_ERROR_IO_ERROR, EET_ERROR_WRITE_ERROR_IO_ERROR,
EET_ERROR_WRITE_ERROR_OUT_OF_SPACE, EET_ERROR_WRITE_ERROR_OUT_OF_SPACE,
EET_ERROR_WRITE_ERROR_FILE_CLOSED EET_ERROR_WRITE_ERROR_FILE_CLOSED,
EET_ERROR_MMAP_FAILED,
EET_ERROR_X509_ENCODING_FAILED,
EET_ERROR_SIGNATURE_FAILED,
EET_ERROR_INVALID_SIGNATURE,
EET_ERROR_NOT_SIGNED,
EET_ERROR_NOT_IMPLEMENTED
} Eet_Error; } Eet_Error;
typedef struct _Eet_File Eet_File; typedef struct _Eet_File Eet_File;
typedef struct _Eet_Dictionary Eet_Dictionary; typedef struct _Eet_Dictionary Eet_Dictionary;
typedef struct _Eet_Data_Descriptor Eet_Data_Descriptor; typedef struct _Eet_Data_Descriptor Eet_Data_Descriptor;
typedef struct _Eet_Key Eet_Key;
typedef struct _Eet_Data_Descriptor_Class Eet_Data_Descriptor_Class; typedef struct _Eet_Data_Descriptor_Class Eet_Data_Descriptor_Class;
#define EET_DATA_DESCRIPTOR_CLASS_VERSION 2 #define EET_DATA_DESCRIPTOR_CLASS_VERSION 2
struct _Eet_Data_Descriptor_Class struct _Eet_Data_Descriptor_Class
{ {
int version; int version;
const char *name; const char *name;
int size; int size;
struct { struct {
skipping to change at line 218 skipping to change at line 226
* *
* return 0; * return 0;
* } * }
* @endcode * @endcode
* *
* @since 1.0.0 * @since 1.0.0
*/ */
EAPI Eet_File *eet_open(const char *file, Eet_File_Mode mode); EAPI Eet_File *eet_open(const char *file, Eet_File_Mode mode);
/** /**
* Open an eet file directly from a memory location. The data are not co
pied,
* so you must keep them around as long as the eet file is open. Their i
s
* currently no cache for this kind of Eet_File, so it's reopen every ti
me
* you do use eet_memopen_read.
*
* @since 2.0.0
*/
EAPI Eet_File *eet_memopen_read(const void *data, size_t size);
/**
* Get the mode an Eet_File was opened with. * Get the mode an Eet_File was opened with.
* @param ef A valid eet file handle. * @param ef A valid eet file handle.
* @return The mode ef was opened with. * @return The mode ef was opened with.
* *
* @since 1.0.0 * @since 1.0.0
*/ */
EAPI Eet_File_Mode eet_mode_get(Eet_File *ef); EAPI Eet_File_Mode eet_mode_get(Eet_File *ef);
/** /**
* Close an eet file handle and flush and writes pending. * Close an eet file handle and flush and writes pending.
skipping to change at line 240 skipping to change at line 258
* This function will flush any pending writes to disk if the eet file * This function will flush any pending writes to disk if the eet file
* was opened for write, and free all data associated with the file hand le * was opened for write, and free all data associated with the file hand le
* and file, and close the file. * and file, and close the file.
* *
* If the eet file handle is not valid nothing will be done. * If the eet file handle is not valid nothing will be done.
* *
* @since 1.0.0 * @since 1.0.0
*/ */
EAPI Eet_Error eet_close(Eet_File *ef); EAPI Eet_Error eet_close(Eet_File *ef);
/**
* Callback used to request if needed the password of a private key.
*
* @since 2.0.0
*/
typedef int (*Eet_Key_Password_Callback)(char *buffer, int size, int rwf
lag, void *data);
/**
* Create an Eet_Key needed for signing an eet file.
*
* The certificate should provide the public that match the private key.
* No verification is done to ensure that.
*
* @since 2.0.0
*/
EAPI Eet_Key* eet_identity_open(const char *certificate_file, const char
*private_key_file, Eet_Key_Password_Callback cb);
/**
* Close and release all ressource used by an Eet_Key.
* An reference counter prevent it from being freed until all file usin
g it are
* also closed.
*
* @since 2.0.0
*/
EAPI void eet_identity_close(Eet_Key *key);
/**
* Set a key to sign a file
*
* @since 2.0.0
*/
EAPI Eet_Error eet_identity_set(Eet_File *ef, Eet_Key *key);
/**
* Display both private and public key of an Eet_Key.
*
* @since 2.0.0
*/
EAPI void eet_identity_print(Eet_Key *key, FILE *out);
/**
* Get the x509 der certificate associated with an Eet_File. Will retur
n NULL
* if the file is not signed.
*
* @since 2.0.0
*/
EAPI const void *eet_identity_x509(Eet_File *ef, int *der_length);
/**
* Display the x509 der certificate to out.
*
* @since 2.0.0
*/
EAPI void eet_identity_certificate_print(const unsigned char *certificat
e, int der_length, FILE *out);
/** /**
* Return a handle to the shared string dictionary of the Eet file * Return a handle to the shared string dictionary of the Eet file
* @param ef A valid eet file handle. * @param ef A valid eet file handle.
* @return A handle to the dictionary of the file * @return A handle to the dictionary of the file
* *
* This function returns a handle to the dictionary of an Eet file whose * This function returns a handle to the dictionary of an Eet file whose
* handle is @p ef, if a dictionary exists. NULL is returned otherwise o r * handle is @p ef, if a dictionary exists. NULL is returned otherwise o r
* if the file handle is known to be invalid. * if the file handle is known to be invalid.
* *
* @since 1.0.0 * @since 1.0.0
skipping to change at line 472 skipping to change at line 545
* On success the function returns a pointer to the image data decoded. The * On success the function returns a pointer to the image data decoded. The
* calling application is responsible for calling free() on the image da ta * calling application is responsible for calling free() on the image da ta
* when it is done with it. On failure NULL is returned and the paramete r * when it is done with it. On failure NULL is returned and the paramete r
* values may not contain any sensible data. * values may not contain any sensible data.
* *
* @since 1.0.0 * @since 1.0.0
*/ */
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 *loss y); 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 *loss y);
/** /**
* Read image data from the named key in the eet file.
* @param ef A valid eet file handle opened for reading.
* @param name Name of the entry. eg: "/base/file_i_want".
* @param src_x The starting x coordinate from where to dump the stream.
* @param src_y The starting y coordinate from where to dump the stream.
* @param d A pointer to the pixel surface.
* @param w The expected width in pixels of the pixel surface to decode.
* @param h The expected height in pixels of the pixel surface to decode
.
* @param row_stride The length of a pixels line in the destination surf
ace.
* @param alpha A pointer to the int to hold the alpha flag.
* @param compress A pointer to the int to hold the compression amount.
* @param quality A pointer to the int to hold the quality amount.
* @param lossy A pointer to the int to hold the lossiness flag.
* @return 1 on success, 0 otherwise.
*
* This function reads an image from an eet file stored under the named
* key in the eet file and return a pointer to the decompressed pixel da
ta.
*
* The other parameters of the image (width, height etc.) are placed int
o
* the values pointed to (they must be supplied). The pixel data is a li
near
* array of pixels starting from the top-left of the image scanning row
by
* row from left to right. Each pile is a 32bit value, with the high byt
e
* being the alpha channel, the next being red, then green, and the low
byte
* being blue. The width and height are measured in pixels and will be
* greater than 0 when returned. The alpha flag is either 0 or 1. 0 deno
tes
* that the alpha channel is not used. 1 denotes that it is significant.
* Compress is filled with the compression value/amount the image was
* stored with. The quality value is filled with the quality encoding of
* the image file (0 - 100). The lossy flags is either 0 or 1 as to if
* the image was encoded lossily or not.
*
* On success the function returns 1, and 0 on failure. On failure the
* parameter values may not contain any sensible data.
*
* @since 1.0.2
*/
EAPI int eet_data_image_read_to_surface(Eet_File *ef, const char *name, u
nsigned int src_x, unsigned int src_y, unsigned int *d, unsigned int w, uns
igned int h, unsigned int row_stride, int *alpha, int *compress, int *quali
ty, int *lossy);
/**
* Write image data to the named key in an eet file. * Write image data to the named key in an eet file.
* @param ef A valid eet file handle opened for writing. * @param ef A valid eet file handle opened for writing.
* @param name Name of the entry. eg: "/base/file_i_want". * @param name Name of the entry. eg: "/base/file_i_want".
* @param data A pointer to the image pixel data. * @param data A pointer to the image pixel data.
* @param w The width of the image in pixels. * @param w The width of the image in pixels.
* @param h The height of the image in pixels. * @param h The height of the image in pixels.
* @param alpha The alpha channel flag. * @param alpha The alpha channel flag.
* @param compress The compression amount. * @param compress The compression amount.
* @param quality The quality encoding amount. * @param quality The quality encoding amount.
* @param lossy The lossiness flag. * @param lossy The lossiness flag.
skipping to change at line 578 skipping to change at line 690
* On success the function returns a pointer to the image data decoded. The * On success the function returns a pointer to the image data decoded. The
* calling application is responsible for calling free() on the image da ta * calling application is responsible for calling free() on the image da ta
* when it is done with it. On failure NULL is returned and the paramete r * when it is done with it. On failure NULL is returned and the paramete r
* values may not contain any sensible data. * values may not contain any sensible data.
* *
* @since 1.0.0 * @since 1.0.0
*/ */
EAPI void *eet_data_image_decode(const void *data, int size, unsigned in t *w, unsigned int *h, int *alpha, int *compress, int *quality, int *lossy) ; EAPI void *eet_data_image_decode(const void *data, int size, unsigned in t *w, unsigned int *h, int *alpha, int *compress, int *quality, int *lossy) ;
/** /**
* Decode Image data into pixel data.
* @param data The encoded pixel data.
* @param size The size, in bytes, of the encoded pixel data.
* @param src_x The starting x coordinate from where to dump the stream.
* @param src_y The starting y coordinate from where to dump the stream.
* @param d A pointer to the pixel surface.
* @param w The expected width in pixels of the pixel surface to decode.
* @param h The expected height in pixels of the pixel surface to decode
.
* @param row_stride The length of a pixels line in the destination surf
ace.
* @param alpha A pointer to the int to hold the alpha flag.
* @param compress A pointer to the int to hold the compression amount.
* @param quality A pointer to the int to hold the quality amount.
* @param lossy A pointer to the int to hold the lossiness flag.
* @return 1 on success, 0 otherwise.
*
* This function takes encoded pixel data and decodes it into raw RGBA
* pixels on success.
*
* The other parameters of the image (alpha, compress etc.) are placed i
nto
* the values pointed to (they must be supplied). The pixel data is a li
near
* array of pixels starting from the top-left of the image scanning row
by
* row from left to right. Each pixel is a 32bit value, with the high by
te
* being the alpha channel, the next being red, then green, and the low
byte
* being blue. The width and height are measured in pixels and will be
* greater than 0 when returned. The alpha flag is either 0 or 1. 0 deno
tes
* that the alpha channel is not used. 1 denotes that it is significant.
* Compress is filled with the compression value/amount the image was
* stored with. The quality value is filled with the quality encoding of
* the image file (0 - 100). The lossy flags is either 0 or 1 as to if
* the image was encoded lossily or not.
*
* On success the function returns 1, and 0 on failure. On failure the
* parameter values may not contain any sensible data.
*
* @since 1.0.2
*/
EAPI int eet_data_image_decode_to_surface(const void *data, int size, un
signed int src_x, unsigned int src_y, unsigned int *d, unsigned int w, unsi
gned int h, unsigned int row_stride, int *alpha, int *compress, int *qualit
y, int *lossy);
/**
* Encode image data for storage or transmission. * Encode image data for storage or transmission.
* @param data A pointer to the image pixel data. * @param data A pointer to the image pixel data.
* @param size_ret A pointer to an int to hold the size of the returned data. * @param size_ret A pointer to an int to hold the size of the returned data.
* @param w The width of the image in pixels. * @param w The width of the image in pixels.
* @param h The height of the image in pixels. * @param h The height of the image in pixels.
* @param alpha The alpha channel flag. * @param alpha The alpha channel flag.
* @param compress The compression amount. * @param compress The compression amount.
* @param quality The quality encoding amount. * @param quality The quality encoding amount.
* @param lossy The lossiness flag. * @param lossy The lossiness flag.
* @return The encoded image data. * @return The encoded image data.
skipping to change at line 813 skipping to change at line 964
/** /**
* This function is an internal used by macros. * This function is an internal used by macros.
* *
* This function is used by macros EET_DATA_DESCRIPTOR_ADD_BASIC(), * This function is used by macros EET_DATA_DESCRIPTOR_ADD_BASIC(),
* EET_DATA_DESCRIPTOR_ADD_SUB() and EET_DATA_DESCRIPTOR_ADD_LIST(). It is * EET_DATA_DESCRIPTOR_ADD_SUB() and EET_DATA_DESCRIPTOR_ADD_LIST(). It is
* complex to use by hand and should be left to be used by the macros, a nd * complex to use by hand and should be left to be used by the macros, a nd
* thus is not documented. * thus is not documented.
* *
* @since 1.0.0 * @since 1.0.0
*/ */
EAPI void eet_data_descriptor_element_add(Eet_Data_Descriptor *edd, cons t char *name, int type, int group_type, int offset, int count, const char * counter_name, Eet_Data_Descriptor *subtype); EAPI void eet_data_descriptor_element_add(Eet_Data_Descriptor *edd, cons t char *name, int type, int group_type, int offset, /* int count_offset, * /int count, const char *counter_name, Eet_Data_Descriptor *subtype);
/** /**
* Read a data structure from an eet file and decodes it. * Read a data structure from an eet file and decodes it.
* @param ef The eet file handle to read from. * @param ef The eet file handle to read from.
* @param edd The data descriptor handle to use when decoding. * @param edd The data descriptor handle to use when decoding.
* @param name The key the data is stored under in the eet file. * @param name The key the data is stored under in the eet file.
* @return A pointer to the decoded data structure. * @return A pointer to the decoded data structure.
* *
* This function decodes a data structure stored in an eet file, returni ng * This function decodes a data structure stored in an eet file, returni ng
* a pointer to it if it decoded successfully, or NULL on failure. This * a pointer to it if it decoded successfully, or NULL on failure. This
skipping to change at line 1038 skipping to change at line 1189
* EET_T_ULONG_LONG or EET_T_STRING. * EET_T_ULONG_LONG or EET_T_STRING.
* *
* @since 1.0.0 * @since 1.0.0
*/ */
#define EET_DATA_DESCRIPTOR_ADD_BASIC(edd, struct_type, name, member, type) \ #define EET_DATA_DESCRIPTOR_ADD_BASIC(edd, struct_type, name, member, type) \
{ \ { \
struct_type ___ett; \ struct_type ___ett; \
\ \
eet_data_descriptor_element_add(edd, name, type, EET_G_UNKNOWN, \ eet_data_descriptor_element_add(edd, name, type, EET_G_UNKNOWN, \
(char *)(&(___ett.member)) - (char * )(&(___ett)), \ (char *)(&(___ett.member)) - (char * )(&(___ett)), \
0, NULL, NULL); \ 0, /* 0, */NULL, NULL); \
} }
/** /**
* Add a sub-element type to a data descriptor * Add a sub-element type to a data descriptor
* @param edd The data descriptor to add the type to. * @param edd The data descriptor to add the type to.
* @param struct_type The type of the struct. * @param struct_type The type of the struct.
* @param name The string name to use to encode/decode this member (must be a constant global and never change). * @param name The string name to use to encode/decode this member (must be a constant global and never change).
* @param member The struct member itself to be encoded. * @param member The struct member itself to be encoded.
* @param subtype The type of sub-type struct to add. * @param subtype The type of sub-type struct to add.
* *
skipping to change at line 1063 skipping to change at line 1214
* this element. * this element.
* *
* @since 1.0.0 * @since 1.0.0
*/ */
#define EET_DATA_DESCRIPTOR_ADD_SUB(edd, struct_type, name, member, subtype ) \ #define EET_DATA_DESCRIPTOR_ADD_SUB(edd, struct_type, name, member, subtype ) \
{ \ { \
struct_type ___ett; \ struct_type ___ett; \
\ \
eet_data_descriptor_element_add(edd, name, EET_T_UNKNOW, EET_G_UNKNO WN, \ eet_data_descriptor_element_add(edd, name, EET_T_UNKNOW, EET_G_UNKNO WN, \
(char *)(&(___ett.member)) - (char * )(&(___ett)), \ (char *)(&(___ett.member)) - (char * )(&(___ett)), \
0, NULL, subtype); \ 0, /* 0, */NULL, subtype); \
} }
/** /**
* Add a linked list type to a data descriptor * Add a linked list type to a data descriptor
* @param edd The data descriptor to add the type to. * @param edd The data descriptor to add the type to.
* @param struct_type The type of the struct. * @param struct_type The type of the struct.
* @param name The string name to use to encode/decode this member (must be a constant global and never change). * @param name The string name to use to encode/decode this member (must be a constant global and never change).
* @param member The struct member itself to be encoded. * @param member The struct member itself to be encoded.
* @param subtype The type of linked list member to add. * @param subtype The type of linked list member to add.
* *
skipping to change at line 1087 skipping to change at line 1238
* element that is in each member of the linked list to be stored. * element that is in each member of the linked list to be stored.
* *
* @since 1.0.0 * @since 1.0.0
*/ */
#define EET_DATA_DESCRIPTOR_ADD_LIST(edd, struct_type, name, member, subtyp e) \ #define EET_DATA_DESCRIPTOR_ADD_LIST(edd, struct_type, name, member, subtyp e) \
{ \ { \
struct_type ___ett; \ struct_type ___ett; \
\ \
eet_data_descriptor_element_add(edd, name, EET_T_UNKNOW, EET_G_LIST, \ eet_data_descriptor_element_add(edd, name, EET_T_UNKNOW, EET_G_LIST, \
(char *)(&(___ett.member)) - (char * )(&(___ett)), \ (char *)(&(___ett.member)) - (char * )(&(___ett)), \
0, NULL, subtype); \ 0, /* 0, */NULL, subtype); \
} }
/** /**
* Add a hash type to a data descriptor * Add a hash type to a data descriptor
* @param edd The data descriptor to add the type to. * @param edd The data descriptor to add the type to.
* @param struct_type The type of the struct. * @param struct_type The type of the struct.
* @param name The string name to use to encode/decode this member (must be a constant global and never change). * @param name The string name to use to encode/decode this member (must be a constant global and never change).
* @param member The struct member itself to be encoded. * @param member The struct member itself to be encoded.
* @param subtype The type of hash member to add. * @param subtype The type of hash member to add.
* *
skipping to change at line 1111 skipping to change at line 1262
* element that is in each member of the hash to be stored. * element that is in each member of the hash to be stored.
* *
* @since 1.0.0 * @since 1.0.0
*/ */
#define EET_DATA_DESCRIPTOR_ADD_HASH(edd, struct_type, name, member, subtyp e) \ #define EET_DATA_DESCRIPTOR_ADD_HASH(edd, struct_type, name, member, subtyp e) \
{ \ { \
struct_type ___ett; \ struct_type ___ett; \
\ \
eet_data_descriptor_element_add(edd, name, EET_T_UNKNOW, EET_G_HASH, \ eet_data_descriptor_element_add(edd, name, EET_T_UNKNOW, EET_G_HASH, \
(char *)(&(___ett.member)) - (char * )(&(___ett)), \ (char *)(&(___ett.member)) - (char * )(&(___ett)), \
0, NULL, subtype); \ 0, /* 0, */NULL, subtype); \
}
/**
* Add a fixed size array type to a data descriptor
* @param edd The data descriptor to add the type to.
* @param struct_type The type of the struct.
* @param name The string name to use to encode/decode this member (must
be a constant global and never change).
* @param member The struct member itself to be encoded.
* @param subtype The type of hash member to add.
*
* This macro lets you easily add a fixed size array of other data types
. All the
* parameters are the same as for EET_DATA_DESCRIPTOR_ADD_BASIC(), with
the
* @p subtype being the exception. This must be the data descriptor of t
he
* element that is in each member of the hash to be stored.
*
* @since 1.0.2
*/
#define EET_DATA_DESCRIPTOR_ADD_ARRAY(edd, struct_type, name, member, subty
pe) \
{ \
struct_type ___ett; \
\
eet_data_descriptor_element_add(edd, name, EET_T_UNKNOW, EET_G_ARRAY
, \
(char *)(&(___ett.member)) - (char *
)(&(___ett)), \
/* 0, */sizeof(___ett.member)/sizeo
f(___ett.member[0]), NULL, subtype); \
}
/**
* Add a variable size array type to a data descriptor
* @param edd The data descriptor to add the type to.
* @param struct_type The type of the struct.
* @param name The string name to use to encode/decode this member (must
be a constant global and never change).
* @param member The struct member itself to be encoded.
* @param subtype The type of hash member to add.
*
* This macro lets you easily add a fixed size array of other data types
. All the
* parameters are the same as for EET_DATA_DESCRIPTOR_ADD_BASIC(), with
the
* @p subtype being the exception. This must be the data descriptor of t
he
* element that is in each member of the hash to be stored.
*
* @since 1.0.2
*/
#define EET_DATA_DESCRIPTOR_ADD_VAR_ARRAY(edd, struct_type, name, member, s
ubtype) \
{ \
struct_type ___ett; \
\
eet_data_descriptor_element_add(edd, name, EET_T_UNKNOW, EET_G_VAR_A
RRAY, \
(char *)(&(___ett.member)) - (char *
)(&(___ett)), \
(char *)(&(___ett.member ## _count))
- (char *)(&(___ett)), /* 0, */NULL, subtype); \
} }
/************************************************************************** */ /************************************************************************** */
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif #endif
 End of changes. 12 change blocks. 
6 lines changed or deleted 252 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/