comparison src/libpst.h @ 190:e3a63888cdd4

add documentation for shared library interface
author Carl Byington <carl@five-ten-sg.com>
date Tue, 14 Apr 2009 22:26:17 -0700
parents d588dafd03e8
children 4b498fd68464
comparison
equal deleted inserted replaced
189:dc807f71d9d2 190:e3a63888cdd4
49 #define PST_FREEBUSY_TENTATIVE 1 49 #define PST_FREEBUSY_TENTATIVE 1
50 #define PST_FREEBUSY_BUSY 2 50 #define PST_FREEBUSY_BUSY 2
51 #define PST_FREEBUSY_OUT_OF_OFFICE 3 51 #define PST_FREEBUSY_OUT_OF_OFFICE 3
52 52
53 // defines labels for appointment->label 53 // defines labels for appointment->label
54 #define PST_APP_LABEL_NONE 0 // None 54 #define PST_APP_LABEL_NONE 0
55 #define PST_APP_LABEL_IMPORTANT 1 // Important 55 #define PST_APP_LABEL_IMPORTANT 1
56 #define PST_APP_LABEL_BUSINESS 2 // Business 56 #define PST_APP_LABEL_BUSINESS 2
57 #define PST_APP_LABEL_PERSONAL 3 // Personal 57 #define PST_APP_LABEL_PERSONAL 3
58 #define PST_APP_LABEL_VACATION 4 // Vacation 58 #define PST_APP_LABEL_VACATION 4
59 #define PST_APP_LABEL_MUST_ATTEND 5 // Must Attend 59 #define PST_APP_LABEL_MUST_ATTEND 5
60 #define PST_APP_LABEL_TRAVEL_REQ 6 // Travel Required 60 #define PST_APP_LABEL_TRAVEL_REQ 6
61 #define PST_APP_LABEL_NEEDS_PREP 7 // Needs Preparation 61 #define PST_APP_LABEL_NEEDS_PREP 7
62 #define PST_APP_LABEL_BIRTHDAY 8 // Birthday 62 #define PST_APP_LABEL_BIRTHDAY 8
63 #define PST_APP_LABEL_ANNIVERSARY 9 // Anniversary 63 #define PST_APP_LABEL_ANNIVERSARY 9
64 #define PST_APP_LABEL_PHONE_CALL 10// Phone Call 64 #define PST_APP_LABEL_PHONE_CALL 10
65 65
66 // define type of reccuring event 66 // define type of reccuring event
67 #define PST_APP_RECUR_NONE 0 67 #define PST_APP_RECUR_NONE 0
68 #define PST_APP_RECUR_DAILY 1 68 #define PST_APP_RECUR_DAILY 1
69 #define PST_APP_RECUR_WEEKLY 2 69 #define PST_APP_RECUR_WEEKLY 2
70 #define PST_APP_RECUR_MONTHLY 3 70 #define PST_APP_RECUR_MONTHLY 3
71 #define PST_APP_RECUR_YEARLY 4 71 #define PST_APP_RECUR_YEARLY 4
72 72
73 73
74 typedef struct pst_misc_6 {
75 int32_t i1;
76 int32_t i2;
77 int32_t i3;
78 int32_t i4;
79 int32_t i5;
80 int32_t i6;
81 } pst_misc_6;
82
83
84 typedef struct pst_entryid { 74 typedef struct pst_entryid {
85 int32_t u1; 75 int32_t u1;
86 char entryid[16]; 76 char entryid[16];
87 uint32_t id; 77 uint32_t id;
88 } pst_entryid; 78 } pst_entryid;
89
90
91 typedef struct pst_desc32 {
92 uint32_t d_id;
93 uint32_t desc_id;
94 uint32_t tree_id;
95 uint32_t parent_d_id;
96 } pst_desc32;
97
98
99 typedef struct pst_desc {
100 uint64_t d_id;
101 uint64_t desc_id;
102 uint64_t tree_id;
103 uint32_t parent_d_id; // not 64 bit ??
104 uint32_t u1; // padding
105 } pst_desc;
106
107
108 typedef struct pst_index32 {
109 uint32_t id;
110 uint32_t offset;
111 uint16_t size;
112 int16_t u1;
113 } pst_index32;
114
115
116 typedef struct pst_index {
117 uint64_t id;
118 uint64_t offset;
119 uint16_t size;
120 int16_t u0;
121 int32_t u1;
122 } pst_index;
123 79
124 80
125 typedef struct pst_index_ll { 81 typedef struct pst_index_ll {
126 uint64_t i_id; 82 uint64_t i_id;
127 uint64_t offset; 83 uint64_t offset;
151 struct pst_desc_tree *child; 107 struct pst_desc_tree *child;
152 struct pst_desc_tree *child_tail; 108 struct pst_desc_tree *child_tail;
153 } pst_desc_tree; 109 } pst_desc_tree;
154 110
155 111
112 /** The string is either utf8 encoded, or it is in the code page
113 * specified by the containing mapi object. It can be forced into
114 * utf8 by calling pst_convert_utf8() or pst_convert_utf8_null().
115 */
156 typedef struct pst_string { 116 typedef struct pst_string {
157 int is_utf8; // 1 = true, 0 = false 117 /** @li 1 true
158 char *str; // either utf8 or some sbcs 118 * @li 0 false */
119 int is_utf8;
120 char *str;
159 } pst_string; 121 } pst_string;
160 122
161 123
124 /** a simple wrapper for binary blobs */
162 typedef struct pst_binary { 125 typedef struct pst_binary {
163 size_t size; 126 size_t size;
164 char *data; 127 char *data;
165 } pst_binary; 128 } pst_binary;
166 129
167 130
168 /** This struct defines an email message 131 /** This contains the email related mapi elements
169 */ 132 */
170 typedef struct pst_item_email { 133 typedef struct pst_item_email {
134 /** mapi element 0x0e06 PR_MESSAGE_DELIVERY_TIME */
171 FILETIME *arrival_date; 135 FILETIME *arrival_date;
172 /** 1 = true, 0 = not set, -1 = false */ 136 /** mapi element 0x0002 PR_ALTERNATE_RECIPIENT_ALLOWED
137 * @li 1 true
138 * @li 0 not set
139 * @li -1 false */
173 int autoforward; 140 int autoforward;
141 /** mapi element 0x0e03 PR_DISPLAY_CC */
174 pst_string cc_address; 142 pst_string cc_address;
143 /** mapi element 0x0e02 PR_DISPLAY_BCC */
175 pst_string bcc_address; 144 pst_string bcc_address;
145 /** mapi element 0x0071 PR_CONVERSATION_INDEX */
176 pst_binary conversation_index; 146 pst_binary conversation_index;
177 /** 1 = true, 0 = false */ 147 /** mapi element 0x3a03 PR_CONVERSION_PROHIBITED
148 * @li 1 true
149 * @li 0 false */
178 int conversion_prohibited; 150 int conversion_prohibited;
179 /** 1 = true, 0 = false */ 151 /** mapi element 0x0e01 PR_DELETE_AFTER_SUBMIT
152 * @li 1 true
153 * @li 0 false */
180 int delete_after_submit; 154 int delete_after_submit;
181 /** 1 = true, 0 = false */ 155 /** mapi element 0x0023 PR_ORIGINATOR_DELIVERY_REPORT_REQUESTED
156 * @li 1 true
157 * @li 0 false */
182 int delivery_report; 158 int delivery_report;
159 /** mapi element 0x6f04 */
183 pst_binary encrypted_body; 160 pst_binary encrypted_body;
161 /** mapi element 0x6f02 */
184 pst_binary encrypted_htmlbody; 162 pst_binary encrypted_htmlbody;
163 /** mapi element 0x007d PR_TRANSPORT_MESSAGE_HEADERS */
185 pst_string header; 164 pst_string header;
165 /** mapi element 0x1013 */
186 pst_string htmlbody; 166 pst_string htmlbody;
187 /** 0=low, 1=normal, 2=high */ 167 /** mapi element 0x0017 PR_IMPORTANCE
168 * @li 0 low
169 * @li 1 normal
170 * @li 2 high */
188 int32_t importance; 171 int32_t importance;
172 /** mapi element 0x1042 */
189 pst_string in_reply_to; 173 pst_string in_reply_to;
190 /** 1 = true, 0 = false */ 174 /** mapi element 0x0058 PR_MESSAGE_CC_ME, this user is listed explicitly in the CC address
175 * @li 1 true
176 * @li 0 false */
191 int message_cc_me; 177 int message_cc_me;
192 /** 1 = true, 0 = false */ 178 /** mapi element 0x0059 PR_MESSAGE_RECIP_ME, this user appears in TO, CC or BCC address list
179 * @li 1 true
180 * @li 0 false */
193 int message_recip_me; 181 int message_recip_me;
194 /** 1 = true, 0 = false */ 182 /** mapi element 0x0057 PR_MESSAGE_TO_ME, this user is listed explicitly in the TO address
183 * @li 1 true
184 * @li 0 false */
195 int message_to_me; 185 int message_to_me;
186 /** mapi element 0x1035 */
196 pst_string messageid; 187 pst_string messageid;
197 /** 0=none, 1=personal, 2=private, 3=company confidential */ 188 /** mapi element 0x002e PR_ORIGINAL_SENSITIVITY
189 * @li 0=none
190 * @li 1=personal
191 * @li 2=private
192 * @li 3=company confidential */
198 int32_t original_sensitivity; 193 int32_t original_sensitivity;
194 /** mapi element 0x0072 PR_ORIGINAL_DISPLAY_BCC */
199 pst_string original_bcc; 195 pst_string original_bcc;
196 /** mapi element 0x0073 PR_ORIGINAL_DISPLAY_CC */
200 pst_string original_cc; 197 pst_string original_cc;
198 /** mapi element 0x0074 PR_ORIGINAL_DISPLAY_TO */
201 pst_string original_to; 199 pst_string original_to;
200 /** mapi element 0x0051 PR_RECEIVED_BY_SEARCH_KEY */
202 pst_string outlook_recipient; 201 pst_string outlook_recipient;
202 /** mapi element 0x0044 PR_RCVD_REPRESENTING_NAME */
203 pst_string outlook_recipient_name; 203 pst_string outlook_recipient_name;
204 /** mapi element 0x0052 PR_RCVD_REPRESENTING_SEARCH_KEY */
204 pst_string outlook_recipient2; 205 pst_string outlook_recipient2;
206 /** mapi element 0x003b PR_SENT_REPRESENTING_SEARCH_KEY */
205 pst_string outlook_sender; 207 pst_string outlook_sender;
208 /** mapi element 0x0042 PR_SENT_REPRESENTING_NAME */
206 pst_string outlook_sender_name; 209 pst_string outlook_sender_name;
210 /** mapi element 0x0c1d PR_SENDER_SEARCH_KEY */
207 pst_string outlook_sender2; 211 pst_string outlook_sender2;
208 /** 0=nonurgent, 1=normal, 2=urgent */ 212 /** mapi element 0x0026 PR_PRIORITY
213 * @li 0 nonurgent
214 * @li 1 normal
215 * @li 2 urgent */
216 /** mapi element */
209 int32_t priority; 217 int32_t priority;
218 /** mapi element 0x0070 PR_CONVERSATION_TOPIC */
210 pst_string processed_subject; 219 pst_string processed_subject;
211 /** 1 = true, 0 = false */ 220 /** mapi element 0x0029 PR_READ_RECEIPT_REQUESTED
221 * @li 1 true
222 * @li 0 false */
212 int read_receipt; 223 int read_receipt;
224 /** mapi element 0x0075 PR_RECEIVED_BY_ADDRTYPE */
213 pst_string recip_access; 225 pst_string recip_access;
226 /** mapi element 0x0076 PR_RECEIVED_BY_EMAIL_ADDRESS */
214 pst_string recip_address; 227 pst_string recip_address;
228 /** mapi element 0x0077 PR_RCVD_REPRESENTING_ADDRTYPE */
215 pst_string recip2_access; 229 pst_string recip2_access;
230 /** mapi element 0x0078 PR_RCVD_REPRESENTING_EMAIL_ADDRESS */
216 pst_string recip2_address; 231 pst_string recip2_address;
217 /** 1 = true, 0 = false */ 232 /** mapi element 0x0c17 PR_REPLY_REQUESTED
233 * @li 1 true
234 * @li 0 false */
218 int reply_requested; 235 int reply_requested;
236 /** mapi element 0x0050 PR_REPLY_RECIPIENT_NAMES */
219 pst_string reply_to; 237 pst_string reply_to;
238 /** mapi element 0x1046, this seems to be the message-id of the rfc822 mail that is being returned */
220 pst_string return_path_address; 239 pst_string return_path_address;
240 /** mapi element 0x1007 PR_RTF_SYNC_BODY_COUNT,
241 * a count of the *significant* charcters in the rtf body. Doesn't count
242 * whitespace and other ignorable characters. */
221 int32_t rtf_body_char_count; 243 int32_t rtf_body_char_count;
244 /** mapi element 0x1006 PR_RTF_SYNC_BODY_CRC */
222 int32_t rtf_body_crc; 245 int32_t rtf_body_crc;
246 /** mapi element 0x1008 PR_RTF_SYNC_BODY_TAG,
247 * the first couple of lines of RTF body so that after modification, then beginning can
248 * once again be found. */
223 pst_string rtf_body_tag; 249 pst_string rtf_body_tag;
250 /** mapi element 0x1009 PR_RTF_COMPRESSED */
224 pst_binary rtf_compressed; 251 pst_binary rtf_compressed;
225 /** 1 = true, 0 = false */ 252 /** mapi element 0x0e1f PR_RTF_IN_SYNC,
253 * True means that the rtf version is same as text body.
254 * False means rtf version is more up-to-date than text body.
255 * If this value doesn't exist, text body is more up-to-date than rtf and
256 * cannot update to the rtf.
257 * @li 1 true
258 * @li 0 false */
226 int rtf_in_sync; 259 int rtf_in_sync;
260 /** mapi element 0x1010 PR_RTF_SYNC_PREFIX_COUNT,
261 * a count of the ignored characters before the first significant character */
227 int32_t rtf_ws_prefix_count; 262 int32_t rtf_ws_prefix_count;
263 /** mapi element 0x1011 PR_RTF_SYNC_TRAILING_COUNT,
264 * a count of the ignored characters after the last significant character */
228 int32_t rtf_ws_trailing_count; 265 int32_t rtf_ws_trailing_count;
266 /** mapi element 0x0064 PR_SENT_REPRESENTING_ADDRTYPE */
229 pst_string sender_access; 267 pst_string sender_access;
268 /** mapi element 0x0065 PR_SENT_REPRESENTING_EMAIL_ADDRESS */
230 pst_string sender_address; 269 pst_string sender_address;
270 /** mapi element 0x0c1e PR_SENDER_ADDRTYPE */
231 pst_string sender2_access; 271 pst_string sender2_access;
272 /** mapi element 0x0c1f PR_SENDER_EMAIL_ADDRESS */
232 pst_string sender2_address; 273 pst_string sender2_address;
233 /** 0=none, 1=personal, 2=private, 3=company confidential */ 274 /** mapi element 0x0036 PR_SENSITIVITY
275 * @li 0=none
276 * @li 1=personal
277 * @li 2=private
278 * @li 3=company confidential */
234 int32_t sensitivity; 279 int32_t sensitivity;
280 /** mapi element 0x0039 PR_CLIENT_SUBMIT_TIME */
235 FILETIME *sent_date; 281 FILETIME *sent_date;
282 /** mapi element 0x0e0a PR_SENTMAIL_ENTRYID */
236 pst_entryid *sentmail_folder; 283 pst_entryid *sentmail_folder;
284 /** mapi element 0x0e04 PR_DISPLAY_TO */
237 pst_string sentto_address; 285 pst_string sentto_address;
238 // delivery report fields 286 /** mapi element 0x1001 PR_REPORT_TEXT, delivery report dsn body */
239 pst_string report_text; 287 pst_string report_text;
288 /** mapi element 0x0032 PR_REPORT_TIME, delivery report time */
240 FILETIME *report_time; 289 FILETIME *report_time;
290 /** mapi element 0x0c04 PR_NDR_REASON_CODE */
241 int32_t ndr_reason_code; 291 int32_t ndr_reason_code;
292 /** mapi element 0x0c05 PR_NDR_DIAG_CODE */
242 int32_t ndr_diag_code; 293 int32_t ndr_diag_code;
294 /** mapi element 0x0c1b PR_SUPPLEMENTARY_INFO */
243 pst_string supplementary_info; 295 pst_string supplementary_info;
296 /** mapi element 0x0c20 PR_NDR_STATUS_CODE */
244 int32_t ndr_status_code; 297 int32_t ndr_status_code;
245 } pst_item_email; 298 } pst_item_email;
246 299
247 300
301 /** This contains the folder related mapi elements
302 */
248 typedef struct pst_item_folder { 303 typedef struct pst_item_folder {
304 /** mapi element 0x3602 PR_CONTENT_COUNT */
249 int32_t item_count; 305 int32_t item_count;
306 /** mapi element 0x3603 PR_CONTENT_UNREAD */
250 int32_t unseen_item_count; 307 int32_t unseen_item_count;
308 /** mapi element 0x3617 PR_ASSOC_CONTENT_COUNT
309 Associated content are items that are attached to this folder, but are hidden from users.
310 */
251 int32_t assoc_count; 311 int32_t assoc_count;
252 /** 1 = true, 0 = false */ 312 /** mapi element 0x360a PR_SUBFOLDERS
313 * @li 1 true
314 * @li 0 false */
315 /** mapi element */
253 int subfolder; 316 int subfolder;
254 } pst_item_folder; 317 } pst_item_folder;
255 318
256 319
320 /** This contains the message store related mapi elements
321 */
257 typedef struct pst_item_message_store { 322 typedef struct pst_item_message_store {
258 pst_entryid *top_of_personal_folder; // 0x35e0 323 /** mapi element 0x35e0 */
259 pst_entryid *default_outbox_folder; // 0x35e2 324 pst_entryid *top_of_personal_folder;
260 pst_entryid *deleted_items_folder; // 0x35e3 325 /** mapi element 0x35e2 */
261 pst_entryid *sent_items_folder; // 0x35e4 326 pst_entryid *default_outbox_folder;
262 pst_entryid *user_views_folder; // 0x35e5 327 /** mapi element 0x35e3 */
263 pst_entryid *common_view_folder; // 0x35e6 328 pst_entryid *deleted_items_folder;
264 pst_entryid *search_root_folder; // 0x35e7 329 /** mapi element 0x35e4 */
265 pst_entryid *top_of_folder; // 0x7c07 330 pst_entryid *sent_items_folder;
266 /** what folders the message store contains 331 /** mapi element 0x35e5 */
267 @li FOLDER_IPM_SUBTREE_VALID 0x1 332 pst_entryid *user_views_folder;
268 @li FOLDER_IPM_INBOX_VALID 0x2 333 /** mapi element 0x35e6 */
269 @li FOLDER_IPM_OUTBOX_VALID 0x4 334 pst_entryid *common_view_folder;
270 @li FOLDER_IPM_WASTEBOX_VALID 0x8 335 /** mapi element 0x35e7 */
271 @li FOLDER_IPM_SENTMAIL_VALID 0x10 336 pst_entryid *search_root_folder;
272 @li FOLDER_VIEWS_VALID 0x20 337 /** mapi element 0x7c07 */
273 @li FOLDER_COMMON_VIEWS_VALID 0x40 338 pst_entryid *top_of_folder;
274 @li FOLDER_FINDER_VALID 0x80 339 /** mapi element 0x35df,
275 */ 340 * bit mask of folders in this message store
276 int32_t valid_mask; // 0x35df 341 * @li 0x1 FOLDER_IPM_SUBTREE_VALID
277 int32_t pwd_chksum; // 0x76ff 342 * @li 0x2 FOLDER_IPM_INBOX_VALID
343 * @li 0x4 FOLDER_IPM_OUTBOX_VALID
344 * @li 0x8 FOLDER_IPM_WASTEBOX_VALID
345 * @li 0x10 FOLDER_IPM_SENTMAIL_VALID
346 * @li 0x20 FOLDER_VIEWS_VALID
347 * @li 0x40 FOLDER_COMMON_VIEWS_VALID
348 * @li 0x80 FOLDER_FINDER_VALID */
349 int32_t valid_mask;
350 /** mapi element 0x76ff */
351 int32_t pwd_chksum;
278 } pst_item_message_store; 352 } pst_item_message_store;
279 353
280 354
281 /** This struct defines a contact 355 /** This contains the contact related mapi elements
282 */ 356 */
283 typedef struct pst_item_contact { 357 typedef struct pst_item_contact {
358 /** Unused - need to find the proper mapi element number for this */
284 pst_string access_method; 359 pst_string access_method;
360 /** mapi element 0x3a00 PR_ACCOUNT */
285 pst_string account_name; 361 pst_string account_name;
362 /** mapi element 0x3003 PR_EMAIL_ADDRESS, or 0x8083 */
286 pst_string address1; 363 pst_string address1;
364 /** mapi element 0x8085 */
287 pst_string address1a; 365 pst_string address1a;
366 /** mapi element 0x8084 */
288 pst_string address1_desc; 367 pst_string address1_desc;
368 /** mapi element 0x3002 PR_ADDRTYPE, or 0x8082 */
289 pst_string address1_transport; 369 pst_string address1_transport;
370 /** mapi element 0x8093 */
290 pst_string address2; 371 pst_string address2;
372 /** mapi element 0x8095 */
291 pst_string address2a; 373 pst_string address2a;
374 /** mapi element 0x8094 */
292 pst_string address2_desc; 375 pst_string address2_desc;
376 /** mapi element 0x8092 */
293 pst_string address2_transport; 377 pst_string address2_transport;
378 /** mapi element 0x80a3 */
294 pst_string address3; 379 pst_string address3;
380 /** mapi element 0x80a5 */
295 pst_string address3a; 381 pst_string address3a;
382 /** mapi element 0x80a4 */
296 pst_string address3_desc; 383 pst_string address3_desc;
384 /** mapi element 0x80a2 */
297 pst_string address3_transport; 385 pst_string address3_transport;
386 /** mapi element 0x3a30 PR_ASSISTANT */
298 pst_string assistant_name; 387 pst_string assistant_name;
388 /** mapi element 0x3a2e PR_ASSISTANT_TELEPHONE_NUMBER */
299 pst_string assistant_phone; 389 pst_string assistant_phone;
390 /** mapi element 0x8535 */
300 pst_string billing_information; 391 pst_string billing_information;
392 /** mapi element 0x3a42 PR_BIRTHDAY */
301 FILETIME *birthday; 393 FILETIME *birthday;
302 pst_string business_address; // 0x801b 394 /** mapi element 0x801b */
395 pst_string business_address;
396 /** mapi element 0x3a27 PR_BUSINESS_ADDRESS_CITY */
303 pst_string business_city; 397 pst_string business_city;
398 /** mapi element 0x3a26 PR_BUSINESS_ADDRESS_COUNTRY */
304 pst_string business_country; 399 pst_string business_country;
400 /** mapi element 0x3a24 PR_BUSINESS_FAX_NUMBER */
305 pst_string business_fax; 401 pst_string business_fax;
402 /** mapi element 0x3a51 PR_BUSINESS_HOME_PAGE */
306 pst_string business_homepage; 403 pst_string business_homepage;
404 /** mapi element 0x3a08 PR_BUSINESS_TELEPHONE_NUMBER */
307 pst_string business_phone; 405 pst_string business_phone;
406 /** mapi element 0x3a1b PR_BUSINESS2_TELEPHONE_NUMBER */
308 pst_string business_phone2; 407 pst_string business_phone2;
408 /** mapi element 0x3a2b PR_BUSINESS_PO_BOX */
309 pst_string business_po_box; 409 pst_string business_po_box;
410 /** mapi element 0x3a2a PR_BUSINESS_POSTAL_CODE */
310 pst_string business_postal_code; 411 pst_string business_postal_code;
412 /** mapi element 0x3a28 PR_BUSINESS_ADDRESS_STATE_OR_PROVINCE */
311 pst_string business_state; 413 pst_string business_state;
414 /** mapi element 0x3a29 PR_BUSINESS_ADDRESS_STREET */
312 pst_string business_street; 415 pst_string business_street;
416 /** mapi element 0x3a02 PR_CALLBACK_TELEPHONE_NUMBER */
313 pst_string callback_phone; 417 pst_string callback_phone;
418 /** mapi element 0x3a1e PR_CAR_TELEPHONE_NUMBER */
314 pst_string car_phone; 419 pst_string car_phone;
420 /** mapi element 0x3a57 PR_COMPANY_MAIN_PHONE_NUMBER */
315 pst_string company_main_phone; 421 pst_string company_main_phone;
422 /** mapi element 0x3a16 PR_COMPANY_NAME */
316 pst_string company_name; 423 pst_string company_name;
424 /** mapi element 0x3a49 PR_COMPUTER_NETWORK_NAME */
317 pst_string computer_name; 425 pst_string computer_name;
426 /** mapi element 0x3a4a PR_CUSTOMER_ID */
318 pst_string customer_id; 427 pst_string customer_id;
428 /** mapi element 0x3a15 PR_POSTAL_ADDRESS */
319 pst_string def_postal_address; 429 pst_string def_postal_address;
430 /** mapi element 0x3a18 PR_DEPARTMENT_NAME */
320 pst_string department; 431 pst_string department;
432 /** mapi element 0x3a45 PR_DISPLAY_NAME_PREFIX */
321 pst_string display_name_prefix; 433 pst_string display_name_prefix;
434 /** mapi element 0x3a06 PR_GIVEN_NAME */
322 pst_string first_name; 435 pst_string first_name;
436 /** mapi element 0x8530 */
323 pst_string followup; 437 pst_string followup;
438 /** mapi element 0x80d8 */
324 pst_string free_busy_address; 439 pst_string free_busy_address;
440 /** mapi element 0x3a4c PR_FTP_SITE */
325 pst_string ftp_site; 441 pst_string ftp_site;
442 /** mapi element 0x8005 */
326 pst_string fullname; 443 pst_string fullname;
327 /** 0=unspecified, 1=female, 2=male */ 444 /** mapi element 0x3a4d PR_GENDER
445 * @li 0 unspecified
446 * @li 1 female
447 * @li 2 male */
328 int16_t gender; 448 int16_t gender;
449 /** mapi element 0x3a07 PR_GOVERNMENT_ID_NUMBER */
329 pst_string gov_id; 450 pst_string gov_id;
451 /** mapi element 0x3a43 PR_HOBBIES */
330 pst_string hobbies; 452 pst_string hobbies;
331 pst_string home_address; // 0x801a 453 /** mapi element 0x801a */
454 pst_string home_address;
455 /** mapi element 0x3a59 PR_HOME_ADDRESS_CITY */
332 pst_string home_city; 456 pst_string home_city;
457 /** mapi element 0x3a5a PR_HOME_ADDRESS_COUNTRY */
333 pst_string home_country; 458 pst_string home_country;
459 /** mapi element 0x3a25 PR_HOME_FAX_NUMBER */
334 pst_string home_fax; 460 pst_string home_fax;
461 /** mapi element 0x3a09 PR_HOME_TELEPHONE_NUMBER */
335 pst_string home_phone; 462 pst_string home_phone;
463 /** mapi element 0x3a2f PR_HOME2_TELEPHONE_NUMBER */
336 pst_string home_phone2; 464 pst_string home_phone2;
465 /** mapi element 0x3a5e PR_HOME_ADDRESS_POST_OFFICE_BOX */
337 pst_string home_po_box; 466 pst_string home_po_box;
467 /** mapi element 0x3a5b PR_HOME_ADDRESS_POSTAL_CODE */
338 pst_string home_postal_code; 468 pst_string home_postal_code;
469 /** mapi element 0x3a5c PR_HOME_ADDRESS_STATE_OR_PROVINCE */
339 pst_string home_state; 470 pst_string home_state;
471 /** mapi element 0x3a5d PR_HOME_ADDRESS_STREET */
340 pst_string home_street; 472 pst_string home_street;
473 /** mapi element 0x3a0a PR_INITIALS */
341 pst_string initials; 474 pst_string initials;
475 /** mapi element 0x3a2d PR_ISDN_NUMBER */
342 pst_string isdn_phone; 476 pst_string isdn_phone;
477 /** mapi element 0x3a17 PR_TITLE */
343 pst_string job_title; 478 pst_string job_title;
479 /** mapi element 0x3a0b PR_KEYWORD */
344 pst_string keyword; 480 pst_string keyword;
481 /** mapi element 0x3a0c PR_LANGUAGE */
345 pst_string language; 482 pst_string language;
483 /** mapi element 0x3a0d PR_LOCATION */
346 pst_string location; 484 pst_string location;
347 /** 1 = true, 0 = false */ 485 /** mapi element 0x3a0e PR_MAIL_PERMISSION
486 * @li 1 true
487 * @li 0 false */
348 int mail_permission; 488 int mail_permission;
489 /** mapi element 0x3a4e PR_MANAGER_NAME */
349 pst_string manager_name; 490 pst_string manager_name;
491 /** mapi element 0x3a44 PR_MIDDLE_NAME */
350 pst_string middle_name; 492 pst_string middle_name;
493 /** mapi element 0x8534 */
351 pst_string mileage; 494 pst_string mileage;
495 /** mapi element 0x3a1c PR_MOBILE_TELEPHONE_NUMBER */
352 pst_string mobile_phone; 496 pst_string mobile_phone;
497 /** mapi element 0x3a4f PR_NICKNAME */
353 pst_string nickname; 498 pst_string nickname;
499 /** mapi element 0x3a19 PR_OFFICE_LOCATION */
354 pst_string office_loc; 500 pst_string office_loc;
501 /** mapi element 0x3a0f PR_MHS_COMMON_NAME */
355 pst_string common_name; 502 pst_string common_name;
503 /** mapi element 0x3a10 PR_ORGANIZATIONAL_ID_NUMBER */
356 pst_string org_id; 504 pst_string org_id;
357 pst_string other_address; // 0x801c 505 /** mapi element 0x801c */
506 pst_string other_address;
507 /** mapi element 0x3a5f PR_OTHER_ADDRESS_CITY */
358 pst_string other_city; 508 pst_string other_city;
509 /** mapi element 0x3a60 PR_OTHER_ADDRESS_COUNTRY */
359 pst_string other_country; 510 pst_string other_country;
511 /** mapi element 0x3a1f PR_OTHER_TELEPHONE_NUMBER */
360 pst_string other_phone; 512 pst_string other_phone;
513 /** mapi element 0x3a64 PR_OTHER_ADDRESS_POST_OFFICE_BOX */
361 pst_string other_po_box; 514 pst_string other_po_box;
515 /** mapi element 0x3a61 PR_OTHER_ADDRESS_POSTAL_CODE */
362 pst_string other_postal_code; 516 pst_string other_postal_code;
517 /** mapi element 0x3a62 PR_OTHER_ADDRESS_STATE_OR_PROVINCE */
363 pst_string other_state; 518 pst_string other_state;
519 /** mapi element 0x3a63 PR_OTHER_ADDRESS_STREET */
364 pst_string other_street; 520 pst_string other_street;
521 /** mapi element 0x3a21 PR_PAGER_TELEPHONE_NUMBER */
365 pst_string pager_phone; 522 pst_string pager_phone;
523 /** mapi element 0x3a50 PR_PERSONAL_HOME_PAGE */
366 pst_string personal_homepage; 524 pst_string personal_homepage;
525 /** mapi element 0x3a47 PR_PREFERRED_BY_NAME */
367 pst_string pref_name; 526 pst_string pref_name;
527 /** mapi element 0x3a23 PR_PRIMARY_FAX_NUMBER */
368 pst_string primary_fax; 528 pst_string primary_fax;
529 /** mapi element 0x3a1a PR_PRIMARY_TELEPHONE_NUMBER */
369 pst_string primary_phone; 530 pst_string primary_phone;
531 /** mapi element 0x3a46 PR_PROFESSION */
370 pst_string profession; 532 pst_string profession;
533 /** mapi element 0x3a1d PR_RADIO_TELEPHONE_NUMBER */
371 pst_string radio_phone; 534 pst_string radio_phone;
372 /** 1 = true, 0 = false */ 535 /** mapi element 0x3a40 PR_SEND_RICH_INFO
536 * @li 1 true
537 * @li 0 false */
373 int rich_text; 538 int rich_text;
539 /** mapi element 0x3a48 PR_SPOUSE_NAME */
374 pst_string spouse_name; 540 pst_string spouse_name;
541 /** mapi element 0x3a05 PR_GENERATION (Jr., Sr., III, etc) */
375 pst_string suffix; 542 pst_string suffix;
543 /** mapi element 0x3a11 PR_SURNAME */
376 pst_string surname; 544 pst_string surname;
545 /** mapi element 0x3a2c PR_TELEX_NUMBER */
377 pst_string telex; 546 pst_string telex;
547 /** mapi element 0x3a20 PR_TRANSMITTABLE_DISPLAY_NAME */
378 pst_string transmittable_display_name; 548 pst_string transmittable_display_name;
549 /** mapi element 0x3a4b PR_TTYTDD_PHONE_NUMBER */
379 pst_string ttytdd_phone; 550 pst_string ttytdd_phone;
551 /** mapi element 0x3a41 PR_WEDDING_ANNIVERSARY */
380 FILETIME *wedding_anniversary; 552 FILETIME *wedding_anniversary;
381 pst_string work_address_street; // 0x8045 553 /** mapi element 0x8045 */
382 pst_string work_address_city; // 0x8046 554 pst_string work_address_street;
383 pst_string work_address_state; // 0x8047 555 /** mapi element 0x8046 */
384 pst_string work_address_postalcode; // 0x8048 556 pst_string work_address_city;
385 pst_string work_address_country; // 0x8049 557 /** mapi element 0x8047 */
386 pst_string work_address_postofficebox; // 0x804a 558 pst_string work_address_state;
559 /** mapi element 0x8048 */
560 pst_string work_address_postalcode;
561 /** mapi element 0x8049 */
562 pst_string work_address_country;
563 /** mapi element 0x804a */
564 pst_string work_address_postofficebox;
387 } pst_item_contact; 565 } pst_item_contact;
388 566
389 567
568 /** This contains the attachment related mapi elements
569 */
390 typedef struct pst_item_attach { 570 typedef struct pst_item_attach {
571 /** mapi element 0x3704 PR_ATTACH_FILENAME */
391 pst_string filename1; 572 pst_string filename1;
573 /** mapi element 0x3707 PR_ATTACH_LONG_FILENAME */
392 pst_string filename2; 574 pst_string filename2;
575 /** mapi element 0x370e PR_ATTACH_MIME_TAG */
393 pst_string mimetype; 576 pst_string mimetype;
577 /** mapi element 0x3701 PR_ATTACH_DATA_OBJ */
394 pst_binary data; 578 pst_binary data;
579 /** only used if the attachment is by reference, in which case this is the id2 reference */
395 uint64_t id2_val; 580 uint64_t id2_val;
396 /** calculated from id2_val during creation of record */ 581 /** calculated from id2_val during creation of record */
397 uint64_t i_id; 582 uint64_t i_id;
398 /** deep copy from child */ 583 /** id2 tree needed to resolve attachments by reference */
399 pst_id2_tree *id2_head; 584 pst_id2_tree *id2_head;
400 /** 0=no attachment, 1=attach by value, 2=attach by reference, 3=attach by reference resolve, 4=attach by reference only, 5=embedded message, 6=OLE */ 585 /** mapi element 0x3705 PR_ATTACH_METHOD
586 * @li 0 no attachment
587 * @li 1 attach by value
588 * @li 2 attach by reference
589 * @li 3 attach by reference resolve
590 * @li 4 attach by reference only
591 * @li 5 embedded message
592 * @li 6 OLE */
401 int32_t method; 593 int32_t method;
594 /** mapi element 0x370b PR_RENDERING_POSITION */
402 int32_t position; 595 int32_t position;
596 /** mapi element 0x3710 PR_ATTACH_MIME_SEQUENCE */
403 int32_t sequence; 597 int32_t sequence;
404 struct pst_item_attach *next; 598 struct pst_item_attach *next;
405 } pst_item_attach; 599 } pst_item_attach;
406 600
407 601
602 /** linked list of extra header fields */
408 typedef struct pst_item_extra_field { 603 typedef struct pst_item_extra_field {
409 char *field_name; 604 char *field_name;
410 char *value; 605 char *value;
411 struct pst_item_extra_field *next; 606 struct pst_item_extra_field *next;
412 } pst_item_extra_field; 607 } pst_item_extra_field;
413 608
414 609
415 /** This struct defines a journal entry 610 /** This contains the journal related mapi elements
416 */ 611 */
417 typedef struct pst_item_journal { 612 typedef struct pst_item_journal {
613 /** mapi element 0x8708 */
418 FILETIME *end; 614 FILETIME *end;
615 /** mapi element 0x8706 */
419 FILETIME *start; 616 FILETIME *start;
617 /** mapi element 0x8700 */
420 pst_string type; 618 pst_string type;
619 /** mapi element 0x8712 */
421 pst_string description; 620 pst_string description;
422 } pst_item_journal; 621 } pst_item_journal;
423 622
424 623
425 /** This struct defines an appointment 624 /** This contains the appointment related mapi elements
426 */ 625 */
427 typedef struct pst_item_appointment { 626 typedef struct pst_item_appointment {
627 /** mapi element 0x820e PR_OUTLOOK_EVENT_START_END */
428 FILETIME *end; 628 FILETIME *end;
629 /** mapi element 0x8208 PR_OUTLOOK_EVENT_LOCATION */
429 pst_string location; 630 pst_string location;
430 /** 1 = true, 0 = false */ 631 /** mapi element 0x8503 PR_OUTLOOK_COMMON_REMINDER_SET
632 * @li 1 true
633 * @li 0 false */
431 int alarm; 634 int alarm;
635 /** mapi element 0x8560 */
432 FILETIME *reminder; 636 FILETIME *reminder;
637 /** mapi element 0x8501 PR_OUTLOOK_COMMON_REMINDER_MINUTES_BEFORE */
433 int32_t alarm_minutes; 638 int32_t alarm_minutes;
639 /** mapi element 0x851f */
434 pst_string alarm_filename; 640 pst_string alarm_filename;
641 /** mapi element 0x820d PR_OUTLOOK_EVENT_START_DATE */
435 FILETIME *start; 642 FILETIME *start;
643 /** mapi element 0x8234 */
436 pst_string timezonestring; 644 pst_string timezonestring;
437 /** 0=free, 1=tentative, 2=busy, 3=out of office*/ 645 /** mapi element 0x8205 PR_OUTLOOK_EVENT_SHOW_TIME_AS
646 * @li 0 free
647 * @li 1 tentative
648 * @li 2 busy
649 * @li 3 out of office*/
438 int32_t showas; 650 int32_t showas;
439 /** @li 0=None 651 /** mapi element 0x8214
440 @li 1=Important 652 * @li 0 None
441 @li 2=Business 653 * @li 1 Important
442 @li 3=Personal 654 * @li 2 Business
443 @li 4=Vacation 655 * @li 3 Personal
444 @li 5=Must Attend 656 * @li 4 Vacation
445 @li 6=Travel Required 657 * @li 5 Must Attend
446 @li 7=Needs Preparation 658 * @li 6 Travel Required
447 @li 8=Birthday 659 * @li 7 Needs Preparation
448 @li 9=Anniversary 660 * @li 8 Birthday
449 @li 10=Phone Call 661 * @li 9 Anniversary
450 */ 662 * @li 10 Phone Call */
451 int32_t label; 663 int32_t label;
452 /** 1 = true, 0 = false */ 664 /** mapi element 0x8215 PR_OUTLOOK_EVENT_ALL_DAY
665 * @li 1 true
666 * @li 0 false */
453 int all_day; 667 int all_day;
454 /** recurrence description */ 668 /** mapi element 0x8232 recurrence description */
455 pst_string recurrence; 669 pst_string recurrence;
456 /** 0=none, 1=daily, 2=weekly, 3=monthly, 4=yearly */ 670 /** mapi element 0x8231
671 * @li 0 none
672 * @li 1 daily
673 * @li 2 weekly
674 * @li 3 monthly
675 * @li 4 yearly */
457 int32_t recurrence_type; 676 int32_t recurrence_type;
677 /** mapi element 0x8235 PR_OUTLOOK_EVENT_RECURRENCE_START */
458 FILETIME *recurrence_start; 678 FILETIME *recurrence_start;
679 /** mapi element 0x8236 PR_OUTLOOK_EVENT_RECURRENCE_END */
459 FILETIME *recurrence_end; 680 FILETIME *recurrence_end;
460 } pst_item_appointment; 681 } pst_item_appointment;
461 682
462 683
684 /** This contains the common mapi elements, and pointers to structures for each major mapi item type */
463 typedef struct pst_item { 685 typedef struct pst_item {
464 pst_item_email *email; // data referring to email 686 /** email mapi elements */
465 pst_item_folder *folder; // data referring to folder 687 pst_item_email *email;
466 pst_item_contact *contact; // data referring to contact 688 /** folder mapi elements */
467 pst_item_attach *attach; // linked list of attachments 689 pst_item_folder *folder;
468 pst_item_message_store *message_store; // data referring to the message store 690 /** contact mapi elements */
469 pst_item_extra_field *extra_fields; // linked list of extra headers and such 691 pst_item_contact *contact;
470 pst_item_journal *journal; // data referring to a journal entry 692 /** linked list of attachments */
471 pst_item_appointment *appointment; // data referring to a calendar entry 693 pst_item_attach *attach;
694 /** message store mapi elements */
695 pst_item_message_store *message_store;
696 /** linked list of extra headers and such */
697 pst_item_extra_field *extra_fields;
698 /** journal mapi elements */
699 pst_item_journal *journal;
700 /** calendar mapi elements */
701 pst_item_appointment *appointment;
702 /** derived from mapi elements 0x001a PR_MESSAGE_CLASS or 0x3613 PR_CONTAINER_CLASS
703 * @li 1 PST_TYPE_NOTE
704 * @li 8 PST_TYPE_APPOINTMENT
705 * @li 9 PST_TYPE_CONTACT
706 * @li 10 PST_TYPE_JOURNAL
707 * @li 11 PST_TYPE_STICKYNOTE
708 * @li 12 PST_TYPE_TASK
709 * @li 13 PST_TYPE_OTHER
710 * @li 14 PST_TYPE_REPORT */
472 int type; 711 int type;
712 /** mapi element 0x001a PR_MESSAGE_CLASS or 0x3613 PR_CONTAINER_CLASS */
473 char *ascii_type; 713 char *ascii_type;
474 /** @li 0x01 - Read 714 /** mapi element 0x0e07 PR_MESSAGE_FLAGS
475 @li 0x02 - Unmodified 715 * @li 0x01 Read
476 @li 0x04 - Submit 716 * @li 0x02 Unmodified
477 @li 0x08 - Unsent 717 * @li 0x04 Submit
478 @li 0x10 - Has Attachments 718 * @li 0x08 Unsent
479 @li 0x20 - From Me 719 * @li 0x10 Has Attachments
480 @li 0x40 - Associated 720 * @li 0x20 From Me
481 @li 0x80 - Resend 721 * @li 0x40 Associated
482 @li 0x100 - RN Pending 722 * @li 0x80 Resend
483 @li 0x200 - NRN Pending 723 * @li 0x100 RN Pending
484 */ 724 * @li 0x200 NRN Pending */
485 int32_t flags; 725 int32_t flags;
726 /** mapi element 0x3001 PR_DISPLAY_NAME */
486 pst_string file_as; 727 pst_string file_as;
728 /** mapi element 0x3004 PR_COMMENT */
487 pst_string comment; 729 pst_string comment;
488 /** null if not specified */ 730 /** derived from extra_fields["content-type"] if it contains a charset= subfield */
489 pst_string body_charset; 731 pst_string body_charset;
490 /** used by email and journal types */ 732 /** mapi element 0x1000 PR_BODY */
491 pst_string body; 733 pst_string body;
492 /** used by email and journal types */ 734 /** mapi element 0x0037 PR_SUBJECT */
493 pst_string subject; 735 pst_string subject;
736 /** mapi element 0x3fde PR_INTERNET_CPID */
494 int32_t internet_cpid; 737 int32_t internet_cpid;
738 /** mapi element 0x3ffd PR_MESSAGE_CODEPAGE */
495 int32_t message_codepage; 739 int32_t message_codepage;
740 /** mapi element 0x0e08 PR_MESSAGE_SIZE */
496 int32_t message_size; 741 int32_t message_size;
742 /** mapi element 0x8554 PR_OUTLOOK_VERSION */
497 pst_string outlook_version; 743 pst_string outlook_version;
744 /** mapi element 0x0ff9 PR_RECORD_KEY */
498 pst_binary record_key; 745 pst_binary record_key;
499 pst_binary predecessor_change; // was formerly stored in record_key 746 /** mapi element 0x65e3 PR_PREDECESSOR_CHANGE_LIST */
500 /** 1 = true, 0 = false */ 747 pst_binary predecessor_change;
748 /** mapi element 0x0063 PR_RESPONSE_REQUESTED
749 * @li 1 true
750 * @li 0 false */
501 int response_requested; 751 int response_requested;
752 /** mapi element 0x3007 PR_CREATION_TIME */
502 FILETIME *create_date; 753 FILETIME *create_date;
754 /** mapi element 0x3008 PR_LAST_MODIFICATION_TIME */
503 FILETIME *modify_date; 755 FILETIME *modify_date;
504 /** 1 = true, 0 = false */ 756 /** mapi element 0x002b PR_RECIPIENT_REASSIGNMENT_PROHIBITED
757 * @li 1 true
758 * @li 0 false */
505 int private_member; 759 int private_member;
506 } pst_item; 760 } pst_item;
507 761
508 762
763 /** linked list of extended attributes */
509 typedef struct pst_x_attrib_ll { 764 typedef struct pst_x_attrib_ll {
510 uint32_t type; 765 uint32_t type;
511 uint32_t mytype; 766 uint32_t mytype;
512 uint32_t map; 767 uint32_t map;
513 void *data; 768 void *data;
514 struct pst_x_attrib_ll *next; 769 struct pst_x_attrib_ll *next;
515 } pst_x_attrib_ll; 770 } pst_x_attrib_ll;
516 771
517 772
773 /** this is only used for internal debugging */
518 typedef struct pst_block_recorder { 774 typedef struct pst_block_recorder {
519 struct pst_block_recorder *next; 775 struct pst_block_recorder *next;
520 int64_t offset; 776 int64_t offset;
521 size_t size; 777 size_t size;
522 int readcount; 778 int readcount;
523 } pst_block_recorder; 779 } pst_block_recorder;
524 780
525 781
526 typedef struct pst_file { 782 typedef struct pst_file {
783 /** the head and tail of the linked list of index structures */
527 pst_index_ll *i_head, *i_tail; 784 pst_index_ll *i_head, *i_tail;
785 /** the head and tail of the top level of the descriptor tree */
528 pst_desc_tree *d_head, *d_tail; 786 pst_desc_tree *d_head, *d_tail;
787 /** the head of the extended attributes linked list */
529 pst_x_attrib_ll *x_head; 788 pst_x_attrib_ll *x_head;
789 /** the head of the block recorder, a debug artifact
790 * used to detect cases where we might read the same
791 * block multiple times while processing a pst file. */
530 pst_block_recorder *block_head; 792 pst_block_recorder *block_head;
531 793
532 /** 0 is 32-bit pst file, pre Outlook 2003; 794 /** @li 0 is 32-bit pst file, pre Outlook 2003;
533 * 1 is 64-bit pst file, Outlook 2003 and later 795 * @li 1 is 64-bit pst file, Outlook 2003 or later */
534 */
535 int do_read64; 796 int do_read64;
797 /** file offset of the first b-tree node in the index tree */
536 uint64_t index1; 798 uint64_t index1;
799 /** back pointer value in the first b-tree node in the index tree */
537 uint64_t index1_back; 800 uint64_t index1_back;
801 /** file offset of the first b-tree node in the descriptor tree*/
538 uint64_t index2; 802 uint64_t index2;
803 /** back pointer value in the first b-tree node in the descriptor tree */
539 uint64_t index2_back; 804 uint64_t index2_back;
540 FILE * fp; // file pointer to opened PST file 805 /** file pointer to opened PST file */
541 uint64_t size; // pst file size 806 FILE * fp;
542 unsigned char encryption; // pst encryption setting 807 /** size of the pst file */
543 unsigned char ind_type; // pst index type 808 uint64_t size;
809 /** @li 0 PST_NO_ENCRYPT, none
810 * @li 1 PST_COMP_ENCRYPT, simple byte substitution cipher with fixed key
811 * @li 2 PST_ENCRYPT, german enigma 3 rotor cipher with fixed key */
812 unsigned char encryption;
813 /** index type or file type
814 * @li 0x0e 32 bit pre Outlook 2003
815 * @li 0x0f 32 bit pre Outlook 2003
816 * @li 0x15 64 bit Outlook 2003 or later
817 * @li 0x17 64 bit Outlook 2003 or later */
818 unsigned char ind_type;
544 } pst_file; 819 } pst_file;
545 820
546 821
547 typedef struct pst_block_offset {
548 int16_t from;
549 int16_t to;
550 } pst_block_offset;
551
552
553 typedef struct pst_block_offset_pointer {
554 char *from;
555 char *to;
556 int needfree;
557 } pst_block_offset_pointer;
558
559
560 typedef struct pst_mapi_element {
561 uint32_t mapi_id;
562 char *data;
563 uint32_t type;
564 size_t size;
565 char *extra;
566 } pst_mapi_element;
567
568
569 typedef struct pst_mapi_object {
570 int32_t count_elements; // count of active elements
571 int32_t orig_count; // originally allocated elements
572 int32_t count_objects; // number of mapi objects in the list
573 struct pst_mapi_element **elements;
574 struct pst_mapi_object *next;
575 } pst_mapi_object;
576
577
578 typedef struct pst_holder {
579 char **buf;
580 FILE *fp;
581 int base64;
582 } pst_holder;
583
584
585 typedef struct pst_subblock {
586 char *buf;
587 size_t read_size;
588 size_t i_offset;
589 } pst_subblock;
590
591
592 typedef struct pst_subblocks {
593 size_t subblock_count;
594 pst_subblock *subs;
595 } pst_subblocks;
596
597
598 // prototypes
599 int pst_open(pst_file *pf, char *name); 822 int pst_open(pst_file *pf, char *name);
600 int pst_close(pst_file *pf); 823 int pst_close(pst_file *pf);
601 pst_desc_tree * pst_getTopOfFolders(pst_file *pf, pst_item *root); 824 pst_desc_tree* pst_getTopOfFolders(pst_file *pf, pst_item *root);
602 size_t pst_attach_to_file(pst_file *pf, pst_item_attach *attach, FILE* fp); 825 size_t pst_attach_to_file(pst_file *pf, pst_item_attach *attach, FILE* fp);
603 size_t pst_attach_to_file_base64(pst_file *pf, pst_item_attach *attach, FILE* fp); 826 size_t pst_attach_to_file_base64(pst_file *pf, pst_item_attach *attach, FILE* fp);
604 int pst_load_index (pst_file *pf); 827 int pst_load_index (pst_file *pf);
605 pst_desc_tree* pst_getNextDptr(pst_desc_tree* d); 828 pst_desc_tree* pst_getNextDptr(pst_desc_tree* d);
606 int pst_load_extended_attributes(pst_file *pf); 829 int pst_load_extended_attributes(pst_file *pf);
607 pst_item* pst_getItem(pst_file *pf, pst_desc_tree *d_ptr); 830 pst_item* pst_getItem(pst_file *pf, pst_desc_tree *d_ptr);
608 pst_item* pst_parse_item (pst_file *pf, pst_desc_tree *d_ptr, pst_id2_tree *m_head); 831 pst_item* pst_parse_item (pst_file *pf, pst_desc_tree *d_ptr, pst_id2_tree *m_head);
609 void pst_freeItem(pst_item *item); 832 void pst_freeItem(pst_item *item);
610 pst_index_ll* pst_getID(pst_file* pf, uint64_t i_id); 833 pst_index_ll* pst_getID(pst_file* pf, uint64_t i_id);
615 char * pst_rfc2426_escape(char *str); 838 char * pst_rfc2426_escape(char *str);
616 char * pst_rfc2425_datetime_format(FILETIME *ft); 839 char * pst_rfc2425_datetime_format(FILETIME *ft);
617 char * pst_rfc2445_datetime_format(FILETIME *ft); 840 char * pst_rfc2445_datetime_format(FILETIME *ft);
618 841
619 842
843 /** Convert a code page integer into a string suitable for iconv()
844 *
845 * @param cp the code page integer used in the pst file
846 * @return pointer to a static buffer holding the string representation of the
847 * equivalent iconv character set
848 */
620 const char* pst_codepage(int cp); 849 const char* pst_codepage(int cp);
850
851
852 /** Get the default character set for this item. This is used to find
853 * the charset for pst_string elements that are not already in utf8 encoding.
854 * @param item pointer to the mapi item of interest
855 * @return default character set as a string useable by iconv()
856 */
621 const char* pst_default_charset(pst_item *item); 857 const char* pst_default_charset(pst_item *item);
858
859
860 /** Convert str to utf8 if possible; null strings are preserved.
861 *
862 * @param item pointer to the containing mapi item
863 * @param str pointer to the mapi string of interest
864 */
622 void pst_convert_utf8_null(pst_item *item, pst_string *str); 865 void pst_convert_utf8_null(pst_item *item, pst_string *str);
866
867
868 /** Convert str to utf8 if possible; null strings are converted into empty strings.
869 *
870 * @param item pointer to the containing mapi item
871 * @param str pointer to the mapi string of interest
872 */
623 void pst_convert_utf8(pst_item *item, pst_string *str); 873 void pst_convert_utf8(pst_item *item, pst_string *str);
624 874
625 875
626 // switch from maximal packing back to default packing 876 // switch from maximal packing back to default packing
627 // undo the packing from the beginning of this file 877 // undo the packing from the beginning of this file