group
group__libshare__memzlib
Provides ability to compress and decompress sets of named data segments (files) for the SHZ compression format.

SHZ Compression and Decompression

typedef
typedef uint32_t shz_idx
typedef
typedef struct shz_map_t shz_map_t
typedef
typedef struct shz_mod_t shz_mod_t
typedef
typedef struct shz_data_t shz_data_t
typedef
typedef struct shz_t shz_t
typedef
typedef struct shz_tree_t shz_tree_t
typedef
typedef struct shz_data_t shz_index_t
typedef
typedef ssize_t(* shz_write_f)(shz_t *, shz_idx *, unsigned char *, size_t)
The bulk write function template for a module.
typedef
typedef int(* shz_read_f)(shz_t *, shz_idx, shbuf_t *)
The bulk read function template for a module.
typedef
typedef int(* shz_list_f)(shz_t *, shz_idx, char *f_path, shbuf_t *, void *p)
function
int shzenc
(shbuf_t *buff, void *data, size_t data_len)
Compress data into a data buffer.
Param
buff
The data buffer to store the compressed data.
data
The data segment to compress.
function
int shzdec
(shbuf_t *buff, unsigned char *data, size_t data_len)
Decompress a data segment into a data buffer.
Param
buff
The data buffer to store the decompressed data.
data
The data segment to decompress.
function
shz_t* shz_init
(shbuf_t *buff, int flags)
function
void shz_free
(shz_t **z_p)
function
shz_t* shz_fopen
(const char *path, int flags)
function
int shz_extract
(shz_t *z, char *fspec)
Extract files from the an archive to the current working directory.
Param
z
The SHZ archive.
fspec
NULL to omit filter or a wild-card filename specification.
Note
Specify a literal filename in the fspec to extract a single file.
function
int shz_list
(shz_t *z, char *rel_path, char *fspec, shz_list_f op, void *p)
Iterate through all files, filtering by file-spec, to call a supplied procedure.
Param
z
The SHZ archive.
rel_path
An absolute path to extract file(s) to.
fspec
NULL to omit filter or a wild-card filename specification.
op
The procedure to call for each file listed.
Note
Specify a literal filename in the fspec to extract a single file.
function
int shz_file_add
(shz_t *z, const char *filename)
Add (or over-write) a file in the archive based on a relative path.
function
int shz_file_append
(shz_t *z, const char *filename, shbuf_t *buff)
Add to the contents of a file in the archive.
function
int shz_file_write
(shz_t *z, const char *filename, shbuf_t *buff)
Write the contents of a file to the archive.
function
int shz_file_read
(shz_t *z, const char *filename, shbuf_t *buff)
Read the contents of a file in the archive.
function
const char* shz_type_label
(int type)
Obtain the print label for a SHZ page type.
function
int shz_arch_init
(shz_t *z, shbuf_t *buff, int flags)
function
int shz_arch_fopen
(shz_t *z, const char *path, int flags)
function
void shz_arch_free
(shz_t *z)
function
shz_hdr_t* shz_page_new
(shz_t *z, int type, shz_idx *bnum_p)
Allocate a new block page for the archive.
function
shz_hdr_t* shz_page
(shz_t *z, int bnum)
Obtain a block page from the archive.
function
int shz_file_extract
(shz_t *z, char *rel_path, char *fspec)
Extracts all files contained in an archive, relative to , that match the filter.
Param
z
The SHZ archive.
rel_path
An absolute path to extract file(s) to.
fspec
NULL for no filter, or a wildcard filename specification.
Note
All paths refernce the local file system.
function
int shz_list_write
(shz_t *z, shz_idx f_idx, char *f_path, shbuf_t *buff, void *p)
function
ssize_t shz_raw_write
(shz_t *z, shz_idx *ret_idx_p, unsigned char *data, size_t data_len)
function
int shz_raw_read
(shz_t *z, shz_idx bnum, shbuf_t *buff)
function
int shz_index_add
(shz_t *z, shz_write_f f, shbuf_t *buff, shz_idx *ret_idx_p)
function
int shz_index_write
(shz_t *z, shz_write_f f, shbuf_t *buff, shz_idx *ret_idx_p)
function
int shz_index_read
(shz_t *z, shz_read_f f, shbuf_t *buff, shz_idx bnum)
function
ssize_t shz_zlib_write
(shz_t *z, shz_idx *z_bnum_p, unsigned char *data, size_t data_len)
function
int shz_zlib_read
(shz_t *z, int page_bnum, shbuf_t *dec_buff)
function
int shz_mod_write
(shz_t *z, shz_idx mod_bnum, shbuf_t *buff)
function
int shz_mod_read
(shz_t *z, shz_mod_t *mod, shbuf_t *buff)
function
time_t shz_mod_ctime
(shz_t *z, shz_idx bnum)
function
time_t shz_mod_mtime
(shz_t *z, shz_idx bnum)
function
const char* shz_mod_label
(shz_t *z, shz_idx bnum)
function
shtime_t shz_ctime
(shz_t *z)
The time that the archive was created.
function
shtime_t shz_mtime
(shz_t *z)
The last time the archive was updated.
function
time_t shz_uctime
(shz_t *z)
The time the archive was created in unix-time.
function
time_t shz_umtime
(shz_t *z)
The last modification time in unix-time format.
define
SHZ_PAGE_SIZE
1024
The size of each page.
define
SHZ_ALLOC_SIZE
65536
The maximum size to allocate at once for the archive.
define
SHZ_PAGE_NONE
0
define
SHZ_PAGE_ROOT
1001
define
SHZ_PAGE_BRANCH
1002
define
SHZ_PAGE_DATA
1004
define
SHZ_PAGE_RAW
1006
define
SHZ_PAGE_INDEX
10011
A block containing hash references to archived data content.
define
SHZ_PAGE_ZLIB_DATA
10021
A block containing a segment of raw zlib compressed data.
define
SHZ_PAGE_ZLIB
10022
define
SHZ_PAGE_DIR
10102
define
SHZ_PAGE_FILE
10104
define
SHZ_PAGE_BASE
23123
A base page which initializes the archive state.
See
shz_base_t structshz__base__t compound
define
MAX_SHZ_PAGE_MODES
24000
define
SHZ_DICT_MASK
0xFF
define
SHZ_HASH_MASK
0xF0
define
SHZ_MAX_INDEX_SIZE
((SHZ_PAGE_SIZE - sizeof()) / sizeof(shz_idx))structshz__data__tcompoundshz_index_t
define
SHZ_WRITE_F
(()(_f))group__libshare__memzlib_1ga04147c4a8cbc72bbb94d3088e7872f92membershz_write_f
define
SHZ_READ_F
(()(_f))group__libshare__memzlib_1gac4bc78a08b4951b293b3692b1161edd5membershz_read_f
define
SHZ_CREATE
(1 << 0)
define
SHZ_FAST
(1 << 1)
whether to reduce the encode (compress) window in order to increase speed
define
SHZ_NOATTR
(1 << 2)
Flag to denote file attributes should not be applied from archive.
define
SHZ_TRUNC
(1 << 3)
Truncate the archive upon initialization.
define
SHZ_RAW
(1 << 4)
Do not encode (compress) the stored data.
define
SHZ_VERBOSE
(1 << 5)
Log information about individual archive operations.
define
SHZ_IGNORE
(1 << 6)
Skip data integrity errors.
define
SHZ_QUIET
(1 << 7)
define
SHZ_ABSOLUTE
(1 << 8)
define
SHZ_ALLOC
(1 << 20)
Whether the buffer is internally allocated by the shz functionality.
define
SHZ_FRESH
(1 << 21)
Whether to start with an empty archive.
define
SHZ_VERIFY
(1 << 22)
Flag to denote that a base CRC needs verified.