0.9.8.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
bmz.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2007-2015 Hypertable, Inc.
3  *
4  * This file is part of Hypertable.
5  *
6  * Hypertable is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; version 3 of the
9  * License, or any later version.
10  *
11  * Hypertable is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with Hypertable. If not, see <http://www.gnu.org/licenses/>
18  */
19 
20 #ifndef HYPERTABLE_BMZ_H
21 #define HYPERTABLE_BMZ_H
22 
23 #include "Common/compat-c.h"
24 
25 #define BMZ_VER_NUM 0x0110
26 #define BMZ_VER_MAJOR (BMZ_VER_NUM >> 12)
27 #define BMZ_VER_MINOR ((BMZ_VER_NUM >> 8) & 0xf)
28 #define BMZ_VER_RELEASE ((BMZ_VER_NUM >> 4) & 0xf)
29 #define BMZ_VER_PATCH (BMZ_VER_NUM & 0xf)
30 
31 /* Error codes */
32 #define BMZ_E_OK 0
33 #define BMZ_E_ERROR (-1)
34 #define BMZ_E_INPUT_OVERRUN (-4)
35 #define BMZ_E_OUTPUT_OVERRUN (-5)
36 
37 
38 /* APIs */
39 
43 HT_EXTERN(int)
44 bmz_init();
45 
60 HT_EXTERN(int)
61 bmz_pack(const void *in, size_t in_len, void *out, size_t *out_len_p,
62  size_t offset, size_t fp_len, unsigned flags, void *work_mem);
63 
75 HT_EXTERN(int)
76 bmz_unpack(const void *in, size_t in_len, void *out, size_t *out_len_p,
77  void *work_mem);
78 
84 HT_EXTERN(size_t)
85 bmz_pack_buflen(size_t in_len);
86 
96 HT_EXTERN(size_t)
97 bmz_pack_worklen(size_t in_len, size_t fp_len);
98 
104 HT_EXTERN(size_t)
105 bmz_unpack_worklen(size_t out_len);
106 
112 HT_EXTERN(int)
113 bmz_set_verbosity(int verbosity);
114 
117 typedef void (*BmzOutProc)(const char *msg, size_t len);
118 
121 typedef void (*BmzDieProc)(const char *msg) HT_NORETURN;
122 
130 
138 
144 HT_EXTERN(unsigned)
145 bmz_checksum(const void *in, size_t in_len);
146 
147 HT_EXTERN(unsigned)
148 bmz_update_checksum(unsigned s, const void *in, size_t in_len);
149 
150 #endif /* HYPERTABLE_BMZ_H */
151 /* vim: et sw=2
152  */
bmz_unpack(const void *in, size_t in_len, void *out, size_t *out_len_p, void *work_mem)
Perform bmz decompression.
Definition: bmz.c:1280
#define HT_NORETURN
Definition: compat-c.h:60
bmz_pack_buflen(size_t in_len)
Compute bmz compression output buffer length.
Definition: bmz.c:1164
bmz_set_die_proc(BmzDieProc proc)
Set fatal message procedure.
bmz_init()
Perform bmz initialization only needs to be called once, mostly for sanity checks.
Definition: bmz.c:1445
bmz_set_verbosity(int verbosity)
Set the verbosity of library for testing and debugging.
Definition: bmz.c:246
bmz_update_checksum(unsigned s, const void *in, size_t in_len)
Definition: bmz.c:1478
bmz_checksum(const void *in, size_t in_len)
A fast checksum (adler32) function that might be useful.
Definition: bmz.c:1473
#define HT_EXTERN(ret_type)
Definition: compat-c.h:52
void(* BmzDieProc)(const char *msg) HT_NORETURN
Signature of the fatal procedure.
Definition: bmz.h:121
bmz_unpack_worklen(size_t out_len)
Return size of work memory for bmz decompression.
Definition: bmz.c:1192
bmz_set_out_proc(BmzOutProc proc)
Set messaging/logging procedure.
Definition: bmz.c:253
bmz_pack_worklen(size_t in_len, size_t fp_len)
Return size of work memory for bmz compression.
Definition: bmz.c:1186
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.
Definition: bmz.c:1254
void(* BmzOutProc)(const char *msg, size_t len)
Signature of the messaging/logging procedure.
Definition: bmz.h:117
Required portability definitions for all .cc files.