1*4eead527Swinesync /* zlib.h -- interface of the 'zlib' general purpose compression library 2*4eead527Swinesync * version 1.2.11, January 15th, 2017 3*4eead527Swinesync * 4*4eead527Swinesync * Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler 5*4eead527Swinesync * 6*4eead527Swinesync * This software is provided 'as-is', without any express or implied 7*4eead527Swinesync * warranty. In no event will the authors be held liable for any damages 8*4eead527Swinesync * arising from the use of this software. 9*4eead527Swinesync * 10*4eead527Swinesync * Permission is granted to anyone to use this software for any purpose, 11*4eead527Swinesync * including commercial applications, and to alter it and redistribute it 12*4eead527Swinesync * freely, subject to the following restrictions: 13*4eead527Swinesync * 14*4eead527Swinesync * 1. The origin of this software must not be misrepresented; you must not 15*4eead527Swinesync * claim that you wrote the original software. If you use this software 16*4eead527Swinesync * in a product, an acknowledgment in the product documentation would be 17*4eead527Swinesync * appreciated but is not required. 18*4eead527Swinesync * 2. Altered source versions must be plainly marked as such, and must not be 19*4eead527Swinesync * misrepresented as being the original software. 20*4eead527Swinesync * 3. This notice may not be removed or altered from any source distribution. 21*4eead527Swinesync * 22*4eead527Swinesync * Jean-loup Gailly Mark Adler 23*4eead527Swinesync * jloup@gzip.org madler@alumni.caltech.edu 24*4eead527Swinesync */ 25*4eead527Swinesync 26*4eead527Swinesync #ifndef ZLIB_H 27*4eead527Swinesync #define ZLIB_H 28*4eead527Swinesync 29*4eead527Swinesync #include "windef.h" 30*4eead527Swinesync 31*4eead527Swinesync #undef FAR 32*4eead527Swinesync #define FAR 33*4eead527Swinesync #define z_const const 34*4eead527Swinesync 35*4eead527Swinesync typedef unsigned char Byte; /* 8 bits */ 36*4eead527Swinesync typedef unsigned int uInt; /* 16 bits or more */ 37*4eead527Swinesync typedef unsigned long uLong; /* 32 bits or more */ 38*4eead527Swinesync 39*4eead527Swinesync typedef Byte FAR Bytef; 40*4eead527Swinesync typedef void FAR *voidpf; 41*4eead527Swinesync 42*4eead527Swinesync typedef char FAR charf; 43*4eead527Swinesync typedef int FAR intf; 44*4eead527Swinesync 45*4eead527Swinesync typedef unsigned char uch; 46*4eead527Swinesync typedef uch FAR uchf; 47*4eead527Swinesync typedef unsigned short ush; 48*4eead527Swinesync typedef ush FAR ushf; 49*4eead527Swinesync typedef unsigned long ulg; 50*4eead527Swinesync 51*4eead527Swinesync typedef voidpf (*alloc_func)(voidpf opaque, uInt items, uInt size); 52*4eead527Swinesync typedef void (*free_func)(voidpf opaque, voidpf address); 53*4eead527Swinesync 54*4eead527Swinesync struct internal_state; 55*4eead527Swinesync 56*4eead527Swinesync typedef struct z_stream_s { 57*4eead527Swinesync z_const Bytef *next_in; /* next input byte */ 58*4eead527Swinesync uInt avail_in; /* number of bytes available at next_in */ 59*4eead527Swinesync uLong total_in; /* total number of input bytes read so far */ 60*4eead527Swinesync 61*4eead527Swinesync Bytef *next_out; /* next output byte will go here */ 62*4eead527Swinesync uInt avail_out; /* remaining free space at next_out */ 63*4eead527Swinesync uLong total_out; /* total number of bytes output so far */ 64*4eead527Swinesync 65*4eead527Swinesync z_const char *msg; /* last error message, NULL if no error */ 66*4eead527Swinesync struct internal_state FAR *state; /* not visible by applications */ 67*4eead527Swinesync 68*4eead527Swinesync alloc_func zalloc; /* used to allocate the internal state */ 69*4eead527Swinesync free_func zfree; /* used to free the internal state */ 70*4eead527Swinesync voidpf opaque; /* private data object passed to zalloc and zfree */ 71*4eead527Swinesync 72*4eead527Swinesync int data_type; /* best guess about the data type: binary or text 73*4eead527Swinesync for deflate, or the decoding state for inflate */ 74*4eead527Swinesync uLong adler; /* Adler-32 or CRC-32 value of the uncompressed data */ 75*4eead527Swinesync uLong reserved; /* reserved for future use */ 76*4eead527Swinesync } z_stream; 77*4eead527Swinesync 78*4eead527Swinesync typedef z_stream FAR *z_streamp; 79*4eead527Swinesync 80*4eead527Swinesync /* 81*4eead527Swinesync gzip header information passed to and from zlib routines. See RFC 1952 82*4eead527Swinesync for more details on the meanings of these fields. 83*4eead527Swinesync */ 84*4eead527Swinesync typedef struct gz_header_s { 85*4eead527Swinesync int text; /* true if compressed data believed to be text */ 86*4eead527Swinesync uLong time; /* modification time */ 87*4eead527Swinesync int xflags; /* extra flags (not used when writing a gzip file) */ 88*4eead527Swinesync int os; /* operating system */ 89*4eead527Swinesync Bytef *extra; /* pointer to extra field or Z_NULL if none */ 90*4eead527Swinesync uInt extra_len; /* extra field length (valid if extra != Z_NULL) */ 91*4eead527Swinesync uInt extra_max; /* space at extra (only when reading header) */ 92*4eead527Swinesync Bytef *name; /* pointer to zero-terminated file name or Z_NULL */ 93*4eead527Swinesync uInt name_max; /* space at name (only when reading header) */ 94*4eead527Swinesync Bytef *comment; /* pointer to zero-terminated comment or Z_NULL */ 95*4eead527Swinesync uInt comm_max; /* space at comment (only when reading header) */ 96*4eead527Swinesync int hcrc; /* true if there was or will be a header crc */ 97*4eead527Swinesync int done; /* true when done reading gzip header (not used 98*4eead527Swinesync when writing a gzip file) */ 99*4eead527Swinesync } gz_header; 100*4eead527Swinesync 101*4eead527Swinesync typedef gz_header FAR *gz_headerp; 102*4eead527Swinesync 103*4eead527Swinesync #define Z_NO_FLUSH 0 104*4eead527Swinesync #define Z_PARTIAL_FLUSH 1 105*4eead527Swinesync #define Z_SYNC_FLUSH 2 106*4eead527Swinesync #define Z_FULL_FLUSH 3 107*4eead527Swinesync #define Z_FINISH 4 108*4eead527Swinesync #define Z_BLOCK 5 109*4eead527Swinesync #define Z_TREES 6 110*4eead527Swinesync /* Allowed flush values; see deflate() and inflate() below for details */ 111*4eead527Swinesync 112*4eead527Swinesync #define Z_OK 0 113*4eead527Swinesync #define Z_STREAM_END 1 114*4eead527Swinesync #define Z_NEED_DICT 2 115*4eead527Swinesync #define Z_ERRNO (-1) 116*4eead527Swinesync #define Z_STREAM_ERROR (-2) 117*4eead527Swinesync #define Z_DATA_ERROR (-3) 118*4eead527Swinesync #define Z_MEM_ERROR (-4) 119*4eead527Swinesync #define Z_BUF_ERROR (-5) 120*4eead527Swinesync #define Z_VERSION_ERROR (-6) 121*4eead527Swinesync /* Return codes for the compression/decompression functions. Negative values 122*4eead527Swinesync * are errors, positive values are used for special but normal events. 123*4eead527Swinesync */ 124*4eead527Swinesync 125*4eead527Swinesync #define Z_NO_COMPRESSION 0 126*4eead527Swinesync #define Z_BEST_SPEED 1 127*4eead527Swinesync #define Z_BEST_COMPRESSION 9 128*4eead527Swinesync #define Z_DEFAULT_COMPRESSION (-1) 129*4eead527Swinesync /* compression levels */ 130*4eead527Swinesync 131*4eead527Swinesync #define Z_FILTERED 1 132*4eead527Swinesync #define Z_HUFFMAN_ONLY 2 133*4eead527Swinesync #define Z_RLE 3 134*4eead527Swinesync #define Z_FIXED 4 135*4eead527Swinesync #define Z_DEFAULT_STRATEGY 0 136*4eead527Swinesync /* compression strategy; see deflateInit2() below for details */ 137*4eead527Swinesync 138*4eead527Swinesync #define Z_BINARY 0 139*4eead527Swinesync #define Z_TEXT 1 140*4eead527Swinesync #define Z_ASCII Z_TEXT /* for compatibility with 1.2.2 and earlier */ 141*4eead527Swinesync #define Z_UNKNOWN 2 142*4eead527Swinesync /* Possible values of the data_type field for deflate() */ 143*4eead527Swinesync 144*4eead527Swinesync #define Z_DEFLATED 8 145*4eead527Swinesync /* The deflate compression method (the only one supported in this version) */ 146*4eead527Swinesync 147*4eead527Swinesync #define Z_NULL 0 /* for initializing zalloc, zfree, opaque */ 148*4eead527Swinesync 149*4eead527Swinesync #define MAX_WBITS 15 /* 32K LZ77 window */ 150*4eead527Swinesync #define MAX_MEM_LEVEL 9 151*4eead527Swinesync 152*4eead527Swinesync extern int inflateInit(z_streamp strm) DECLSPEC_HIDDEN; 153*4eead527Swinesync extern int inflateInit2(z_streamp strm, int windowBits) DECLSPEC_HIDDEN; 154*4eead527Swinesync extern int inflate(z_streamp strm, int flush) DECLSPEC_HIDDEN; 155*4eead527Swinesync extern int inflateEnd(z_streamp strm) DECLSPEC_HIDDEN; 156*4eead527Swinesync 157*4eead527Swinesync extern int deflateInit(z_streamp strm, int level) DECLSPEC_HIDDEN; 158*4eead527Swinesync extern int deflateInit2(z_streamp strm, int level, int method, int windowBits, int memLevel, int strategy) DECLSPEC_HIDDEN; 159*4eead527Swinesync extern int deflate(z_streamp strm, int flush) DECLSPEC_HIDDEN; 160*4eead527Swinesync extern int deflateEnd(z_streamp strm) DECLSPEC_HIDDEN; 161*4eead527Swinesync 162*4eead527Swinesync #endif /* ZLIB_H */ 163