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 struct shz_map_t shz_map_t
typedef struct shz_mod_t shz_mod_t
typedef struct shz_data_t shz_data_t
typedef struct shz_t shz_t
typedef struct shz_tree_t shz_tree_t
typedef struct shz_data_t shz_index_t
typedef ssize_t(* shz_write_f)(shz_t *, shz_idx *, unsigned char *, size_t)
The bulk write function template for a module.
typedef int(* shz_read_f)(shz_t *, shz_idx, shbuf_t *)
The bulk read function template for a module.
typedef int(* shz_list_f)(shz_t *, shz_idx, char *f_path, shbuf_t *, void *p)
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.
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.
shz_t* shz_init
(shbuf_t *buff, int flags)
void shz_free
(shz_t **z_p)
shz_t* shz_fopen
(const char *path, int flags)
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.
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.
int shz_file_add
(shz_t *z, const char *filename)
Add (or over-write) a file in the archive based on a relative path.
int shz_file_append
(shz_t *z, const char *filename, shbuf_t *buff)
Add to the contents of a file in the archive.
int shz_file_write
(shz_t *z, const char *filename, shbuf_t *buff)
Write the contents of a file to the archive.
int shz_file_read
(shz_t *z, const char *filename, shbuf_t *buff)
Read the contents of a file in the archive.
const char* shz_type_label
(int type)
Obtain the print label for a SHZ page type.
int shz_arch_init
(shz_t *z, shbuf_t *buff, int flags)
int shz_arch_fopen
(shz_t *z, const char *path, int flags)
void shz_arch_free
(shz_t *z)
shz_hdr_t* shz_page_new
(shz_t *z, int type, shz_idx *bnum_p)
Allocate a new block page for the archive.
shz_hdr_t* shz_page
(shz_t *z, int bnum)
Obtain a block page from the archive.
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.
int shz_list_write
(shz_t *z, shz_idx f_idx, char *f_path, shbuf_t *buff, void *p)
ssize_t shz_raw_write
(shz_t *z, shz_idx *ret_idx_p, unsigned char *data, size_t data_len)
int shz_raw_read
(shz_t *z, shz_idx bnum, shbuf_t *buff)
int shz_index_add
(shz_t *z, shz_write_f f, shbuf_t *buff, shz_idx *ret_idx_p)
int shz_index_write
(shz_t *z, shz_write_f f, shbuf_t *buff, shz_idx *ret_idx_p)
int shz_index_read
(shz_t *z, shz_read_f f, shbuf_t *buff, shz_idx bnum)
ssize_t shz_zlib_write
(shz_t *z, shz_idx *z_bnum_p, unsigned char *data, size_t data_len)
int shz_zlib_read
(shz_t *z, int page_bnum, shbuf_t *dec_buff)
int shz_mod_write
(shz_t *z, shz_idx mod_bnum, shbuf_t *buff)
int shz_mod_read
(shz_t *z, shz_mod_t *mod, shbuf_t *buff)
time_t shz_mod_ctime
(shz_t *z, shz_idx bnum)
time_t shz_mod_mtime
(shz_t *z, shz_idx bnum)
const char* shz_mod_label
(shz_t *z, shz_idx bnum)
shtime_t shz_ctime
(shz_t *z)
The time that the archive was created.
shtime_t shz_mtime
(shz_t *z)
The last time the archive was updated.
time_t shz_uctime
(shz_t *z)
The time the archive was created in unix-time.
time_t shz_umtime
(shz_t *z)
The last modification time in unix-time format.
SHZ_PAGE_SIZE
1024
The size of each page.
SHZ_ALLOC_SIZE
65536
The maximum size to allocate at once for the archive.
SHZ_PAGE_INDEX
10011
A block containing hash references to archived data content.
SHZ_PAGE_ZLIB_DATA
10021
A block containing a segment of raw zlib compressed data.
SHZ_PAGE_BASE
23123
A base page which initializes the archive state.
See
shz_base_t
structshz__base__t
compound
SHZ_MAX_INDEX_SIZE
((SHZ_PAGE_SIZE - sizeof()) / sizeof(shz_idx))structshz__data__tcompoundshz_index_t
SHZ_WRITE_F
(()(_f))group__libshare__memzlib_1ga04147c4a8cbc72bbb94d3088e7872f92membershz_write_f
SHZ_READ_F
(()(_f))group__libshare__memzlib_1gac4bc78a08b4951b293b3692b1161edd5membershz_read_f
SHZ_FAST
(1 << 1)
whether to reduce the encode (compress) window in order to increase speed
SHZ_NOATTR
(1 << 2)
Flag to denote file attributes should not be applied from archive.
SHZ_TRUNC
(1 << 3)
Truncate the archive upon initialization.
SHZ_RAW
(1 << 4)
Do not encode (compress) the stored data.
SHZ_VERBOSE
(1 << 5)
Log information about individual archive operations.
SHZ_IGNORE
(1 << 6)
Skip data integrity errors.
SHZ_ALLOC
(1 << 20)
Whether the buffer is internally allocated by the shz functionality.
SHZ_FRESH
(1 << 21)
Whether to start with an empty archive.
SHZ_VERIFY
(1 << 22)
Flag to denote that a base CRC needs verified.