Eet Data Serialization using A Ciphers
[Eet Data Serialization]
Most of the Eet Data Serialization have alternative versions that accounts for ciphers to protect their content.
More...Functions | |
EAPI void * | eet_data_read_cipher (Eet_File *ef, Eet_Data_Descriptor *edd, const char *name, const char *cipher_key) |
Read a data structure from an eet file and decodes it using a cipher. | |
EAPI void * | eet_data_xattr_cipher_get (const char *filename, const char *attribute, Eet_Data_Descriptor *edd, const char *cipher_key) |
Read a data structure from an eet extended attribute and decodes it using a cipher. | |
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) |
Write a data structure from memory and store in an eet file using a cipher. | |
EAPI Eina_Bool | eet_data_xattr_cipher_set (const char *filename, const char *attribute, Eet_Data_Descriptor *edd, const char *cipher_key, const void *data, Eina_Xattr_Flags flags) |
Write a data structure from memory and store in an eet extended attribute using a cipher. | |
EAPI int | eet_data_text_dump_cipher (const void *data_in, const char *cipher_key, int size_in, Eet_Dump_Callback dumpfunc, void *dumpdata) |
Dump an eet encoded data structure into ascii text using a cipher. | |
EAPI void * | eet_data_text_undump_cipher (const char *text, const char *cipher_key, int textlen, int *size_ret) |
Take an ascii encoding from eet_data_text_dump() and re-encode in binary using a cipher. | |
EAPI int | eet_data_dump_cipher (Eet_File *ef, const char *name, const char *cipher_key, Eet_Dump_Callback dumpfunc, void *dumpdata) |
Dump an eet encoded data structure from an eet file into ascii text using a cipher. | |
EAPI int | eet_data_undump_cipher (Eet_File *ef, const char *name, const char *cipher_key, const char *text, int textlen, int compress) |
Take an ascii encoding from eet_data_dump() and re-encode in binary using a cipher. | |
EAPI void * | eet_data_descriptor_decode_cipher (Eet_Data_Descriptor *edd, const void *data_in, const char *cipher_key, int size_in) |
Decode a data structure from an arbitrary location in memory using a cipher. | |
EAPI void * | eet_data_descriptor_encode_cipher (Eet_Data_Descriptor *edd, const void *data_in, const char *cipher_key, int *size_ret) |
Encode a data struct to memory and return that encoded data using a cipher. |
Detailed Description
Most of the Eet Data Serialization have alternative versions that accounts for ciphers to protect their content.
Function Documentation
EAPI void* eet_data_descriptor_decode_cipher | ( | Eet_Data_Descriptor * | edd, | |
const void * | data_in, | |||
const char * | cipher_key, | |||
int | size_in | |||
) |
Decode a data structure from an arbitrary location in memory using a cipher.
- Parameters:
-
edd The data descriptor to use when decoding. data_in The pointer to the data to decode into a struct. cipher_key The key to use as cipher. size_in The size of the data pointed to in bytes.
- Returns:
- NULL on failure, or a valid decoded struct pointer on success.
The data to be decoded is stored at the memory pointed to by data_in
, and is described by the descriptor pointed to by edd
. The data size is passed in as the value to size_in
, ande must be greater than 0 to succeed.
This function is useful for decoding data structures delivered to the application by means other than an eet file, such as an IPC or socket connection, raw files, shared memory etc.
Please see eet_data_read() for more information.
- See also:
- eet_data_descriptor_decode()
- Since:
- 1.0.0
Referenced by eet_data_descriptor_decode(), and eet_data_xattr_cipher_get().
EAPI void* eet_data_descriptor_encode_cipher | ( | Eet_Data_Descriptor * | edd, | |
const void * | data_in, | |||
const char * | cipher_key, | |||
int * | size_ret | |||
) |
Encode a data struct to memory and return that encoded data using a cipher.
- Parameters:
-
edd The data descriptor to use when encoding. data_in The pointer to the struct to encode into data. cipher_key The key to use as cipher. size_ret pointer to the an int to be filled with the decoded size.
- Returns:
- NULL on failure, or a valid encoded data chunk on success.
The parameter edd
must point to a valid data descriptor, and data_in
must point to the right data structure to encode. If not, the encoding may fail.
On success a non NULL valid pointer is returned and what size_ret
points to is set to the size of this decoded data, in bytes. When the encoded data is no longer needed, call free() on it. On failure NULL is returned and what size_ret
points to is set to 0.
Please see eet_data_write() for more information.
- See also:
- eet_data_descriptor_encode()
- Since:
- 1.0.0
Referenced by eet_connection_send(), eet_data_descriptor_encode(), and eet_data_xattr_cipher_set().
EAPI int eet_data_dump_cipher | ( | Eet_File * | ef, | |
const char * | name, | |||
const char * | cipher_key, | |||
Eet_Dump_Callback | dumpfunc, | |||
void * | dumpdata | |||
) |
Dump an eet encoded data structure from an eet file into ascii text using a cipher.
- Parameters:
-
ef A valid eet file handle. name Name of the entry. eg: "/base/file_i_want". cipher_key The key to use as cipher. dumpfunc The function to call passed a string when new data is converted to text dumpdata The data to pass to the dumpfunc
callback.
- Returns:
- 1 on success, 0 on failure
name
and convert it into human readable ascii text. It does this by calling the dumpfunc
callback for all new text that is generated. This callback should append to any existing text buffer and will be passed the pointer dumpdata
as a parameter as well as a string with new text to be appended.
- See also:
- eet_data_dump()
- Since:
- 1.0.0
References eet_dictionary_get(), eet_node_del(), eet_node_dump(), eet_read_cipher(), and eet_read_direct().
Referenced by eet_data_dump().
EAPI void* eet_data_read_cipher | ( | Eet_File * | ef, | |
Eet_Data_Descriptor * | edd, | |||
const char * | name, | |||
const char * | cipher_key | |||
) |
Read a data structure from an eet file and decodes it using a cipher.
- Parameters:
-
ef The eet file handle to read from. edd The data descriptor handle to use when decoding. name The key the data is stored under in the eet file. cipher_key The key to use as cipher.
- Returns:
- A pointer to the decoded data structure.
Once a data structure has been described by the programmer with the fields they wish to save or load, storing or retrieving a data structure from an eet file, or from a chunk of memory is as simple as a single function call.
- See also:
- eet_data_read()
- Since:
- 1.0.0
References eet_dictionary_get(), eet_read_cipher(), and eet_read_direct().
Referenced by eet_data_read().
EAPI int eet_data_text_dump_cipher | ( | const void * | data_in, | |
const char * | cipher_key, | |||
int | size_in, | |||
Eet_Dump_Callback | dumpfunc, | |||
void * | dumpdata | |||
) |
Dump an eet encoded data structure into ascii text using a cipher.
- Parameters:
-
data_in The pointer to the data to decode into a struct. cipher_key The key to use as cipher. size_in The size of the data pointed to in bytes. dumpfunc The function to call passed a string when new data is converted to text dumpdata The data to pass to the dumpfunc
callback.
- Returns:
- 1 on success, 0 on failure
dumpfunc
callback for all new text that is generated. This callback should append to any existing text buffer and will be passed the pointer dumpdata
as a parameter as well as a string with new text to be appended.Example:
void output(void *data, const char *string) { printf("%s", string); } void dump(const char *file) { FILE *f; int len; void *data; f = fopen(file, "r"); fseek(f, 0, SEEK_END); len = ftell(f); rewind(f); data = malloc(len); fread(data, len, 1, f); fclose(f); eet_data_text_dump_cipher(data, cipher_key, len, output, NULL); }
- See also:
- eet_data_text_dump()
- Since:
- 1.0.0
References eet_node_del(), and eet_node_dump().
Referenced by eet_data_text_dump().
EAPI void* eet_data_text_undump_cipher | ( | const char * | text, | |
const char * | cipher_key, | |||
int | textlen, | |||
int * | size_ret | |||
) |
Take an ascii encoding from eet_data_text_dump() and re-encode in binary using a cipher.
- Parameters:
-
text The pointer to the string data to parse and encode. cipher_key The key to use as cipher. textlen The size of the string in bytes (not including 0 byte terminator). size_ret This gets filled in with the encoded data blob size in bytes.
- Returns:
- The encoded data on success, NULL on failure.
text
and return an encoded data lump the same way eet_data_descriptor_encode() takes an in-memory data struct and encodes into a binary blob. text
is a normal C string.
- See also:
- eet_data_text_undump()
- Since:
- 1.0.0
Referenced by eet_data_text_undump().
EAPI int eet_data_undump_cipher | ( | Eet_File * | ef, | |
const char * | name, | |||
const char * | cipher_key, | |||
const char * | text, | |||
int | textlen, | |||
int | compress | |||
) |
Take an ascii encoding from eet_data_dump() and re-encode in binary using a cipher.
- Parameters:
-
ef A valid eet file handle. name Name of the entry. eg: "/base/file_i_want". cipher_key The key to use as cipher. text The pointer to the string data to parse and encode. textlen The size of the string in bytes (not including 0 byte terminator). compress Compression flags (1 == compress, 0 = don't compress).
- Returns:
- 1 on success, 0 on failure
text
, encode it the same way eet_data_descriptor_encode() takes an in-memory data struct and encodes into a binary blob.The data (optionally compressed) will be in ram, pending a flush to disk (it will stay in ram till the eet file handle is closed though).
- See also:
- eet_data_undump()
- Since:
- 1.0.0
References eet_dictionary_get(), and eet_write_cipher().
Referenced by eet_data_undump().
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 | |||
) |
Write a data structure from memory and store in an eet file using a cipher.
- Parameters:
-
ef The eet file handle to write to. edd The data descriptor to use when encoding. name The key to store the data under in the eet file. cipher_key The key to use as cipher. data A pointer to the data structure to ssave and encode. compress Compression flags for storage.
- Returns:
- bytes written on successful write, 0 on failure.
- Since:
- 1.0.0
References eet_dictionary_get(), and eet_write_cipher().
Referenced by eet_data_write().
EAPI void* eet_data_xattr_cipher_get | ( | const char * | filename, | |
const char * | attribute, | |||
Eet_Data_Descriptor * | edd, | |||
const char * | cipher_key | |||
) |
Read a data structure from an eet extended attribute and decodes it using a cipher.
- Parameters:
-
filename The file to extract the extended attribute from. attribute The attribute to get the data from. edd The data descriptor handle to use when decoding. cipher_key The key to use as cipher.
- Returns:
- A pointer to the decoded data structure.
Once a data structure has been described by the programmer with the fields they wish to save or load, storing or retrieving a data structure from an eet file, from a chunk of memory or from an extended attribute is as simple as a single function call.
- Since:
- 1.5.0
References eet_data_descriptor_decode_cipher().
EAPI Eina_Bool eet_data_xattr_cipher_set | ( | const char * | filename, | |
const char * | attribute, | |||
Eet_Data_Descriptor * | edd, | |||
const char * | cipher_key, | |||
const void * | data, | |||
Eina_Xattr_Flags | flags | |||
) |
Write a data structure from memory and store in an eet extended attribute using a cipher.
- Parameters:
-
filename The file to write the extended attribute to. attribute The attribute to store the data to. edd The data descriptor to use when encoding. cipher_key The key to use as cipher. data A pointer to the data structure to ssave and encode. flags The policy to use when setting the data.
- Returns:
- EINA_TRUE on success, EINA_FALSE on failure.
- Since:
- 1.5.0
References eet_data_descriptor_encode_cipher().