comparison src/libpst.h @ 46:b2a7f2e0926a

more fixes for 64 bit format
author carl
date Sat, 12 Jan 2008 15:20:53 -0800
parents d4606d460daf
children 5fb8d997feed
comparison
equal deleted inserted replaced
45:b961bcdadd0e 46:b2a7f2e0926a
1 /*** 1 /***
2 * libpst.h 2 * libpst.h
3 * Part of LibPST project 3 * Part of LibPST project
4 * Written by David Smith 4 * Written by David Smith
5 * dave.s@earthcorp.com 5 * dave.s@earthcorp.com
6 */ 6 */
7 // LibPST - Library for Accessing Outlook .pst files 7 // LibPST - Library for Accessing Outlook .pst files
8 // Dave Smith - davesmith@users.sourceforge.net 8 // Dave Smith - davesmith@users.sourceforge.net
9 9
10 #ifndef LIBPST_H 10 #ifndef LIBPST_H
33 #endif // defined _MSC_VER 33 #endif // defined _MSC_VER
34 34
35 #if BYTE_ORDER == BIG_ENDIAN 35 #if BYTE_ORDER == BIG_ENDIAN
36 # define LE64_CPU(x) \ 36 # define LE64_CPU(x) \
37 x = ((((x) & 0xff00000000000000) >> 56) | \ 37 x = ((((x) & 0xff00000000000000) >> 56) | \
38 (((x) & 0x00ff000000000000) >> 40) | \ 38 (((x) & 0x00ff000000000000) >> 40) | \
39 (((x) & 0x0000ff0000000000) >> 24) | \ 39 (((x) & 0x0000ff0000000000) >> 24) | \
40 (((x) & 0x000000ff00000000) >> 8 ) | \ 40 (((x) & 0x000000ff00000000) >> 8 ) | \
41 (((x) & 0x00000000ff000000) << 8 ) | \ 41 (((x) & 0x00000000ff000000) << 8 ) | \
42 (((x) & 0x0000000000ff0000) << 24) | \ 42 (((x) & 0x0000000000ff0000) << 24) | \
43 (((x) & 0x000000000000ff00) << 40) | \ 43 (((x) & 0x000000000000ff00) << 40) | \
44 (((x) & 0x00000000000000ff) << 56)); 44 (((x) & 0x00000000000000ff) << 56));
45 # define LE32_CPU(x) \ 45 # define LE32_CPU(x) \
46 x = ((((x) & 0xff000000) >> 24) | \ 46 x = ((((x) & 0xff000000) >> 24) | \
47 (((x) & 0x00ff0000) >> 8 ) | \ 47 (((x) & 0x00ff0000) >> 8 ) | \
48 (((x) & 0x0000ff00) << 8 ) | \ 48 (((x) & 0x0000ff00) << 8 ) | \
49 (((x) & 0x000000ff) << 24)); 49 (((x) & 0x000000ff) << 24));
50 # define LE16_CPU(x) \ 50 # define LE16_CPU(x) \
51 x = ((((x) & 0xff00) >> 8) | \ 51 x = ((((x) & 0xff00) >> 8) | \
52 (((x) & 0x00ff) << 8)); 52 (((x) & 0x00ff) << 8));
53 #elif BYTE_ORDER == LITTLE_ENDIAN 53 #elif BYTE_ORDER == LITTLE_ENDIAN
54 # define LE64_CPU(x) {} 54 # define LE64_CPU(x) {}
55 # define LE32_CPU(x) {} 55 # define LE32_CPU(x) {}
56 # define LE16_CPU(x) {} 56 # define LE16_CPU(x) {}
57 #else 57 #else
84 #define PST_NO_ENCRYPT 0 84 #define PST_NO_ENCRYPT 0
85 #define PST_COMP_ENCRYPT 1 85 #define PST_COMP_ENCRYPT 1
86 #define PST_ENCRYPT 2 86 #define PST_ENCRYPT 2
87 87
88 // defines different types of mappings 88 // defines different types of mappings
89 #define PST_MAP_ATTRIB 1 89 #define PST_MAP_ATTRIB (uint32_t)1
90 #define PST_MAP_HEADER 2 90 #define PST_MAP_HEADER (uint32_t)2
91 91
92 // define my custom email attributes. 92 // define my custom email attributes.
93 #define PST_ATTRIB_HEADER -1 93 #define PST_ATTRIB_HEADER -1
94 94
95 // defines types of free/busy values for appointment->showas 95 // defines types of free/busy values for appointment->showas
97 #define PST_FREEBUSY_TENTATIVE 1 97 #define PST_FREEBUSY_TENTATIVE 1
98 #define PST_FREEBUSY_BUSY 2 98 #define PST_FREEBUSY_BUSY 2
99 #define PST_FREEBUSY_OUT_OF_OFFICE 3 99 #define PST_FREEBUSY_OUT_OF_OFFICE 3
100 100
101 // defines labels for appointment->label 101 // defines labels for appointment->label
102 #define PST_APP_LABEL_NONE 0 // None 102 #define PST_APP_LABEL_NONE 0 // None
103 #define PST_APP_LABEL_IMPORTANT 1 // Important 103 #define PST_APP_LABEL_IMPORTANT 1 // Important
104 #define PST_APP_LABEL_BUSINESS 2 // Business 104 #define PST_APP_LABEL_BUSINESS 2 // Business
105 #define PST_APP_LABEL_PERSONAL 3 // Personal 105 #define PST_APP_LABEL_PERSONAL 3 // Personal
106 #define PST_APP_LABEL_VACATION 4 // Vacation 106 #define PST_APP_LABEL_VACATION 4 // Vacation
107 #define PST_APP_LABEL_MUST_ATTEND 5 // Must Attend 107 #define PST_APP_LABEL_MUST_ATTEND 5 // Must Attend
108 #define PST_APP_LABEL_TRAVEL_REQ 6 // Travel Required 108 #define PST_APP_LABEL_TRAVEL_REQ 6 // Travel Required
109 #define PST_APP_LABEL_NEEDS_PREP 7 // Needs Preparation 109 #define PST_APP_LABEL_NEEDS_PREP 7 // Needs Preparation
110 #define PST_APP_LABEL_BIRTHDAY 8 // Birthday 110 #define PST_APP_LABEL_BIRTHDAY 8 // Birthday
111 #define PST_APP_LABEL_ANNIVERSARY 9 // Anniversary 111 #define PST_APP_LABEL_ANNIVERSARY 9 // Anniversary
112 #define PST_APP_LABEL_PHONE_CALL 10// Phone Call 112 #define PST_APP_LABEL_PHONE_CALL 10// Phone Call
113 113
114 extern int do_read64; 114 typedef struct pst_misc_6_struct {
115
116 typedef struct _pst_misc_6_struct {
117 int32_t i1; 115 int32_t i1;
118 int32_t i2; 116 int32_t i2;
119 int32_t i3; 117 int32_t i3;
120 int32_t i4; 118 int32_t i4;
121 int32_t i5; 119 int32_t i5;
122 int32_t i6; 120 int32_t i6;
123 } pst_misc_6; 121 } pst_misc_6;
124 122
125 typedef struct _pst_entryid_struct { 123 typedef struct pst_entryid_struct {
126 int32_t u1; 124 int32_t u1;
127 char entryid[16]; 125 char entryid[16];
128 uint32_t id; 126 uint32_t id;
129 } pst_entryid; 127 } pst_entryid;
130 128
131 typedef struct _pst_desc_struct32 { 129 typedef struct pst_desc_struct32 {
132 uint32_t d_id; 130 uint32_t d_id;
133 uint32_t desc_id; 131 uint32_t desc_id;
134 uint32_t list_id; 132 uint32_t list_id;
135 uint32_t parent_id; 133 uint32_t parent_id;
136 } pst_desc32; 134 } pst_desc32;
137 135
138 typedef struct _pst_desc_structn { 136 typedef struct pst_desc_structn {
139 uint64_t d_id; 137 uint64_t d_id;
140 uint64_t desc_id; 138 uint64_t desc_id;
141 uint64_t list_id; 139 uint64_t list_id;
142 uint32_t parent_id; // not 64 bit ?? 140 uint32_t parent_id; // not 64 bit ??
143 uint32_t u1; // padding 141 uint32_t u1; // padding
144 } pst_descn; 142 } pst_descn;
145 143
146 typedef struct _pst_index_struct32 { 144 typedef struct pst_index_struct32 {
147 uint32_t id; 145 uint32_t id;
148 int32_t offset; 146 uint32_t offset;
149 uint16_t size; 147 uint16_t size;
150 int16_t u1; 148 int16_t u1;
151 } pst_index32; 149 } pst_index32;
152 150
153 typedef struct _pst_index_struct { 151 typedef struct pst_index_struct {
154 uint64_t id; 152 uint64_t id;
155 int64_t offset; 153 uint64_t offset;
156 uint16_t size; 154 uint16_t size;
157 int16_t u0; 155 int16_t u0;
158 int32_t u1; 156 int32_t u1;
159 } pst_index; 157 } pst_index;
160 158
161 typedef struct _pst_index_tree32 { 159 typedef struct pst_index_tree32 {
162 uint32_t id; 160 uint32_t id;
163 int32_t offset; 161 uint32_t offset;
164 int32_t size; 162 uint32_t size;
165 int32_t u1; 163 int32_t u1;
166 struct _pst_index_tree * next; 164 struct pst_index_tree * next;
167 } pst_index_ll32; 165 } pst_index_ll32;
168 166
169 typedef struct _pst_index_tree { 167 typedef struct pst_index_tree {
170 uint64_t id; 168 uint64_t id;
171 int64_t offset; 169 uint64_t offset;
172 int64_t size; 170 uint64_t size;
173 int64_t u1; 171 int64_t u1;
174 struct _pst_index_tree * next; 172 struct pst_index_tree * next;
175 } pst_index_ll; 173 } pst_index_ll;
176 174
177 typedef struct _pst_index2_tree { 175 typedef struct pst_index2_tree {
178 uint32_t id2; 176 uint64_t id2;
179 pst_index_ll *id; 177 pst_index_ll *id;
180 struct _pst_index2_tree * next; 178 struct pst_index2_tree * next;
181 } pst_index2_ll; 179 } pst_index2_ll;
182 180
183 typedef struct _pst_desc_tree { 181 typedef struct pst_desc_tree {
184 uint32_t id; 182 uint64_t id;
185 pst_index_ll * list_index; 183 pst_index_ll * list_index;
186 pst_index_ll * desc; 184 pst_index_ll * desc;
187 int32_t no_child; 185 int32_t no_child;
188 struct _pst_desc_tree * prev; 186 struct pst_desc_tree * prev;
189 struct _pst_desc_tree * next; 187 struct pst_desc_tree * next;
190 struct _pst_desc_tree * parent; 188 struct pst_desc_tree * parent;
191 struct _pst_desc_tree * child; 189 struct pst_desc_tree * child;
192 struct _pst_desc_tree * child_tail; 190 struct pst_desc_tree * child_tail;
193 } pst_desc_ll; 191 } pst_desc_ll;
194 192
195 typedef struct _pst_item_email_subject { 193 typedef struct pst_item_email_subject {
196 int32_t off1; 194 int32_t off1;
197 int32_t off2; 195 int32_t off2;
198 char *subj; 196 char *subj;
199 } pst_item_email_subject; 197 } pst_item_email_subject;
200 198
201 typedef struct _pst_item_email { 199 typedef struct pst_item_email {
202 FILETIME *arrival_date; 200 FILETIME *arrival_date;
203 int32_t autoforward; // 1 = true, 0 = not set, -1 = false 201 int32_t autoforward; // 1 = true, 0 = not set, -1 = false
204 char *body; 202 char *body;
205 char *cc_address; 203 char *cc_address;
206 char *common_name; 204 char *common_name;
207 int32_t conv_index; 205 int32_t conv_index;
208 int32_t conversion_prohib; 206 int32_t conversion_prohib;
209 int32_t delete_after_submit; // 1 = true, 0 = false 207 int32_t delete_after_submit; // 1 = true, 0 = false
210 int32_t delivery_report; // 1 = true, 0 = false 208 int32_t delivery_report; // 1 = true, 0 = false
211 char *encrypted_body; 209 char *encrypted_body;
212 int32_t encrypted_body_size; 210 int32_t encrypted_body_size;
213 char *encrypted_htmlbody; 211 char *encrypted_htmlbody;
214 int32_t encrypted_htmlbody_size; 212 int32_t encrypted_htmlbody_size;
215 int32_t flag; 213 int32_t flag;
216 char *header; 214 char *header;
217 char *htmlbody; 215 char *htmlbody;
218 int32_t importance; 216 int32_t importance;
219 char *in_reply_to; 217 char *in_reply_to;
220 int32_t message_cc_me; // 1 = true, 0 = false 218 int32_t message_cc_me; // 1 = true, 0 = false
221 int32_t message_recip_me; // 1 = true, 0 = false 219 int32_t message_recip_me; // 1 = true, 0 = false
222 int32_t message_to_me; // 1 = true, 0 = false 220 int32_t message_to_me; // 1 = true, 0 = false
223 char *messageid; 221 char *messageid;
224 int32_t orig_sensitivity; 222 int32_t orig_sensitivity;
225 char *outlook_recipient; 223 char *outlook_recipient;
226 char *outlook_recipient2; 224 char *outlook_recipient2;
227 char *outlook_sender; 225 char *outlook_sender;
228 char *outlook_sender_name; 226 char *outlook_sender_name;
229 char *outlook_sender2; 227 char *outlook_sender2;
230 int32_t priority; 228 int32_t priority;
231 char *proc_subject; 229 char *proc_subject;
232 int32_t read_receipt; 230 int32_t read_receipt;
233 char *recip_access; 231 char *recip_access;
234 char *recip_address; 232 char *recip_address;
235 char *recip2_access; 233 char *recip2_access;
236 char *recip2_address; 234 char *recip2_address;
237 int32_t reply_requested; 235 int32_t reply_requested;
238 char *reply_to; 236 char *reply_to;
239 char *return_path_address; 237 char *return_path_address;
240 int32_t rtf_body_char_count; 238 int32_t rtf_body_char_count;
241 int32_t rtf_body_crc; 239 int32_t rtf_body_crc;
242 char *rtf_body_tag; 240 char *rtf_body_tag;
243 char *rtf_compressed; 241 char *rtf_compressed;
244 uint32_t rtf_compressed_size; 242 uint32_t rtf_compressed_size;
245 int32_t rtf_in_sync; // 1 = true, 0 = doesn't exist, -1 = false 243 int32_t rtf_in_sync; // 1 = true, 0 = doesn't exist, -1 = false
246 int32_t rtf_ws_prefix_count; 244 int32_t rtf_ws_prefix_count;
247 int32_t rtf_ws_trailing_count; 245 int32_t rtf_ws_trailing_count;
248 char *sender_access; 246 char *sender_access;
249 char *sender_address; 247 char *sender_address;
250 char *sender2_access; 248 char *sender2_access;
251 char *sender2_address; 249 char *sender2_address;
252 int32_t sensitivity; 250 int32_t sensitivity;
253 FILETIME *sent_date; 251 FILETIME *sent_date;
254 pst_entryid *sentmail_folder; 252 pst_entryid *sentmail_folder;
255 char *sentto_address; 253 char *sentto_address;
256 pst_item_email_subject *subject; 254 pst_item_email_subject *subject;
257 } pst_item_email; 255 } pst_item_email;
258 256
259 typedef struct _pst_item_folder { 257 typedef struct pst_item_folder {
260 int32_t email_count; 258 int32_t email_count;
261 int32_t unseen_email_count; 259 int32_t unseen_email_count;
262 int32_t assoc_count; 260 int32_t assoc_count;
263 char subfolder; 261 char subfolder;
264 } pst_item_folder; 262 } pst_item_folder;
265 263
266 typedef struct _pst_item_message_store { 264 typedef struct pst_item_message_store {
267 pst_entryid *deleted_items_folder; 265 pst_entryid *deleted_items_folder;
268 pst_entryid *search_root_folder; 266 pst_entryid *search_root_folder;
269 pst_entryid *top_of_personal_folder; 267 pst_entryid *top_of_personal_folder;
270 pst_entryid *top_of_folder; 268 pst_entryid *top_of_folder;
271 int32_t valid_mask; // what folders the message store contains 269 int32_t valid_mask; // what folders the message store contains
272 int32_t pwd_chksum; 270 int32_t pwd_chksum;
273 } pst_item_message_store; 271 } pst_item_message_store;
274 272
275 typedef struct _pst_item_contact { 273 typedef struct pst_item_contact {
276 char *access_method; 274 char *access_method;
277 char *account_name; 275 char *account_name;
278 char *address1; 276 char *address1;
279 char *address1a; 277 char *address1a;
280 char *address1_desc; 278 char *address1_desc;
366 char *transmittable_display_name; 364 char *transmittable_display_name;
367 char *ttytdd_phone; 365 char *ttytdd_phone;
368 FILETIME *wedding_anniversary; 366 FILETIME *wedding_anniversary;
369 } pst_item_contact; 367 } pst_item_contact;
370 368
371 typedef struct _pst_item_attach { 369 typedef struct pst_item_attach {
372 char *filename1; 370 char *filename1;
373 char *filename2; 371 char *filename2;
374 char *mimetype; 372 char *mimetype;
375 char *data; 373 char *data;
376 size_t size; 374 size_t size;
377 int32_t id2_val; 375 uint64_t id2_val;
378 int32_t id_val; // calculated from id2_val during creation of record 376 uint64_t id_val; // calculated from id2_val during creation of record
379 int32_t method; 377 int32_t method;
380 int32_t position; 378 int32_t position;
381 int32_t sequence; 379 int32_t sequence;
382 struct _pst_item_attach *next; 380 struct pst_item_attach *next;
383 } pst_item_attach; 381 } pst_item_attach;
384 382
385 typedef struct _pst_item_extra_field { 383 typedef struct pst_item_extra_field {
386 char *field_name; 384 char *field_name;
387 char *value; 385 char *value;
388 struct _pst_item_extra_field *next; 386 struct pst_item_extra_field *next;
389 } pst_item_extra_field; 387 } pst_item_extra_field;
390 388
391 typedef struct _pst_item_journal { 389 typedef struct pst_item_journal {
392 FILETIME *end; 390 FILETIME *end;
393 FILETIME *start; 391 FILETIME *start;
394 char *type; 392 char *type;
395 } pst_item_journal; 393 } pst_item_journal;
396 394
397 typedef struct _pst_item_appointment { 395 typedef struct pst_item_appointment {
398 FILETIME *end; 396 FILETIME *end;
399 char *location; 397 char *location;
400 FILETIME *reminder; 398 FILETIME *reminder;
401 FILETIME *start; 399 FILETIME *start;
402 char *timezonestring; 400 char *timezonestring;
403 int32_t showas; 401 int32_t showas;
404 int32_t label; 402 int32_t label;
405 int32_t all_day; 403 int32_t all_day;
406 } pst_item_appointment; 404 } pst_item_appointment;
407 405
408 typedef struct _pst_item { 406 typedef struct pst_item {
409 struct _pst_item_email *email; // data reffering to email 407 struct pst_item_email *email; // data reffering to email
410 struct _pst_item_folder *folder; // data reffering to folder 408 struct pst_item_folder *folder; // data reffering to folder
411 struct _pst_item_contact *contact; // data reffering to contact 409 struct pst_item_contact *contact; // data reffering to contact
412 struct _pst_item_attach *attach; // linked list of attachments 410 struct pst_item_attach *attach; // linked list of attachments
413 struct _pst_item_message_store *message_store; // data referring to the message store 411 struct pst_item_message_store *message_store; // data referring to the message store
414 struct _pst_item_extra_field *extra_fields; // linked list of extra headers and such 412 struct pst_item_extra_field *extra_fields; // linked list of extra headers and such
415 struct _pst_item_journal *journal; // data reffering to a journal entry 413 struct pst_item_journal *journal; // data reffering to a journal entry
416 struct _pst_item_appointment *appointment; // data reffering to a calendar entry 414 struct pst_item_appointment *appointment; // data reffering to a calendar entry
417 int32_t type; 415 int32_t type;
418 char *ascii_type; 416 char *ascii_type;
419 char *file_as; 417 char *file_as;
420 char *comment; 418 char *comment;
421 int32_t message_size; 419 int32_t message_size;
426 FILETIME *create_date; 424 FILETIME *create_date;
427 FILETIME *modify_date; 425 FILETIME *modify_date;
428 int32_t private_member; 426 int32_t private_member;
429 } pst_item; 427 } pst_item;
430 428
431 typedef struct _pst_x_attrib_ll { 429 typedef struct pst_x_attrib_ll {
432 int32_t type; 430 uint32_t type;
433 int32_t mytype; 431 uint32_t mytype;
434 int32_t map; 432 uint32_t map;
435 void *data; 433 void *data;
436 struct _pst_x_attrib_ll *next; 434 struct pst_x_attrib_ll *next;
437 } pst_x_attrib_ll; 435 } pst_x_attrib_ll;
438 436
439 typedef struct _pst_file { 437 typedef struct pst_file {
440 pst_index_ll *i_head, *i_tail; 438 pst_index_ll *i_head, *i_tail;
441 pst_index2_ll *i2_head; 439 pst_index2_ll *i2_head;
442 pst_desc_ll *d_head, *d_tail; 440 pst_desc_ll *d_head, *d_tail;
443 pst_x_attrib_ll *x_head; 441 pst_x_attrib_ll *x_head;
444 int32_t index1; 442
445 int32_t index1_count; 443 //set this to 0 to read 32-bit pst files (pre Outlook 2003)
446 int32_t index2; 444 //set this to 1 to read 64-bit pst files (Outlook 2003 and later)
447 int32_t index2_count; 445 int do_read64;
448 int64_t index1_64; 446
449 int64_t index1_count_64; 447 uint64_t index1;
450 int64_t index2_64; 448 uint64_t index1_back;
451 int64_t index2_count_64; 449 uint64_t index2;
452 FILE * fp; // file pointer to opened PST file 450 uint64_t index2_back;
453 size_t size; // pst file size 451 FILE * fp; // file pointer to opened PST file
452 uint64_t size; // pst file size
454 unsigned char encryption; // pst encryption setting 453 unsigned char encryption; // pst encryption setting
455 unsigned char ind_type; // pst index type 454 unsigned char ind_type; // pst index type
456 } pst_file; 455 } pst_file;
457 456
458 typedef struct _pst_block_offset { 457 typedef struct pst_block_offset {
459 int16_t from; 458 int16_t from;
460 int16_t to; 459 int16_t to;
461 } pst_block_offset; 460 } pst_block_offset;
462 461
463 typedef struct _pst_block_offset_pointer { 462 typedef struct pst_block_offset_pointer {
464 unsigned char *from; 463 unsigned char *from;
465 unsigned char *to; 464 unsigned char *to;
466 int needfree; 465 int needfree;
467 } pst_block_offset_pointer; 466 } pst_block_offset_pointer;
468 467
469 struct _pst_num_item { 468 struct pst_num_item {
470 uint32_t id; 469 uint32_t id;
471 unsigned char *data; 470 unsigned char *data;
472 int32_t type; 471 uint32_t type;
473 size_t size; 472 size_t size;
474 char *extra; 473 char *extra;
475 }; 474 };
476 475
477 typedef struct _pst_num_array { 476 typedef struct pst_num_array {
478 int32_t count_item; 477 int32_t count_item;
479 int32_t orig_count; 478 int32_t orig_count;
480 int32_t count_array; 479 int32_t count_array;
481 struct _pst_num_item ** items; 480 struct pst_num_item ** items;
482 struct _pst_num_array *next; 481 struct pst_num_array *next;
483 } pst_num_array; 482 } pst_num_array;
484 483
485 struct holder { 484 struct holder {
486 unsigned char **buf; 485 unsigned char **buf;
487 FILE * fp; 486 FILE * fp;
488 int32_t base64; 487 int base64;
489 char base64_extra_chars[3]; 488 char base64_extra_chars[3];
490 int32_t base64_extra; 489 uint32_t base64_extra;
491 }; 490 };
492 491
493 // prototypes 492 // prototypes
494 void set_read64(); 493 int pst_open(pst_file *pf, char *name, char *mode);
495 int32_t pst_open(pst_file *pf, char *name, char *mode); 494 int pst_close(pst_file *pf);
496 int32_t pst_close(pst_file *pf); 495 pst_desc_ll * pst_getTopOfFolders(pst_file *pf, pst_item *root);
497 pst_desc_ll * pst_getTopOfFolders(pst_file *pf, pst_item *root); 496 size_t pst_attach_to_mem(pst_file *pf, pst_item_attach *attach, unsigned char **b);
498 int32_t pst_attach_to_mem(pst_file *pf, pst_item_attach *attach, unsigned char **b); 497 size_t pst_attach_to_file(pst_file *pf, pst_item_attach *attach, FILE* fp);
499 int32_t pst_attach_to_file(pst_file *pf, pst_item_attach *attach, FILE* fp); 498 size_t pst_attach_to_file_base64(pst_file *pf, pst_item_attach *attach, FILE* fp);
500 int32_t pst_attach_to_file_base64(pst_file *pf, pst_item_attach *attach, FILE* fp); 499 int pst_load_index (pst_file *pf);
501 int32_t pst_load_index (pst_file *pf); 500 pst_desc_ll* pst_getNextDptr(pst_desc_ll* d);
502 pst_desc_ll* pst_getNextDptr(pst_desc_ll* d); 501 int pst_load_extended_attributes(pst_file *pf);
503 int32_t pst_load_extended_attributes(pst_file *pf); 502
504 503 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);
505 int32_t _pst_build_id_ptr(pst_file *pf, off_t offset, int32_t depth, int64_t linku1, uint64_t start_val, uint64_t end_val); 504 int pst_build_desc_ptr (pst_file *pf, off_t offset, int32_t depth, uint64_t linku1, uint64_t *high_id, uint64_t start_val, uint64_t end_val);
506 int32_t _pst_build_desc_ptr (pst_file *pf, off_t offset, int32_t depth, int64_t linku1, uint64_t *high_id, uint64_t start_id, uint64_t end_val); 505 pst_item* pst_getItem(pst_file *pf, pst_desc_ll *d_ptr);
507 pst_item* _pst_getItem(pst_file *pf, pst_desc_ll *d_ptr); 506 pst_item* pst_parse_item (pst_file *pf, pst_desc_ll *d_ptr);
508 pst_item* _pst_parse_item (pst_file *pf, pst_desc_ll *d_ptr); 507 pst_num_array* pst_parse_block(pst_file *pf, uint64_t block_id, pst_index2_ll *i2_head);
509 pst_num_array * _pst_parse_block(pst_file *pf, uint32_t block_id, pst_index2_ll *i2_head); 508 int pst_process(pst_num_array *list, pst_item *item, pst_item_attach *attach);
510 int32_t _pst_process(pst_num_array *list, pst_item *item, pst_item_attach *attach); 509 void pst_free_list(pst_num_array *list);
511 int32_t _pst_free_list(pst_num_array *list); 510 void pst_freeItem(pst_item *item);
512 void _pst_freeItem(pst_item *item); 511 void pst_free_id2(pst_index2_ll * head);
513 int32_t _pst_free_id2(pst_index2_ll * head); 512 void pst_free_id (pst_index_ll *head);
514 int32_t _pst_free_id (pst_index_ll *head); 513 void pst_free_desc (pst_desc_ll *head);
515 int32_t _pst_free_desc (pst_desc_ll *head); 514 void pst_free_xattrib(pst_x_attrib_ll *x);
516 int32_t _pst_free_xattrib(pst_x_attrib_ll *x); 515 int pst_getBlockOffsetPointer(pst_file *pf, pst_index2_ll *i2_head, unsigned char *buf, size_t read_size, uint32_t i_offset, uint32_t offset, pst_block_offset_pointer *p);
517 int32_t _pst_getBlockOffsetPointer(pst_file *pf, pst_index2_ll *i2_head, unsigned char *buf, int32_t read_size, int32_t i_offset, int32_t offset, pst_block_offset_pointer *p); 516 int pst_getBlockOffset(unsigned char *buf, size_t read_size, uint32_t i_offset, uint32_t offset, pst_block_offset *p);
518 int32_t _pst_getBlockOffset(unsigned char *buf, int32_t read_size, int32_t i_offset, int32_t offset, pst_block_offset *p); 517 pst_index2_ll* pst_build_id2(pst_file *pf, pst_index_ll* list, pst_index2_ll* head_ptr);
519 pst_index2_ll * _pst_build_id2(pst_file *pf, pst_index_ll* list, pst_index2_ll* head_ptr); 518 pst_index_ll* pst_getID(pst_file* pf, uint64_t id);
520 pst_index_ll * _pst_getID(pst_file* pf, uint64_t id); 519 pst_index_ll* pst_getID2(pst_index2_ll * ptr, uint64_t id);
521 pst_index_ll * _pst_getID2(pst_index2_ll * ptr, uint32_t id); 520 pst_desc_ll* pst_getDptr(pst_file *pf, uint64_t id);
522 pst_desc_ll * _pst_getDptr(pst_file *pf, uint32_t id); 521 size_t pst_read_block_size(pst_file *pf, off_t offset, size_t size, char **buf, int32_t do_enc, unsigned char is_index);
523 size_t _pst_read_block_size(pst_file *pf, off_t offset, size_t size, char **buf, int32_t do_enc, unsigned char is_index); 522 int pst_decrypt(unsigned char *buf, size_t size, unsigned char type);
524 int32_t _pst_decrypt(unsigned char *buf, size_t size, int32_t type); 523 uint64_t pst_getIntAt(pst_file *pf, char *buf);
525 int64_t _getIntAt(char *buf); 524 uint64_t pst_getIntAtPos(pst_file *pf, off_t pos);
526 int64_t _pst_getIntAtPos(FILE *fp, off_t pos); 525 int pst_getAtPos(FILE *fp, off_t pos, void* buf, size_t size);
527 int32_t _pst_getAtPos(FILE *fp, off_t pos, void* buf, uint32_t size); 526 int pst_get (FILE *fp, void *buf, size_t size);
528 int32_t _pst_get (FILE *fp, void *buf, uint32_t size); 527 size_t pst_ff_getIDblock_dec(pst_file *pf, uint64_t id, unsigned char **b);
529 size_t _pst_ff_getIDblock_dec(pst_file *pf, uint32_t id, unsigned char **b); 528 size_t pst_ff_getIDblock(pst_file *pf, uint64_t id, unsigned char** b);
530 size_t _pst_ff_getIDblock(pst_file *pf, uint32_t id, unsigned char** b); 529 size_t pst_ff_getID2block(pst_file *pf, uint64_t id2, pst_index2_ll *id2_head, unsigned char** buf);
531 size_t _pst_ff_getID2block(pst_file *pf, uint32_t id2, pst_index2_ll *id2_head, unsigned char** buf); 530 size_t pst_ff_getID2data(pst_file *pf, pst_index_ll *ptr, struct holder *h);
532 size_t _pst_ff_getID2data(pst_file *pf, pst_index_ll *ptr, struct holder *h); 531 size_t pst_ff_compile_ID(pst_file *pf, uint64_t id, struct holder *h, size_t size);
533 size_t _pst_ff_compile_ID(pst_file *pf, uint32_t id, struct holder *h, int32_t size); 532
534 533 int pst_strincmp(char *a, char *b, size_t x);
535 int32_t pst_strincmp(char *a, char *b, int32_t x); 534 int pst_stricmp(char *a, char *b);
536 int32_t pst_stricmp(char *a, char *b); 535 size_t pst_fwrite(const void*ptr, size_t size, size_t nmemb, FILE*stream);
537 size_t pst_fwrite(const void*ptr, size_t size, size_t nmemb, FILE*stream); 536 char * pst_wide_to_single(char *wt, int32_t size);
538 char * _pst_wide_to_single(char *wt, int32_t size); 537
539 538 char * pst_rfc2426_escape(char *str);
540 char *pst_rfc2426_escape(char *str); 539 int pst_chr_count(char *str, char x);
541 int pst_chr_count(char *str, char x); 540 char * pst_rfc2425_datetime_format(FILETIME *ft);
542 char *pst_rfc2425_datetime_format(FILETIME *ft); 541 char * pst_rfc2445_datetime_format(FILETIME *ft);
543 char *pst_rfc2445_datetime_format(FILETIME *ft); 542
544 543 int32_t pst_printDptr(pst_file *pf);
545 // DEBUG functions 544 int32_t pst_printIDptr(pst_file* pf);
546 int32_t _pst_printDptr(pst_file *pf); 545 int32_t pst_printID2ptr(pst_index2_ll *ptr);
547 int32_t _pst_printIDptr(pst_file* pf);
548 int32_t _pst_printID2ptr(pst_index2_ll *ptr);
549 void * xmalloc(size_t size);
550 546
551 #endif // defined LIBPST_H 547 #endif // defined LIBPST_H