comparison src/libpst.h @ 204:268458c79e9b

more cleanup of the shared library interface, but still not fully thread safe
author Carl Byington <carl@five-ten-sg.com>
date Sat, 06 Jun 2009 11:39:02 -0700
parents 3850a3b11745
children 94bde95d7e18
comparison
equal deleted inserted replaced
203:9fb600ef4e03 204:268458c79e9b
992 * @return pointer to the element, or NULL if not found. 992 * @return pointer to the element, or NULL if not found.
993 */ 993 */
994 pst_index_ll* pst_getID(pst_file* pf, uint64_t i_id); 994 pst_index_ll* pst_getID(pst_file* pf, uint64_t i_id);
995 995
996 996
997 /** Decrypt a block of data from the pst file.
998 * @param i_id identifier of this block, needed as part of the key for the enigma cipher
999 * @param buf pointer to the buffer to be decrypted in place
1000 * @param size size of the buffer
1001 * @param type
1002 @li 0 PST_NO_ENCRYPT, none
1003 @li 1 PST_COMP_ENCRYPT, simple byte substitution cipher with fixed key
1004 @li 2 PST_ENCRYPT, german enigma 3 rotor cipher with fixed key
1005 * @return 0 if ok, -1 if error (NULL buffer or unknown encryption type)
1006 */
1007 int pst_decrypt(uint64_t i_id, char *buf, size_t size, unsigned char type);
1008
1009
1010 /** Get an ID block from the file using pst_ff_getIDblock() and decrypt if necessary. 997 /** Get an ID block from the file using pst_ff_getIDblock() and decrypt if necessary.
1011 * @param pf pointer to the pst_file structure setup by pst_open(). 998 * @param pf pointer to the pst_file structure setup by pst_open().
1012 * @param i_id ID of block to retrieve 999 * @param i_id ID of block to retrieve
1013 * @param buf reference to pointer to buffer that will contain the data block. 1000 * @param buf reference to pointer to buffer that will contain the data block.
1014 * If this pointer is non-NULL, it will first be free()d. 1001 * If this pointer is non-NULL, it will first be free()d.
1015 * @return Size of block read into memory 1002 * @return Size of block read into memory
1016 */ 1003 */
1017 size_t pst_ff_getIDblock_dec(pst_file *pf, uint64_t i_id, char **buf); 1004 size_t pst_ff_getIDblock_dec(pst_file *pf, uint64_t i_id, char **buf);
1018
1019
1020 /** Read a block of data from the file into memory.
1021 * @param pf pointer to the pst_file structure setup by pst_open().
1022 * @param i_id ID of block to read
1023 * @param buf reference to pointer to buffer that will contain the data block.
1024 * If this pointer is non-NULL, it will first be free()d.
1025 * @return size of block read into memory
1026 */
1027 size_t pst_ff_getIDblock(pst_file *pf, uint64_t i_id, char** buf);
1028 1005
1029 1006
1030 /** fwrite with checking for null pointer. 1007 /** fwrite with checking for null pointer.
1031 * @param ptr pointer to the buffer 1008 * @param ptr pointer to the buffer
1032 * @param size size of each item 1009 * @param size size of each item