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