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