1193323Sed/* $FreeBSD: releng/10.2/sys/net/zlib.h 245102 2013-01-06 14:59:59Z peter $	*/
2193323Sed
3193323Sed/*
4193323Sed * This file is derived from zlib.h and zconf.h from the zlib-1.0.4
5193323Sed * distribution by Jean-loup Gailly and Mark Adler, with some additions
6193323Sed * by Paul Mackerras to aid in implementing Deflate compression and
7193323Sed * decompression for PPP packets.
8193323Sed */
9193323Sed
10193323Sed/*
11193323Sed *  ==FILEVERSION 971127==
12193323Sed *
13193323Sed * This marker is used by the Linux installation script to determine
14193323Sed * whether an up-to-date version of this file is already installed.
15193323Sed */
16193323Sed
17193323Sed
18193323Sed/* +++ zlib.h */
19193323Sed/*-
20193323Sed  zlib.h -- interface of the 'zlib' general purpose compression library
21193323Sed  version 1.0.4, Jul 24th, 1996.
22193323Sed
23193323Sed  Copyright (C) 1995-1996 Jean-loup Gailly and Mark Adler
24193323Sed
25195340Sed  This software is provided 'as-is', without any express or implied
26193323Sed  warranty.  In no event will the authors be held liable for any damages
27193323Sed  arising from the use of this software.
28193323Sed
29193323Sed  Permission is granted to anyone to use this software for any purpose,
30193323Sed  including commercial applications, and to alter it and redistribute it
31193323Sed  freely, subject to the following restrictions:
32193323Sed
33208599Srdivacky  1. The origin of this software must not be misrepresented; you must not
34208599Srdivacky     claim that you wrote the original software. If you use this software
35193323Sed     in a product, an acknowledgment in the product documentation would be
36193323Sed     appreciated but is not required.
37193323Sed  2. Altered source versions must be plainly marked as such, and must not be
38193323Sed     misrepresented as being the original software.
39193323Sed  3. This notice may not be removed or altered from any source distribution.
40193323Sed
41193323Sed  Jean-loup Gailly        Mark Adler
42193323Sed  gzip@prep.ai.mit.edu    madler@alumni.caltech.edu
43193323Sed*/
44193323Sed/*
45193323Sed  The data format used by the zlib library is described by RFCs (Request for
46193323Sed  Comments) 1950 to 1952 in the files ftp://ds.internic.net/rfc/rfc1950.txt
47193323Sed  (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format).
48193323Sed*/
49193323Sed
50193323Sed#ifndef _ZLIB_H
51193323Sed#define _ZLIB_H
52193323Sed
53193323Sed#ifdef __cplusplus
54193323Sedextern "C" {
55193323Sed#endif
56193323Sed
57193323Sed
58193323Sed/* +++ zconf.h */
59193323Sed/* zconf.h -- configuration of the zlib compression library
60193323Sed * Copyright (C) 1995-1996 Jean-loup Gailly.
61193323Sed * For conditions of distribution and use, see copyright notice in zlib.h
62193323Sed */
63193323Sed
64208599Srdivacky/* From: zconf.h,v 1.20 1996/07/02 15:09:28 me Exp $ */
65208599Srdivacky
66193323Sed#ifndef _ZCONF_H
67193323Sed#define _ZCONF_H
68208599Srdivacky
69208599Srdivacky/*
70208599Srdivacky * If you *really* need a unique prefix for all types and library functions,
71208599Srdivacky * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
72208599Srdivacky */
73208599Srdivacky#ifdef Z_PREFIX
74208599Srdivacky#  define deflateInit_	z_deflateInit_
75208599Srdivacky#  define deflate	z_deflate
76208599Srdivacky#  define deflateEnd	z_deflateEnd
77208599Srdivacky#  define inflateInit_ 	z_inflateInit_
78208599Srdivacky#  define inflate	z_inflate
79208599Srdivacky#  define inflateEnd	z_inflateEnd
80208599Srdivacky#  define deflateInit2_	z_deflateInit2_
81208599Srdivacky#  define deflateSetDictionary z_deflateSetDictionary
82208599Srdivacky#  define deflateCopy	z_deflateCopy
83193323Sed#  define deflateReset	z_deflateReset
84195340Sed#  define deflateParams	z_deflateParams
85193323Sed#  define inflateInit2_	z_inflateInit2_
86193323Sed#  define inflateSetDictionary z_inflateSetDictionary
87193323Sed#  define inflateSync	z_inflateSync
88193323Sed#  define inflateReset	z_inflateReset
89193323Sed#  define compress	z_compress
90193323Sed#  define uncompress	z_uncompress
91193323Sed#  define adler32	z_adler32
92193323Sed#if 0
93193323Sed#  define crc32		z_crc32
94193323Sed#  define get_crc_table z_get_crc_table
95193323Sed#endif
96193323Sed
97193323Sed#  define Byte		z_Byte
98195340Sed#  define uInt		z_uInt
99193323Sed#  define uLong		z_uLong
100193323Sed#  define Bytef	        z_Bytef
101193323Sed#  define charf		z_charf
102193323Sed#  define intf		z_intf
103193323Sed#  define uIntf		z_uIntf
104193323Sed#  define uLongf	z_uLongf
105193323Sed#  define voidpf	z_voidpf
106193323Sed#  define voidp		z_voidp
107193323Sed#endif
108193323Sed
109193323Sed#if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32)
110193323Sed#  define WIN32
111193323Sed#endif
112193323Sed#if defined(__GNUC__) || defined(WIN32) || defined(__386__) || defined(__i386__)
113193323Sed#  ifndef __32BIT__
114193323Sed#    define __32BIT__
115193323Sed#  endif
116193323Sed#endif
117193323Sed#if defined(__MSDOS__) && !defined(MSDOS)
118193323Sed#  define MSDOS
119193323Sed#endif
120193323Sed
121193323Sed/*
122193323Sed * Compile with -DMAXSEG_64K if the alloc function cannot allocate more
123193323Sed * than 64k bytes at a time (needed on systems with 16-bit int).
124193323Sed */
125193323Sed#if defined(MSDOS) && !defined(__32BIT__)
126193323Sed#  define MAXSEG_64K
127193323Sed#endif
128193323Sed#ifdef MSDOS
129193323Sed#  define UNALIGNED_OK
130193323Sed#endif
131193323Sed
132193323Sed#if (defined(MSDOS) || defined(_WINDOWS) || defined(WIN32))  && !defined(STDC)
133193323Sed#  define STDC
134193323Sed#endif
135193323Sed#if (defined(__STDC__) || defined(__cplusplus)) && !defined(STDC)
136195340Sed#  define STDC
137193323Sed#endif
138193323Sed
139193323Sed#ifndef STDC
140193323Sed#  ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */
141193323Sed#    define const
142193323Sed#  endif
143193323Sed#endif
144193323Sed
145193323Sed/* Some Mac compilers merge all .h files incorrectly: */
146193323Sed#if defined(__MWERKS__) || defined(applec) ||defined(THINK_C) ||defined(__SC__)
147195340Sed#  define NO_DUMMY_DECL
148193323Sed#endif
149193323Sed
150193323Sed/* Maximum value for memLevel in deflateInit2 */
151193323Sed#ifndef MAX_MEM_LEVEL
152193323Sed#  ifdef MAXSEG_64K
153193323Sed#    define MAX_MEM_LEVEL 8
154193323Sed#  else
155193323Sed#    define MAX_MEM_LEVEL 9
156193323Sed#  endif
157193323Sed#endif
158193323Sed
159193323Sed/* Maximum value for windowBits in deflateInit2 and inflateInit2 */
160193323Sed#ifndef MAX_WBITS
161193323Sed#  define MAX_WBITS   15 /* 32K LZ77 window */
162195340Sed#endif
163198090Srdivacky
164198090Srdivacky/* The memory requirements for deflate are (in bytes):
165198090Srdivacky            1 << (windowBits+2)   +  1 << (memLevel+9)
166193323Sed that is: 128K for windowBits=15  +  128K for memLevel = 8  (default values)
167193323Sed plus a few kilobytes for small objects. For example, if you want to reduce
168198090Srdivacky the default memory requirements from 256K to 128K, compile with
169193323Sed     make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7"
170198090Srdivacky Of course this will generally degrade compression (there's no free lunch).
171193323Sed
172198090Srdivacky   The memory requirements for inflate are (in bytes) 1 << windowBits
173193323Sed that is, 32K for windowBits=15 (default value) plus a few kilobytes
174198090Srdivacky for small objects.
175193323Sed*/
176198090Srdivacky
177193323Sed                        /* Type declarations */
178198090Srdivacky
179193323Sed#ifndef OF /* function prototypes */
180198090Srdivacky#  ifdef STDC
181198090Srdivacky#    define OF(args)  args
182198090Srdivacky#  else
183193323Sed#    define OF(args)  ()
184193323Sed#  endif
185193323Sed#endif
186193323Sed
187193323Sed/* The following definitions for FAR are needed only for MSDOS mixed
188195340Sed * model programming (small or medium model with some far allocations).
189193323Sed * This was tested only with MSC; for other MSDOS compilers you may have
190193323Sed * to define NO_MEMCPY in zutil.h.  If you don't need the mixed model,
191195340Sed * just define FAR to be empty.
192193323Sed */
193193323Sed#if (defined(M_I86SM) || defined(M_I86MM)) && !defined(__32BIT__)
194206083Srdivacky   /* MSC small or medium model */
195206083Srdivacky#  define SMALL_MEDIUM
196206083Srdivacky#  ifdef _MSC_VER
197206083Srdivacky#    define FAR __far
198206083Srdivacky#  else
199193323Sed#    define FAR far
200198090Srdivacky#  endif
201193323Sed#endif
202193323Sed#if defined(__BORLANDC__) && (defined(__SMALL__) || defined(__MEDIUM__))
203193323Sed#  ifndef __32BIT__
204193323Sed#    define SMALL_MEDIUM
205193323Sed#    define FAR __far
206193323Sed#  endif
207193323Sed#endif
208193323Sed#ifndef FAR
209193323Sed#   define FAR
210193323Sed#endif
211195340Sed
212193323Sedtypedef unsigned char  Byte;  /* 8 bits */
213193323Sedtypedef unsigned int   uInt;  /* 16 bits or more */
214193323Sedtypedef unsigned long  uLong; /* 32 bits or more */
215193323Sed
216193323Sed#if defined(__BORLANDC__) && defined(SMALL_MEDIUM)
217193323Sed   /* Borland C/C++ ignores FAR inside typedef */
218193323Sed#  define Bytef Byte FAR
219193323Sed#else
220193323Sed   typedef Byte  FAR Bytef;
221193323Sed#endif
222193323Sedtypedef char  FAR charf;
223193323Sedtypedef int   FAR intf;
224193323Sedtypedef uInt  FAR uIntf;
225193323Sedtypedef uLong FAR uLongf;
226198090Srdivacky
227193323Sed#ifdef STDC
228193323Sed   typedef void FAR *voidpf;
229193323Sed   typedef void     *voidp;
230193323Sed#else
231193323Sed   typedef Byte FAR *voidpf;
232193323Sed   typedef Byte     *voidp;
233198090Srdivacky#endif
234198090Srdivacky
235193323Sed
236198090Srdivacky/* Compile with -DZLIB_DLL for Windows DLL support */
237193323Sed#if (defined(_WINDOWS) || defined(WINDOWS)) && defined(ZLIB_DLL)
238193323Sed#  include <windows.h>
239193323Sed#  define EXPORT  WINAPI
240193323Sed#else
241193323Sed#  define EXPORT
242193323Sed#endif
243193323Sed
244193323Sed#endif /* _ZCONF_H */
245193323Sed/* --- zconf.h */
246193323Sed
247193323Sed#define ZLIB_VERSION "1.0.4P"
248193323Sed
249193323Sed/*
250193323Sed     The 'zlib' compression library provides in-memory compression and
251193323Sed  decompression functions, including integrity checks of the uncompressed
252198090Srdivacky  data.  This version of the library supports only one compression method
253193323Sed  (deflation) but other algorithms may be added later and will have the same
254193323Sed  stream interface.
255193323Sed
256193323Sed     For compression the application must provide the output buffer and
257193323Sed  may optionally provide the input buffer for optimization. For decompression,
258193323Sed  the application must provide the input buffer and may optionally provide
259193323Sed  the output buffer for optimization.
260193323Sed
261193323Sed     Compression can be done in a single step if the buffers are large
262193323Sed  enough (for example if an input file is mmap'ed), or can be done by
263193323Sed  repeated calls of the compression function.  In the latter case, the
264193323Sed  application must provide more input and/or consume the output
265193323Sed  (providing more output space) before each call.
266193323Sed
267193323Sed     The library does not install any signal handler. It is recommended to
268193323Sed  add at least a handler for SIGSEGV when decompressing; the library checks
269193323Sed  the consistency of the input data whenever possible but may go nuts
270193323Sed  for some forms of corrupted input.
271193323Sed*/
272193323Sed
273193323Sedtypedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size));
274206083Srdivackytypedef void   (*free_func)  OF((voidpf opaque, voidpf address));
275193323Sed
276193323Sedstruct internal_state;
277193323Sed
278206083Srdivackytypedef struct z_stream_s {
279193323Sed    Bytef    *next_in;  /* next input byte */
280193323Sed    uInt     avail_in;  /* number of bytes available at next_in */
281193323Sed    uLong    total_in;  /* total nb of input bytes read so far */
282193323Sed
283193323Sed    Bytef    *next_out; /* next output byte should be put there */
284193323Sed    uInt     avail_out; /* remaining free space at next_out */
285193323Sed    uLong    total_out; /* total nb of bytes output so far */
286193323Sed
287193323Sed    const char     *msg; /* last error message, NULL if no error */
288193323Sed    struct internal_state FAR *state; /* not visible by applications */
289193323Sed
290193323Sed    alloc_func zalloc;  /* used to allocate the internal state */
291193323Sed    free_func  zfree;   /* used to free the internal state */
292193323Sed    voidpf     opaque;  /* private data object passed to zalloc and zfree */
293193323Sed
294193323Sed    int     data_type;  /* best guess about the data type: ascii or binary */
295193323Sed    uLong   adler;      /* adler32 value of the uncompressed data */
296193323Sed    uLong   reserved;   /* reserved for future use */
297193323Sed} z_stream;
298193323Sed
299193323Sedtypedef z_stream FAR *z_streamp;
300195340Sed
301193323Sed/*
302193323Sed   The application must update next_in and avail_in when avail_in has
303193323Sed   dropped to zero. It must update next_out and avail_out when avail_out
304193323Sed   has dropped to zero. The application must initialize zalloc, zfree and
305193323Sed   opaque before calling the init function. All other fields are set by the
306193323Sed   compression library and must not be updated by the application.
307193323Sed
308193323Sed   The opaque value provided by the application will be passed as the first
309193323Sed   parameter for calls of zalloc and zfree. This can be useful for custom
310193323Sed   memory management. The compression library attaches no meaning to the
311193323Sed   opaque value.
312193323Sed
313193323Sed   zalloc must return Z_NULL if there is not enough memory for the object.
314193323Sed   On 16-bit systems, the functions zalloc and zfree must be able to allocate
315193323Sed   exactly 65536 bytes, but will not be required to allocate more than this
316193323Sed   if the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS,
317193323Sed   pointers returned by zalloc for objects of exactly 65536 bytes *must*
318193323Sed   have their offset normalized to zero. The default allocation function
319193323Sed   provided by this library ensures this (see zutil.c). To reduce memory
320193323Sed   requirements and avoid any allocation of 64K objects, at the expense of
321193323Sed   compression ratio, compile the library with -DMAX_WBITS=14 (see zconf.h).
322193323Sed
323193323Sed   The fields total_in and total_out can be used for statistics or
324193323Sed   progress reports. After compression, total_in holds the total size of
325193323Sed   the uncompressed data and may be saved for use in the decompressor
326193323Sed   (particularly if the decompressor wants to decompress everything in
327198090Srdivacky   a single step).
328193323Sed*/
329193323Sed
330193323Sed                        /* constants */
331193323Sed
332193323Sed#define Z_NO_FLUSH      0
333193323Sed#define Z_PARTIAL_FLUSH 1
334193323Sed#define Z_PACKET_FLUSH	2
335193323Sed#define Z_SYNC_FLUSH    3
336193323Sed#define Z_FULL_FLUSH    4
337193323Sed#define Z_FINISH        5
338193323Sed/* Allowed flush values; see deflate() below for details */
339198090Srdivacky
340198090Srdivacky#define Z_OK            0
341198090Srdivacky#define Z_STREAM_END    1
342193323Sed#define Z_NEED_DICT     2
343193323Sed#define Z_ERRNO        (-1)
344193323Sed#define Z_STREAM_ERROR (-2)
345193323Sed#define Z_DATA_ERROR   (-3)
346193323Sed#define Z_MEM_ERROR    (-4)
347193323Sed#define Z_BUF_ERROR    (-5)
348193323Sed#define Z_VERSION_ERROR (-6)
349193323Sed/* Return codes for the compression/decompression functions. Negative
350193323Sed * values are errors, positive values are used for special but normal events.
351193323Sed */
352198090Srdivacky
353198090Srdivacky#define Z_NO_COMPRESSION         0
354198090Srdivacky#define Z_BEST_SPEED             1
355193323Sed#define Z_BEST_COMPRESSION       9
356193323Sed#define Z_DEFAULT_COMPRESSION  (-1)
357193323Sed/* compression levels */
358193323Sed
359193323Sed#define Z_FILTERED            1
360193323Sed#define Z_HUFFMAN_ONLY        2
361193323Sed#define Z_DEFAULT_STRATEGY    0
362193323Sed/* compression strategy; see deflateInit2() below for details */
363193323Sed
364193323Sed#define Z_BINARY   0
365193323Sed#define Z_ASCII    1
366193323Sed#define Z_UNKNOWN  2
367198090Srdivacky/* Possible values of the data_type field */
368198090Srdivacky
369198090Srdivacky#define Z_DEFLATED   8
370193323Sed/* The deflate compression method (the only one supported in this version) */
371193323Sed
372193323Sed#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
373193323Sed
374193323Sed#define zlib_version zlibVersion()
375193323Sed/* for compatibility with versions < 1.0.2 */
376193323Sed
377193323Sed                        /* basic functions */
378193323Sed
379193323Sedextern const char * EXPORT zlibVersion OF((void));
380198090Srdivacky/* The application can compare zlibVersion and ZLIB_VERSION for consistency.
381198090Srdivacky   If the first character differs, the library code actually used is
382198090Srdivacky   not compatible with the zlib.h header file used by the application.
383193323Sed   This check is automatically made by deflateInit and inflateInit.
384193323Sed */
385193323Sed
386193323Sed/*
387193323Sedextern int EXPORT deflateInit OF((z_streamp strm, int level));
388193323Sed
389193323Sed     Initializes the internal stream state for compression. The fields
390193323Sed   zalloc, zfree and opaque must be initialized before by the caller.
391193323Sed   If zalloc and zfree are set to Z_NULL, deflateInit updates them to
392193323Sed   use default allocation functions.
393193323Sed
394193323Sed     The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9:
395193323Sed   1 gives best speed, 9 gives best compression, 0 gives no compression at
396195340Sed   all (the input data is simply copied a block at a time).
397193323Sed   Z_DEFAULT_COMPRESSION requests a default compromise between speed and
398193323Sed   compression (currently equivalent to level 6).
399193323Sed
400193323Sed     deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not
401193323Sed   enough memory, Z_STREAM_ERROR if level is not a valid compression level,
402193323Sed   Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible
403193323Sed   with the version assumed by the caller (ZLIB_VERSION).
404193323Sed   msg is set to null if there is no error message.  deflateInit does not
405193323Sed   perform any compression: this will be done by deflate().
406193323Sed*/
407193323Sed
408193323Sed
409193323Sedextern int EXPORT deflate OF((z_streamp strm, int flush));
410193323Sed/*
411193323Sed  Performs one or both of the following actions:
412193323Sed
413193323Sed  - Compress more input starting at next_in and update next_in and avail_in
414193323Sed    accordingly. If not all input can be processed (because there is not
415193323Sed    enough room in the output buffer), next_in and avail_in are updated and
416193323Sed    processing will resume at this point for the next call of deflate().
417193323Sed
418193323Sed  - Provide more output starting at next_out and update next_out and avail_out
419193323Sed    accordingly. This action is forced if the parameter flush is non zero.
420193323Sed    Forcing flush frequently degrades the compression ratio, so this parameter
421193323Sed    should be set only when necessary (in interactive applications).
422193323Sed    Some output may be provided even if flush is not set.
423193323Sed
424193323Sed  Before the call of deflate(), the application should ensure that at least
425193323Sed  one of the actions is possible, by providing more input and/or consuming
426193323Sed  more output, and updating avail_in or avail_out accordingly; avail_out
427193323Sed  should never be zero before the call. The application can consume the
428193323Sed  compressed output when it wants, for example when the output buffer is full
429193323Sed  (avail_out == 0), or after each call of deflate(). If deflate returns Z_OK
430193323Sed  and with zero avail_out, it must be called again after making room in the
431193323Sed  output buffer because there might be more output pending.
432193323Sed
433193323Sed    If the parameter flush is set to Z_PARTIAL_FLUSH, the current compression
434193323Sed  block is terminated and flushed to the output buffer so that the
435193323Sed  decompressor can get all input data available so far. For method 9, a future
436193323Sed  variant on method 8, the current block will be flushed but not terminated.
437193323Sed  Z_SYNC_FLUSH has the same effect as partial flush except that the compressed
438193323Sed  output is byte aligned (the compressor can clear its internal bit buffer)
439193323Sed  and the current block is always terminated; this can be useful if the
440193323Sed  compressor has to be restarted from scratch after an interruption (in which
441193323Sed  case the internal state of the compressor may be lost).
442193323Sed    If flush is set to Z_FULL_FLUSH, the compression block is terminated, a
443193323Sed  special marker is output and the compression dictionary is discarded; this
444193323Sed  is useful to allow the decompressor to synchronize if one compressed block
445193323Sed  has been damaged (see inflateSync below).  Flushing degrades compression and
446193323Sed  so should be used only when necessary.  Using Z_FULL_FLUSH too often can
447193323Sed  seriously degrade the compression. If deflate returns with avail_out == 0,
448193323Sed  this function must be called again with the same value of the flush
449193323Sed  parameter and more output space (updated avail_out), until the flush is
450193323Sed  complete (deflate returns with non-zero avail_out).
451193323Sed
452193323Sed    If the parameter flush is set to Z_PACKET_FLUSH, the compression
453195340Sed  block is terminated, and a zero-length stored block is output,
454193323Sed  omitting the length bytes (the effect of this is that the 3-bit type
455193323Sed  code 000 for a stored block is output, and the output is then
456193323Sed  byte-aligned).  This is designed for use at the end of a PPP packet.
457193323Sed
458193323Sed    If the parameter flush is set to Z_FINISH, pending input is processed,
459193323Sed  pending output is flushed and deflate returns with Z_STREAM_END if there
460193323Sed  was enough output space; if deflate returns with Z_OK, this function must be
461193323Sed  called again with Z_FINISH and more output space (updated avail_out) but no
462193323Sed  more input data, until it returns with Z_STREAM_END or an error. After
463193323Sed  deflate has returned Z_STREAM_END, the only possible operations on the
464193323Sed  stream are deflateReset or deflateEnd.
465193323Sed
466193323Sed    Z_FINISH can be used immediately after deflateInit if all the compression
467193323Sed  is to be done in a single step. In this case, avail_out must be at least
468193323Sed  0.1% larger than avail_in plus 12 bytes.  If deflate does not return
469193323Sed  Z_STREAM_END, then it must be called again as described above.
470193323Sed
471193323Sed    deflate() may update data_type if it can make a good guess about
472193323Sed  the input data type (Z_ASCII or Z_BINARY). In doubt, the data is considered
473193323Sed  binary. This field is only for information purposes and does not affect
474193323Sed  the compression algorithm in any manner.
475193323Sed
476193323Sed    deflate() returns Z_OK if some progress has been made (more input
477193323Sed  processed or more output produced), Z_STREAM_END if all input has been
478193323Sed  consumed and all output has been produced (only when flush is set to
479193323Sed  Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example
480193323Sed  if next_in or next_out was NULL), Z_BUF_ERROR if no progress is possible.
481193323Sed*/
482193323Sed
483193323Sed
484193323Sedextern int EXPORT deflateEnd OF((z_streamp strm));
485193323Sed/*
486193323Sed     All dynamically allocated data structures for this stream are freed.
487193323Sed   This function discards any unprocessed input and does not flush any
488193323Sed   pending output.
489193323Sed
490193323Sed     deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the
491193323Sed   stream state was inconsistent, Z_DATA_ERROR if the stream was freed
492193323Sed   prematurely (some input or output was discarded). In the error case,
493193323Sed   msg may be set but then points to a static string (which must not be
494193323Sed   deallocated).
495193323Sed*/
496193323Sed
497193323Sed
498193323Sed/*
499193323Sedextern int EXPORT inflateInit OF((z_streamp strm));
500193323Sed
501193323Sed     Initializes the internal stream state for decompression. The fields
502193323Sed   zalloc, zfree and opaque must be initialized before by the caller.  If
503193323Sed   zalloc and zfree are set to Z_NULL, inflateInit updates them to use default
504193323Sed   allocation functions.
505193323Sed
506193323Sed     inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not
507193323Sed   enough memory, Z_VERSION_ERROR if the zlib library version is incompatible
508193323Sed   with the version assumed by the caller.  msg is set to null if there is no
509193323Sed   error message. inflateInit does not perform any decompression: this will be
510193323Sed   done by inflate().
511193323Sed*/
512193323Sed
513193323Sed#if defined(__FreeBSD__) && defined(_KERNEL)
514193323Sed#define inflate       _zlib104_inflate     /* FreeBSD already has an inflate :-( */
515193323Sed#endif
516193323Sed
517193323Sedextern int EXPORT inflate OF((z_streamp strm, int flush));
518193323Sed/*
519193323Sed  Performs one or both of the following actions:
520193323Sed
521193323Sed  - Decompress more input starting at next_in and update next_in and avail_in
522193323Sed    accordingly. If not all input can be processed (because there is not
523193323Sed    enough room in the output buffer), next_in is updated and processing
524193323Sed    will resume at this point for the next call of inflate().
525193323Sed
526193323Sed  - Provide more output starting at next_out and update next_out and avail_out
527193323Sed    accordingly.  inflate() provides as much output as possible, until there
528193323Sed    is no more input data or no more space in the output buffer (see below
529193323Sed    about the flush parameter).
530193323Sed
531193323Sed  Before the call of inflate(), the application should ensure that at least
532193323Sed  one of the actions is possible, by providing more input and/or consuming
533193323Sed  more output, and updating the next_* and avail_* values accordingly.
534193323Sed  The application can consume the uncompressed output when it wants, for
535193323Sed  example when the output buffer is full (avail_out == 0), or after each
536193323Sed  call of inflate(). If inflate returns Z_OK and with zero avail_out, it
537193323Sed  must be called again after making room in the output buffer because there
538193323Sed  might be more output pending.
539193323Sed
540193323Sed    If the parameter flush is set to Z_PARTIAL_FLUSH or Z_PACKET_FLUSH,
541193323Sed  inflate flushes as much output as possible to the output buffer. The
542195340Sed  flushing behavior of inflate is not specified for values of the flush
543193323Sed  parameter other than Z_PARTIAL_FLUSH, Z_PACKET_FLUSH or Z_FINISH, but the
544193323Sed  current implementation actually flushes as much output as possible
545202375Srdivacky  anyway.  For Z_PACKET_FLUSH, inflate checks that once all the input data
546193323Sed  has been consumed, it is expecting to see the length field of a stored
547193323Sed  block; if not, it returns Z_DATA_ERROR.
548193323Sed
549193323Sed    inflate() should normally be called until it returns Z_STREAM_END or an
550193323Sed  error. However if all decompression is to be performed in a single step
551193323Sed  (a single call of inflate), the parameter flush should be set to
552193323Sed  Z_FINISH. In this case all pending input is processed and all pending
553193323Sed  output is flushed; avail_out must be large enough to hold all the
554193323Sed  uncompressed data. (The size of the uncompressed data may have been saved
555193323Sed  by the compressor for this purpose.) The next operation on this stream must
556193323Sed  be inflateEnd to deallocate the decompression state. The use of Z_FINISH
557193323Sed  is never required, but can be used to inform inflate that a faster routine
558193323Sed  may be used for the single inflate() call.
559193323Sed
560193323Sed    inflate() returns Z_OK if some progress has been made (more input
561193323Sed  processed or more output produced), Z_STREAM_END if the end of the
562193323Sed  compressed data has been reached and all uncompressed output has been
563193323Sed  produced, Z_NEED_DICT if a preset dictionary is needed at this point (see
564193323Sed  inflateSetDictionary below), Z_DATA_ERROR if the input data was corrupted,
565193323Sed  Z_STREAM_ERROR if the stream structure was inconsistent (for example if
566193323Sed  next_in or next_out was NULL), Z_MEM_ERROR if there was not enough memory,
567193323Sed  Z_BUF_ERROR if no progress is possible or if there was not enough room in
568193323Sed  the output buffer when Z_FINISH is used. In the Z_DATA_ERROR case, the
569193323Sed  application may then call inflateSync to look for a good compression block.
570193323Sed  In the Z_NEED_DICT case, strm->adler is set to the Adler32 value of the
571193323Sed  dictionary chosen by the compressor.
572195340Sed*/
573193323Sed
574193323Sed
575193323Sedextern int EXPORT inflateEnd OF((z_streamp strm));
576193323Sed/*
577193323Sed     All dynamically allocated data structures for this stream are freed.
578193323Sed   This function discards any unprocessed input and does not flush any
579193323Sed   pending output.
580193323Sed
581193323Sed     inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state
582193323Sed   was inconsistent. In the error case, msg may be set but then points to a
583193323Sed   static string (which must not be deallocated).
584193323Sed*/
585193323Sed
586193323Sed                        /* Advanced functions */
587193323Sed
588193323Sed/*
589193323Sed    The following functions are needed only in some special applications.
590193323Sed*/
591193323Sed
592193323Sed/*
593193323Sedextern int EXPORT deflateInit2 OF((z_streamp strm,
594193323Sed                                   int  level,
595193323Sed                                   int  method,
596193323Sed                                   int  windowBits,
597195340Sed                                   int  memLevel,
598193323Sed                                   int  strategy));
599193323Sed
600193323Sed     This is another version of deflateInit with more compression options. The
601193323Sed   fields next_in, zalloc, zfree and opaque must be initialized before by
602193323Sed   the caller.
603193323Sed
604193323Sed     The method parameter is the compression method. It must be Z_DEFLATED in
605193323Sed   this version of the library. (Method 9 will allow a 64K history buffer and
606193323Sed   partial block flushes.)
607193323Sed
608193323Sed     The windowBits parameter is the base two logarithm of the window size
609193323Sed   (the size of the history buffer).  It should be in the range 8..15 for this
610193323Sed   version of the library (the value 16 will be allowed for method 9). Larger
611193323Sed   values of this parameter result in better compression at the expense of
612193323Sed   memory usage. The default value is 15 if deflateInit is used instead.
613193323Sed
614193323Sed     The memLevel parameter specifies how much memory should be allocated
615193323Sed   for the internal compression state. memLevel=1 uses minimum memory but
616193323Sed   is slow and reduces compression ratio; memLevel=9 uses maximum memory
617193323Sed   for optimal speed. The default value is 8. See zconf.h for total memory
618193323Sed   usage as a function of windowBits and memLevel.
619193323Sed
620193323Sed     The strategy parameter is used to tune the compression algorithm. Use the
621193323Sed   value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a
622193323Sed   filter (or predictor), or Z_HUFFMAN_ONLY to force Huffman encoding only (no
623193323Sed   string match).  Filtered data consists mostly of small values with a
624193323Sed   somewhat random distribution. In this case, the compression algorithm is
625193323Sed   tuned to compress them better. The effect of Z_FILTERED is to force more
626193323Sed   Huffman coding and less string matching; it is somewhat intermediate
627193323Sed   between Z_DEFAULT and Z_HUFFMAN_ONLY. The strategy parameter only affects
628193323Sed   the compression ratio but not the correctness of the compressed output even
629193323Sed   if it is not set appropriately.
630193323Sed
631193323Sed     If next_in is not null, the library will use this buffer to hold also
632193323Sed   some history information; the buffer must either hold the entire input
633193323Sed   data, or have at least 1<<(windowBits+1) bytes and be writable. If next_in
634193323Sed   is null, the library will allocate its own history buffer (and leave next_in
635193323Sed   null). next_out need not be provided here but must be provided by the
636193323Sed   application for the next call of deflate().
637193323Sed
638193323Sed     If the history buffer is provided by the application, next_in must
639193323Sed   must never be changed by the application since the compressor maintains
640193323Sed   information inside this buffer from call to call; the application
641193323Sed   must provide more input only by increasing avail_in. next_in is always
642193323Sed   reset by the library in this case.
643193323Sed
644193323Sed      deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was
645193323Sed   not enough memory, Z_STREAM_ERROR if a parameter is invalid (such as
646193323Sed   an invalid method). msg is set to null if there is no error message.
647193323Sed   deflateInit2 does not perform any compression: this will be done by
648193323Sed   deflate().
649193323Sed*/
650193323Sed
651193323Sedextern int EXPORT deflateSetDictionary OF((z_streamp strm,
652193323Sed                                           const Bytef *dictionary,
653193323Sed				           uInt  dictLength));
654193323Sed/*
655193323Sed     Initializes the compression dictionary (history buffer) from the given
656193323Sed   byte sequence without producing any compressed output. This function must
657193323Sed   be called immediately after deflateInit or deflateInit2, before any call
658193323Sed   of deflate. The compressor and decompressor must use exactly the same
659193323Sed   dictionary (see inflateSetDictionary).
660193323Sed     The dictionary should consist of strings (byte sequences) that are likely
661193323Sed   to be encountered later in the data to be compressed, with the most commonly
662193323Sed   used strings preferably put towards the end of the dictionary. Using a
663193323Sed   dictionary is most useful when the data to be compressed is short and
664193323Sed   can be predicted with good accuracy; the data can then be compressed better
665193323Sed   than with the default empty dictionary. In this version of the library,
666193323Sed   only the last 32K bytes of the dictionary are used.
667193323Sed     Upon return of this function, strm->adler is set to the Adler32 value
668193323Sed   of the dictionary; the decompressor may later use this value to determine
669193323Sed   which dictionary has been used by the compressor. (The Adler32 value
670193323Sed   applies to the whole dictionary even if only a subset of the dictionary is
671195340Sed   actually used by the compressor.)
672193323Sed
673193323Sed     deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a
674193323Sed   parameter is invalid (such as NULL dictionary) or the stream state
675193323Sed   is inconsistent (for example if deflate has already been called for this
676193323Sed   stream). deflateSetDictionary does not perform any compression: this will
677193323Sed   be done by deflate().
678193323Sed*/
679193323Sed
680193323Sedextern int EXPORT deflateCopy OF((z_streamp dest,
681193323Sed                                  z_streamp source));
682193323Sed/*
683193323Sed     Sets the destination stream as a complete copy of the source stream.  If
684193323Sed   the source stream is using an application-supplied history buffer, a new
685193323Sed   buffer is allocated for the destination stream.  The compressed output
686193323Sed   buffer is always application-supplied. It's the responsibility of the
687193323Sed   application to provide the correct values of next_out and avail_out for the
688193323Sed   next call of deflate.
689193323Sed
690193323Sed     This function can be useful when several compression strategies will be
691193323Sed   tried, for example when there are several ways of pre-processing the input
692193323Sed   data with a filter. The streams that will be discarded should then be freed
693193323Sed   by calling deflateEnd.  Note that deflateCopy duplicates the internal
694193323Sed   compression state which can be quite large, so this strategy is slow and
695193323Sed   can consume lots of memory.
696193323Sed
697193323Sed     deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not
698195340Sed   enough memory, Z_STREAM_ERROR if the source stream state was inconsistent
699193323Sed   (such as zalloc being NULL). msg is left unchanged in both source and
700193323Sed   destination.
701193323Sed*/
702193323Sed
703193323Sedextern int EXPORT deflateReset OF((z_streamp strm));
704193323Sed/*
705193323Sed     This function is equivalent to deflateEnd followed by deflateInit,
706193323Sed   but does not free and reallocate all the internal compression state.
707193323Sed   The stream will keep the same compression level and any other attributes
708193323Sed   that may have been set by deflateInit2.
709193323Sed
710193323Sed      deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
711193323Sed   stream state was inconsistent (such as zalloc or state being NULL).
712193323Sed*/
713193323Sed
714193323Sedextern int EXPORT deflateParams OF((z_streamp strm, int level, int strategy));
715193323Sed/*
716193323Sed     Dynamically update the compression level and compression strategy.
717193323Sed   This can be used to switch between compression and straight copy of
718193323Sed   the input data, or to switch to a different kind of input data requiring
719193323Sed   a different strategy. If the compression level is changed, the input
720193323Sed   available so far is compressed with the old level (and may be flushed);
721193323Sed   the new level will take effect only at the next call of deflate().
722193323Sed
723193323Sed     Before the call of deflateParams, the stream state must be set as for
724193323Sed   a call of deflate(), since the currently available input may have to
725193323Sed   be compressed and flushed. In particular, strm->avail_out must be non-zero.
726193323Sed
727193323Sed     deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source
728193323Sed   stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR
729193323Sed   if strm->avail_out was zero.
730193323Sed*/
731193323Sed
732193323Sedextern int EXPORT deflateOutputPending OF((z_streamp strm));
733193323Sed/*
734193323Sed     Returns the number of bytes of output which are immediately
735193323Sed   available from the compressor (i.e. without any further input
736193323Sed   or flush).
737193323Sed*/
738193323Sed
739193323Sed/*
740193323Sedextern int EXPORT inflateInit2 OF((z_streamp strm,
741193323Sed                                   int  windowBits));
742193323Sed
743193323Sed     This is another version of inflateInit with more compression options. The
744193323Sed   fields next_out, zalloc, zfree and opaque must be initialized before by
745193323Sed   the caller.
746193323Sed
747193323Sed     The windowBits parameter is the base two logarithm of the maximum window
748193323Sed   size (the size of the history buffer).  It should be in the range 8..15 for
749193323Sed   this version of the library (the value 16 will be allowed soon). The
750193323Sed   default value is 15 if inflateInit is used instead. If a compressed stream
751193323Sed   with a larger window size is given as input, inflate() will return with
752   the error code Z_DATA_ERROR instead of trying to allocate a larger window.
753
754     If next_out is not null, the library will use this buffer for the history
755   buffer; the buffer must either be large enough to hold the entire output
756   data, or have at least 1<<windowBits bytes.  If next_out is null, the
757   library will allocate its own buffer (and leave next_out null). next_in
758   need not be provided here but must be provided by the application for the
759   next call of inflate().
760
761     If the history buffer is provided by the application, next_out must
762   never be changed by the application since the decompressor maintains
763   history information inside this buffer from call to call; the application
764   can only reset next_out to the beginning of the history buffer when
765   avail_out is zero and all output has been consumed.
766
767      inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was
768   not enough memory, Z_STREAM_ERROR if a parameter is invalid (such as
769   windowBits < 8). msg is set to null if there is no error message.
770   inflateInit2 does not perform any decompression: this will be done by
771   inflate().
772*/
773
774extern int EXPORT inflateSetDictionary OF((z_streamp strm,
775				           const Bytef *dictionary,
776					   uInt  dictLength));
777/*
778     Initializes the decompression dictionary (history buffer) from the given
779   uncompressed byte sequence. This function must be called immediately after
780   a call of inflate if this call returned Z_NEED_DICT. The dictionary chosen
781   by the compressor can be determined from the Adler32 value returned by this
782   call of inflate. The compressor and decompressor must use exactly the same
783   dictionary (see deflateSetDictionary).
784
785     inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a
786   parameter is invalid (such as NULL dictionary) or the stream state is
787   inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the
788   expected one (incorrect Adler32 value). inflateSetDictionary does not
789   perform any decompression: this will be done by subsequent calls of
790   inflate().
791*/
792
793extern int EXPORT inflateSync OF((z_streamp strm));
794/*
795    Skips invalid compressed data until the special marker (see deflate()
796  above) can be found, or until all available input is skipped. No output
797  is provided.
798
799    inflateSync returns Z_OK if the special marker has been found, Z_BUF_ERROR
800  if no more input was provided, Z_DATA_ERROR if no marker has been found,
801  or Z_STREAM_ERROR if the stream structure was inconsistent. In the success
802  case, the application may save the current current value of total_in which
803  indicates where valid compressed data was found. In the error case, the
804  application may repeatedly call inflateSync, providing more input each time,
805  until success or end of the input data.
806*/
807
808extern int EXPORT inflateReset OF((z_streamp strm));
809/*
810     This function is equivalent to inflateEnd followed by inflateInit,
811   but does not free and reallocate all the internal decompression state.
812   The stream will keep attributes that may have been set by inflateInit2.
813
814      inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source
815   stream state was inconsistent (such as zalloc or state being NULL).
816*/
817
818extern int inflateIncomp OF((z_stream *strm));
819/*
820     This function adds the data at next_in (avail_in bytes) to the output
821   history without performing any output.  There must be no pending output,
822   and the decompressor must be expecting to see the start of a block.
823   Calling this function is equivalent to decompressing a stored block
824   containing the data at next_in (except that the data is not output).
825*/
826
827                        /* utility functions */
828
829/*
830     The following utility functions are implemented on top of the
831   basic stream-oriented functions. To simplify the interface, some
832   default options are assumed (compression level, window size,
833   standard memory allocation functions). The source code of these
834   utility functions can easily be modified if you need special options.
835*/
836
837extern int EXPORT compress OF((Bytef *dest,   uLongf *destLen,
838			       const Bytef *source, uLong sourceLen));
839/*
840     Compresses the source buffer into the destination buffer.  sourceLen is
841   the byte length of the source buffer. Upon entry, destLen is the total
842   size of the destination buffer, which must be at least 0.1% larger than
843   sourceLen plus 12 bytes. Upon exit, destLen is the actual size of the
844   compressed buffer.
845     This function can be used to compress a whole file at once if the
846   input file is mmap'ed.
847     compress returns Z_OK if success, Z_MEM_ERROR if there was not
848   enough memory, Z_BUF_ERROR if there was not enough room in the output
849   buffer.
850*/
851
852extern int EXPORT uncompress OF((Bytef *dest,   uLongf *destLen,
853				 const Bytef *source, uLong sourceLen));
854/*
855     Decompresses the source buffer into the destination buffer.  sourceLen is
856   the byte length of the source buffer. Upon entry, destLen is the total
857   size of the destination buffer, which must be large enough to hold the
858   entire uncompressed data. (The size of the uncompressed data must have
859   been saved previously by the compressor and transmitted to the decompressor
860   by some mechanism outside the scope of this compression library.)
861   Upon exit, destLen is the actual size of the compressed buffer.
862     This function can be used to decompress a whole file at once if the
863   input file is mmap'ed.
864
865     uncompress returns Z_OK if success, Z_MEM_ERROR if there was not
866   enough memory, Z_BUF_ERROR if there was not enough room in the output
867   buffer, or Z_DATA_ERROR if the input data was corrupted.
868*/
869
870
871typedef voidp gzFile;
872
873extern gzFile EXPORT gzopen  OF((const char *path, const char *mode));
874/*
875     Opens a gzip (.gz) file for reading or writing. The mode parameter
876   is as in fopen ("rb" or "wb") but can also include a compression level
877   ("wb9").  gzopen can be used to read a file which is not in gzip format;
878   in this case gzread will directly read from the file without decompression.
879     gzopen returns NULL if the file could not be opened or if there was
880   insufficient memory to allocate the (de)compression state; errno
881   can be checked to distinguish the two cases (if errno is zero, the
882   zlib error is Z_MEM_ERROR).
883*/
884
885extern gzFile EXPORT gzdopen  OF((int fd, const char *mode));
886/*
887     gzdopen() associates a gzFile with the file descriptor fd.  File
888   descriptors are obtained from calls like open, dup, creat, pipe or
889   fileno (in the file has been previously opened with fopen).
890   The mode parameter is as in gzopen.
891     The next call of gzclose on the returned gzFile will also close the
892   file descriptor fd, just like fclose(fdopen(fd), mode) closes the file
893   descriptor fd. If you want to keep fd open, use gzdopen(dup(fd), mode).
894     gzdopen returns NULL if there was insufficient memory to allocate
895   the (de)compression state.
896*/
897
898extern int EXPORT    gzread  OF((gzFile file, voidp buf, unsigned len));
899/*
900     Reads the given number of uncompressed bytes from the compressed file.
901   If the input file was not in gzip format, gzread copies the given number
902   of bytes into the buffer.
903     gzread returns the number of uncompressed bytes actually read (0 for
904   end of file, -1 for error). */
905
906extern int EXPORT    gzwrite OF((gzFile file, const voidp buf, unsigned len));
907/*
908     Writes the given number of uncompressed bytes into the compressed file.
909   gzwrite returns the number of uncompressed bytes actually written
910   (0 in case of error).
911*/
912
913extern int EXPORT    gzflush OF((gzFile file, int flush));
914/*
915     Flushes all pending output into the compressed file. The parameter
916   flush is as in the deflate() function. The return value is the zlib
917   error number (see function gzerror below). gzflush returns Z_OK if
918   the flush parameter is Z_FINISH and all output could be flushed.
919     gzflush should be called only when strictly necessary because it can
920   degrade compression.
921*/
922
923extern int EXPORT    gzclose OF((gzFile file));
924/*
925     Flushes all pending output if necessary, closes the compressed file
926   and deallocates all the (de)compression state. The return value is the zlib
927   error number (see function gzerror below).
928*/
929
930extern const char * EXPORT gzerror OF((gzFile file, int *errnum));
931/*
932     Returns the error message for the last error which occurred on the
933   given compressed file. errnum is set to zlib error number. If an
934   error occurred in the filesystem and not in the compression library,
935   errnum is set to Z_ERRNO and the application may consult errno
936   to get the exact error code.
937*/
938
939                        /* checksum functions */
940
941/*
942     These functions are not related to compression but are exported
943   anyway because they might be useful in applications using the
944   compression library.
945*/
946
947extern uLong EXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len));
948
949/*
950     Update a running Adler-32 checksum with the bytes buf[0..len-1] and
951   return the updated checksum. If buf is NULL, this function returns
952   the required initial value for the checksum.
953   An Adler-32 checksum is almost as reliable as a CRC32 but can be computed
954   much faster. Usage example:
955
956     uLong adler = adler32(0L, Z_NULL, 0);
957
958     while (read_buffer(buffer, length) != EOF) {
959       adler = adler32(adler, buffer, length);
960     }
961     if (adler != original_adler) error();
962*/
963
964#if 0
965extern uLong EXPORT crc32   OF((uLong crc, const Bytef *buf, uInt len));
966/*
967     Update a running crc with the bytes buf[0..len-1] and return the updated
968   crc. If buf is NULL, this function returns the required initial value
969   for the crc. Pre- and post-conditioning (one's complement) is performed
970   within this function so it shouldn't be done by the application.
971   Usage example:
972
973     uLong crc = crc32(0L, Z_NULL, 0);
974
975     while (read_buffer(buffer, length) != EOF) {
976       crc = crc32(crc, buffer, length);
977     }
978     if (crc != original_crc) error();
979*/
980#endif
981
982
983                        /* various hacks, don't look :) */
984
985/* deflateInit and inflateInit are macros to allow checking the zlib version
986 * and the compiler's view of z_stream:
987 */
988extern int EXPORT deflateInit_ OF((z_streamp strm, int level,
989			           const char *version, int stream_size));
990extern int EXPORT inflateInit_ OF((z_streamp strm,
991				   const char *version, int stream_size));
992extern int EXPORT deflateInit2_ OF((z_streamp strm, int  level, int  method,
993				    int windowBits, int memLevel, int strategy,
994				    const char *version, int stream_size));
995extern int EXPORT inflateInit2_ OF((z_streamp strm, int  windowBits,
996				    const char *version, int stream_size));
997#define deflateInit(strm, level) \
998        deflateInit_((strm), (level),       ZLIB_VERSION, sizeof(z_stream))
999#define inflateInit(strm) \
1000        inflateInit_((strm),                ZLIB_VERSION, sizeof(z_stream))
1001#define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \
1002        deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\
1003		      (strategy),           ZLIB_VERSION, sizeof(z_stream))
1004#define inflateInit2(strm, windowBits) \
1005        inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream))
1006
1007#if !defined(_Z_UTIL_H) && !defined(NO_DUMMY_DECL)
1008    struct internal_state {int dummy;}; /* hack for buggy compilers */
1009#endif
1010
1011uLongf *get_crc_table OF((void)); /* can be used by asm versions of crc32() */
1012
1013#ifdef _KERNEL
1014struct vnode;
1015extern gzFile gz_open     OF((const char *path, const char *mode,
1016	                              struct vnode *vp));
1017#endif
1018
1019
1020#ifdef __cplusplus
1021}
1022#endif
1023
1024#endif /* _ZLIB_H */
1025/* --- zlib.h */
1026