diff options
Diffstat (limited to '')
-rw-r--r-- | libraries/eet/src/lib/Eet_private.h | 135 |
1 files changed, 135 insertions, 0 deletions
diff --git a/libraries/eet/src/lib/Eet_private.h b/libraries/eet/src/lib/Eet_private.h index 83f4c18..c04daf0 100644 --- a/libraries/eet/src/lib/Eet_private.h +++ b/libraries/eet/src/lib/Eet_private.h | |||
@@ -66,6 +66,126 @@ struct _Eet_Node | |||
66 | Eet_Node_Data data; | 66 | Eet_Node_Data data; |
67 | }; | 67 | }; |
68 | 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 | |||
69 | /* | 189 | /* |
70 | * variable and macros used for the eina_log module | 190 | * variable and macros used for the eina_log module |
71 | */ | 191 | */ |
@@ -178,6 +298,21 @@ Eet_Node * | |||
178 | void | 298 | void |
179 | eet_node_free(Eet_Node *node); | 299 | eet_node_free(Eet_Node *node); |
180 | 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 | |||
181 | #ifndef PATH_MAX | 316 | #ifndef PATH_MAX |
182 | # define PATH_MAX 4096 | 317 | # define PATH_MAX 4096 |
183 | #endif /* ifndef PATH_MAX */ | 318 | #endif /* ifndef PATH_MAX */ |