diff options
Diffstat (limited to 'libraries/eet/src/lib/Eet_private.h')
-rw-r--r-- | libraries/eet/src/lib/Eet_private.h | 326 |
1 files changed, 0 insertions, 326 deletions
diff --git a/libraries/eet/src/lib/Eet_private.h b/libraries/eet/src/lib/Eet_private.h deleted file mode 100644 index c04daf0..0000000 --- a/libraries/eet/src/lib/Eet_private.h +++ /dev/null | |||
@@ -1,326 +0,0 @@ | |||
1 | #ifndef _EET_PRIVATE_H | ||
2 | #define _EET_PRIVATE_H | ||
3 | |||
4 | #include <Eina.h> | ||
5 | |||
6 | typedef enum _Eet_Convert_Type Eet_Convert_Type; | ||
7 | |||
8 | enum _Eet_Convert_Type | ||
9 | { | ||
10 | EET_D_NOTHING = 0, | ||
11 | EET_D_FLOAT = 1 << 1, | ||
12 | EET_D_DOUBLE = 1 << 2, | ||
13 | EET_D_FIXED_POINT = 1 << 4 | ||
14 | }; | ||
15 | |||
16 | typedef struct _Eet_String Eet_String; | ||
17 | typedef struct _Eet_Convert Eet_Convert; | ||
18 | |||
19 | struct _Eet_Convert | ||
20 | { | ||
21 | float f; | ||
22 | double d; | ||
23 | Eina_F32p32 fp; | ||
24 | |||
25 | Eet_Convert_Type type; | ||
26 | }; | ||
27 | |||
28 | struct _Eet_String | ||
29 | { | ||
30 | const char *str; | ||
31 | |||
32 | int len; | ||
33 | |||
34 | int next; | ||
35 | int prev; | ||
36 | |||
37 | unsigned char hash; | ||
38 | unsigned char allocated : 1; | ||
39 | }; | ||
40 | struct _Eet_Dictionary | ||
41 | { | ||
42 | Eet_String *all; | ||
43 | Eina_Hash *converts; | ||
44 | |||
45 | int size; | ||
46 | int offset; | ||
47 | |||
48 | int hash[256]; | ||
49 | |||
50 | int count; | ||
51 | int total; | ||
52 | |||
53 | const char *start; | ||
54 | const char *end; | ||
55 | }; | ||
56 | |||
57 | struct _Eet_Node | ||
58 | { | ||
59 | int type; | ||
60 | int count; | ||
61 | const char *name; | ||
62 | const char *key; | ||
63 | Eet_Node *values; | ||
64 | Eet_Node *next; | ||
65 | Eet_Node *parent; | ||
66 | Eet_Node_Data data; | ||
67 | }; | ||
68 | |||
69 | typedef struct _Eet_File_Header Eet_File_Header; | ||
70 | typedef struct _Eet_File_Node Eet_File_Node; | ||
71 | typedef struct _Eet_File_Directory Eet_File_Directory; | ||
72 | |||
73 | struct _Eet_File | ||
74 | { | ||
75 | const char *path; | ||
76 | Eina_File *readfp; | ||
77 | Eet_File_Header *header; | ||
78 | Eet_Dictionary *ed; | ||
79 | Eet_Key *key; | ||
80 | const unsigned char *data; | ||
81 | const void *x509_der; | ||
82 | const void *signature; | ||
83 | void *sha1; | ||
84 | |||
85 | Eet_File_Mode mode; | ||
86 | |||
87 | int magic; | ||
88 | int references; | ||
89 | |||
90 | unsigned long int data_size; | ||
91 | int x509_length; | ||
92 | unsigned int signature_length; | ||
93 | int sha1_length; | ||
94 | |||
95 | Eina_Lock file_lock; | ||
96 | |||
97 | unsigned char writes_pending : 1; | ||
98 | unsigned char delete_me_now : 1; | ||
99 | }; | ||
100 | |||
101 | struct _Eet_File_Header | ||
102 | { | ||
103 | int magic; | ||
104 | Eet_File_Directory *directory; | ||
105 | }; | ||
106 | |||
107 | struct _Eet_File_Directory | ||
108 | { | ||
109 | int size; | ||
110 | Eet_File_Node **nodes; | ||
111 | }; | ||
112 | |||
113 | struct _Eet_File_Node | ||
114 | { | ||
115 | char *name; | ||
116 | void *data; | ||
117 | Eet_File_Node *next; /* FIXME: make buckets linked lists */ | ||
118 | |||
119 | unsigned long int offset; | ||
120 | unsigned long int dictionary_offset; | ||
121 | unsigned long int name_offset; | ||
122 | |||
123 | unsigned int name_size; | ||
124 | unsigned int size; | ||
125 | unsigned int data_size; | ||
126 | |||
127 | unsigned char free_name : 1; | ||
128 | unsigned char compression : 1; | ||
129 | unsigned char ciphered : 1; | ||
130 | unsigned char alias : 1; | ||
131 | }; | ||
132 | |||
133 | #if 0 | ||
134 | /* Version 2 */ | ||
135 | /* NB: all int's are stored in network byte order on disk */ | ||
136 | /* file format: */ | ||
137 | int magic; /* magic number ie 0x1ee7ff00 */ | ||
138 | int num_directory_entries; /* number of directory entries to follow */ | ||
139 | int bytes_directory_entries; /* bytes of directory entries to follow */ | ||
140 | struct | ||
141 | { | ||
142 | int offset; /* bytes offset into file for data chunk */ | ||
143 | int flags; /* flags - for now 0 = uncompressed and clear, 1 = compressed and clear, 2 = uncompressed and ciphered, 3 = compressed and ciphered */ | ||
144 | int size; /* size of the data chunk */ | ||
145 | int data_size; /* size of the (uncompressed) data chunk */ | ||
146 | int name_size; /* length in bytes of the name field */ | ||
147 | char name[name_size]; /* name string (variable length) and \0 terminated */ | ||
148 | } directory[num_directory_entries]; | ||
149 | /* and now startes the data stream... */ | ||
150 | #endif /* if 0 */ | ||
151 | |||
152 | #if 0 | ||
153 | /* Version 3 */ | ||
154 | /* NB: all int's are stored in network byte order on disk */ | ||
155 | /* file format: */ | ||
156 | int magic; /* magic number ie 0x1ee70f42 */ | ||
157 | int num_directory_entries; /* number of directory entries to follow */ | ||
158 | int num_dictionary_entries; /* number of dictionary entries to follow */ | ||
159 | struct | ||
160 | { | ||
161 | int data_offset; /* bytes offset into file for data chunk */ | ||
162 | int size; /* size of the data chunk */ | ||
163 | int data_size; /* size of the (uncompressed) data chunk */ | ||
164 | int name_offset; /* bytes offset into file for name string */ | ||
165 | int name_size; /* length in bytes of the name field */ | ||
166 | int flags; /* bit flags - for now: | ||
167 | bit 0 => compresion on/off | ||
168 | bit 1 => ciphered on/off | ||
169 | bit 2 => alias | ||
170 | */ | ||
171 | } directory[num_directory_entries]; | ||
172 | struct | ||
173 | { | ||
174 | int hash; | ||
175 | int offset; | ||
176 | int size; | ||
177 | int prev; | ||
178 | int next; | ||
179 | } dictionary[num_dictionary_entries]; | ||
180 | /* now start the string stream. */ | ||
181 | /* and right after them the data stream. */ | ||
182 | int magic_sign; /* Optional, only if the eet file is signed. */ | ||
183 | int signature_length; /* Signature length. */ | ||
184 | int x509_length; /* Public certificate that signed the file. */ | ||
185 | char signature[signature_length]; /* The signature. */ | ||
186 | char x509[x509_length]; /* The public certificate. */ | ||
187 | #endif /* if 0 */ | ||
188 | |||
189 | /* | ||
190 | * variable and macros used for the eina_log module | ||
191 | */ | ||
192 | extern int _eet_log_dom_global; | ||
193 | |||
194 | /* | ||
195 | * Macros that are used everywhere | ||
196 | * | ||
197 | * the first four macros are the general macros for the lib | ||
198 | */ | ||
199 | #ifdef EET_DEFAULT_LOG_COLOR | ||
200 | # undef EET_DEFAULT_LOG_COLOR | ||
201 | #endif /* ifdef EET_DEFAULT_LOG_COLOR */ | ||
202 | #define EET_DEFAULT_LOG_COLOR EINA_COLOR_CYAN | ||
203 | #ifdef ERR | ||
204 | # undef ERR | ||
205 | #endif /* ifdef ERR */ | ||
206 | #define ERR(...) EINA_LOG_DOM_ERR(_eet_log_dom_global, __VA_ARGS__) | ||
207 | #ifdef DBG | ||
208 | # undef DBG | ||
209 | #endif /* ifdef DBG */ | ||
210 | #define DBG(...) EINA_LOG_DOM_DBG(_eet_log_dom_global, __VA_ARGS__) | ||
211 | #ifdef INF | ||
212 | # undef INF | ||
213 | #endif /* ifdef INF */ | ||
214 | #define INF(...) EINA_LOG_DOM_INFO(_eet_log_dom_global, __VA_ARGS__) | ||
215 | #ifdef WRN | ||
216 | # undef WRN | ||
217 | #endif /* ifdef WRN */ | ||
218 | #define WRN(...) EINA_LOG_DOM_WARN(_eet_log_dom_global, __VA_ARGS__) | ||
219 | #ifdef CRIT | ||
220 | # undef CRIT | ||
221 | #endif /* ifdef CRIT */ | ||
222 | #define CRIT(...) EINA_LOG_DOM_CRIT(_eet_log_dom_global, __VA_ARGS__) | ||
223 | |||
224 | Eet_Dictionary * | ||
225 | eet_dictionary_add(void); | ||
226 | void | ||
227 | eet_dictionary_free(Eet_Dictionary *ed); | ||
228 | int | ||
229 | eet_dictionary_string_add(Eet_Dictionary *ed, | ||
230 | const char *string); | ||
231 | int | ||
232 | eet_dictionary_string_get_size(const Eet_Dictionary *ed, | ||
233 | int index); | ||
234 | const char * | ||
235 | eet_dictionary_string_get_char(const Eet_Dictionary *ed, | ||
236 | int index); | ||
237 | Eina_Bool | ||
238 | eet_dictionary_string_get_float(const Eet_Dictionary *ed, | ||
239 | int index, | ||
240 | float *result); | ||
241 | Eina_Bool | ||
242 | eet_dictionary_string_get_double(const Eet_Dictionary *ed, | ||
243 | int index, | ||
244 | double *result); | ||
245 | Eina_Bool | ||
246 | eet_dictionary_string_get_fp(const Eet_Dictionary *ed, | ||
247 | int index, | ||
248 | Eina_F32p32 *result); | ||
249 | int | ||
250 | eet_dictionary_string_get_hash(const Eet_Dictionary *ed, | ||
251 | int index); | ||
252 | |||
253 | int _eet_hash_gen(const char *key, | ||
254 | int hash_size); | ||
255 | |||
256 | const void * | ||
257 | eet_identity_check(const void *data_base, | ||
258 | unsigned int data_length, | ||
259 | void **sha1, | ||
260 | int *sha1_length, | ||
261 | const void *signature_base, | ||
262 | unsigned int signature_length, | ||
263 | const void **raw_signature_base, | ||
264 | unsigned int *raw_signature_length, | ||
265 | int *x509_length); | ||
266 | void * | ||
267 | eet_identity_compute_sha1(const void *data_base, | ||
268 | unsigned int data_length, | ||
269 | int *sha1_length); | ||
270 | Eet_Error | ||
271 | eet_cipher(const void *data, | ||
272 | unsigned int size, | ||
273 | const char *key, | ||
274 | unsigned int length, | ||
275 | void **result, | ||
276 | unsigned int *result_length); | ||
277 | Eet_Error | ||
278 | eet_decipher(const void *data, | ||
279 | unsigned int size, | ||
280 | const char *key, | ||
281 | unsigned int length, | ||
282 | void **result, | ||
283 | unsigned int *result_length); | ||
284 | Eet_Error | ||
285 | eet_identity_sign(FILE *fp, | ||
286 | Eet_Key *key); | ||
287 | void | ||
288 | eet_identity_unref(Eet_Key *key); | ||
289 | void | ||
290 | eet_identity_ref(Eet_Key *key); | ||
291 | |||
292 | void | ||
293 | eet_node_shutdown(void); | ||
294 | int | ||
295 | eet_node_init(void); | ||
296 | Eet_Node * | ||
297 | eet_node_new(void); | ||
298 | void | ||
299 | eet_node_free(Eet_Node *node); | ||
300 | |||
301 | |||
302 | #define GENERIC_ALLOC_FREE_HEADER(TYPE, Type) \ | ||
303 | TYPE *Type##_malloc(unsigned int); \ | ||
304 | TYPE *Type##_calloc(unsigned int); \ | ||
305 | void Type##_mp_free(TYPE *e); | ||
306 | |||
307 | GENERIC_ALLOC_FREE_HEADER(Eet_File_Directory, eet_file_directory); | ||
308 | GENERIC_ALLOC_FREE_HEADER(Eet_File_Node, eet_file_node); | ||
309 | GENERIC_ALLOC_FREE_HEADER(Eet_File_Header, eet_file_header); | ||
310 | GENERIC_ALLOC_FREE_HEADER(Eet_Dictionary, eet_dictionary); | ||
311 | GENERIC_ALLOC_FREE_HEADER(Eet_File, eet_file); | ||
312 | |||
313 | Eina_Bool eet_mempool_init(void); | ||
314 | void eet_mempool_shutdown(void); | ||
315 | |||
316 | #ifndef PATH_MAX | ||
317 | # define PATH_MAX 4096 | ||
318 | #endif /* ifndef PATH_MAX */ | ||
319 | |||
320 | #ifdef DNDEBUG | ||
321 | # define EET_ASSERT(Test, Do) if (Test == 0) {Do; } | ||
322 | #else /* ifdef DNDEBUG */ | ||
323 | # define EET_ASSERT(Test, Do) if (Test == 0) {abort(); } | ||
324 | #endif /* ifdef DNDEBUG */ | ||
325 | |||
326 | #endif /* ifndef _EET_PRIVATE_H */ | ||