Mercurial > libpst
annotate src/libpst.h @ 109:7947334d53ad
Added tag stable-0-6-21 for changeset 1b2a4fac1303
author | Carl Byington <carl@five-ten-sg.com> |
---|---|
date | Tue, 21 Oct 2008 14:45:39 -0700 |
parents | 8c4482be0b4c |
children | ed2a260bbb98 |
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; |
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
|
191 uint64_t parent_id; |
49 | 192 pst_index_ll * list_index; |
193 pst_index_ll * desc; | |
194 int32_t no_child; | |
195 struct pst_desc_tree * prev; | |
196 struct pst_desc_tree * next; | |
197 struct pst_desc_tree * parent; | |
198 struct pst_desc_tree * child; | |
199 struct pst_desc_tree * child_tail; | |
16 | 200 } pst_desc_ll; |
201 | |
49 | 202 |
46 | 203 typedef struct pst_item_email_subject { |
49 | 204 int off1; |
205 int off2; | |
206 char *subj; | |
16 | 207 } pst_item_email_subject; |
208 | |
49 | 209 |
46 | 210 typedef struct pst_item_email { |
49 | 211 FILETIME *arrival_date; |
212 int autoforward; // 1 = true, 0 = not set, -1 = false | |
213 char *body; | |
214 char *cc_address; | |
59
7d5c637aaafb
General cleanup and code fixes.
Carl Byington <carl@five-ten-sg.com>
parents:
52
diff
changeset
|
215 char *bcc_address; |
49 | 216 char *common_name; |
217 int32_t conv_index; | |
218 int conversion_prohib; // 1 = true, 0 = false | |
219 int delete_after_submit; // 1 = true, 0 = false | |
220 int delivery_report; // 1 = true, 0 = false | |
221 char *encrypted_body; | |
50 | 222 size_t encrypted_body_size; |
49 | 223 char *encrypted_htmlbody; |
50 | 224 size_t encrypted_htmlbody_size; |
49 | 225 int32_t flag; |
226 char *header; | |
227 char *htmlbody; | |
228 int32_t importance; | |
229 char *in_reply_to; | |
230 int message_cc_me; // 1 = true, 0 = false | |
231 int message_recip_me; // 1 = true, 0 = false | |
232 int message_to_me; // 1 = true, 0 = false | |
233 char *messageid; | |
234 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
|
235 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
|
236 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
|
237 char *original_to; |
49 | 238 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
|
239 char *outlook_recipient_name; |
49 | 240 char *outlook_recipient2; |
241 char *outlook_sender; | |
242 char *outlook_sender_name; | |
243 char *outlook_sender2; | |
244 int32_t priority; | |
245 char *proc_subject; | |
246 int read_receipt; // 1 = true, 0 = false | |
247 char *recip_access; | |
248 char *recip_address; | |
249 char *recip2_access; | |
250 char *recip2_address; | |
251 int reply_requested; // 1 = true, 0 = false | |
252 char *reply_to; | |
253 char *return_path_address; | |
254 int32_t rtf_body_char_count; | |
255 int32_t rtf_body_crc; | |
256 char *rtf_body_tag; | |
257 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
|
258 uint32_t rtf_compressed_size; |
49 | 259 int rtf_in_sync; // 1 = true, 0 = doesn't exist, -1 = false |
260 int32_t rtf_ws_prefix_count; | |
261 int32_t rtf_ws_trailing_count; | |
262 char *sender_access; | |
263 char *sender_address; | |
264 char *sender2_access; | |
265 char *sender2_address; | |
266 int32_t sensitivity; | |
267 FILETIME *sent_date; | |
268 pst_entryid *sentmail_folder; | |
269 char *sentto_address; | |
270 pst_item_email_subject *subject; | |
16 | 271 } pst_item_email; |
272 | |
49 | 273 |
46 | 274 typedef struct pst_item_folder { |
49 | 275 int32_t email_count; |
276 int32_t unseen_email_count; | |
277 int32_t assoc_count; | |
278 int subfolder; // 1 = true, 0 = false | |
16 | 279 } pst_item_folder; |
280 | |
49 | 281 |
46 | 282 typedef struct pst_item_message_store { |
51 | 283 pst_entryid *top_of_personal_folder; // 0x35e0 |
284 pst_entryid *default_outbox_folder; // 0x35e2 | |
285 pst_entryid *deleted_items_folder; // 0x35e3 | |
286 pst_entryid *sent_items_folder; // 0x35e4 | |
287 pst_entryid *user_views_folder; // 0x35e5 | |
288 pst_entryid *common_view_folder; // 0x35e6 | |
289 pst_entryid *search_root_folder; // 0x35e7 | |
290 pst_entryid *top_of_folder; // 0x7c07 | |
291 int32_t valid_mask; // 0x35df // what folders the message store contains | |
292 int32_t pwd_chksum; // 0x76ff | |
16 | 293 } pst_item_message_store; |
294 | |
49 | 295 |
46 | 296 typedef struct pst_item_contact { |
49 | 297 char *access_method; |
298 char *account_name; | |
299 char *address1; | |
300 char *address1a; | |
301 char *address1_desc; | |
302 char *address1_transport; | |
303 char *address2; | |
304 char *address2a; | |
305 char *address2_desc; | |
306 char *address2_transport; | |
307 char *address3; | |
308 char *address3a; | |
309 char *address3_desc; | |
310 char *address3_transport; | |
311 char *assistant_name; | |
312 char *assistant_phone; | |
313 char *billing_information; | |
314 FILETIME *birthday; | |
51 | 315 char *business_address; // 0x801b |
49 | 316 char *business_city; |
317 char *business_country; | |
318 char *business_fax; | |
319 char *business_homepage; | |
320 char *business_phone; | |
321 char *business_phone2; | |
322 char *business_po_box; | |
323 char *business_postal_code; | |
324 char *business_state; | |
325 char *business_street; | |
326 char *callback_phone; | |
327 char *car_phone; | |
328 char *company_main_phone; | |
329 char *company_name; | |
330 char *computer_name; | |
331 char *customer_id; | |
332 char *def_postal_address; | |
333 char *department; | |
334 char *display_name_prefix; | |
335 char *first_name; | |
336 char *followup; | |
337 char *free_busy_address; | |
338 char *ftp_site; | |
339 char *fullname; | |
51 | 340 int16_t gender; |
49 | 341 char *gov_id; |
342 char *hobbies; | |
51 | 343 char *home_address; // 0x801a |
49 | 344 char *home_city; |
345 char *home_country; | |
346 char *home_fax; | |
347 char *home_phone; | |
348 char *home_phone2; | |
349 char *home_po_box; | |
350 char *home_postal_code; | |
351 char *home_state; | |
352 char *home_street; | |
353 char *initials; | |
354 char *isdn_phone; | |
355 char *job_title; | |
356 char *keyword; | |
357 char *language; | |
358 char *location; | |
51 | 359 int mail_permission; // 1 = true, 0 = false |
49 | 360 char *manager_name; |
361 char *middle_name; | |
362 char *mileage; | |
363 char *mobile_phone; | |
364 char *nickname; | |
365 char *office_loc; | |
366 char *org_id; | |
51 | 367 char *other_address; // 0x801c |
49 | 368 char *other_city; |
369 char *other_country; | |
370 char *other_phone; | |
371 char *other_po_box; | |
372 char *other_postal_code; | |
373 char *other_state; | |
374 char *other_street; | |
375 char *pager_phone; | |
376 char *personal_homepage; | |
377 char *pref_name; | |
378 char *primary_fax; | |
379 char *primary_phone; | |
380 char *profession; | |
381 char *radio_phone; | |
51 | 382 int rich_text; // 1 = true, 0 = false |
49 | 383 char *spouse_name; |
384 char *suffix; | |
385 char *surname; | |
386 char *telex; | |
387 char *transmittable_display_name; | |
388 char *ttytdd_phone; | |
389 FILETIME *wedding_anniversary; | |
51 | 390 char *work_address_street; // 0x8045 |
391 char *work_address_city; // 0x8046 | |
392 char *work_address_state; // 0x8047 | |
393 char *work_address_postalcode; // 0x8048 | |
394 char *work_address_country; // 0x8049 | |
395 char *work_address_postofficebox; // 0x804a | |
16 | 396 } pst_item_contact; |
397 | |
49 | 398 |
46 | 399 typedef struct pst_item_attach { |
49 | 400 char *filename1; |
401 char *filename2; | |
402 char *mimetype; | |
403 char *data; | |
404 size_t size; | |
405 uint64_t id2_val; | |
406 uint64_t id_val; // calculated from id2_val during creation of record | |
407 int32_t method; | |
408 int32_t position; | |
409 int32_t sequence; | |
410 struct pst_item_attach *next; | |
16 | 411 } pst_item_attach; |
412 | |
49 | 413 |
46 | 414 typedef struct pst_item_extra_field { |
49 | 415 char *field_name; |
416 char *value; | |
417 struct pst_item_extra_field *next; | |
16 | 418 } pst_item_extra_field; |
419 | |
49 | 420 |
46 | 421 typedef struct pst_item_journal { |
49 | 422 FILETIME *end; |
423 FILETIME *start; | |
424 char *type; | |
16 | 425 } pst_item_journal; |
426 | |
49 | 427 |
46 | 428 typedef struct pst_item_appointment { |
49 | 429 FILETIME *end; |
50 | 430 char *location; |
431 int alarm; // 1 = true, 0 = false | |
49 | 432 FILETIME *reminder; |
50 | 433 int32_t alarm_minutes; |
434 char *alarm_filename; | |
49 | 435 FILETIME *start; |
50 | 436 char *timezonestring; |
437 int32_t showas; | |
438 int32_t label; | |
439 int all_day; // 1 = true, 0 = false | |
440 char *recurrence; | |
441 int32_t recurrence_type; | |
442 FILETIME *recurrence_start; | |
443 FILETIME *recurrence_end; | |
16 | 444 } pst_item_appointment; |
445 | |
49 | 446 |
46 | 447 typedef struct pst_item { |
49 | 448 struct pst_item_email *email; // data reffering to email |
449 struct pst_item_folder *folder; // data reffering to folder | |
450 struct pst_item_contact *contact; // data reffering to contact | |
451 struct pst_item_attach *attach; // linked list of attachments | |
452 struct pst_item_message_store *message_store; // data referring to the message store | |
453 struct pst_item_extra_field *extra_fields; // linked list of extra headers and such | |
454 struct pst_item_journal *journal; // data reffering to a journal entry | |
455 struct pst_item_appointment *appointment; // data reffering to a calendar entry | |
456 int type; | |
457 char *ascii_type; | |
458 char *file_as; | |
459 char *comment; | |
460 int32_t message_size; | |
461 char *outlook_version; | |
462 char *record_key; // probably 16 bytes long. | |
463 size_t record_key_size; | |
464 int response_requested; // 1 = true, 0 = false | |
465 FILETIME *create_date; | |
466 FILETIME *modify_date; | |
467 int private_member; // 1 = true, 0 = false | |
16 | 468 } pst_item; |
469 | |
49 | 470 |
46 | 471 typedef struct pst_x_attrib_ll { |
49 | 472 uint32_t type; |
473 uint32_t mytype; | |
474 uint32_t map; | |
475 void *data; | |
476 struct pst_x_attrib_ll *next; | |
16 | 477 } pst_x_attrib_ll; |
478 | |
49 | 479 |
52 | 480 typedef struct pst_block_recorder { |
481 struct pst_block_recorder *next; | |
482 off_t offset; | |
483 size_t size; | |
484 int readcount; | |
485 } pst_block_recorder; | |
486 | |
487 | |
46 | 488 typedef struct pst_file { |
49 | 489 pst_index_ll *i_head, *i_tail; |
52 | 490 pst_desc_ll *d_head, *d_tail; |
49 | 491 pst_x_attrib_ll *x_head; |
52 | 492 pst_block_recorder *block_head; |
46 | 493 |
49 | 494 //set this to 0 to read 32-bit pst files (pre Outlook 2003) |
495 //set this to 1 to read 64-bit pst files (Outlook 2003 and later) | |
496 int do_read64; | |
46 | 497 |
49 | 498 uint64_t index1; |
499 uint64_t index1_back; | |
500 uint64_t index2; | |
501 uint64_t index2_back; | |
502 FILE * fp; // file pointer to opened PST file | |
503 uint64_t size; // pst file size | |
504 unsigned char encryption; // pst encryption setting | |
505 unsigned char ind_type; // pst index type | |
16 | 506 } pst_file; |
507 | |
49 | 508 |
46 | 509 typedef struct pst_block_offset { |
49 | 510 int16_t from; |
511 int16_t to; | |
16 | 512 } pst_block_offset; |
513 | |
49 | 514 |
46 | 515 typedef struct pst_block_offset_pointer { |
52 | 516 char *from; |
517 char *to; | |
518 int needfree; | |
35 | 519 } pst_block_offset_pointer; |
520 | |
49 | 521 |
522 typedef struct pst_num_item { | |
52 | 523 uint32_t id; // not an id1 or id2, this is actually some sort of type code |
524 char *data; | |
525 uint32_t type; | |
526 size_t size; | |
527 char *extra; | |
49 | 528 } pst_num_item; |
529 | |
16 | 530 |
46 | 531 typedef struct pst_num_array { |
49 | 532 int32_t count_item; |
533 int32_t orig_count; | |
534 int32_t count_array; | |
535 struct pst_num_item ** items; | |
536 struct pst_num_array *next; | |
16 | 537 } pst_num_array; |
538 | |
49 | 539 |
540 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
|
541 char **buf; |
997cf1373f9e
fix base64 encoding that could create long lines
Carl Byington <carl@five-ten-sg.com>
parents:
90
diff
changeset
|
542 FILE *fp; |
997cf1373f9e
fix base64 encoding that could create long lines
Carl Byington <carl@five-ten-sg.com>
parents:
90
diff
changeset
|
543 int base64; |
49 | 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); |
102
8c4482be0b4c
remove unreachable code
Carl Byington <carl@five-ten-sg.com>
parents:
101
diff
changeset
|
572 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 | 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 |