#include "common.h"
Go to the source code of this file.
| Data Structures | |
| struct | pst_entryid | 
| struct | pst_index_ll | 
| struct | pst_id2_tree | 
| struct | pst_desc_tree | 
| struct | pst_string | 
| The string is either utf8 encoded, or it is in the code page specified by the containing mapi object.  More... | |
| struct | pst_binary | 
| a simple wrapper for binary blobs  More... | |
| struct | pst_item_email | 
| This contains the email related mapi elements.  More... | |
| struct | pst_item_folder | 
| This contains the folder related mapi elements.  More... | |
| struct | pst_item_message_store | 
| This contains the message store related mapi elements.  More... | |
| struct | pst_item_contact | 
| This contains the contact related mapi elements.  More... | |
| struct | pst_item_attach | 
| This contains the attachment related mapi elements.  More... | |
| struct | pst_item_extra_field | 
| linked list of extra header fields  More... | |
| struct | pst_item_journal | 
| This contains the journal related mapi elements.  More... | |
| struct | pst_recurrence | 
| This contains the recurrence data separated into fields.  More... | |
| struct | pst_item_appointment | 
| This contains the appointment related mapi elements.  More... | |
| struct | pst_item | 
| This contains the common mapi elements, and pointers to structures for each major mapi item type.  More... | |
| struct | pst_x_attrib_ll | 
| Linked list of extended attributes.  More... | |
| struct | pst_block_recorder | 
| this is only used for internal debugging  More... | |
| struct | pst_file | 
| Defines | |
| #define | PST_TYPE_NOTE 1 | 
| #define | PST_TYPE_SCHEDULE 2 | 
| #define | PST_TYPE_APPOINTMENT 8 | 
| #define | PST_TYPE_CONTACT 9 | 
| #define | PST_TYPE_JOURNAL 10 | 
| #define | PST_TYPE_STICKYNOTE 11 | 
| #define | PST_TYPE_TASK 12 | 
| #define | PST_TYPE_OTHER 13 | 
| #define | PST_TYPE_REPORT 14 | 
| #define | PST_NO_ENCRYPT 0 | 
| #define | PST_COMP_ENCRYPT 1 | 
| #define | PST_ENCRYPT 2 | 
| #define | PST_MAP_ATTRIB (uint32_t)1 | 
| #define | PST_MAP_HEADER (uint32_t)2 | 
| #define | PST_ATTRIB_HEADER -1 | 
| #define | PST_FREEBUSY_FREE 0 | 
| #define | PST_FREEBUSY_TENTATIVE 1 | 
| #define | PST_FREEBUSY_BUSY 2 | 
| #define | PST_FREEBUSY_OUT_OF_OFFICE 3 | 
| #define | PST_APP_LABEL_NONE 0 | 
| #define | PST_APP_LABEL_IMPORTANT 1 | 
| #define | PST_APP_LABEL_BUSINESS 2 | 
| #define | PST_APP_LABEL_PERSONAL 3 | 
| #define | PST_APP_LABEL_VACATION 4 | 
| #define | PST_APP_LABEL_MUST_ATTEND 5 | 
| #define | PST_APP_LABEL_TRAVEL_REQ 6 | 
| #define | PST_APP_LABEL_NEEDS_PREP 7 | 
| #define | PST_APP_LABEL_BIRTHDAY 8 | 
| #define | PST_APP_LABEL_ANNIVERSARY 9 | 
| #define | PST_APP_LABEL_PHONE_CALL 10 | 
| #define | PST_APP_RECUR_NONE 0 | 
| #define | PST_APP_RECUR_DAILY 1 | 
| #define | PST_APP_RECUR_WEEKLY 2 | 
| #define | PST_APP_RECUR_MONTHLY 3 | 
| #define | PST_APP_RECUR_YEARLY 4 | 
| #define | PST_ATTACH_NONE 0 | 
| #define | PST_ATTACH_BY_VALUE 1 | 
| #define | PST_ATTACH_BY_REF 2 | 
| #define | PST_ATTACH_BY_REF_RESOLV 3 | 
| #define | PST_ATTACH_BY_REF_ONLY 4 | 
| #define | PST_ATTACH_EMBEDDED 5 | 
| #define | PST_ATTACH_OLE 6 | 
| #define | PST_FLAG_READ 0x01 | 
| #define | PST_FLAG_UNMODIFIED 0x02 | 
| #define | PST_FLAG_SUBMIT 0x04 | 
| #define | PST_FLAG_UNSENT 0x08 | 
| #define | PST_FLAG_HAS_ATTACHMENT 0x10 | 
| #define | PST_FLAG_FROM_ME 0x20 | 
| #define | PST_FLAG_ASSOCIATED 0x40 | 
| #define | PST_FLAG_RESEND 0x80 | 
| #define | PST_FLAG_RN_PENDING 0x100 | 
| #define | PST_FLAG_NRN_PENDING 0x200 | 
| Functions | |
| int | pst_open (pst_file *pf, const char *name, const char *charset) | 
| Open a pst file. | |
| int | pst_reopen (pst_file *pf) | 
| Reopen the pst file after a fork. | |
| int | pst_load_index (pst_file *pf) | 
| Load the index entries from the pst file. | |
| int | pst_load_extended_attributes (pst_file *pf) | 
| Load the extended attribute mapping table from the pst file. | |
| int | pst_close (pst_file *pf) | 
| Close a pst file. | |
| pst_desc_tree * | pst_getTopOfFolders (pst_file *pf, const pst_item *root) | 
| Get the top of folders descriptor tree. | |
| pst_binary | pst_attach_to_mem (pst_file *pf, pst_item_attach *attach) | 
| Assemble the binary attachment into a single buffer. | |
| size_t | pst_attach_to_file (pst_file *pf, pst_item_attach *attach, FILE *fp) | 
| Write a binary attachment to a file. | |
| size_t | pst_attach_to_file_base64 (pst_file *pf, pst_item_attach *attach, FILE *fp) | 
| Write a binary attachment base64 encoded to a file. | |
| pst_desc_tree * | pst_getNextDptr (pst_desc_tree *d) | 
| Walk the descriptor tree. | |
| pst_item * | pst_parse_item (pst_file *pf, pst_desc_tree *d_ptr, pst_id2_tree *m_head) | 
| Assemble a mapi object from a descriptor pointer. | |
| void | pst_freeItem (pst_item *item) | 
| Free the item returned by pst_parse_item(). | |
| pst_index_ll * | pst_getID (pst_file *pf, uint64_t i_id) | 
| Lookup the i_id in the index linked list, and return a pointer to the element. | |
| size_t | pst_ff_getIDblock_dec (pst_file *pf, uint64_t i_id, char **buf) | 
| Get an ID block from the file using pst_ff_getIDblock() and decrypt if necessary. | |
| int | pst_stricmp (char *a, char *b) | 
| compare strings case-insensitive. | |
| size_t | pst_fwrite (const void *ptr, size_t size, size_t nmemb, FILE *stream) | 
| fwrite with checking for null pointer. | |
| char * | pst_rfc2426_escape (char *str, char **result, size_t *resultlen) | 
| Add any necessary escape characters for rfc2426 vcard format. | |
| char * | pst_rfc2425_datetime_format (const FILETIME *ft, int buflen, char *result) | 
| Convert a FILETIME into rfc2425 date/time format 1953-10-15T23:10:00Z which is the same as one of the forms in the ISO3601 standard. | |
| char * | pst_rfc2445_datetime_format (const FILETIME *ft, int buflen, char *result) | 
| Convert a FILETIME into rfc2445 date/time format 19531015T231000Z. | |
| char * | pst_rfc2445_datetime_format_now (int buflen, char *result) | 
| Convert the current time rfc2445 date/time format 19531015T231000Z. | |
| const char * | pst_default_charset (pst_item *item, int buflen, char *result) | 
| Get the default character set for this item. | |
| void | pst_rfc2231 (pst_string *str) | 
| Convert str to rfc2231 encoding of str. | |
| void | pst_rfc2047 (pst_item *item, pst_string *str, int needs_quote) | 
| Convert str to rfc2047 encoding of str, possibly enclosed in quotes if it contains spaces. | |
| void | pst_convert_utf8_null (pst_item *item, pst_string *str) | 
| Convert str to utf8 if possible; null strings are preserved. | |
| void | pst_convert_utf8 (pst_item *item, pst_string *str) | 
| Convert str to utf8 if possible; null strings are converted into empty strings. | |
| pst_recurrence * | pst_convert_recurrence (pst_item_appointment *appt) | 
| Decode raw recurrence data into a better structure. | |
| void | pst_free_recurrence (pst_recurrence *r) | 
| Free a recurrence structure. | |
| size_t pst_attach_to_file | ( | pst_file * | pf, | |
| pst_item_attach * | attach, | |||
| FILE * | fp | |||
| ) | 
Write a binary attachment to a file.
| pf | pointer to the pst_file structure setup by pst_open(). | |
| attach | pointer to the attachment record | |
| fp | pointer to an open FILE. | 
| size_t pst_attach_to_file_base64 | ( | pst_file * | pf, | |
| pst_item_attach * | attach, | |||
| FILE * | fp | |||
| ) | 
Write a binary attachment base64 encoded to a file.
| pf | pointer to the pst_file structure setup by pst_open(). | |
| attach | pointer to the attachment record | |
| fp | pointer to an open FILE. | 
| pst_binary pst_attach_to_mem | ( | pst_file * | pf, | |
| pst_item_attach * | attach | |||
| ) | 
Assemble the binary attachment into a single buffer.
| pf | pointer to the pst_file structure setup by pst_open(). | |
| attach | pointer to the attachment record | 
| int pst_close | ( | pst_file * | pf | ) | 
Close a pst file.
| pf | pointer to the pst_file structure setup by pst_open(). | 
| pst_recurrence* pst_convert_recurrence | ( | pst_item_appointment * | appt | ) | 
Decode raw recurrence data into a better structure.
| appt | pointer to appointment structure | 
| void pst_convert_utf8 | ( | pst_item * | item, | |
| pst_string * | str | |||
| ) | 
Convert str to utf8 if possible; null strings are converted into empty strings.
| item | pointer to the containing mapi item | |
| str | pointer to the mapi string of interest | 
| void pst_convert_utf8_null | ( | pst_item * | item, | |
| pst_string * | str | |||
| ) | 
Convert str to utf8 if possible; null strings are preserved.
| item | pointer to the containing mapi item | |
| str | pointer to the mapi string of interest | 
| const char* pst_default_charset | ( | pst_item * | item, | |
| int | buflen, | |||
| char * | result | |||
| ) | 
Get the default character set for this item.
This is used to find the charset for pst_string elements that are not already in utf8 encoding.
| item | pointer to the mapi item of interest | |
| [in] | buflen | length of the output buffer | 
| [out] | result | pointer to output buffer, must be at least 30 bytes | 
| size_t pst_ff_getIDblock_dec | ( | pst_file * | pf, | |
| uint64_t | i_id, | |||
| char ** | buf | |||
| ) | 
Get an ID block from the file using pst_ff_getIDblock() and decrypt if necessary.
| pf | pointer to the pst_file structure setup by pst_open(). | |
| i_id | ID of block to retrieve | |
| buf | reference to pointer to buffer that will contain the data block. If this pointer is non-NULL, it will first be free()d. | 
| void pst_free_recurrence | ( | pst_recurrence * | r | ) | 
Free a recurrence structure.
| r | input pointer to be freed | 
| void pst_freeItem | ( | pst_item * | item | ) | 
Free the item returned by pst_parse_item().
| item | pointer to item returned from pst_parse_item(). | 
| size_t pst_fwrite | ( | const void * | ptr, | |
| size_t | size, | |||
| size_t | nmemb, | |||
| FILE * | stream | |||
| ) | 
fwrite with checking for null pointer.
| ptr | pointer to the buffer | |
| size | size of each item | |
| nmemb | number of items | |
| stream | output file | 
| pst_index_ll* pst_getID | ( | pst_file * | pf, | |
| uint64_t | i_id | |||
| ) | 
Lookup the i_id in the index linked list, and return a pointer to the element.
| pf | pointer to the pst_file structure setup by pst_open(). | |
| i_id | key for the index linked list | 
| pst_desc_tree* pst_getNextDptr | ( | pst_desc_tree * | d | ) | 
Walk the descriptor tree.
| d | pointer to the current item in the descriptor tree. | 
| pst_desc_tree* pst_getTopOfFolders | ( | pst_file * | pf, | |
| const pst_item * | root | |||
| ) | 
Get the top of folders descriptor tree.
This is the main descriptor tree that needs to be walked to look at every item in the pst file.
| pf | pointer to the pst_file structure setup by pst_open(). | |
| root | root item, which can be obtained by pst_parse_item(pf, pf->d_head, NULL). | 
| int pst_load_extended_attributes | ( | pst_file * | pf | ) | 
Load the extended attribute mapping table from the pst file.
This should normally be the second call after pst_open().
| pf | pointer to the pst_file structure setup by pst_open(). | 
| int pst_load_index | ( | pst_file * | pf | ) | 
Load the index entries from the pst file.
This loads both the i_id linked list, and the d_id tree, and should normally be the first call after pst_open().
| pf | pointer to the pst_file structure setup by pst_open(). | 
| int pst_open | ( | pst_file * | pf, | |
| const char * | name, | |||
| const char * | charset | |||
| ) | 
Open a pst file.
| pf | pointer to uninitialized pst_file structure. This structure will be filled in by this function. | |
| name | name of the file, suitable for fopen(). | |
| charset | default charset for item with unspecified character sets | 
| pst_item* pst_parse_item | ( | pst_file * | pf, | |
| pst_desc_tree * | d_ptr, | |||
| pst_id2_tree * | m_head | |||
| ) | 
Assemble a mapi object from a descriptor pointer.
| pf | pointer to the pst_file structure setup by pst_open(). | |
| d_ptr | pointer to an item in the descriptor tree. | |
| m_head | normally NULL. This is only used when processing embedded attached rfc822 messages, in which case it is attach->id2_head. | 
| int pst_reopen | ( | pst_file * | pf | ) | 
Reopen the pst file after a fork.
| pf | pointer to the pst_file structure setup by pst_open(). | 
| void pst_rfc2047 | ( | pst_item * | item, | |
| pst_string * | str, | |||
| int | needs_quote | |||
| ) | 
Convert str to rfc2047 encoding of str, possibly enclosed in quotes if it contains spaces.
| item | pointer to the containing mapi item | |
| str | pointer to the mapi string of interest | |
| needs_quote | true if strings containing spaces should be wrapped in quotes | 
| void pst_rfc2231 | ( | pst_string * | str | ) | 
Convert str to rfc2231 encoding of str.
| str | pointer to the mapi string of interest | 
| char* pst_rfc2425_datetime_format | ( | const FILETIME * | ft, | |
| int | buflen, | |||
| char * | result | |||
| ) | 
Convert a FILETIME into rfc2425 date/time format 1953-10-15T23:10:00Z which is the same as one of the forms in the ISO3601 standard.
| [in] | ft | time to be converted | 
| [in] | buflen | length of the output buffer | 
| [out] | result | pointer to output buffer, must be at least 30 bytes | 
| char* pst_rfc2426_escape | ( | char * | str, | |
| char ** | result, | |||
| size_t * | resultlen | |||
| ) | 
Add any necessary escape characters for rfc2426 vcard format.
| [in] | str | pointer to input string | 
| [in,out] | result | pointer to a char* pointer that may be realloc'ed if needed | 
| [in,out] | resultlen | size of the result buffer | 
| char* pst_rfc2445_datetime_format | ( | const FILETIME * | ft, | |
| int | buflen, | |||
| char * | result | |||
| ) | 
Convert a FILETIME into rfc2445 date/time format 19531015T231000Z.
| [in] | ft | time to be converted | 
| [in] | buflen | length of the output buffer | 
| [out] | result | pointer to output buffer, must be at least 30 bytes | 
| char* pst_rfc2445_datetime_format_now | ( | int | buflen, | |
| char * | result | |||
| ) | 
Convert the current time rfc2445 date/time format 19531015T231000Z.
| [in] | buflen | length of the output buffer | 
| [out] | result | pointer to output buffer, must be at least 30 bytes | 
| int pst_stricmp | ( | char * | a, | |
| char * | b | |||
| ) | 
compare strings case-insensitive.
 1.6.1
 1.6.1