0.9.8.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Macros | Typedefs | Functions
bmz.h File Reference
#include "Common/compat-c.h"
Include dependency graph for bmz.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define BMZ_VER_NUM   0x0110
 
#define BMZ_VER_MAJOR   (BMZ_VER_NUM >> 12)
 
#define BMZ_VER_MINOR   ((BMZ_VER_NUM >> 8) & 0xf)
 
#define BMZ_VER_RELEASE   ((BMZ_VER_NUM >> 4) & 0xf)
 
#define BMZ_VER_PATCH   (BMZ_VER_NUM & 0xf)
 
#define BMZ_E_OK   0
 
#define BMZ_E_ERROR   (-1)
 
#define BMZ_E_INPUT_OVERRUN   (-4)
 
#define BMZ_E_OUTPUT_OVERRUN   (-5)
 

Typedefs

typedef void(* BmzOutProc )(const char *msg, size_t len)
 Signature of the messaging/logging procedure. More...
 
typedef void(* BmzDieProc )(const char *msg) HT_NORETURN
 Signature of the fatal procedure. More...
 

Functions

 bmz_init ()
 Perform bmz initialization only needs to be called once, mostly for sanity checks. More...
 
 bmz_pack (const void *in, size_t in_len, void *out, size_t *out_len_p, size_t offset, size_t fp_len, unsigned flags, void *work_mem)
 Perform bmz compression. More...
 
 bmz_unpack (const void *in, size_t in_len, void *out, size_t *out_len_p, void *work_mem)
 Perform bmz decompression. More...
 
 bmz_pack_buflen (size_t in_len)
 Compute bmz compression output buffer length. More...
 
 bmz_pack_worklen (size_t in_len, size_t fp_len)
 Return size of work memory for bmz compression. More...
 
 bmz_unpack_worklen (size_t out_len)
 Return size of work memory for bmz decompression. More...
 
 bmz_set_verbosity (int verbosity)
 Set the verbosity of library for testing and debugging. More...
 
 bmz_set_out_proc (BmzOutProc proc)
 Set messaging/logging procedure. More...
 
 bmz_set_die_proc (BmzDieProc proc)
 Set fatal message procedure. More...
 
 bmz_checksum (const void *in, size_t in_len)
 A fast checksum (adler32) function that might be useful. More...
 
 bmz_update_checksum (unsigned s, const void *in, size_t in_len)
 

Macro Definition Documentation

#define BMZ_E_ERROR   (-1)

Definition at line 33 of file bmz.h.

#define BMZ_E_INPUT_OVERRUN   (-4)

Definition at line 34 of file bmz.h.

#define BMZ_E_OK   0

Definition at line 32 of file bmz.h.

#define BMZ_E_OUTPUT_OVERRUN   (-5)

Definition at line 35 of file bmz.h.

#define BMZ_VER_MAJOR   (BMZ_VER_NUM >> 12)

Definition at line 26 of file bmz.h.

#define BMZ_VER_MINOR   ((BMZ_VER_NUM >> 8) & 0xf)

Definition at line 27 of file bmz.h.

#define BMZ_VER_NUM   0x0110

Definition at line 25 of file bmz.h.

#define BMZ_VER_PATCH   (BMZ_VER_NUM & 0xf)

Definition at line 29 of file bmz.h.

#define BMZ_VER_RELEASE   ((BMZ_VER_NUM >> 4) & 0xf)

Definition at line 28 of file bmz.h.

Typedef Documentation

typedef void(* BmzDieProc)(const char *msg) HT_NORETURN

Signature of the fatal procedure.

Definition at line 121 of file bmz.h.

typedef void(* BmzOutProc)(const char *msg, size_t len)

Signature of the messaging/logging procedure.

Definition at line 117 of file bmz.h.

Function Documentation

bmz_checksum ( const void *  in,
size_t  in_len 
)

A fast checksum (adler32) function that might be useful.

Parameters
in- input buffer
in_len- input buffer length in bytes

Definition at line 1473 of file bmz.c.

bmz_init ( )

Perform bmz initialization only needs to be called once, mostly for sanity checks.

Definition at line 1445 of file bmz.c.

bmz_pack ( const void *  in,
size_t  in_len,
void *  out,
size_t *  out_len_p,
size_t  offset,
size_t  fp_len,
unsigned  flags,
void *  work_mem 
)

Perform bmz compression.

Parameters
in- input buffer
in_len- input buffer length in bytes
out- output buffer for compressed data
out_len_p- pointer to the length of output, which specifies the size of the output buffer as input and is set to the length of compressed data on return
offset- starting offset of fingerprints, use 0 if you have to ask
fp_len- fingerprint length, use 50 if you have to ask
flags- compression options. See BMZ_F_* defines.
work_mem- pointer to work memory buffer, cf. bmz_pack_worklen
Returns
error code

Definition at line 1254 of file bmz.c.

bmz_pack_buflen ( size_t  in_len)

Compute bmz compression output buffer length.

Parameters
in_len- input buffer length in bytes
Returns
output length in bytes

Definition at line 1164 of file bmz.c.

bmz_pack_worklen ( size_t  in_len,
size_t  fp_len 
)

Return size of work memory for bmz compression.

So we don't have to allocate memory per invocation when the input buffer size is fixed.

Parameters
in_len- input buffer length in bytes
fp_len- fingerprint length in bytes
Returns
length in bytes

Definition at line 1186 of file bmz.c.

bmz_set_die_proc ( BmzDieProc  proc)

Set fatal message procedure.

Parameters
proc- pointer to a fatal function
Returns
old proc
bmz_set_out_proc ( BmzOutProc  proc)

Set messaging/logging procedure.

Parameters
proc- pointer to a message function
Returns
old proc

Definition at line 253 of file bmz.c.

bmz_set_verbosity ( int  verbosity)

Set the verbosity of library for testing and debugging.

Parameters
verbosity- 0, 1, 2
Returns
old verbosity

Definition at line 246 of file bmz.c.

bmz_unpack ( const void *  in,
size_t  in_len,
void *  out,
size_t *  out_len_p,
void *  work_mem 
)

Perform bmz decompression.

Parameters
in- input buffer (compressed)
in_len- input buffer length in bytes
out- output buffer
out_len_p- pointer to the length of output, which specifies the size of the output buffer and is set to length of uncompressed data on return;
work_mem- pointer to work memory buffer, cf. bmz_unpack_worklen
Returns
error code

Definition at line 1280 of file bmz.c.

bmz_unpack_worklen ( size_t  out_len)

Return size of work memory for bmz decompression.

Parameters
out_len- work memory length in bytes
Returns
length in bytes

Definition at line 1192 of file bmz.c.

bmz_update_checksum ( unsigned  s,
const void *  in,
size_t  in_len 
)

Definition at line 1478 of file bmz.c.