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