Mercurial > libpst
annotate src/libpst.h @ 79:56fa05fd5271
Patch from Robert Simpson for encryption type 2.
Fix the order of testing item types to avoid claiming there are multiple message stores.
author | Carl Byington <carl@five-ten-sg.com> |
---|---|
date | Fri, 13 Jun 2008 20:47:01 -0700 |
parents | 987aa872294e |
children | 3ec5ad97e926 |
rev | line source |
---|---|
16 | 1 /*** |
2 * libpst.h | |
3 * Part of LibPST project | |
4 * Written by David Smith | |
46 | 5 * dave.s@earthcorp.com |
16 | 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 | |
75
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
14 #include <stdint.h> |
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
15 #ifndef FILETIME_DEFINED |
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
16 #define FILETIME_DEFINED |
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
17 //Win32 Filetime struct - copied from WINE |
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
18 typedef struct { |
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
19 uint32_t dwLowDateTime; |
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
20 uint32_t dwHighDateTime; |
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
21 } FILETIME; |
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
22 #endif |
987aa872294e
Use ftello/fseeko to properly handle large files.
Carl Byington <carl@five-ten-sg.com>
parents:
73
diff
changeset
|
23 #endif |
16 | 24 |
25 // According to Jan Wolter, sys/param.h is the most portable source of endian | |
26 // information on UNIX systems. see http://www.unixpapa.com/incnote/byteorder.html | |
27 #ifdef _MSC_VER | |
28 #define BYTE_ORDER LITTLE_ENDIAN | |
29 #else | |
30 #include <sys/param.h> | |
31 #endif // defined _MSC_VER | |
32 | |
33 #if BYTE_ORDER == BIG_ENDIAN | |
34 # define LE64_CPU(x) \ | |
35 x = ((((x) & 0xff00000000000000) >> 56) | \ | |
46 | 36 (((x) & 0x00ff000000000000) >> 40) | \ |
37 (((x) & 0x0000ff0000000000) >> 24) | \ | |
38 (((x) & 0x000000ff00000000) >> 8 ) | \ | |
39 (((x) & 0x00000000ff000000) << 8 ) | \ | |
40 (((x) & 0x0000000000ff0000) << 24) | \ | |
41 (((x) & 0x000000000000ff00) << 40) | \ | |
42 (((x) & 0x00000000000000ff) << 56)); | |
16 | 43 # define LE32_CPU(x) \ |
44 x = ((((x) & 0xff000000) >> 24) | \ | |
46 | 45 (((x) & 0x00ff0000) >> 8 ) | \ |
46 (((x) & 0x0000ff00) << 8 ) | \ | |
47 (((x) & 0x000000ff) << 24)); | |
16 | 48 # define LE16_CPU(x) \ |
49 x = ((((x) & 0xff00) >> 8) | \ | |
46 | 50 (((x) & 0x00ff) << 8)); |
16 | 51 #elif BYTE_ORDER == LITTLE_ENDIAN |
52 # define LE64_CPU(x) {} | |
53 # define LE32_CPU(x) {} | |
54 # define LE16_CPU(x) {} | |
55 #else | |
56 # error "Byte order not supported by this library" | |
57 #endif // BYTE_ORDER | |
58 | |
59 | |
79
56fa05fd5271
Patch from Robert Simpson for encryption type 2.
Carl Byington <carl@five-ten-sg.com>
parents:
75
diff
changeset
|
60 #define PST_TYPE_NOTE 1 |
16 | 61 #define PST_TYPE_APPOINTMENT 8 |
79
56fa05fd5271
Patch from Robert Simpson for encryption type 2.
Carl Byington <carl@five-ten-sg.com>
parents:
75
diff
changeset
|
62 #define PST_TYPE_CONTACT 9 |
56fa05fd5271
Patch from Robert Simpson for encryption type 2.
Carl Byington <carl@five-ten-sg.com>
parents:
75
diff
changeset
|
63 #define PST_TYPE_JOURNAL 10 |
16 | 64 #define PST_TYPE_STICKYNOTE 11 |
79
56fa05fd5271
Patch from Robert Simpson for encryption type 2.
Carl Byington <carl@five-ten-sg.com>
parents:
75
diff
changeset
|
65 #define PST_TYPE_TASK 12 |
56fa05fd5271
Patch from Robert Simpson for encryption type 2.
Carl Byington <carl@five-ten-sg.com>
parents:
75
diff
changeset
|
66 #define PST_TYPE_OTHER 13 |
56fa05fd5271
Patch from Robert Simpson for encryption type 2.
Carl Byington <carl@five-ten-sg.com>
parents:
75
diff
changeset
|
67 #define PST_TYPE_REPORT 14 |
16 | 68 |
69 // defines whether decryption is done on this bit of data | |
70 #define PST_NO_ENC 0 | |
79
56fa05fd5271
Patch from Robert Simpson for encryption type 2.
Carl Byington <carl@five-ten-sg.com>
parents:
75
diff
changeset
|
71 #define PST_ENC 1 |
16 | 72 |
73 // defines types of possible encryption | |
79
56fa05fd5271
Patch from Robert Simpson for encryption type 2.
Carl Byington <carl@five-ten-sg.com>
parents:
75
diff
changeset
|
74 #define PST_NO_ENCRYPT 0 |
16 | 75 #define PST_COMP_ENCRYPT 1 |
79
56fa05fd5271
Patch from Robert Simpson for encryption type 2.
Carl Byington <carl@five-ten-sg.com>
parents:
75
diff
changeset
|
76 #define PST_ENCRYPT 2 |
16 | 77 |
78 // defines different types of mappings | |
46 | 79 #define PST_MAP_ATTRIB (uint32_t)1 |
80 #define PST_MAP_HEADER (uint32_t)2 | |
16 | 81 |
82 // define my custom email attributes. | |
83 #define PST_ATTRIB_HEADER -1 | |
84 | |
85 // defines types of free/busy values for appointment->showas | |
86 #define PST_FREEBUSY_FREE 0 | |
87 #define PST_FREEBUSY_TENTATIVE 1 | |
88 #define PST_FREEBUSY_BUSY 2 | |
89 #define PST_FREEBUSY_OUT_OF_OFFICE 3 | |
90 | |
91 // defines labels for appointment->label | |
46 | 92 #define PST_APP_LABEL_NONE 0 // None |
16 | 93 #define PST_APP_LABEL_IMPORTANT 1 // Important |
46 | 94 #define PST_APP_LABEL_BUSINESS 2 // Business |
95 #define PST_APP_LABEL_PERSONAL 3 // Personal | |
96 #define PST_APP_LABEL_VACATION 4 // Vacation | |
16 | 97 #define PST_APP_LABEL_MUST_ATTEND 5 // Must Attend |
98 #define PST_APP_LABEL_TRAVEL_REQ 6 // Travel Required | |
99 #define PST_APP_LABEL_NEEDS_PREP 7 // Needs Preparation | |
46 | 100 #define PST_APP_LABEL_BIRTHDAY 8 // Birthday |
16 | 101 #define PST_APP_LABEL_ANNIVERSARY 9 // Anniversary |
102 #define PST_APP_LABEL_PHONE_CALL 10// Phone Call | |
103 | |
50 | 104 // define type of reccuring event |
105 #define PST_APP_RECUR_NONE 0 | |
106 #define PST_APP_RECUR_DAILY 1 | |
107 #define PST_APP_RECUR_WEEKLY 2 | |
108 #define PST_APP_RECUR_MONTHLY 3 | |
109 #define PST_APP_RECUR_YEARLY 4 | |
110 | |
49 | 111 |
46 | 112 typedef struct pst_misc_6_struct { |
49 | 113 int32_t i1; |
114 int32_t i2; | |
115 int32_t i3; | |
116 int32_t i4; | |
117 int32_t i5; | |
118 int32_t i6; | |
16 | 119 } pst_misc_6; |
120 | |
49 | 121 |
46 | 122 typedef struct pst_entryid_struct { |
49 | 123 int32_t u1; |
124 char entryid[16]; | |
125 uint32_t id; | |
16 | 126 } pst_entryid; |
127 | |
49 | 128 |
46 | 129 typedef struct pst_desc_struct32 { |
49 | 130 uint32_t d_id; |
131 uint32_t desc_id; | |
132 uint32_t list_id; | |
133 uint32_t parent_id; | |
43 | 134 } pst_desc32; |
16 | 135 |
49 | 136 |
46 | 137 typedef struct pst_desc_structn { |
49 | 138 uint64_t d_id; |
139 uint64_t desc_id; | |
140 uint64_t list_id; | |
141 uint32_t parent_id; // not 64 bit ?? | |
142 uint32_t u1; // padding | |
43 | 143 } pst_descn; |
144 | |
49 | 145 |
46 | 146 typedef struct pst_index_struct32 { |
49 | 147 uint32_t id; |
148 uint32_t offset; | |
149 uint16_t size; | |
150 int16_t u1; | |
43 | 151 } pst_index32; |
152 | |
49 | 153 |
46 | 154 typedef struct pst_index_struct { |
49 | 155 uint64_t id; |
156 uint64_t offset; | |
157 uint16_t size; | |
158 int16_t u0; | |
159 int32_t u1; | |
16 | 160 } pst_index; |
161 | |
49 | 162 |
46 | 163 typedef struct pst_index_tree32 { |
49 | 164 uint32_t id; |
165 uint32_t offset; | |
166 uint32_t size; | |
167 int32_t u1; | |
168 struct pst_index_tree * next; | |
43 | 169 } pst_index_ll32; |
170 | |
49 | 171 |
46 | 172 typedef struct pst_index_tree { |
49 | 173 uint64_t id; |
174 uint64_t offset; | |
175 uint64_t size; | |
176 int64_t u1; | |
177 struct pst_index_tree * next; | |
16 | 178 } pst_index_ll; |
179 | |
49 | 180 |
46 | 181 typedef struct pst_index2_tree { |
49 | 182 uint64_t id2; |
183 pst_index_ll *id; | |
184 struct pst_index2_tree * next; | |
16 | 185 } pst_index2_ll; |
186 | |
49 | 187 |
46 | 188 typedef struct pst_desc_tree { |
49 | 189 uint64_t id; |
190 pst_index_ll * list_index; | |
191 pst_index_ll * desc; | |
192 int32_t no_child; | |
193 struct pst_desc_tree * prev; | |
194 struct pst_desc_tree * next; | |
195 struct pst_desc_tree * parent; | |
196 struct pst_desc_tree * child; | |
197 struct pst_desc_tree * child_tail; | |
16 | 198 } pst_desc_ll; |
199 | |
49 | 200 |
46 | 201 typedef struct pst_item_email_subject { |
49 | 202 int off1; |
203 int off2; | |
204 char *subj; | |
16 | 205 } pst_item_email_subject; |
206 | |
49 | 207 |
46 | 208 typedef struct pst_item_email { |
49 | 209 FILETIME *arrival_date; |
210 int autoforward; // 1 = true, 0 = not set, -1 = false | |
211 char *body; | |
212 char *cc_address; | |
59
7d5c637aaafb
General cleanup and code fixes.
Carl Byington <carl@five-ten-sg.com>
parents:
52
diff
changeset
|
213 char *bcc_address; |
49 | 214 char *common_name; |
215 int32_t conv_index; | |
216 int conversion_prohib; // 1 = true, 0 = false | |
217 int delete_after_submit; // 1 = true, 0 = false | |
218 int delivery_report; // 1 = true, 0 = false | |
219 char *encrypted_body; | |
50 | 220 size_t encrypted_body_size; |
49 | 221 char *encrypted_htmlbody; |
50 | 222 size_t encrypted_htmlbody_size; |
49 | 223 int32_t flag; |
224 char *header; | |
225 char *htmlbody; | |
226 int32_t importance; | |
227 char *in_reply_to; | |
228 int message_cc_me; // 1 = true, 0 = false | |
229 int message_recip_me; // 1 = true, 0 = false | |
230 int message_to_me; // 1 = true, 0 = false | |
231 char *messageid; | |
232 int32_t orig_sensitivity; | |
63
cfd6175f9334
Start work on pst2dii to convert to Summation dii load file format.
Carl Byington <carl@five-ten-sg.com>
parents:
59
diff
changeset
|
233 char *original_bcc; |
cfd6175f9334
Start work on pst2dii to convert to Summation dii load file format.
Carl Byington <carl@five-ten-sg.com>
parents:
59
diff
changeset
|
234 char *original_cc; |
cfd6175f9334
Start work on pst2dii to convert to Summation dii load file format.
Carl Byington <carl@five-ten-sg.com>
parents:
59
diff
changeset
|
235 char *original_to; |
49 | 236 char *outlook_recipient; |
63
cfd6175f9334
Start work on pst2dii to convert to Summation dii load file format.
Carl Byington <carl@five-ten-sg.com>
parents:
59
diff
changeset
|
237 char *outlook_recipient_name; |
49 | 238 char *outlook_recipient2; |
239 char *outlook_sender; | |
240 char *outlook_sender_name; | |
241 char *outlook_sender2; | |
242 int32_t priority; | |
243 char *proc_subject; | |
244 int read_receipt; // 1 = true, 0 = false | |
245 char *recip_access; | |
246 char *recip_address; | |
247 char *recip2_access; | |
248 char *recip2_address; | |
249 int reply_requested; // 1 = true, 0 = false | |
250 char *reply_to; | |
251 char *return_path_address; | |
252 int32_t rtf_body_char_count; | |
253 int32_t rtf_body_crc; | |
254 char *rtf_body_tag; | |
255 char *rtf_compressed; | |
63
cfd6175f9334
Start work on pst2dii to convert to Summation dii load file format.
Carl Byington <carl@five-ten-sg.com>
parents:
59
diff
changeset
|
256 uint32_t rtf_compressed_size; |
49 | 257 int rtf_in_sync; // 1 = true, 0 = doesn't exist, -1 = false |
258 int32_t rtf_ws_prefix_count; | |
259 int32_t rtf_ws_trailing_count; | |
260 char *sender_access; | |
261 char *sender_address; | |
262 char *sender2_access; | |
263 char *sender2_address; | |
264 int32_t sensitivity; | |
265 FILETIME *sent_date; | |
266 pst_entryid *sentmail_folder; | |
267 char *sentto_address; | |
268 pst_item_email_subject *subject; | |
16 | 269 } pst_item_email; |
270 | |
49 | 271 |
46 | 272 typedef struct pst_item_folder { |
49 | 273 int32_t email_count; |
274 int32_t unseen_email_count; | |
275 int32_t assoc_count; | |
276 int subfolder; // 1 = true, 0 = false | |
16 | 277 } pst_item_folder; |
278 | |
49 | 279 |
46 | 280 typedef struct pst_item_message_store { |
51 | 281 pst_entryid *top_of_personal_folder; // 0x35e0 |
282 pst_entryid *default_outbox_folder; // 0x35e2 | |
283 pst_entryid *deleted_items_folder; // 0x35e3 | |
284 pst_entryid *sent_items_folder; // 0x35e4 | |
285 pst_entryid *user_views_folder; // 0x35e5 | |
286 pst_entryid *common_view_folder; // 0x35e6 | |
287 pst_entryid *search_root_folder; // 0x35e7 | |
288 pst_entryid *top_of_folder; // 0x7c07 | |
289 int32_t valid_mask; // 0x35df // what folders the message store contains | |
290 int32_t pwd_chksum; // 0x76ff | |
16 | 291 } pst_item_message_store; |
292 | |
49 | 293 |
46 | 294 typedef struct pst_item_contact { |
49 | 295 char *access_method; |
296 char *account_name; | |
297 char *address1; | |
298 char *address1a; | |
299 char *address1_desc; | |
300 char *address1_transport; | |
301 char *address2; | |
302 char *address2a; | |
303 char *address2_desc; | |
304 char *address2_transport; | |
305 char *address3; | |
306 char *address3a; | |
307 char *address3_desc; | |
308 char *address3_transport; | |
309 char *assistant_name; | |
310 char *assistant_phone; | |
311 char *billing_information; | |
312 FILETIME *birthday; | |
51 | 313 char *business_address; // 0x801b |
49 | 314 char *business_city; |
315 char *business_country; | |
316 char *business_fax; | |
317 char *business_homepage; | |
318 char *business_phone; | |
319 char *business_phone2; | |
320 char *business_po_box; | |
321 char *business_postal_code; | |
322 char *business_state; | |
323 char *business_street; | |
324 char *callback_phone; | |
325 char *car_phone; | |
326 char *company_main_phone; | |
327 char *company_name; | |
328 char *computer_name; | |
329 char *customer_id; | |
330 char *def_postal_address; | |
331 char *department; | |
332 char *display_name_prefix; | |
333 char *first_name; | |
334 char *followup; | |
335 char *free_busy_address; | |
336 char *ftp_site; | |
337 char *fullname; | |
51 | 338 int16_t gender; |
49 | 339 char *gov_id; |
340 char *hobbies; | |
51 | 341 char *home_address; // 0x801a |
49 | 342 char *home_city; |
343 char *home_country; | |
344 char *home_fax; | |
345 char *home_phone; | |
346 char *home_phone2; | |
347 char *home_po_box; | |
348 char *home_postal_code; | |
349 char *home_state; | |
350 char *home_street; | |
351 char *initials; | |
352 char *isdn_phone; | |
353 char *job_title; | |
354 char *keyword; | |
355 char *language; | |
356 char *location; | |
51 | 357 int mail_permission; // 1 = true, 0 = false |
49 | 358 char *manager_name; |
359 char *middle_name; | |
360 char *mileage; | |
361 char *mobile_phone; | |
362 char *nickname; | |
363 char *office_loc; | |
364 char *org_id; | |
51 | 365 char *other_address; // 0x801c |
49 | 366 char *other_city; |
367 char *other_country; | |
368 char *other_phone; | |
369 char *other_po_box; | |
370 char *other_postal_code; | |
371 char *other_state; | |
372 char *other_street; | |
373 char *pager_phone; | |
374 char *personal_homepage; | |
375 char *pref_name; | |
376 char *primary_fax; | |
377 char *primary_phone; | |
378 char *profession; | |
379 char *radio_phone; | |
51 | 380 int rich_text; // 1 = true, 0 = false |
49 | 381 char *spouse_name; |
382 char *suffix; | |
383 char *surname; | |
384 char *telex; | |
385 char *transmittable_display_name; | |
386 char *ttytdd_phone; | |
387 FILETIME *wedding_anniversary; | |
51 | 388 char *work_address_street; // 0x8045 |
389 char *work_address_city; // 0x8046 | |
390 char *work_address_state; // 0x8047 | |
391 char *work_address_postalcode; // 0x8048 | |
392 char *work_address_country; // 0x8049 | |
393 char *work_address_postofficebox; // 0x804a | |
16 | 394 } pst_item_contact; |
395 | |
49 | 396 |
46 | 397 typedef struct pst_item_attach { |
49 | 398 char *filename1; |
399 char *filename2; | |
400 char *mimetype; | |
401 char *data; | |
402 size_t size; | |
403 uint64_t id2_val; | |
404 uint64_t id_val; // calculated from id2_val during creation of record | |
405 int32_t method; | |
406 int32_t position; | |
407 int32_t sequence; | |
408 struct pst_item_attach *next; | |
16 | 409 } pst_item_attach; |
410 | |
49 | 411 |
46 | 412 typedef struct pst_item_extra_field { |
49 | 413 char *field_name; |
414 char *value; | |
415 struct pst_item_extra_field *next; | |
16 | 416 } pst_item_extra_field; |
417 | |
49 | 418 |
46 | 419 typedef struct pst_item_journal { |
49 | 420 FILETIME *end; |
421 FILETIME *start; | |
422 char *type; | |
16 | 423 } pst_item_journal; |
424 | |
49 | 425 |
46 | 426 typedef struct pst_item_appointment { |
49 | 427 FILETIME *end; |
50 | 428 char *location; |
429 int alarm; // 1 = true, 0 = false | |
49 | 430 FILETIME *reminder; |
50 | 431 int32_t alarm_minutes; |
432 char *alarm_filename; | |
49 | 433 FILETIME *start; |
50 | 434 char *timezonestring; |
435 int32_t showas; | |
436 int32_t label; | |
437 int all_day; // 1 = true, 0 = false | |
438 char *recurrence; | |
439 int32_t recurrence_type; | |
440 FILETIME *recurrence_start; | |
441 FILETIME *recurrence_end; | |
16 | 442 } pst_item_appointment; |
443 | |
49 | 444 |
46 | 445 typedef struct pst_item { |
49 | 446 struct pst_item_email *email; // data reffering to email |
447 struct pst_item_folder *folder; // data reffering to folder | |
448 struct pst_item_contact *contact; // data reffering to contact | |
449 struct pst_item_attach *attach; // linked list of attachments | |
450 struct pst_item_message_store *message_store; // data referring to the message store | |
451 struct pst_item_extra_field *extra_fields; // linked list of extra headers and such | |
452 struct pst_item_journal *journal; // data reffering to a journal entry | |
453 struct pst_item_appointment *appointment; // data reffering to a calendar entry | |
454 int type; | |
455 char *ascii_type; | |
456 char *file_as; | |
457 char *comment; | |
458 int32_t message_size; | |
459 char *outlook_version; | |
460 char *record_key; // probably 16 bytes long. | |
461 size_t record_key_size; | |
462 int response_requested; // 1 = true, 0 = false | |
463 FILETIME *create_date; | |
464 FILETIME *modify_date; | |
465 int private_member; // 1 = true, 0 = false | |
16 | 466 } pst_item; |
467 | |
49 | 468 |
46 | 469 typedef struct pst_x_attrib_ll { |
49 | 470 uint32_t type; |
471 uint32_t mytype; | |
472 uint32_t map; | |
473 void *data; | |
474 struct pst_x_attrib_ll *next; | |
16 | 475 } pst_x_attrib_ll; |
476 | |
49 | 477 |
52 | 478 typedef struct pst_block_recorder { |
479 struct pst_block_recorder *next; | |
480 off_t offset; | |
481 size_t size; | |
482 int readcount; | |
483 } pst_block_recorder; | |
484 | |
485 | |
46 | 486 typedef struct pst_file { |
49 | 487 pst_index_ll *i_head, *i_tail; |
52 | 488 pst_desc_ll *d_head, *d_tail; |
49 | 489 pst_x_attrib_ll *x_head; |
52 | 490 pst_block_recorder *block_head; |
46 | 491 |
49 | 492 //set this to 0 to read 32-bit pst files (pre Outlook 2003) |
493 //set this to 1 to read 64-bit pst files (Outlook 2003 and later) | |
494 int do_read64; | |
46 | 495 |
49 | 496 uint64_t index1; |
497 uint64_t index1_back; | |
498 uint64_t index2; | |
499 uint64_t index2_back; | |
500 FILE * fp; // file pointer to opened PST file | |
501 uint64_t size; // pst file size | |
502 unsigned char encryption; // pst encryption setting | |
503 unsigned char ind_type; // pst index type | |
16 | 504 } pst_file; |
505 | |
49 | 506 |
46 | 507 typedef struct pst_block_offset { |
49 | 508 int16_t from; |
509 int16_t to; | |
16 | 510 } pst_block_offset; |
511 | |
49 | 512 |
46 | 513 typedef struct pst_block_offset_pointer { |
52 | 514 char *from; |
515 char *to; | |
516 int needfree; | |
35 | 517 } pst_block_offset_pointer; |
518 | |
49 | 519 |
520 typedef struct pst_num_item { | |
52 | 521 uint32_t id; // not an id1 or id2, this is actually some sort of type code |
522 char *data; | |
523 uint32_t type; | |
524 size_t size; | |
525 char *extra; | |
49 | 526 } pst_num_item; |
527 | |
16 | 528 |
46 | 529 typedef struct pst_num_array { |
49 | 530 int32_t count_item; |
531 int32_t orig_count; | |
532 int32_t count_array; | |
533 struct pst_num_item ** items; | |
534 struct pst_num_array *next; | |
16 | 535 } pst_num_array; |
536 | |
49 | 537 |
538 typedef struct pst_holder { | |
52 | 539 char **buf; |
49 | 540 FILE * fp; |
541 int base64; | |
542 char base64_extra_chars[3]; | |
543 uint32_t base64_extra; | |
544 } pst_holder; | |
545 | |
546 | |
547 typedef struct pst_subblock { | |
52 | 548 char *buf; |
549 size_t read_size; | |
550 size_t i_offset; | |
49 | 551 } pst_subblock; |
552 | |
553 | |
554 typedef struct pst_subblocks { | |
555 size_t subblock_count; | |
556 pst_subblock *subs; | |
557 } pst_subblocks; | |
558 | |
16 | 559 |
560 // prototypes | |
59
7d5c637aaafb
General cleanup and code fixes.
Carl Byington <carl@five-ten-sg.com>
parents:
52
diff
changeset
|
561 int pst_open(pst_file *pf, char *name); |
46 | 562 int pst_close(pst_file *pf); |
563 pst_desc_ll * pst_getTopOfFolders(pst_file *pf, pst_item *root); | |
52 | 564 size_t pst_attach_to_mem(pst_file *pf, pst_item_attach *attach, char **b); |
46 | 565 size_t pst_attach_to_file(pst_file *pf, pst_item_attach *attach, FILE* fp); |
566 size_t pst_attach_to_file_base64(pst_file *pf, pst_item_attach *attach, FILE* fp); | |
567 int pst_load_index (pst_file *pf); | |
568 pst_desc_ll* pst_getNextDptr(pst_desc_ll* d); | |
569 int pst_load_extended_attributes(pst_file *pf); | |
16 | 570 |
46 | 571 int pst_build_id_ptr(pst_file *pf, off_t offset, int32_t depth, uint64_t linku1, uint64_t start_val, uint64_t end_val); |
48 | 572 int pst_build_desc_ptr(pst_file *pf, off_t offset, int32_t depth, uint64_t linku1, uint64_t *high_id, uint64_t start_val, uint64_t end_val); |
46 | 573 pst_item* pst_getItem(pst_file *pf, pst_desc_ll *d_ptr); |
574 pst_item* pst_parse_item (pst_file *pf, pst_desc_ll *d_ptr); | |
48 | 575 pst_num_array* pst_parse_block(pst_file *pf, uint64_t block_id, pst_index2_ll *i2_head, pst_num_array *na_head); |
46 | 576 int pst_process(pst_num_array *list, pst_item *item, pst_item_attach *attach); |
577 void pst_free_list(pst_num_array *list); | |
578 void pst_freeItem(pst_item *item); | |
579 void pst_free_id2(pst_index2_ll * head); | |
580 void pst_free_id (pst_index_ll *head); | |
581 void pst_free_desc (pst_desc_ll *head); | |
582 void pst_free_xattrib(pst_x_attrib_ll *x); | |
49 | 583 int pst_getBlockOffsetPointer(pst_file *pf, pst_index2_ll *i2_head, pst_subblocks *subblocks, uint32_t offset, pst_block_offset_pointer *p); |
52 | 584 int pst_getBlockOffset(char *buf, size_t read_size, uint32_t i_offset, uint32_t offset, pst_block_offset *p); |
46 | 585 pst_index2_ll* pst_build_id2(pst_file *pf, pst_index_ll* list, pst_index2_ll* head_ptr); |
586 pst_index_ll* pst_getID(pst_file* pf, uint64_t id); | |
587 pst_index_ll* pst_getID2(pst_index2_ll * ptr, uint64_t id); | |
588 pst_desc_ll* pst_getDptr(pst_file *pf, uint64_t id); | |
51 | 589 size_t pst_read_block_size(pst_file *pf, off_t offset, size_t size, char **buf); |
79
56fa05fd5271
Patch from Robert Simpson for encryption type 2.
Carl Byington <carl@five-ten-sg.com>
parents:
75
diff
changeset
|
590 int pst_decrypt(uint64_t id, char *buf, size_t size, unsigned char type); |
46 | 591 uint64_t pst_getIntAt(pst_file *pf, char *buf); |
592 uint64_t pst_getIntAtPos(pst_file *pf, off_t pos); | |
52 | 593 size_t pst_getAtPos(pst_file *pf, off_t pos, void* buf, size_t size); |
594 size_t pst_ff_getIDblock_dec(pst_file *pf, uint64_t id, char **b); | |
595 size_t pst_ff_getIDblock(pst_file *pf, uint64_t id, char** b); | |
596 size_t pst_ff_getID2block(pst_file *pf, uint64_t id2, pst_index2_ll *id2_head, char** buf); | |
49 | 597 size_t pst_ff_getID2data(pst_file *pf, pst_index_ll *ptr, pst_holder *h); |
598 size_t pst_ff_compile_ID(pst_file *pf, uint64_t id, pst_holder *h, size_t size); | |
16 | 599 |
46 | 600 int pst_strincmp(char *a, char *b, size_t x); |
601 int pst_stricmp(char *a, char *b); | |
602 size_t pst_fwrite(const void*ptr, size_t size, size_t nmemb, FILE*stream); | |
47 | 603 char * pst_wide_to_single(char *wt, size_t size); |
43 | 604 |
46 | 605 char * pst_rfc2426_escape(char *str); |
606 int pst_chr_count(char *str, char x); | |
607 char * pst_rfc2425_datetime_format(FILETIME *ft); | |
608 char * pst_rfc2445_datetime_format(FILETIME *ft); | |
43 | 609 |
51 | 610 void pst_printDptr(pst_file *pf, pst_desc_ll *ptr); |
611 void pst_printIDptr(pst_file* pf); | |
612 void pst_printID2ptr(pst_index2_ll *ptr); | |
16 | 613 |
614 #endif // defined LIBPST_H |