1 /* 2 * pts_defl.h -- C header file ZIP compression ripped from linux-2.6.8.1 3 * by pts@fazekas.hu at Tue Jan 18 15:19:06 CET 2005 4 * 5 * This ZIP compression (ZIP == PostScript /FlateEncode compression filter 6 * (ZLIB RFC 1950)) routine has been ripped from the Linux kernel 2.6.8.1 7 * (directory lib/zlib_deflate), which has been ripped from ZLIB 1.1.3 8 * 9 * This is a minimal .h file, to avoid namespace pollution. 10 * See more in the beginning of pts_defl.c 11 * For documentation comments, see pts_defl.c 12 * 13 */ 14 15 #ifndef PTS_DEFL_H 16 #define PTS_DEFL_H 17 18 #define PTS_DEFL_RIPPED_ZLIB 1 19 20 /** Must be at least zlib_deflate_workspacesize(): 267946 on Linux i386 */ 21 #define ZLIB_DEFLATE_WORKSPACESIZE_MIN 270000 22 23 #define ZLIB_VERSION "1.1.3" 24 25 #define Z_NO_FLUSH 0 26 #define Z_PARTIAL_FLUSH 1 /* will be removed, use Z_SYNC_FLUSH instead */ 27 #define Z_PACKET_FLUSH 2 28 #define Z_SYNC_FLUSH 3 29 #define Z_FULL_FLUSH 4 30 #define Z_FINISH 5 31 /* Allowed flush values; see deflate() below for details */ 32 33 #define Z_OK 0 34 #define Z_STREAM_END 1 35 #define Z_NEED_DICT 2 36 #define Z_ERRNO (-1) 37 #define Z_STREAM_ERROR (-2) 38 #define Z_DATA_ERROR (-3) 39 #define Z_MEM_ERROR (-4) 40 #define Z_BUF_ERROR (-5) 41 #define Z_VERSION_ERROR (-6) 42 /* Return codes for the compression/decompression functions. Negative 43 * values are errors, positive values are used for special but normal events. 44 */ 45 46 #define Z_NO_COMPRESSION 0 47 #define Z_BEST_SPEED 1 48 #define Z_BEST_COMPRESSION 9 49 #define Z_DEFAULT_COMPRESSION (-1) 50 /* compression levels */ 51 52 #define Z_BINARY 0 53 #define Z_ASCII 1 54 #define Z_UNKNOWN 2 55 /* Possible values of the data_type field */ 56 57 struct zlib_internal_state; /**** pts ****/ /* Dat: was: internal_state */ 58 59 typedef struct z_stream_s { 60 unsigned char *next_in; /* next input byte */ 61 unsigned int avail_in; /* number of bytes available at next_in */ 62 unsigned long total_in; /* total nb of input bytes read so far */ 63 64 unsigned char *next_out; /* next output byte should be put there */ 65 unsigned int avail_out; /* remaining free space at next_out */ 66 unsigned long total_out; /* total nb of bytes output so far */ 67 68 char *msg; /* last error message, NULLP if no error */ 69 struct zlib_internal_state *state; /* not visible by applications */ 70 71 void *workspace; /* memory allocated for this stream */ 72 73 int data_type; /* best guess about the data type: ascii or binary */ 74 unsigned long adler; /* adler32 value of the uncompressed data */ 75 unsigned long reserved; /* reserved for future use */ 76 } z_stream; 77 78 #ifdef __cplusplus 79 #define EXTERN_C extern "C" 80 #else 81 #define EXTERN_C extern 82 #endif 83 84 EXTERN_C int zlib_deflate_workspacesize (void); 85 EXTERN_C int zlib_deflate (z_stream* strm, int flush); 86 EXTERN_C int zlib_deflateEnd (z_stream* strm); 87 EXTERN_C int zlib_deflateParams (z_stream* strm, int level, int strategy); 88 89 EXTERN_C int zlib_deflateInit_ (z_stream* strm, int level, 90 const char *version, int stream_size); 91 EXTERN_C int zlib_deflateInit2_ (z_stream* strm, int level, int method, 92 int windowBits, int memLevel, 93 int strategy, const char *version, 94 int stream_size); 95 #define zlib_deflateInit(strm, level) \ 96 zlib_deflateInit_((strm), (level), ZLIB_VERSION, sizeof(z_stream)) 97 #define zlib_deflateInit2(strm, level, method, windowBits, memLevel, strategy) \ 98 zlib_deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\ 99 (strategy), ZLIB_VERSION, sizeof(z_stream)) 100 101 #endif 102