xref: /dflybsd-src/sys/sys/inflate.h (revision 86d7f5d305c6adaa56ff4582ece9859d73106103)
1*86d7f5d3SJohn Marino /*
2*86d7f5d3SJohn Marino  * ----------------------------------------------------------------------------
3*86d7f5d3SJohn Marino  * "THE BEER-WARE LICENSE" (Revision 42):
4*86d7f5d3SJohn Marino  * <phk@login.dkuug.dk> wrote this file.  As long as you retain this notice you
5*86d7f5d3SJohn Marino  * can do whatever you want with this stuff. If we meet some day, and you think
6*86d7f5d3SJohn Marino  * this stuff is worth it, you can buy me a beer in return.   Poul-Henning Kamp
7*86d7f5d3SJohn Marino  * ----------------------------------------------------------------------------
8*86d7f5d3SJohn Marino  *
9*86d7f5d3SJohn Marino  * $FreeBSD: src/sys/sys/inflate.h,v 1.11 1999/12/29 04:24:42 peter Exp $
10*86d7f5d3SJohn Marino  * $DragonFly: src/sys/sys/inflate.h,v 1.4 2006/05/20 02:42:13 dillon Exp $
11*86d7f5d3SJohn Marino  *
12*86d7f5d3SJohn Marino  */
13*86d7f5d3SJohn Marino #ifndef	_SYS_INFLATE_H_
14*86d7f5d3SJohn Marino #define	_SYS_INFLATE_H_
15*86d7f5d3SJohn Marino 
16*86d7f5d3SJohn Marino #if defined(_KERNEL) || defined(KZIP)
17*86d7f5d3SJohn Marino 
18*86d7f5d3SJohn Marino #ifndef _SYS_TYPES_H_
19*86d7f5d3SJohn Marino #include <sys/types.h>
20*86d7f5d3SJohn Marino #endif
21*86d7f5d3SJohn Marino 
22*86d7f5d3SJohn Marino #define GZ_EOF -1
23*86d7f5d3SJohn Marino 
24*86d7f5d3SJohn Marino #define GZ_WSIZE 0x8000
25*86d7f5d3SJohn Marino 
26*86d7f5d3SJohn Marino /*
27*86d7f5d3SJohn Marino  * Global variables used by inflate and friends.
28*86d7f5d3SJohn Marino  * This structure is used in order to make inflate() reentrant.
29*86d7f5d3SJohn Marino  */
30*86d7f5d3SJohn Marino struct inflate {
31*86d7f5d3SJohn Marino 	/* Public part */
32*86d7f5d3SJohn Marino 
33*86d7f5d3SJohn Marino 	/* This pointer is passed along to the two functions below */
34*86d7f5d3SJohn Marino 	void           *gz_private;
35*86d7f5d3SJohn Marino 
36*86d7f5d3SJohn Marino 	/* Fetch next character to be uncompressed */
37*86d7f5d3SJohn Marino 	int             (*gz_input) (void *);
38*86d7f5d3SJohn Marino 
39*86d7f5d3SJohn Marino 	/* Dispose of uncompressed characters */
40*86d7f5d3SJohn Marino 	int             (*gz_output) (void *, u_char *, u_long);
41*86d7f5d3SJohn Marino 
42*86d7f5d3SJohn Marino 	/* Private part */
43*86d7f5d3SJohn Marino 	u_long          gz_bb;	/* bit buffer */
44*86d7f5d3SJohn Marino 	unsigned        gz_bk;	/* bits in bit buffer */
45*86d7f5d3SJohn Marino 	unsigned        gz_hufts;	/* track memory usage */
46*86d7f5d3SJohn Marino 	struct huft    *gz_fixed_tl;	/* must init to NULL !! */
47*86d7f5d3SJohn Marino 	struct huft    *gz_fixed_td;
48*86d7f5d3SJohn Marino 	int             gz_fixed_bl;
49*86d7f5d3SJohn Marino 	int             gz_fixed_bd;
50*86d7f5d3SJohn Marino 	u_char         *gz_slide;
51*86d7f5d3SJohn Marino 	unsigned        gz_wp;
52*86d7f5d3SJohn Marino };
53*86d7f5d3SJohn Marino 
54*86d7f5d3SJohn Marino int inflate     (struct inflate *);
55*86d7f5d3SJohn Marino 
56*86d7f5d3SJohn Marino #endif	/* _KERNEL || KZIP */
57*86d7f5d3SJohn Marino 
58*86d7f5d3SJohn Marino #endif	/* ! _SYS_INFLATE_H_ */
59