comparison src/libpst.h @ 52:034641c26ab9

code cleanup
author carl
date Thu, 31 Jan 2008 08:03:30 -0800
parents 06c0262ad689
children 7d5c637aaafb
comparison
equal deleted inserted replaced
51:06c0262ad689 52:034641c26ab9
478 void *data; 478 void *data;
479 struct pst_x_attrib_ll *next; 479 struct pst_x_attrib_ll *next;
480 } pst_x_attrib_ll; 480 } pst_x_attrib_ll;
481 481
482 482
483 typedef struct pst_block_recorder {
484 struct pst_block_recorder *next;
485 off_t offset;
486 size_t size;
487 int readcount;
488 } pst_block_recorder;
489
490
483 typedef struct pst_file { 491 typedef struct pst_file {
484 pst_index_ll *i_head, *i_tail; 492 pst_index_ll *i_head, *i_tail;
485 pst_index2_ll *i2_head; 493 pst_desc_ll *d_head, *d_tail;
486 pst_desc_ll *d_head, *d_tail;
487 pst_x_attrib_ll *x_head; 494 pst_x_attrib_ll *x_head;
495 pst_block_recorder *block_head;
488 496
489 //set this to 0 to read 32-bit pst files (pre Outlook 2003) 497 //set this to 0 to read 32-bit pst files (pre Outlook 2003)
490 //set this to 1 to read 64-bit pst files (Outlook 2003 and later) 498 //set this to 1 to read 64-bit pst files (Outlook 2003 and later)
491 int do_read64; 499 int do_read64;
492 500
506 int16_t to; 514 int16_t to;
507 } pst_block_offset; 515 } pst_block_offset;
508 516
509 517
510 typedef struct pst_block_offset_pointer { 518 typedef struct pst_block_offset_pointer {
511 unsigned char *from; 519 char *from;
512 unsigned char *to; 520 char *to;
513 int needfree; 521 int needfree;
514 } pst_block_offset_pointer; 522 } pst_block_offset_pointer;
515 523
516 524
517 typedef struct pst_num_item { 525 typedef struct pst_num_item {
518 uint32_t id; // not an id1 or id2, this is actually some sort of type code 526 uint32_t id; // not an id1 or id2, this is actually some sort of type code
519 unsigned char *data; 527 char *data;
520 uint32_t type; 528 uint32_t type;
521 size_t size; 529 size_t size;
522 char *extra; 530 char *extra;
523 } pst_num_item; 531 } pst_num_item;
524 532
525 533
526 typedef struct pst_num_array { 534 typedef struct pst_num_array {
527 int32_t count_item; 535 int32_t count_item;
531 struct pst_num_array *next; 539 struct pst_num_array *next;
532 } pst_num_array; 540 } pst_num_array;
533 541
534 542
535 typedef struct pst_holder { 543 typedef struct pst_holder {
536 unsigned char **buf; 544 char **buf;
537 FILE * fp; 545 FILE * fp;
538 int base64; 546 int base64;
539 char base64_extra_chars[3]; 547 char base64_extra_chars[3];
540 uint32_t base64_extra; 548 uint32_t base64_extra;
541 } pst_holder; 549 } pst_holder;
542 550
543 551
544 typedef struct pst_subblock { 552 typedef struct pst_subblock {
545 unsigned char *buf; 553 char *buf;
546 size_t read_size; 554 size_t read_size;
547 size_t i_offset; 555 size_t i_offset;
548 } pst_subblock; 556 } pst_subblock;
549 557
550 558
551 typedef struct pst_subblocks { 559 typedef struct pst_subblocks {
552 size_t subblock_count; 560 size_t subblock_count;
556 564
557 // prototypes 565 // prototypes
558 int pst_open(pst_file *pf, char *name, char *mode); 566 int pst_open(pst_file *pf, char *name, char *mode);
559 int pst_close(pst_file *pf); 567 int pst_close(pst_file *pf);
560 pst_desc_ll * pst_getTopOfFolders(pst_file *pf, pst_item *root); 568 pst_desc_ll * pst_getTopOfFolders(pst_file *pf, pst_item *root);
561 size_t pst_attach_to_mem(pst_file *pf, pst_item_attach *attach, unsigned char **b); 569 size_t pst_attach_to_mem(pst_file *pf, pst_item_attach *attach, char **b);
562 size_t pst_attach_to_file(pst_file *pf, pst_item_attach *attach, FILE* fp); 570 size_t pst_attach_to_file(pst_file *pf, pst_item_attach *attach, FILE* fp);
563 size_t pst_attach_to_file_base64(pst_file *pf, pst_item_attach *attach, FILE* fp); 571 size_t pst_attach_to_file_base64(pst_file *pf, pst_item_attach *attach, FILE* fp);
564 int pst_load_index (pst_file *pf); 572 int pst_load_index (pst_file *pf);
565 pst_desc_ll* pst_getNextDptr(pst_desc_ll* d); 573 pst_desc_ll* pst_getNextDptr(pst_desc_ll* d);
566 int pst_load_extended_attributes(pst_file *pf); 574 int pst_load_extended_attributes(pst_file *pf);
576 void pst_free_id2(pst_index2_ll * head); 584 void pst_free_id2(pst_index2_ll * head);
577 void pst_free_id (pst_index_ll *head); 585 void pst_free_id (pst_index_ll *head);
578 void pst_free_desc (pst_desc_ll *head); 586 void pst_free_desc (pst_desc_ll *head);
579 void pst_free_xattrib(pst_x_attrib_ll *x); 587 void pst_free_xattrib(pst_x_attrib_ll *x);
580 int pst_getBlockOffsetPointer(pst_file *pf, pst_index2_ll *i2_head, pst_subblocks *subblocks, uint32_t offset, pst_block_offset_pointer *p); 588 int pst_getBlockOffsetPointer(pst_file *pf, pst_index2_ll *i2_head, pst_subblocks *subblocks, uint32_t offset, pst_block_offset_pointer *p);
581 int pst_getBlockOffset(unsigned char *buf, size_t read_size, uint32_t i_offset, uint32_t offset, pst_block_offset *p); 589 int pst_getBlockOffset(char *buf, size_t read_size, uint32_t i_offset, uint32_t offset, pst_block_offset *p);
582 pst_index2_ll* pst_build_id2(pst_file *pf, pst_index_ll* list, pst_index2_ll* head_ptr); 590 pst_index2_ll* pst_build_id2(pst_file *pf, pst_index_ll* list, pst_index2_ll* head_ptr);
583 pst_index_ll* pst_getID(pst_file* pf, uint64_t id); 591 pst_index_ll* pst_getID(pst_file* pf, uint64_t id);
584 pst_index_ll* pst_getID2(pst_index2_ll * ptr, uint64_t id); 592 pst_index_ll* pst_getID2(pst_index2_ll * ptr, uint64_t id);
585 pst_desc_ll* pst_getDptr(pst_file *pf, uint64_t id); 593 pst_desc_ll* pst_getDptr(pst_file *pf, uint64_t id);
586 size_t pst_read_block_size(pst_file *pf, off_t offset, size_t size, char **buf); 594 size_t pst_read_block_size(pst_file *pf, off_t offset, size_t size, char **buf);
587 int pst_decrypt(unsigned char *buf, size_t size, unsigned char type); 595 int pst_decrypt(unsigned char *buf, size_t size, unsigned char type);
588 uint64_t pst_getIntAt(pst_file *pf, char *buf); 596 uint64_t pst_getIntAt(pst_file *pf, char *buf);
589 uint64_t pst_getIntAtPos(pst_file *pf, off_t pos); 597 uint64_t pst_getIntAtPos(pst_file *pf, off_t pos);
590 int pst_getAtPos(FILE *fp, off_t pos, void* buf, size_t size); 598 size_t pst_getAtPos(pst_file *pf, off_t pos, void* buf, size_t size);
591 size_t pst_ff_getIDblock_dec(pst_file *pf, uint64_t id, unsigned char **b); 599 size_t pst_ff_getIDblock_dec(pst_file *pf, uint64_t id, char **b);
592 size_t pst_ff_getIDblock(pst_file *pf, uint64_t id, unsigned char** b); 600 size_t pst_ff_getIDblock(pst_file *pf, uint64_t id, char** b);
593 size_t pst_ff_getID2block(pst_file *pf, uint64_t id2, pst_index2_ll *id2_head, unsigned char** buf); 601 size_t pst_ff_getID2block(pst_file *pf, uint64_t id2, pst_index2_ll *id2_head, char** buf);
594 size_t pst_ff_getID2data(pst_file *pf, pst_index_ll *ptr, pst_holder *h); 602 size_t pst_ff_getID2data(pst_file *pf, pst_index_ll *ptr, pst_holder *h);
595 size_t pst_ff_compile_ID(pst_file *pf, uint64_t id, pst_holder *h, size_t size); 603 size_t pst_ff_compile_ID(pst_file *pf, uint64_t id, pst_holder *h, size_t size);
596 604
597 int pst_strincmp(char *a, char *b, size_t x); 605 int pst_strincmp(char *a, char *b, size_t x);
598 int pst_stricmp(char *a, char *b); 606 int pst_stricmp(char *a, char *b);