libpst.h File Reference
`#include "common.h"`
Include dependency graph for libpst.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

## Macros

#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_TYPE_MAX 15
#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

## Typedefs

typedef struct pst_entryid | pst_entryid
typedef struct pst_index_ll | pst_index_ll
typedef struct pst_id2_tree | pst_id2_tree
typedef struct pst_desc_tree | pst_desc_tree
typedef struct pst_string | pst_string
| The string is either utf8 encoded, or it is in the code page specified by the containing mapi object. More...
typedef struct pst_binary | pst_binary
| a simple wrapper for binary blobs More...
typedef struct pst_item_email | pst_item_email
| This contains the email related mapi elements. More...
typedef struct pst_item_folder | pst_item_folder
| This contains the folder related mapi elements. More...
typedef struct pst_item_message_store | pst_item_message_store
| This contains the message store related mapi elements. More...
typedef struct pst_item_contact | pst_item_contact
| This contains the contact related mapi elements. More...
typedef struct pst_item_attach | pst_item_attach
| This contains the attachment related mapi elements. More...
typedef struct pst_item_extra_field | pst_item_extra_field
| linked list of extra header fields More...
typedef struct pst_item_journal | pst_item_journal
| This contains the journal related mapi elements. More...
typedef struct pst_recurrence | pst_recurrence
| This contains the recurrence data separated into fields. More...
typedef struct pst_item_appointment | pst_item_appointment
| This contains the appointment related mapi elements. More...
typedef struct pst_item | pst_item
| This contains the common mapi elements, and pointers to structures for each major mapi item type. More...
typedef struct pst_x_attrib_ll | pst_x_attrib_ll
| Linked list of extended attributes. More...
typedef struct pst_block_recorder | pst_block_recorder
| this is only used for internal debugging More...
typedef struct pst_file | pst_file

## Functions

int | pst_open (pst_file *pf, const char *name, const char *charset)
| Open a pst file. More...
int | pst_reopen (pst_file *pf)
| Reopen the pst file after a fork. More...
int | pst_load_index (pst_file *pf)
| Load the index entries from the pst file. More...
int | pst_load_extended_attributes (pst_file *pf)
| Load the extended attribute mapping table from the pst file. More...
int | pst_close (pst_file *pf)
| Close a pst file. More...
pst_desc_tree * | pst_getTopOfFolders (pst_file *pf, const pst_item *root)
| Get the top of folders descriptor tree. More...
pst_binary | pst_attach_to_mem (pst_file *pf, pst_item_attach *attach)
| Assemble the binary attachment into a single buffer. More...
size_t | pst_attach_to_file (pst_file *pf, pst_item_attach *attach, FILE *fp)
| Write a binary attachment to a file. More...
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. More...
pst_desc_tree * | pst_getNextDptr (pst_desc_tree *d)
| Walk the descriptor tree. More...
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. More...
void | pst_freeItem (pst_item *item)
| Free the item returned by pst_parse_item(). More...
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. More...
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. More...
int | pst_stricmp (char *a, char *b)
| compare strings case-insensitive. More...
size_t | pst_fwrite (const void *ptr, size_t size, size_t nmemb, FILE *stream)
| fwrite with checking for null pointer. More...
char * | pst_rfc2426_escape (char *str, char **result, size_t *resultlen)
| Add any necessary escape characters for rfc2426 vcard format. More...
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. More...
char * | pst_rfc2445_datetime_format (const FILETIME *ft, int buflen, char *result)
| Convert a FILETIME into rfc2445 date/time format 19531015T231000Z. More...
char * | pst_rfc2445_datetime_format_now (int buflen, char *result)
| Convert the current time rfc2445 date/time format 19531015T231000Z. More...
const char * | pst_default_charset (pst_item *item, int buflen, char *result)
| Get the default character set for this item. More...
void | pst_rfc2231 (pst_string *str)
| Convert str to rfc2231 encoding of str. More...
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. More...
void | pst_convert_utf8_null (pst_item *item, pst_string *str)
| Convert str to utf8 if possible; null strings are preserved. More...
void | pst_convert_utf8 (pst_item *item, pst_string *str)
| Convert str to utf8 if possible; null strings are converted into empty strings. More...
pst_recurrence * | pst_convert_recurrence (pst_item_appointment *appt)
| Decode raw recurrence data into a better structure. More...
void | pst_free_recurrence (pst_recurrence *r)
| Free a recurrence structure. More...

## Macro Definition Documentation

## PST_APP_LABEL_ANNIVERSARY

#define PST_APP_LABEL_ANNIVERSARY 9

Definition at line 70 of file libpst.h.

## PST_APP_LABEL_BIRTHDAY

#define PST_APP_LABEL_BIRTHDAY 8

Definition at line 69 of file libpst.h.

## PST_APP_LABEL_BUSINESS

#define PST_APP_LABEL_BUSINESS 2

Definition at line 63 of file libpst.h.

## PST_APP_LABEL_IMPORTANT

#define PST_APP_LABEL_IMPORTANT 1

Definition at line 62 of file libpst.h.

## PST_APP_LABEL_MUST_ATTEND

#define PST_APP_LABEL_MUST_ATTEND 5

Definition at line 66 of file libpst.h.

## PST_APP_LABEL_NEEDS_PREP

#define PST_APP_LABEL_NEEDS_PREP 7

Definition at line 68 of file libpst.h.

## PST_APP_LABEL_NONE

#define PST_APP_LABEL_NONE 0

Definition at line 61 of file libpst.h.

## PST_APP_LABEL_PERSONAL

#define PST_APP_LABEL_PERSONAL 3

Definition at line 64 of file libpst.h.

## PST_APP_LABEL_PHONE_CALL

#define PST_APP_LABEL_PHONE_CALL 10

Definition at line 71 of file libpst.h.

## PST_APP_LABEL_TRAVEL_REQ

#define PST_APP_LABEL_TRAVEL_REQ 6

Definition at line 67 of file libpst.h.

## PST_APP_LABEL_VACATION

#define PST_APP_LABEL_VACATION 4

Definition at line 65 of file libpst.h.

## PST_APP_RECUR_DAILY

#define PST_APP_RECUR_DAILY 1

Definition at line 75 of file libpst.h.

## PST_APP_RECUR_MONTHLY

#define PST_APP_RECUR_MONTHLY 3

Definition at line 77 of file libpst.h.

## PST_APP_RECUR_NONE

#define PST_APP_RECUR_NONE 0

Definition at line 74 of file libpst.h.

## PST_APP_RECUR_WEEKLY

#define PST_APP_RECUR_WEEKLY 2

Definition at line 76 of file libpst.h.

## PST_APP_RECUR_YEARLY

#define PST_APP_RECUR_YEARLY 4

Definition at line 78 of file libpst.h.

## PST_ATTACH_BY_REF

#define PST_ATTACH_BY_REF 2

Definition at line 83 of file libpst.h.

## PST_ATTACH_BY_REF_ONLY

#define PST_ATTACH_BY_REF_ONLY 4

Definition at line 85 of file libpst.h.

## PST_ATTACH_BY_REF_RESOLV

#define PST_ATTACH_BY_REF_RESOLV 3

Definition at line 84 of file libpst.h.

## PST_ATTACH_BY_VALUE

#define PST_ATTACH_BY_VALUE 1

Definition at line 82 of file libpst.h.

## PST_ATTACH_EMBEDDED

#define PST_ATTACH_EMBEDDED 5

Definition at line 86 of file libpst.h.

## PST_ATTACH_NONE

#define PST_ATTACH_NONE 0

Definition at line 81 of file libpst.h.

## PST_ATTACH_OLE

#define PST_ATTACH_OLE 6

Definition at line 87 of file libpst.h.

## PST_ATTRIB_HEADER

#define PST_ATTRIB_HEADER -1

Definition at line 52 of file libpst.h.

## PST_COMP_ENCRYPT

#define PST_COMP_ENCRYPT 1

Definition at line 44 of file libpst.h.

## PST_ENCRYPT

#define PST_ENCRYPT 2

Definition at line 45 of file libpst.h.

## PST_FLAG_ASSOCIATED

#define PST_FLAG_ASSOCIATED 0x40

Definition at line 96 of file libpst.h.

## PST_FLAG_FROM_ME

#define PST_FLAG_FROM_ME 0x20

Definition at line 95 of file libpst.h.

## PST_FLAG_HAS_ATTACHMENT

#define PST_FLAG_HAS_ATTACHMENT 0x10

Definition at line 94 of file libpst.h.

## PST_FLAG_NRN_PENDING

#define PST_FLAG_NRN_PENDING 0x200

Definition at line 99 of file libpst.h.

## PST_FLAG_READ

#define PST_FLAG_READ 0x01

Definition at line 90 of file libpst.h.

## PST_FLAG_RESEND

#define PST_FLAG_RESEND 0x80

Definition at line 97 of file libpst.h.

## PST_FLAG_RN_PENDING

#define PST_FLAG_RN_PENDING 0x100

Definition at line 98 of file libpst.h.

## PST_FLAG_SUBMIT

#define PST_FLAG_SUBMIT 0x04

Definition at line 92 of file libpst.h.

## PST_FLAG_UNMODIFIED

#define PST_FLAG_UNMODIFIED 0x02

Definition at line 91 of file libpst.h.

## PST_FLAG_UNSENT

#define PST_FLAG_UNSENT 0x08

Definition at line 93 of file libpst.h.

## PST_FREEBUSY_BUSY

#define PST_FREEBUSY_BUSY 2

Definition at line 57 of file libpst.h.

## PST_FREEBUSY_FREE

#define PST_FREEBUSY_FREE 0

Definition at line 55 of file libpst.h.

## PST_FREEBUSY_OUT_OF_OFFICE

#define PST_FREEBUSY_OUT_OF_OFFICE 3

Definition at line 58 of file libpst.h.

## PST_FREEBUSY_TENTATIVE

#define PST_FREEBUSY_TENTATIVE 1

Definition at line 56 of file libpst.h.

## PST_MAP_ATTRIB

#define PST_MAP_ATTRIB (uint32_t)1

Definition at line 48 of file libpst.h.

## PST_MAP_HEADER

#define PST_MAP_HEADER (uint32_t)2

Definition at line 49 of file libpst.h.

## PST_NO_ENCRYPT

#define PST_NO_ENCRYPT 0

Definition at line 43 of file libpst.h.

## PST_TYPE_APPOINTMENT

#define PST_TYPE_APPOINTMENT 8

Definition at line 33 of file libpst.h.

## PST_TYPE_CONTACT

#define PST_TYPE_CONTACT 9

Definition at line 34 of file libpst.h.

## PST_TYPE_JOURNAL

#define PST_TYPE_JOURNAL 10

Definition at line 35 of file libpst.h.

## PST_TYPE_MAX

#define PST_TYPE_MAX 15

Definition at line 40 of file libpst.h.

## PST_TYPE_NOTE

#define PST_TYPE_NOTE 1

Definition at line 31 of file libpst.h.

## PST_TYPE_OTHER

#define PST_TYPE_OTHER 13

Definition at line 38 of file libpst.h.

## PST_TYPE_REPORT

#define PST_TYPE_REPORT 14

Definition at line 39 of file libpst.h.

## PST_TYPE_SCHEDULE

#define PST_TYPE_SCHEDULE 2

Definition at line 32 of file libpst.h.

## PST_TYPE_STICKYNOTE

#define PST_TYPE_STICKYNOTE 11

Definition at line 36 of file libpst.h.

## PST_TYPE_TASK

#define PST_TYPE_TASK 12

Definition at line 37 of file libpst.h.

## Typedef Documentation

## pst_binary

typedef struct pst_binary pst_binary

a simple wrapper for binary blobs

## pst_block_recorder

typedef struct pst_block_recorder pst_block_recorder

this is only used for internal debugging

## pst_desc_tree

typedef struct pst_desc_tree pst_desc_tree

## pst_entryid

typedef struct pst_entryid pst_entryid

## pst_file

typedef struct pst_file pst_file

## pst_id2_tree

typedef struct pst_id2_tree pst_id2_tree

## pst_index_ll

typedef struct pst_index_ll pst_index_ll

## pst_item

typedef struct pst_item pst_item

This contains the common mapi elements, and pointers to structures for each major mapi item type.

It represents a complete mapi object.

## pst_item_appointment

typedef struct pst_item_appointment pst_item_appointment

This contains the appointment related mapi elements.

## pst_item_attach

typedef struct pst_item_attach pst_item_attach

This contains the attachment related mapi elements.

## pst_item_contact

typedef struct pst_item_contact pst_item_contact

This contains the contact related mapi elements.

## pst_item_email

typedef struct pst_item_email pst_item_email

This contains the email related mapi elements.

## pst_item_extra_field

typedef struct pst_item_extra_field pst_item_extra_field

linked list of extra header fields

## pst_item_folder

typedef struct pst_item_folder pst_item_folder

This contains the folder related mapi elements.

## pst_item_journal

typedef struct pst_item_journal pst_item_journal

This contains the journal related mapi elements.

## pst_item_message_store

typedef struct pst_item_message_store pst_item_message_store

This contains the message store related mapi elements.

## pst_recurrence

typedef struct pst_recurrence pst_recurrence

This contains the recurrence data separated into fields.

http://www.geocities.com/cainrandom/dev/MAPIRecurrence.html

## pst_string

typedef struct pst_string pst_string

The string is either utf8 encoded, or it is in the code page specified by the containing mapi object.

It can be forced into utf8 by calling pst_convert_utf8() or pst_convert_utf8_null().

## pst_x_attrib_ll

typedef struct pst_x_attrib_ll pst_x_attrib_ll

Linked list of extended attributes.

This is used to convert mapi_id values in the pst file into canonical mapi_id values to be used in this code. This list is kept in sorted order, where the key is the 'map' field. Some mapi_id values are converted to canonical mapi_id values (PST_MAP_ATTRIB), and others are converted to a string (PST_ATTRIB_HEADER).

## Function Documentation

## pst_attach_to_file()

size_t pst_attach_to_file | ( | pst_file * | pf,
|  | pst_item_attach * | attach,
|  | FILE * | fp
| ) |  |

Write a binary attachment to a file.

Parameters

  pf | pointer to the pst_file structure setup by pst_open().
  attach | pointer to the attachment record
  fp | pointer to an open FILE.

## pst_attach_to_file_base64()

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.

Parameters

  pf | pointer to the pst_file structure setup by pst_open().
  attach | pointer to the attachment record
  fp | pointer to an open FILE.

## pst_attach_to_mem()

pst_binary pst_attach_to_mem | ( | pst_file * | pf,
|  | pst_item_attach * | attach
| ) |  |

Assemble the binary attachment into a single buffer.

Parameters

  pf | pointer to the pst_file structure setup by pst_open().
  attach | pointer to the attachment record

Returns
  structure containing size of and pointer to the buffer. the caller must free this buffer.

## pst_close()

int pst_close | ( | pst_file * | pf | ) |

Close a pst file.

Parameters

  pf | pointer to the pst_file structure setup by pst_open().

## pst_convert_recurrence()

pst_recurrence* pst_convert_recurrence | ( | pst_item_appointment * | appt | ) |

Decode raw recurrence data into a better structure.

Parameters

  appt | pointer to appointment structure

Returns
  pointer to decoded recurrence structure that must be free'd by the caller.

## pst_convert_utf8()

void pst_convert_utf8 | ( | pst_item * | item,
|  | pst_string * | str
| ) |  |

Convert str to utf8 if possible; null strings are converted into empty strings.

Parameters

  item | pointer to the containing mapi item
  str | pointer to the mapi string of interest

## pst_convert_utf8_null()

void pst_convert_utf8_null | ( | pst_item * | item,
|  | pst_string * | str
| ) |  |

Convert str to utf8 if possible; null strings are preserved.

Parameters

  item | pointer to the containing mapi item
  str | pointer to the mapi string of interest

## pst_default_charset()

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.

Parameters

  | 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

Returns
  default character set as a string usable by iconv()

## pst_ff_getIDblock_dec()

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.

Parameters

  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.

Returns
  Size of block read into memory

## pst_free_recurrence()

void pst_free_recurrence | ( | pst_recurrence * | r | ) |

Free a recurrence structure.

Parameters

  r | input pointer to be freed

## pst_freeItem()

void pst_freeItem | ( | pst_item * | item | ) |

Free the item returned by pst_parse_item().

Parameters

  item | pointer to item returned from pst_parse_item().

## pst_fwrite()

size_t pst_fwrite | ( | const void * | ptr,
|  | size_t | size,
|  | size_t | nmemb,
|  | FILE * | stream
| ) |  |

fwrite with checking for null pointer.

Parameters

  ptr | pointer to the buffer
  size | size of each item
  nmemb | number of items
  stream | output file

Returns
  number of bytes written, zero if ptr==NULL

## pst_getID()

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.

Parameters

  pf | pointer to the pst_file structure setup by pst_open().
  i_id | key for the index linked list

Returns
  pointer to the element, or NULL if not found.

## pst_getNextDptr()

pst_desc_tree* pst_getNextDptr | ( | pst_desc_tree * | d | ) |

Walk the descriptor tree.

Parameters

  d | pointer to the current item in the descriptor tree.

Returns
  pointer to the next item in the descriptor tree.

## pst_getTopOfFolders()

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.

Parameters

  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).

## pst_load_extended_attributes()

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().

Parameters

  pf | pointer to the pst_file structure setup by pst_open().

## pst_load_index()

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().

Parameters

  pf | pointer to the pst_file structure setup by pst_open().

## pst_open()

int pst_open | ( | pst_file * | pf,
|  | const char * | name,
|  | const char * | charset
| ) |  |

Open a pst file.

Parameters

  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

Returns
  0 if ok, -1 if error

## pst_parse_item()

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.

Parameters

  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.

Returns
  pointer to the mapi object. Must be free'd by pst_freeItem().

## pst_reopen()

int pst_reopen | ( | pst_file * | pf | ) |

Reopen the pst file after a fork.

Parameters

  pf | pointer to the pst_file structure setup by pst_open().

Returns
  0 if ok, -1 if error

## pst_rfc2047()

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.

Parameters

  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

## pst_rfc2231()

void pst_rfc2231 | ( | pst_string * | str | ) |

Convert str to rfc2231 encoding of str.

Parameters

  str | pointer to the mapi string of interest

## pst_rfc2425_datetime_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.

Parameters

  [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

Returns
  time in rfc2425 format

## pst_rfc2426_escape()

char* pst_rfc2426_escape | ( | char * | str,
|  | char ** | result,
|  | size_t * | resultlen
| ) |  |

Add any necessary escape characters for rfc2426 vcard format.

Parameters

  [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

Returns
  pointer to output string, either the input pointer if there are no characters that need escapes, or a pointer to a possibly realloc'ed result buffer.

## pst_rfc2445_datetime_format()

char* pst_rfc2445_datetime_format | ( | const FILETIME * | ft,
|  | int | buflen,
|  | char * | result
| ) |  |

Convert a FILETIME into rfc2445 date/time format 19531015T231000Z.

Parameters

  [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

Returns
  time in rfc2445 format

## pst_rfc2445_datetime_format_now()

char* pst_rfc2445_datetime_format_now | ( | int | buflen,
|  | char * | result
| ) |  |

Convert the current time rfc2445 date/time format 19531015T231000Z.

Parameters

  [in] | buflen | length of the output buffer
  [out] | result | pointer to output buffer, must be at least 30 bytes

Returns
  time in rfc2445 format

## pst_stricmp()

int pst_stricmp | ( | char * | a,
|  | char * | b
| ) |  |

compare strings case-insensitive.

Returns
  -1 if a < b, 0 if a==b, 1 if a > b