Main Page | Data Structures | File List | Data Fields | Globals

mspack.h File Reference

#include <sys/types.h>
#include <unistd.h>

Go to the source code of this file.

Data Structures

struct  mscab_compressor
 TODO. More...

struct  mscab_decompressor
 A decompressor for .CAB (Microsoft Cabinet) files. More...

struct  mscabd_cabinet
 A structure which represents a single cabinet file. More...

struct  mscabd_file
 A structure which represents a single file in a cabinet or cabinet set. More...

struct  mscabd_folder
 A structure which represents a single folder in a cabinet or cabinet set. More...

struct  mschm_compressor
 TODO. More...

struct  mschm_decompressor
 A decompressor for .CHM (Microsoft HTMLHelp) files. More...

struct  mschmd_file
 A structure which represents a file stored in a CHM helpfile. More...

struct  mschmd_header
 A structure which represents a CHM helpfile. More...

struct  mschmd_sec_mscompressed
 A structure which represents the compressed section of a CHM helpfile. More...

struct  mschmd_sec_uncompressed
 A structure which represents the uncompressed section of a CHM helpfile. More...

struct  mschmd_section
 A structure which represents a section of a CHM helpfile. More...

struct  mshlp_compressor
 TODO. More...

struct  mshlp_decompressor
 TODO. More...

struct  mskwaj_compressor
 TODO. More...

struct  mskwaj_decompressor
 TODO. More...

struct  mslit_compressor
 TODO. More...

struct  mslit_decompressor
 TODO. More...

struct  mspack_file
 A structure which represents an open file handle. More...

struct  mspack_system
 A structure which abstracts file I/O and memory management. More...

struct  msszdd_compressor
 TODO. More...

struct  msszdd_decompressor
 TODO. More...


Defines

#define LIB_MSPACK_H   1
#define MSPACK_SYS_SELFTEST(result)
 System self-test function, to ensure both library and calling program can use one another.

#define MSPACK_VER_LIBRARY   (0)
 Pass to mspack_version() to get the overall library version.

#define MSPACK_VER_SYSTEM   (1)
 Pass to mspack_version() to get the mspack_system version.

#define MSPACK_VER_MSCABD   (2)
 Pass to mspack_version() to get the mscab_decompressor version.

#define MSPACK_VER_MSCABC   (3)
 Pass to mspack_version() to get the mscab_compressor version.

#define MSPACK_VER_MSCHMD   (4)
 Pass to mspack_version() to get the mschm_decompressor version.

#define MSPACK_VER_MSCHMC   (5)
 Pass to mspack_version() to get the mschm_compressor version.

#define MSPACK_VER_MSLITD   (6)
 Pass to mspack_version() to get the mslit_decompressor version.

#define MSPACK_VER_MSLITC   (7)
 Pass to mspack_version() to get the mslit_compressor version.

#define MSPACK_VER_MSHLPD   (8)
 Pass to mspack_version() to get the mshlp_decompressor version.

#define MSPACK_VER_MSHLPC   (9)
 Pass to mspack_version() to get the mshlp_compressor version.

#define MSPACK_VER_MSSZDDD   (10)
 Pass to mspack_version() to get the msszdd_decompressor version.

#define MSPACK_VER_MSSZDDC   (11)
 Pass to mspack_version() to get the msszdd_compressor version.

#define MSPACK_VER_MSKWAJD   (12)
 Pass to mspack_version() to get the mskwaj_decompressor version.

#define MSPACK_VER_MSKWAJC   (13)
 Pass to mspack_version() to get the mskwaj_compressor version.

#define MSPACK_SYS_OPEN_READ   (0)
 mspack_system::open() mode: open existing file for reading.

#define MSPACK_SYS_OPEN_WRITE   (1)
 mspack_system::open() mode: open new file for writing

#define MSPACK_SYS_OPEN_UPDATE   (2)
 mspack_system::open() mode: open existing file for writing

#define MSPACK_SYS_OPEN_APPEND   (3)
 mspack_system::open() mode: open existing file for writing

#define MSPACK_SYS_SEEK_START   (0)
 mspack_system::seek() mode: seek relative to start of file

#define MSPACK_SYS_SEEK_CUR   (1)
 mspack_system::seek() mode: seek relative to current offset

#define MSPACK_SYS_SEEK_END   (2)
 mspack_system::seek() mode: seek relative to end of file

#define MSPACK_ERR_OK   (0)
 Error code: no error.

#define MSPACK_ERR_ARGS   (1)
 Error code: bad arguments to method.

#define MSPACK_ERR_OPEN   (2)
 Error code: error opening file.

#define MSPACK_ERR_READ   (3)
 Error code: error reading file.

#define MSPACK_ERR_WRITE   (4)
 Error code: error writing file.

#define MSPACK_ERR_SEEK   (5)
 Error code: seek error.

#define MSPACK_ERR_NOMEMORY   (6)
 Error code: out of memory.

#define MSPACK_ERR_SIGNATURE   (7)
 Error code: bad "magic id" in file.

#define MSPACK_ERR_DATAFORMAT   (8)
 Error code: bad or corrupt file format.

#define MSPACK_ERR_CHECKSUM   (9)
 Error code: bad checksum or CRC.

#define MSPACK_ERR_CRUNCH   (10)
 Error code: error during compression.

#define MSPACK_ERR_DECRUNCH   (11)
 Error code: error during decompression.

#define MSCAB_HDR_RESV_OFFSET   (0x28)
 Offset from start of cabinet to the reserved header data (if present).

#define MSCAB_HDR_PREVCAB   (0x01)
 Cabinet header flag: cabinet has a predecessor.

#define MSCAB_HDR_NEXTCAB   (0x02)
 Cabinet header flag: cabinet has a successor.

#define MSCAB_HDR_RESV   (0x04)
 Cabinet header flag: cabinet has reserved header space.

#define MSCABD_COMP_METHOD(comp_type)   ((comp_type) & 0x0F)
 Returns the compression method used by a folder.

#define MSCABD_COMP_LEVEL(comp_type)   (((comp_type) >> 8) & 0x1F)
 Returns the compression level used by a folder.

#define MSCAB_COMP_NONE   (0)
 Compression mode: no compression.

#define MSCAB_COMP_MSZIP   (1)
 Compression mode: MSZIP (deflate) compression.

#define MSCAB_COMP_QUANTUM   (2)
 Compression mode: Quantum compression.

#define MSCAB_COMP_LZX   (3)
 Compression mode: LZX compression.

#define MSCAB_ATTRIB_RDONLY   (0x01)
 mscabd_file::attribs attribute: file is read-only.

#define MSCAB_ATTRIB_HIDDEN   (0x02)
 mscabd_file::attribs attribute: file is hidden.

#define MSCAB_ATTRIB_SYSTEM   (0x04)
 mscabd_file::attribs attribute: file is an operating system file.

#define MSCAB_ATTRIB_ARCH   (0x20)
 mscabd_file::attribs attribute: file is "archived".

#define MSCAB_ATTRIB_EXEC   (0x40)
 mscabd_file::attribs attribute: file is an executable program.

#define MSCAB_ATTRIB_UTF_NAME   (0x80)
 mscabd_file::attribs attribute: filename is UTF8, not ISO-8859-1.

#define MSCABD_PARAM_SEARCHBUF   (0)
 mscab_decompressor::set_param() parameter: search buffer size.

#define MSCABD_PARAM_FIXMSZIP   (1)
 mscab_decompressor::set_param() parameter: repair MS-ZIP streams?

#define MSCABD_PARAM_DECOMPBUF   (2)
 mscab_decompressor::set_param() parameter: size of decompression buffer


Functions

int mspack_sys_selftest_internal (int)
 Part of the MSPACK_SYS_SELFTEST() macro, must not be used directly.

int mspack_version (int interface)
 Enquire about the binary compatibility version of a specific interface in the library.

mscab_compressormspack_create_cab_compressor (struct mspack_system *sys)
 Creates a new CAB compressor.

mscab_decompressormspack_create_cab_decompressor (struct mspack_system *sys)
 Creates a new CAB decompressor.

void mspack_destroy_cab_compressor (struct mscab_compressor *this)
 Destroys an existing CAB compressor.

void mspack_destroy_cab_decompressor (struct mscab_decompressor *this)
 Destroys an existing CAB decompressor.

mschm_compressormspack_create_chm_compressor (struct mspack_system *sys)
 Creates a new CHM compressor.

mschm_decompressormspack_create_chm_decompressor (struct mspack_system *sys)
 Creates a new CHM decompressor.

void mspack_destroy_chm_compressor (struct mschm_compressor *this)
 Destroys an existing CHM compressor.

void mspack_destroy_chm_decompressor (struct mschm_decompressor *this)
 Destroys an existing CHM decompressor.

mslit_compressormspack_create_lit_compressor (struct mspack_system *sys)
 Creates a new LIT compressor.

mslit_decompressormspack_create_lit_decompressor (struct mspack_system *sys)
 Creates a new LIT decompressor.

void mspack_destroy_lit_compressor (struct mslit_compressor *this)
 Destroys an existing LIT compressor.

void mspack_destroy_lit_decompressor (struct mslit_decompressor *this)
 Destroys an existing LIT decompressor.

mshlp_compressormspack_create_hlp_compressor (struct mspack_system *sys)
 Creates a new HLP compressor.

mshlp_decompressormspack_create_hlp_decompressor (struct mspack_system *sys)
 Creates a new HLP decompressor.

void mspack_destroy_hlp_compressor (struct mshlp_compressor *this)
 Destroys an existing hlp compressor.

void mspack_destroy_hlp_decompressor (struct mshlp_decompressor *this)
 Destroys an existing hlp decompressor.

msszdd_compressormspack_create_szdd_compressor (struct mspack_system *sys)
 Creates a new SZDD compressor.

msszdd_decompressormspack_create_szdd_decompressor (struct mspack_system *sys)
 Creates a new SZDD decompressor.

void mspack_destroy_szdd_compressor (struct msszdd_compressor *this)
 Destroys an existing SZDD compressor.

void mspack_destroy_szdd_decompressor (struct msszdd_decompressor *this)
 Destroys an existing SZDD decompressor.

mskwaj_compressormspack_create_kwaj_compressor (struct mspack_system *sys)
 Creates a new KWAJ compressor.

mskwaj_decompressormspack_create_kwaj_decompressor (struct mspack_system *sys)
 Creates a new KWAJ decompressor.

void mspack_destroy_kwaj_compressor (struct mskwaj_compressor *this)
 Destroys an existing KWAJ compressor.

void mspack_destroy_kwaj_decompressor (struct mskwaj_decompressor *this)
 Destroys an existing KWAJ decompressor.


Define Documentation

#define LIB_MSPACK_H   1
 

#define MSCAB_ATTRIB_ARCH   (0x20)
 

mscabd_file::attribs attribute: file is "archived".

#define MSCAB_ATTRIB_EXEC   (0x40)
 

mscabd_file::attribs attribute: file is an executable program.

#define MSCAB_ATTRIB_HIDDEN   (0x02)
 

mscabd_file::attribs attribute: file is hidden.

#define MSCAB_ATTRIB_RDONLY   (0x01)
 

mscabd_file::attribs attribute: file is read-only.

#define MSCAB_ATTRIB_SYSTEM   (0x04)
 

mscabd_file::attribs attribute: file is an operating system file.

#define MSCAB_ATTRIB_UTF_NAME   (0x80)
 

mscabd_file::attribs attribute: filename is UTF8, not ISO-8859-1.

#define MSCAB_COMP_LZX   (3)
 

Compression mode: LZX compression.

#define MSCAB_COMP_MSZIP   (1)
 

Compression mode: MSZIP (deflate) compression.

#define MSCAB_COMP_NONE   (0)
 

Compression mode: no compression.

#define MSCAB_COMP_QUANTUM   (2)
 

Compression mode: Quantum compression.

#define MSCAB_HDR_NEXTCAB   (0x02)
 

Cabinet header flag: cabinet has a successor.

#define MSCAB_HDR_PREVCAB   (0x01)
 

Cabinet header flag: cabinet has a predecessor.

#define MSCAB_HDR_RESV   (0x04)
 

Cabinet header flag: cabinet has reserved header space.

#define MSCAB_HDR_RESV_OFFSET   (0x28)
 

Offset from start of cabinet to the reserved header data (if present).

#define MSCABD_COMP_LEVEL comp_type   )     (((comp_type) >> 8) & 0x1F)
 

Returns the compression level used by a folder.

Parameters:
comp_type a mscabd_folder::comp_type value
Returns:
the compression level. This is only defined by LZX and Quantum compression

#define MSCABD_COMP_METHOD comp_type   )     ((comp_type) & 0x0F)
 

Returns the compression method used by a folder.

Parameters:
comp_type a mscabd_folder::comp_type value
Returns:
one of MSCAB_COMP_NONE, MSCAB_COMP_MSZIP, MSCAB_COMP_QUANTUM or MSCAB_COMP_LZX

#define MSCABD_PARAM_DECOMPBUF   (2)
 

mscab_decompressor::set_param() parameter: size of decompression buffer

#define MSCABD_PARAM_FIXMSZIP   (1)
 

mscab_decompressor::set_param() parameter: repair MS-ZIP streams?

#define MSCABD_PARAM_SEARCHBUF   (0)
 

mscab_decompressor::set_param() parameter: search buffer size.

#define MSPACK_ERR_ARGS   (1)
 

Error code: bad arguments to method.

#define MSPACK_ERR_CHECKSUM   (9)
 

Error code: bad checksum or CRC.

#define MSPACK_ERR_CRUNCH   (10)
 

Error code: error during compression.

#define MSPACK_ERR_DATAFORMAT   (8)
 

Error code: bad or corrupt file format.

#define MSPACK_ERR_DECRUNCH   (11)
 

Error code: error during decompression.

#define MSPACK_ERR_NOMEMORY   (6)
 

Error code: out of memory.

#define MSPACK_ERR_OK   (0)
 

Error code: no error.

#define MSPACK_ERR_OPEN   (2)
 

Error code: error opening file.

#define MSPACK_ERR_READ   (3)
 

Error code: error reading file.

#define MSPACK_ERR_SEEK   (5)
 

Error code: seek error.

#define MSPACK_ERR_SIGNATURE   (7)
 

Error code: bad "magic id" in file.

#define MSPACK_ERR_WRITE   (4)
 

Error code: error writing file.

#define MSPACK_SYS_OPEN_APPEND   (3)
 

mspack_system::open() mode: open existing file for writing

#define MSPACK_SYS_OPEN_READ   (0)
 

mspack_system::open() mode: open existing file for reading.

#define MSPACK_SYS_OPEN_UPDATE   (2)
 

mspack_system::open() mode: open existing file for writing

#define MSPACK_SYS_OPEN_WRITE   (1)
 

mspack_system::open() mode: open new file for writing

#define MSPACK_SYS_SEEK_CUR   (1)
 

mspack_system::seek() mode: seek relative to current offset

#define MSPACK_SYS_SEEK_END   (2)
 

mspack_system::seek() mode: seek relative to end of file

#define MSPACK_SYS_SEEK_START   (0)
 

mspack_system::seek() mode: seek relative to start of file

#define MSPACK_SYS_SELFTEST result   ) 
 

Value:

do { \
  (result) = mspack_sys_selftest_internal(sizeof(off_t)); \
} while (0)
System self-test function, to ensure both library and calling program can use one another.

A result of MSPACK_ERR_OK means the library and caller are compatible. Any other result indicates that the library and caller are not compatible and should not be used. In particular, a value of MSPACK_ERR_SEEK means the library and caller use different off_t datatypes.

It should be used like so:

 int selftest_result;
 MSPACK_SYS_SELFTEST(selftest_result);
 if (selftest_result != MSPACK_ERR_OK) {
   fprintf(stderr, "incompatible with this build of libmspack\n");
   exit(0);
 }

Parameters:
result an int variable to store the result of the self-test

#define MSPACK_VER_LIBRARY   (0)
 

Pass to mspack_version() to get the overall library version.

#define MSPACK_VER_MSCABC   (3)
 

Pass to mspack_version() to get the mscab_compressor version.

#define MSPACK_VER_MSCABD   (2)
 

Pass to mspack_version() to get the mscab_decompressor version.

#define MSPACK_VER_MSCHMC   (5)
 

Pass to mspack_version() to get the mschm_compressor version.

#define MSPACK_VER_MSCHMD   (4)
 

Pass to mspack_version() to get the mschm_decompressor version.

#define MSPACK_VER_MSHLPC   (9)
 

Pass to mspack_version() to get the mshlp_compressor version.

#define MSPACK_VER_MSHLPD   (8)
 

Pass to mspack_version() to get the mshlp_decompressor version.

#define MSPACK_VER_MSKWAJC   (13)
 

Pass to mspack_version() to get the mskwaj_compressor version.

#define MSPACK_VER_MSKWAJD   (12)
 

Pass to mspack_version() to get the mskwaj_decompressor version.

#define MSPACK_VER_MSLITC   (7)
 

Pass to mspack_version() to get the mslit_compressor version.

#define MSPACK_VER_MSLITD   (6)
 

Pass to mspack_version() to get the mslit_decompressor version.

#define MSPACK_VER_MSSZDDC   (11)
 

Pass to mspack_version() to get the msszdd_compressor version.

#define MSPACK_VER_MSSZDDD   (10)
 

Pass to mspack_version() to get the msszdd_decompressor version.

#define MSPACK_VER_SYSTEM   (1)
 

Pass to mspack_version() to get the mspack_system version.


Function Documentation

struct mscab_compressor* mspack_create_cab_compressor struct mspack_system sys  ) 
 

Creates a new CAB compressor.

Parameters:
sys a custom mspack_system structure, or NULL to use the default
Returns:
a mscab_compressor or NULL

struct mscab_decompressor* mspack_create_cab_decompressor struct mspack_system sys  ) 
 

Creates a new CAB decompressor.

Parameters:
sys a custom mspack_system structure, or NULL to use the default
Returns:
a mscab_decompressor or NULL

struct mschm_compressor* mspack_create_chm_compressor struct mspack_system sys  ) 
 

Creates a new CHM compressor.

Parameters:
sys a custom mspack_system structure, or NULL to use the default
Returns:
a mschm_compressor or NULL

struct mschm_decompressor* mspack_create_chm_decompressor struct mspack_system sys  ) 
 

Creates a new CHM decompressor.

Parameters:
sys a custom mspack_system structure, or NULL to use the default
Returns:
a mschm_decompressor or NULL

struct mshlp_compressor* mspack_create_hlp_compressor struct mspack_system sys  ) 
 

Creates a new HLP compressor.

Parameters:
sys a custom mspack_system structure, or NULL to use the default
Returns:
a mshlp_compressor or NULL

struct mshlp_decompressor* mspack_create_hlp_decompressor struct mspack_system sys  ) 
 

Creates a new HLP decompressor.

Parameters:
sys a custom mspack_system structure, or NULL to use the default
Returns:
a mshlp_decompressor or NULL

struct mskwaj_compressor* mspack_create_kwaj_compressor struct mspack_system sys  ) 
 

Creates a new KWAJ compressor.

Parameters:
sys a custom mspack_system structure, or NULL to use the default
Returns:
a mskwaj_compressor or NULL

struct mskwaj_decompressor* mspack_create_kwaj_decompressor struct mspack_system sys  ) 
 

Creates a new KWAJ decompressor.

Parameters:
sys a custom mspack_system structure, or NULL to use the default
Returns:
a mskwaj_decompressor or NULL

struct mslit_compressor* mspack_create_lit_compressor struct mspack_system sys  ) 
 

Creates a new LIT compressor.

Parameters:
sys a custom mspack_system structure, or NULL to use the default
Returns:
a mslit_compressor or NULL

struct mslit_decompressor* mspack_create_lit_decompressor struct mspack_system sys  ) 
 

Creates a new LIT decompressor.

Parameters:
sys a custom mspack_system structure, or NULL to use the default
Returns:
a mslit_decompressor or NULL

struct msszdd_compressor* mspack_create_szdd_compressor struct mspack_system sys  ) 
 

Creates a new SZDD compressor.

Parameters:
sys a custom mspack_system structure, or NULL to use the default
Returns:
a msszdd_compressor or NULL

struct msszdd_decompressor* mspack_create_szdd_decompressor struct mspack_system sys  ) 
 

Creates a new SZDD decompressor.

Parameters:
sys a custom mspack_system structure, or NULL to use the default
Returns:
a msszdd_decompressor or NULL

void mspack_destroy_cab_compressor struct mscab_compressor this  ) 
 

Destroys an existing CAB compressor.

Parameters:
this the mscab_compressor to destroy

void mspack_destroy_cab_decompressor struct mscab_decompressor this  ) 
 

Destroys an existing CAB decompressor.

Parameters:
this the mscab_decompressor to destroy

void mspack_destroy_chm_compressor struct mschm_compressor this  ) 
 

Destroys an existing CHM compressor.

Parameters:
this the mschm_compressor to destroy

void mspack_destroy_chm_decompressor struct mschm_decompressor this  ) 
 

Destroys an existing CHM decompressor.

Parameters:
this the mschm_decompressor to destroy

void mspack_destroy_hlp_compressor struct mshlp_compressor this  ) 
 

Destroys an existing hlp compressor.

Parameters:
this the mshlp_compressor to destroy

void mspack_destroy_hlp_decompressor struct mshlp_decompressor this  ) 
 

Destroys an existing hlp decompressor.

Parameters:
this the mshlp_decompressor to destroy

void mspack_destroy_kwaj_compressor struct mskwaj_compressor this  ) 
 

Destroys an existing KWAJ compressor.

Parameters:
this the mskwaj_compressor to destroy

void mspack_destroy_kwaj_decompressor struct mskwaj_decompressor this  ) 
 

Destroys an existing KWAJ decompressor.

Parameters:
this the mskwaj_decompressor to destroy

void mspack_destroy_lit_compressor struct mslit_compressor this  ) 
 

Destroys an existing LIT compressor.

Parameters:
this the mslit_compressor to destroy

void mspack_destroy_lit_decompressor struct mslit_decompressor this  ) 
 

Destroys an existing LIT decompressor.

Parameters:
this the mslit_decompressor to destroy

void mspack_destroy_szdd_compressor struct msszdd_compressor this  ) 
 

Destroys an existing SZDD compressor.

Parameters:
this the msszdd_compressor to destroy

void mspack_destroy_szdd_decompressor struct msszdd_decompressor this  ) 
 

Destroys an existing SZDD decompressor.

Parameters:
this the msszdd_decompressor to destroy

int mspack_sys_selftest_internal int   ) 
 

Part of the MSPACK_SYS_SELFTEST() macro, must not be used directly.

int mspack_version int  interface  ) 
 

Enquire about the binary compatibility version of a specific interface in the library.

Currently, the following interfaces are defined:

The result of the function should be interpreted as follows:

  • -1: this interface is completely unknown to the library
  • 0: this interface is known, but non-functioning
  • 1: this interface has all basic functionality
  • 2, 3, ...: this interface has additional functionality, clearly marked in the documentation as "version 2", "version 3" and so on.

Parameters:
interface the interface to request current version of
Returns:
the version of the requested interface


Generated on Wed Mar 10 13:13:54 2004 for libmspack by doxygen 1.3.5