Mercurial > libpst
annotate src/libpst.h @ 41:183ae993b9ad
security fix for potential buffer overrun in lz decompress
author | carl |
---|---|
date | Tue, 02 Oct 2007 15:49:44 -0700 |
parents | 2ad7ef0a3c4f |
children | f6db1f060a95 |
rev | line source |
---|---|
16 | 1 /*** |
2 * libpst.h | |
3 * Part of LibPST project | |
4 * Written by David Smith | |
5 * dave.s@earthcorp.com | |
6 */ | |
7 // LibPST - Library for Accessing Outlook .pst files | |
8 // Dave Smith - davesmith@users.sourceforge.net | |
9 | |
10 #ifndef LIBPST_H | |
11 #define LIBPST_H | |
12 | |
13 #ifndef _MSC_VER | |
14 | |
15 #ifndef FILETIME_DEFINED | |
16 #define FILETIME_DEFINED | |
17 //Win32 Filetime struct - copied from WINE | |
18 typedef struct { | |
19 u_int32_t dwLowDateTime; | |
20 u_int32_t dwHighDateTime; | |
21 } FILETIME; | |
22 #endif //ifndef FILETIME_DEFINED | |
23 #endif //ifndef _MSC_VER | |
24 | |
25 // define the INT32_MAX here cause it isn't normally defined | |
26 #ifndef INT32_MAX | |
27 # define INT32_MAX INT_MAX | |
28 #endif | |
29 | |
30 // According to Jan Wolter, sys/param.h is the most portable source of endian | |
31 // information on UNIX systems. see http://www.unixpapa.com/incnote/byteorder.html | |
32 #ifdef _MSC_VER | |
33 #define BYTE_ORDER LITTLE_ENDIAN | |
34 #else | |
35 #include <sys/param.h> | |
36 #endif // defined _MSC_VER | |
37 | |
38 #if BYTE_ORDER == BIG_ENDIAN | |
39 # define LE64_CPU(x) \ | |
40 x = ((((x) & 0xff00000000000000) >> 56) | \ | |
41 (((x) & 0x00ff000000000000) >> 40) | \ | |
42 (((x) & 0x0000ff0000000000) >> 24) | \ | |
43 (((x) & 0x000000ff00000000) >> 8 ) | \ | |
44 (((x) & 0x00000000ff000000) << 8 ) | \ | |
45 (((x) & 0x0000000000ff0000) << 24) | \ | |
46 (((x) & 0x000000000000ff00) << 40) | \ | |
47 (((x) & 0x00000000000000ff) << 56)); | |
48 # define LE32_CPU(x) \ | |
49 x = ((((x) & 0xff000000) >> 24) | \ | |
50 (((x) & 0x00ff0000) >> 8 ) | \ | |
51 (((x) & 0x0000ff00) << 8 ) | \ | |
52 (((x) & 0x000000ff) << 24)); | |
53 # define LE16_CPU(x) \ | |
54 x = ((((x) & 0xff00) >> 8) | \ | |
55 (((x) & 0x00ff) << 8)); | |
56 #elif BYTE_ORDER == LITTLE_ENDIAN | |
57 # define LE64_CPU(x) {} | |
58 # define LE32_CPU(x) {} | |
59 # define LE16_CPU(x) {} | |
60 #else | |
61 # error "Byte order not supported by this library" | |
62 #endif // BYTE_ORDER | |
63 | |
64 | |
65 #ifdef _MSC_VER | |
66 #include "windows.h" | |
67 #define int32_t int | |
68 #define u_int32_t unsigned int | |
69 #define int16_t short int | |
70 #define u_int16_t unsigned short int | |
71 #endif // _MSC_VER | |
72 | |
73 #define PST_TYPE_NOTE 1 | |
74 #define PST_TYPE_APPOINTMENT 8 | |
75 #define PST_TYPE_CONTACT 9 | |
76 #define PST_TYPE_JOURNAL 10 | |
77 #define PST_TYPE_STICKYNOTE 11 | |
78 #define PST_TYPE_TASK 12 | |
79 #define PST_TYPE_OTHER 13 | |
80 #define PST_TYPE_REPORT 14 | |
81 | |
82 // defines whether decryption is done on this bit of data | |
83 #define PST_NO_ENC 0 | |
84 #define PST_ENC 1 | |
85 | |
86 // defines types of possible encryption | |
87 #define PST_NO_ENCRYPT 0 | |
88 #define PST_COMP_ENCRYPT 1 | |
89 #define PST_ENCRYPT 2 | |
90 | |
91 // defines different types of mappings | |
92 #define PST_MAP_ATTRIB 1 | |
93 #define PST_MAP_HEADER 2 | |
94 | |
95 // define my custom email attributes. | |
96 #define PST_ATTRIB_HEADER -1 | |
97 | |
98 // defines types of free/busy values for appointment->showas | |
99 #define PST_FREEBUSY_FREE 0 | |
100 #define PST_FREEBUSY_TENTATIVE 1 | |
101 #define PST_FREEBUSY_BUSY 2 | |
102 #define PST_FREEBUSY_OUT_OF_OFFICE 3 | |
103 | |
104 // defines labels for appointment->label | |
105 #define PST_APP_LABEL_NONE 0 // None | |
106 #define PST_APP_LABEL_IMPORTANT 1 // Important | |
107 #define PST_APP_LABEL_BUSINESS 2 // Business | |
108 #define PST_APP_LABEL_PERSONAL 3 // Personal | |
109 #define PST_APP_LABEL_VACATION 4 // Vacation | |
110 #define PST_APP_LABEL_MUST_ATTEND 5 // Must Attend | |
111 #define PST_APP_LABEL_TRAVEL_REQ 6 // Travel Required | |
112 #define PST_APP_LABEL_NEEDS_PREP 7 // Needs Preparation | |
113 #define PST_APP_LABEL_BIRTHDAY 8 // Birthday | |
114 #define PST_APP_LABEL_ANNIVERSARY 9 // Anniversary | |
115 #define PST_APP_LABEL_PHONE_CALL 10// Phone Call | |
116 | |
117 typedef struct _pst_misc_6_struct { | |
118 int32_t i1; | |
119 int32_t i2; | |
120 int32_t i3; | |
121 int32_t i4; | |
122 int32_t i5; | |
123 int32_t i6; | |
124 } pst_misc_6; | |
125 | |
126 typedef struct _pst_entryid_struct { | |
127 int32_t u1; | |
128 char entryid[16]; | |
35 | 129 u_int32_t id; |
16 | 130 } pst_entryid; |
131 | |
132 typedef struct _pst_desc_struct { | |
133 u_int32_t d_id; | |
134 u_int32_t desc_id; | |
135 u_int32_t list_id; | |
136 u_int32_t parent_id; | |
137 } pst_desc; | |
138 | |
139 typedef struct _pst_index_struct{ | |
140 u_int32_t id; | |
141 int32_t offset; | |
142 u_int16_t size; | |
143 int16_t u1; | |
144 } pst_index; | |
145 | |
146 typedef struct _pst_index_tree { | |
147 u_int32_t id; | |
148 int32_t offset; | |
149 size_t size; | |
150 int32_t u1; | |
151 struct _pst_index_tree * next; | |
152 } pst_index_ll; | |
153 | |
154 typedef struct _pst_index2_tree { | |
35 | 155 u_int32_t id2; |
16 | 156 pst_index_ll *id; |
157 struct _pst_index2_tree * next; | |
158 } pst_index2_ll; | |
159 | |
160 typedef struct _pst_desc_tree { | |
161 u_int32_t id; | |
162 pst_index_ll * list_index; | |
163 pst_index_ll * desc; | |
164 int32_t no_child; | |
165 struct _pst_desc_tree * prev; | |
166 struct _pst_desc_tree * next; | |
167 struct _pst_desc_tree * parent; | |
168 struct _pst_desc_tree * child; | |
169 struct _pst_desc_tree * child_tail; | |
170 } pst_desc_ll; | |
171 | |
172 typedef struct _pst_item_email_subject { | |
173 int32_t off1; | |
174 int32_t off2; | |
175 char *subj; | |
176 } pst_item_email_subject; | |
177 | |
178 typedef struct _pst_item_email { | |
179 FILETIME *arrival_date; | |
41
183ae993b9ad
security fix for potential buffer overrun in lz decompress
carl
parents:
39
diff
changeset
|
180 int32_t autoforward; // 1 = true, 0 = not set, -1 = false |
183ae993b9ad
security fix for potential buffer overrun in lz decompress
carl
parents:
39
diff
changeset
|
181 char *body; |
183ae993b9ad
security fix for potential buffer overrun in lz decompress
carl
parents:
39
diff
changeset
|
182 char *cc_address; |
183ae993b9ad
security fix for potential buffer overrun in lz decompress
carl
parents:
39
diff
changeset
|
183 char *common_name; |
183ae993b9ad
security fix for potential buffer overrun in lz decompress
carl
parents:
39
diff
changeset
|
184 int32_t conv_index; |
183ae993b9ad
security fix for potential buffer overrun in lz decompress
carl
parents:
39
diff
changeset
|
185 int32_t conversion_prohib; |
183ae993b9ad
security fix for potential buffer overrun in lz decompress
carl
parents:
39
diff
changeset
|
186 int32_t delete_after_submit; // 1 = true, 0 = false |
183ae993b9ad
security fix for potential buffer overrun in lz decompress
carl
parents:
39
diff
changeset
|
187 int32_t delivery_report; // 1 = true, 0 = false |
183ae993b9ad
security fix for potential buffer overrun in lz decompress
carl
parents:
39
diff
changeset
|
188 char *encrypted_body; |
183ae993b9ad
security fix for potential buffer overrun in lz decompress
carl
parents:
39
diff
changeset
|
189 int32_t encrypted_body_size; |
183ae993b9ad
security fix for potential buffer overrun in lz decompress
carl
parents:
39
diff
changeset
|
190 char *encrypted_htmlbody; |
183ae993b9ad
security fix for potential buffer overrun in lz decompress
carl
parents:
39
diff
changeset
|
191 int32_t encrypted_htmlbody_size; |
183ae993b9ad
security fix for potential buffer overrun in lz decompress
carl
parents:
39
diff
changeset
|
192 int32_t flag; |
183ae993b9ad
security fix for potential buffer overrun in lz decompress
carl
parents:
39
diff
changeset
|
193 char *header; |
183ae993b9ad
security fix for potential buffer overrun in lz decompress
carl
parents:
39
diff
changeset
|
194 char *htmlbody; |
183ae993b9ad
security fix for potential buffer overrun in lz decompress
carl
parents:
39
diff
changeset
|
195 int32_t importance; |
183ae993b9ad
security fix for potential buffer overrun in lz decompress
carl
parents:
39
diff
changeset
|
196 char *in_reply_to; |
183ae993b9ad
security fix for potential buffer overrun in lz decompress
carl
parents:
39
diff
changeset
|
197 int32_t message_cc_me; // 1 = true, 0 = false |
183ae993b9ad
security fix for potential buffer overrun in lz decompress
carl
parents:
39
diff
changeset
|
198 int32_t message_recip_me; // 1 = true, 0 = false |
183ae993b9ad
security fix for potential buffer overrun in lz decompress
carl
parents:
39
diff
changeset
|
199 int32_t message_to_me; // 1 = true, 0 = false |
183ae993b9ad
security fix for potential buffer overrun in lz decompress
carl
parents:
39
diff
changeset
|
200 char *messageid; |
183ae993b9ad
security fix for potential buffer overrun in lz decompress
carl
parents:
39
diff
changeset
|
201 int32_t orig_sensitivity; |
183ae993b9ad
security fix for potential buffer overrun in lz decompress
carl
parents:
39
diff
changeset
|
202 char *outlook_recipient; |
183ae993b9ad
security fix for potential buffer overrun in lz decompress
carl
parents:
39
diff
changeset
|
203 char *outlook_recipient2; |
183ae993b9ad
security fix for potential buffer overrun in lz decompress
carl
parents:
39
diff
changeset
|
204 char *outlook_sender; |
183ae993b9ad
security fix for potential buffer overrun in lz decompress
carl
parents:
39
diff
changeset
|
205 char *outlook_sender_name; |
183ae993b9ad
security fix for potential buffer overrun in lz decompress
carl
parents:
39
diff
changeset
|
206 char *outlook_sender2; |
183ae993b9ad
security fix for potential buffer overrun in lz decompress
carl
parents:
39
diff
changeset
|
207 int32_t priority; |
183ae993b9ad
security fix for potential buffer overrun in lz decompress
carl
parents:
39
diff
changeset
|
208 char *proc_subject; |
183ae993b9ad
security fix for potential buffer overrun in lz decompress
carl
parents:
39
diff
changeset
|
209 int32_t read_receipt; |
183ae993b9ad
security fix for potential buffer overrun in lz decompress
carl
parents:
39
diff
changeset
|
210 char *recip_access; |
183ae993b9ad
security fix for potential buffer overrun in lz decompress
carl
parents:
39
diff
changeset
|
211 char *recip_address; |
183ae993b9ad
security fix for potential buffer overrun in lz decompress
carl
parents:
39
diff
changeset
|
212 char *recip2_access; |
183ae993b9ad
security fix for potential buffer overrun in lz decompress
carl
parents:
39
diff
changeset
|
213 char *recip2_address; |
183ae993b9ad
security fix for potential buffer overrun in lz decompress
carl
parents:
39
diff
changeset
|
214 int32_t reply_requested; |
183ae993b9ad
security fix for potential buffer overrun in lz decompress
carl
parents:
39
diff
changeset
|
215 char *reply_to; |
183ae993b9ad
security fix for potential buffer overrun in lz decompress
carl
parents:
39
diff
changeset
|
216 char *return_path_address; |
183ae993b9ad
security fix for potential buffer overrun in lz decompress
carl
parents:
39
diff
changeset
|
217 int32_t rtf_body_char_count; |
183ae993b9ad
security fix for potential buffer overrun in lz decompress
carl
parents:
39
diff
changeset
|
218 int32_t rtf_body_crc; |
183ae993b9ad
security fix for potential buffer overrun in lz decompress
carl
parents:
39
diff
changeset
|
219 char *rtf_body_tag; |
183ae993b9ad
security fix for potential buffer overrun in lz decompress
carl
parents:
39
diff
changeset
|
220 char *rtf_compressed; |
183ae993b9ad
security fix for potential buffer overrun in lz decompress
carl
parents:
39
diff
changeset
|
221 u_int32_t rtf_compressed_size; |
183ae993b9ad
security fix for potential buffer overrun in lz decompress
carl
parents:
39
diff
changeset
|
222 int32_t rtf_in_sync; // 1 = true, 0 = doesn't exist, -1 = false |
183ae993b9ad
security fix for potential buffer overrun in lz decompress
carl
parents:
39
diff
changeset
|
223 int32_t rtf_ws_prefix_count; |
183ae993b9ad
security fix for potential buffer overrun in lz decompress
carl
parents:
39
diff
changeset
|
224 int32_t rtf_ws_trailing_count; |
183ae993b9ad
security fix for potential buffer overrun in lz decompress
carl
parents:
39
diff
changeset
|
225 char *sender_access; |
183ae993b9ad
security fix for potential buffer overrun in lz decompress
carl
parents:
39
diff
changeset
|
226 char *sender_address; |
183ae993b9ad
security fix for potential buffer overrun in lz decompress
carl
parents:
39
diff
changeset
|
227 char *sender2_access; |
183ae993b9ad
security fix for potential buffer overrun in lz decompress
carl
parents:
39
diff
changeset
|
228 char *sender2_address; |
183ae993b9ad
security fix for potential buffer overrun in lz decompress
carl
parents:
39
diff
changeset
|
229 int32_t sensitivity; |
16 | 230 FILETIME *sent_date; |
231 pst_entryid *sentmail_folder; | |
41
183ae993b9ad
security fix for potential buffer overrun in lz decompress
carl
parents:
39
diff
changeset
|
232 char *sentto_address; |
16 | 233 pst_item_email_subject *subject; |
234 } pst_item_email; | |
235 | |
236 typedef struct _pst_item_folder { | |
237 int32_t email_count; | |
238 int32_t unseen_email_count; | |
239 int32_t assoc_count; | |
240 char subfolder; | |
241 } pst_item_folder; | |
242 | |
243 typedef struct _pst_item_message_store { | |
244 pst_entryid *deleted_items_folder; | |
245 pst_entryid *search_root_folder; | |
246 pst_entryid *top_of_personal_folder; | |
247 pst_entryid *top_of_folder; | |
248 int32_t valid_mask; // what folders the message store contains | |
249 int32_t pwd_chksum; | |
250 } pst_item_message_store; | |
251 | |
252 typedef struct _pst_item_contact { | |
253 char *access_method; | |
254 char *account_name; | |
255 char *address1; | |
256 char *address1a; | |
257 char *address1_desc; | |
258 char *address1_transport; | |
259 char *address2; | |
260 char *address2a; | |
261 char *address2_desc; | |
262 char *address2_transport; | |
263 char *address3; | |
264 char *address3a; | |
265 char *address3_desc; | |
266 char *address3_transport; | |
267 char *assistant_name; | |
268 char *assistant_phone; | |
269 char *billing_information; | |
270 FILETIME *birthday; | |
271 char *business_address; | |
272 char *business_city; | |
273 char *business_country; | |
274 char *business_fax; | |
275 char *business_homepage; | |
276 char *business_phone; | |
277 char *business_phone2; | |
278 char *business_po_box; | |
279 char *business_postal_code; | |
280 char *business_state; | |
281 char *business_street; | |
282 char *callback_phone; | |
283 char *car_phone; | |
284 char *company_main_phone; | |
285 char *company_name; | |
286 char *computer_name; | |
287 char *customer_id; | |
288 char *def_postal_address; | |
289 char *department; | |
290 char *display_name_prefix; | |
291 char *first_name; | |
292 char *followup; | |
293 char *free_busy_address; | |
294 char *ftp_site; | |
295 char *fullname; | |
296 int32_t gender; | |
297 char *gov_id; | |
298 char *hobbies; | |
299 char *home_address; | |
300 char *home_city; | |
301 char *home_country; | |
302 char *home_fax; | |
303 char *home_phone; | |
304 char *home_phone2; | |
305 char *home_po_box; | |
306 char *home_postal_code; | |
307 char *home_state; | |
308 char *home_street; | |
309 char *initials; | |
310 char *isdn_phone; | |
311 char *job_title; | |
312 char *keyword; | |
313 char *language; | |
314 char *location; | |
315 int32_t mail_permission; | |
316 char *manager_name; | |
317 char *middle_name; | |
318 char *mileage; | |
319 char *mobile_phone; | |
320 char *nickname; | |
321 char *office_loc; | |
322 char *org_id; | |
323 char *other_address; | |
324 char *other_city; | |
325 char *other_country; | |
326 char *other_phone; | |
327 char *other_po_box; | |
328 char *other_postal_code; | |
329 char *other_state; | |
330 char *other_street; | |
331 char *pager_phone; | |
332 char *personal_homepage; | |
333 char *pref_name; | |
334 char *primary_fax; | |
335 char *primary_phone; | |
336 char *profession; | |
337 char *radio_phone; | |
338 int32_t rich_text; | |
339 char *spouse_name; | |
340 char *suffix; | |
341 char *surname; | |
342 char *telex; | |
343 char *transmittable_display_name; | |
344 char *ttytdd_phone; | |
345 FILETIME *wedding_anniversary; | |
346 } pst_item_contact; | |
347 | |
348 typedef struct _pst_item_attach { | |
349 char *filename1; | |
350 char *filename2; | |
351 char *mimetype; | |
352 char *data; | |
36 | 353 size_t size; |
16 | 354 int32_t id2_val; |
355 int32_t id_val; // calculated from id2_val during creation of record | |
356 int32_t method; | |
357 int32_t position; | |
358 int32_t sequence; | |
359 struct _pst_item_attach *next; | |
360 } pst_item_attach; | |
361 | |
362 typedef struct _pst_item_extra_field { | |
363 char *field_name; | |
364 char *value; | |
365 struct _pst_item_extra_field *next; | |
366 } pst_item_extra_field; | |
367 | |
368 typedef struct _pst_item_journal { | |
369 FILETIME *end; | |
370 FILETIME *start; | |
371 char *type; | |
372 } pst_item_journal; | |
373 | |
374 typedef struct _pst_item_appointment { | |
375 FILETIME *end; | |
376 char *location; | |
377 FILETIME *reminder; | |
378 FILETIME *start; | |
379 char *timezonestring; | |
380 int32_t showas; | |
381 int32_t label; | |
31 | 382 int32_t all_day; |
16 | 383 } pst_item_appointment; |
384 | |
385 typedef struct _pst_item { | |
386 struct _pst_item_email *email; // data reffering to email | |
387 struct _pst_item_folder *folder; // data reffering to folder | |
388 struct _pst_item_contact *contact; // data reffering to contact | |
389 struct _pst_item_attach *attach; // linked list of attachments | |
390 struct _pst_item_message_store * message_store; // data referring to the message store | |
391 struct _pst_item_extra_field *extra_fields; // linked list of extra headers and such | |
392 struct _pst_item_journal *journal; // data reffering to a journal entry | |
393 struct _pst_item_appointment *appointment; // data reffering to a calendar entry | |
394 int32_t type; | |
395 char *ascii_type; | |
396 char *file_as; | |
397 char *comment; | |
398 int32_t message_size; | |
399 char *outlook_version; | |
400 char *record_key; // probably 16 bytes long. | |
401 size_t record_key_size; | |
402 int32_t response_requested; | |
403 FILETIME *create_date; | |
404 FILETIME *modify_date; | |
405 int32_t private_member; | |
406 } pst_item; | |
407 | |
408 typedef struct _pst_x_attrib_ll { | |
409 int32_t type; | |
410 int32_t mytype; | |
411 int32_t map; | |
412 void *data; | |
413 struct _pst_x_attrib_ll *next; | |
414 } pst_x_attrib_ll; | |
415 | |
416 typedef struct _pst_file { | |
417 pst_index_ll *i_head, *i_tail; | |
418 pst_index2_ll *i2_head; | |
419 pst_desc_ll *d_head, *d_tail; | |
420 pst_x_attrib_ll *x_head; | |
421 int32_t index1; | |
422 int32_t index1_count; | |
423 int32_t index2; | |
424 int32_t index2_count; | |
31 | 425 FILE * fp; // file pointer to opened PST file |
426 size_t size; // pst file size | |
427 unsigned char encryption; // pst encryption setting | |
428 unsigned char ind_type; // pst index type | |
16 | 429 } pst_file; |
430 | |
431 typedef struct _pst_block_offset { | |
432 int16_t from; | |
433 int16_t to; | |
434 } pst_block_offset; | |
435 | |
35 | 436 typedef struct _pst_block_offset_pointer { |
437 unsigned char *from; | |
438 unsigned char *to; | |
439 int needfree; | |
440 } pst_block_offset_pointer; | |
441 | |
16 | 442 struct _pst_num_item { |
35 | 443 u_int32_t id; |
16 | 444 unsigned char *data; |
445 int32_t type; | |
446 size_t size; | |
447 char *extra; | |
448 }; | |
449 | |
450 typedef struct _pst_num_array { | |
451 int32_t count_item; | |
39 | 452 int32_t orig_count; |
16 | 453 int32_t count_array; |
454 struct _pst_num_item ** items; | |
455 struct _pst_num_array *next; | |
456 } pst_num_array; | |
457 | |
458 struct holder { | |
459 unsigned char **buf; | |
460 FILE * fp; | |
461 int32_t base64; | |
462 char base64_extra_chars[3]; | |
463 int32_t base64_extra; | |
464 }; | |
465 | |
466 // prototypes | |
467 int32_t pst_open(pst_file *pf, char *name, char *mode); | |
468 int32_t pst_close(pst_file *pf); | |
469 pst_desc_ll * pst_getTopOfFolders(pst_file *pf, pst_item *root); | |
470 int32_t pst_attach_to_mem(pst_file *pf, pst_item_attach *attach, unsigned char **b); | |
471 int32_t pst_attach_to_file(pst_file *pf, pst_item_attach *attach, FILE* fp); | |
472 int32_t pst_attach_to_file_base64(pst_file *pf, pst_item_attach *attach, FILE* fp); | |
473 int32_t pst_load_index (pst_file *pf); | |
474 pst_desc_ll* pst_getNextDptr(pst_desc_ll* d); | |
475 int32_t pst_load_extended_attributes(pst_file *pf); | |
476 | |
34
07177825c91b
fix signed/unsigned to allow very small pst files with only leaf nodes
carl
parents:
31
diff
changeset
|
477 int32_t _pst_build_id_ptr(pst_file *pf, int32_t offset, int32_t depth, int32_t linku1, u_int32_t start_val, u_int32_t end_val); |
35 | 478 int32_t _pst_build_desc_ptr (pst_file *pf, int32_t offset, int32_t depth, int32_t linku1, u_int32_t *high_id, u_int32_t start_id, u_int32_t end_val); |
16 | 479 pst_item* _pst_getItem(pst_file *pf, pst_desc_ll *d_ptr); |
480 void * _pst_parse_item (pst_file *pf, pst_desc_ll *d_ptr); | |
481 pst_num_array * _pst_parse_block(pst_file *pf, u_int32_t block_id, pst_index2_ll *i2_head); | |
39 | 482 int32_t _pst_process(pst_num_array *list, pst_item *item, pst_item_attach *attach); |
16 | 483 int32_t _pst_free_list(pst_num_array *list); |
484 void _pst_freeItem(pst_item *item); | |
485 int32_t _pst_free_id2(pst_index2_ll * head); | |
486 int32_t _pst_free_id (pst_index_ll *head); | |
487 int32_t _pst_free_desc (pst_desc_ll *head); | |
488 int32_t _pst_free_xattrib(pst_x_attrib_ll *x); | |
35 | 489 int32_t _pst_getBlockOffsetPointer(pst_file *pf, pst_index2_ll *i2_head, unsigned char *buf, int32_t read_size, int32_t i_offset, int32_t offset, pst_block_offset_pointer *p); |
31 | 490 int32_t _pst_getBlockOffset(unsigned char *buf, int32_t read_size, int32_t i_offset, int32_t offset, pst_block_offset *p); |
16 | 491 pst_index2_ll * _pst_build_id2(pst_file *pf, pst_index_ll* list, pst_index2_ll* head_ptr); |
492 pst_index_ll * _pst_getID(pst_file* pf, u_int32_t id); | |
493 pst_index_ll * _pst_getID2(pst_index2_ll * ptr, u_int32_t id); | |
494 pst_desc_ll * _pst_getDptr(pst_file *pf, u_int32_t id); | |
495 size_t _pst_read_block_size(pst_file *pf, int32_t offset, size_t size, char ** buf, int32_t do_enc, | |
496 unsigned char is_index); | |
497 int32_t _pst_decrypt(unsigned char *buf, size_t size, int32_t type); | |
498 int32_t _pst_getAtPos(FILE *fp, int32_t pos, void* buf, u_int32_t size); | |
499 int32_t _pst_get (FILE *fp, void *buf, u_int32_t size); | |
500 size_t _pst_ff_getIDblock_dec(pst_file *pf, u_int32_t id, unsigned char **b); | |
501 size_t _pst_ff_getIDblock(pst_file *pf, u_int32_t id, unsigned char** b); | |
502 size_t _pst_ff_getID2block(pst_file *pf, u_int32_t id2, pst_index2_ll *id2_head, unsigned char** buf); | |
503 size_t _pst_ff_getID2data(pst_file *pf, pst_index_ll *ptr, struct holder *h); | |
504 size_t _pst_ff_compile_ID(pst_file *pf, u_int32_t id, struct holder *h, int32_t size); | |
505 | |
506 int32_t pst_strincmp(char *a, char *b, int32_t x); | |
507 int32_t pst_stricmp(char *a, char *b); | |
508 size_t pst_fwrite(const void*ptr, size_t size, size_t nmemb, FILE*stream); | |
509 char * _pst_wide_to_single(char *wt, int32_t size); | |
510 // DEBUG functions | |
511 int32_t _pst_printDptr(pst_file *pf); | |
512 int32_t _pst_printIDptr(pst_file* pf); | |
513 int32_t _pst_printID2ptr(pst_index2_ll *ptr); | |
514 void * xmalloc(size_t size); | |
515 | |
516 #endif // defined LIBPST_H |