comparison libpst.h @ 10:a818f3c2e589

fix tree walk, we now use the item counts in the node blocks
author carl
date Fri, 17 Feb 2006 15:48:38 -0800
parents 2b58cf15aaf7
children bf12a9d4524c
comparison
equal deleted inserted replaced
9:8c724896a28a 10:a818f3c2e589
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
36 #endif // defined _MSC_VER 36 #endif // defined _MSC_VER
37 37
38 #if BYTE_ORDER == BIG_ENDIAN 38 #if BYTE_ORDER == BIG_ENDIAN
39 # define LE64_CPU(x) \ 39 # define LE64_CPU(x) \
40 x = ((((x) & 0xff00000000000000) >> 56) | \ 40 x = ((((x) & 0xff00000000000000) >> 56) | \
41 (((x) & 0x00ff000000000000) >> 40) | \ 41 (((x) & 0x00ff000000000000) >> 40) | \
42 (((x) & 0x0000ff0000000000) >> 24) | \ 42 (((x) & 0x0000ff0000000000) >> 24) | \
43 (((x) & 0x000000ff00000000) >> 8 ) | \ 43 (((x) & 0x000000ff00000000) >> 8 ) | \
44 (((x) & 0x00000000ff000000) << 8 ) | \ 44 (((x) & 0x00000000ff000000) << 8 ) | \
45 (((x) & 0x0000000000ff0000) << 24) | \ 45 (((x) & 0x0000000000ff0000) << 24) | \
46 (((x) & 0x000000000000ff00) << 40) | \ 46 (((x) & 0x000000000000ff00) << 40) | \
47 (((x) & 0x00000000000000ff) << 56)); 47 (((x) & 0x00000000000000ff) << 56));
48 # define LE32_CPU(x) \ 48 # define LE32_CPU(x) \
49 x = ((((x) & 0xff000000) >> 24) | \ 49 x = ((((x) & 0xff000000) >> 24) | \
50 (((x) & 0x00ff0000) >> 8 ) | \ 50 (((x) & 0x00ff0000) >> 8 ) | \
51 (((x) & 0x0000ff00) << 8 ) | \ 51 (((x) & 0x0000ff00) << 8 ) | \
52 (((x) & 0x000000ff) << 24)); 52 (((x) & 0x000000ff) << 24));
53 # define LE16_CPU(x) \ 53 # define LE16_CPU(x) \
54 x = ((((x) & 0xff00) >> 8) | \ 54 x = ((((x) & 0xff00) >> 8) | \
55 (((x) & 0x00ff) << 8)); 55 (((x) & 0x00ff) << 8));
56 #elif BYTE_ORDER == LITTLE_ENDIAN 56 #elif BYTE_ORDER == LITTLE_ENDIAN
57 # define LE64_CPU(x) {} 57 # define LE64_CPU(x) {}
58 # define LE32_CPU(x) {} 58 # define LE32_CPU(x) {}
59 # define LE16_CPU(x) {} 59 # define LE16_CPU(x) {}
60 #else 60 #else
103 #define PST_FREEBUSY_TENTATIVE 1 103 #define PST_FREEBUSY_TENTATIVE 1
104 #define PST_FREEBUSY_BUSY 2 104 #define PST_FREEBUSY_BUSY 2
105 #define PST_FREEBUSY_OUT_OF_OFFICE 3 105 #define PST_FREEBUSY_OUT_OF_OFFICE 3
106 106
107 // defines labels for appointment->label 107 // defines labels for appointment->label
108 #define PST_APP_LABEL_NONE 0 // None 108 #define PST_APP_LABEL_NONE 0 // None
109 #define PST_APP_LABEL_IMPORTANT 1 // Important 109 #define PST_APP_LABEL_IMPORTANT 1 // Important
110 #define PST_APP_LABEL_BUSINESS 2 // Business 110 #define PST_APP_LABEL_BUSINESS 2 // Business
111 #define PST_APP_LABEL_PERSONAL 3 // Personal 111 #define PST_APP_LABEL_PERSONAL 3 // Personal
112 #define PST_APP_LABEL_VACATION 4 // Vacation 112 #define PST_APP_LABEL_VACATION 4 // Vacation
113 #define PST_APP_LABEL_MUST_ATTEND 5 // Must Attend 113 #define PST_APP_LABEL_MUST_ATTEND 5 // Must Attend
114 #define PST_APP_LABEL_TRAVEL_REQ 6 // Travel Required 114 #define PST_APP_LABEL_TRAVEL_REQ 6 // Travel Required
115 #define PST_APP_LABEL_NEEDS_PREP 7 // Needs Preparation 115 #define PST_APP_LABEL_NEEDS_PREP 7 // Needs Preparation
116 #define PST_APP_LABEL_BIRTHDAY 8 // Birthday 116 #define PST_APP_LABEL_BIRTHDAY 8 // Birthday
117 #define PST_APP_LABEL_ANNIVERSARY 9 // Anniversary 117 #define PST_APP_LABEL_ANNIVERSARY 9 // Anniversary
118 #define PST_APP_LABEL_PHONE_CALL 10// Phone Call 118 #define PST_APP_LABEL_PHONE_CALL 10// Phone Call
119 119
120 typedef struct _pst_misc_6_struct { 120 typedef struct _pst_misc_6_struct {
121 int32_t i1; 121 int32_t i1;
421 int32_t index1_count; 421 int32_t index1_count;
422 int32_t index2; 422 int32_t index2;
423 int32_t index2_count; 423 int32_t index2_count;
424 FILE * fp; 424 FILE * fp;
425 size_t size; 425 size_t size;
426 unsigned char index1_depth;
427 unsigned char index2_depth;
428 unsigned char encryption; 426 unsigned char encryption;
429 unsigned char id_depth_ok;
430 unsigned char desc_depth_ok;
431 unsigned char ind_type; 427 unsigned char ind_type;
432 } pst_file; 428 } pst_file;
433 429
434 typedef struct _pst_block_offset { 430 typedef struct _pst_block_offset {
435 int16_t from; 431 int16_t from;
468 int32_t pst_attach_to_file_base64(pst_file *pf, pst_item_attach *attach, FILE* fp); 464 int32_t pst_attach_to_file_base64(pst_file *pf, pst_item_attach *attach, FILE* fp);
469 int32_t pst_load_index (pst_file *pf); 465 int32_t pst_load_index (pst_file *pf);
470 pst_desc_ll* pst_getNextDptr(pst_desc_ll* d); 466 pst_desc_ll* pst_getNextDptr(pst_desc_ll* d);
471 int32_t pst_load_extended_attributes(pst_file *pf); 467 int32_t pst_load_extended_attributes(pst_file *pf);
472 468
473 int32_t _pst_build_id_ptr(pst_file *pf, int32_t offset, int32_t depth, int32_t start_val, int32_t end_val); 469 int32_t _pst_build_id_ptr(pst_file *pf, int32_t offset, int32_t depth, int32_t linku1, int32_t start_val, int32_t end_val);
474 int32_t _pst_build_desc_ptr (pst_file *pf, int32_t offset, int32_t depth, int32_t *high_id, 470 int32_t _pst_build_desc_ptr (pst_file *pf, int32_t offset, int32_t depth, int32_t linku1, int32_t *high_id, int32_t start_id, int32_t end_val);
475 int32_t start_id, int32_t end_val);
476 pst_item* _pst_getItem(pst_file *pf, pst_desc_ll *d_ptr); 471 pst_item* _pst_getItem(pst_file *pf, pst_desc_ll *d_ptr);
477 void * _pst_parse_item (pst_file *pf, pst_desc_ll *d_ptr); 472 void * _pst_parse_item (pst_file *pf, pst_desc_ll *d_ptr);
478 pst_num_array * _pst_parse_block(pst_file *pf, u_int32_t block_id, pst_index2_ll *i2_head); 473 pst_num_array * _pst_parse_block(pst_file *pf, u_int32_t block_id, pst_index2_ll *i2_head);
479 int32_t _pst_process(pst_num_array *list, pst_item *item); 474 int32_t _pst_process(pst_num_array *list, pst_item *item);
480 int32_t _pst_free_list(pst_num_array *list); 475 int32_t _pst_free_list(pst_num_array *list);
481 void _pst_freeItem(pst_item *item); 476 void _pst_freeItem(pst_item *item);
482 int32_t _pst_free_id2(pst_index2_ll * head); 477 int32_t _pst_free_id2(pst_index2_ll * head);
483 int32_t _pst_free_id (pst_index_ll *head); 478 int32_t _pst_free_id (pst_index_ll *head);
484 int32_t _pst_free_desc (pst_desc_ll *head); 479 int32_t _pst_free_desc (pst_desc_ll *head);
485 int32_t _pst_free_xattrib(pst_x_attrib_ll *x); 480 int32_t _pst_free_xattrib(pst_x_attrib_ll *x);
486 int32_t _pst_getBlockOffset(char *buf, int32_t i_offset, int32_t offset, pst_block_offset *p); 481 int32_t _pst_getBlockOffset(char *buf, int32_t read_size, int32_t i_offset, int32_t offset, pst_block_offset *p);
487 pst_index2_ll * _pst_build_id2(pst_file *pf, pst_index_ll* list, pst_index2_ll* head_ptr); 482 pst_index2_ll * _pst_build_id2(pst_file *pf, pst_index_ll* list, pst_index2_ll* head_ptr);
488 pst_index_ll * _pst_getID(pst_file* pf, u_int32_t id); 483 pst_index_ll * _pst_getID(pst_file* pf, u_int32_t id);
489 pst_index_ll * _pst_getID2(pst_index2_ll * ptr, u_int32_t id); 484 pst_index_ll * _pst_getID2(pst_index2_ll * ptr, u_int32_t id);
490 pst_desc_ll * _pst_getDptr(pst_file *pf, u_int32_t id); 485 pst_desc_ll * _pst_getDptr(pst_file *pf, u_int32_t id);
491 size_t _pst_read_block_size(pst_file *pf, int32_t offset, size_t size, char ** buf, int32_t do_enc, 486 size_t _pst_read_block_size(pst_file *pf, int32_t offset, size_t size, char ** buf, int32_t do_enc,