[0001]
[0002]
[0003]
[0004]
[0005]
[0006]
[0007]
[0008]
[0009]
[0010]
[0011]
[0012]
[0013]
[0014]
[0015]
[0016]
[0017]
[0018]
[0019]
[0020]
[0021]
[0022]
[0023]
[0024]
[0025]
[0026]
[0027]
[0028]
[0029]
[0030]
[0031]
[0032]
[0033]
[0034]
[0035]
[0036]
[0037]
[0038]
[0039]
[0040]
[0041]
[0042]
[0043]
[0044]
[0045]
[0046]
[0047]
[0048]
[0049]
[0050]
[0051]
[0052]
[0053]
[0054]
[0055]
[0056]
[0057]
[0058]
[0059]
[0060]
[0061]
[0062]
[0063]
[0064]
[0065]
[0066]
[0067]
[0068]
[0069]
[0070]
[0071]
[0072]
[0073]
[0074]
[0075]
[0076]
[0077]
[0078]
[0079]
[0080]
[0081]
[0082]
[0083]
[0084]
[0085]
[0086]
[0087]
[0088]
[0089]
[0090]
[0091]
[0092]
[0093]
[0094]
[0095]
[0096]
[0097]
[0098]
[0099]
[0100]
[0101]
[0102]
[0103]
[0104]
[0105]
[0106]
[0107]
[0108]
[0109]
[0110]
[0111]
[0112]
[0113]
[0114]
[0115]
[0116]
[0117]
[0118]
[0119]
[0120]
[0121]
[0122]
[0123]
[0124]
[0125]
[0126]
[0127]
[0128]
[0129]
[0130]
[0131]
[0132]
[0133]
[0134]
[0135]
[0136]
[0137]
[0138]
[0139]
[0140]
[0141]
[0142]
[0143]
[0144]
[0145]
[0146]
[0147]
[0148]
[0149]
[0150]
[0151]
[0152]
[0153]
/*****************************************************************************/
/*
                                  gzip.h

*/
/*****************************************************************************/

#ifndef GZIP_COMPRESS_DEFINED
#define GZIP_COMPRESS_DEFINED

/******************************/
/* define WASD GZIP structure */
/******************************/

/* this structure is especially included by WASD.H and PROXYSTRUCT.H */

#define BOOL int

typedef struct GzipCompressStruct GZIP_COMPRESS;

struct GzipCompressStruct
{
   BOOL  DeflateEndOfStream,
         DeflateFlushStream,
         DeflateStartStream,
         InflateEndOfStream,
         InflateStartStream;

   int  DeflateBufferCount,
        DeflateBufferSize,
        DeflateBytesIn,
        DeflateBytesOut,
        DeflateMemoryAllocated,
        FlushBytesOut,
        FlushTickSeconds,
        InflateAvailIn,
        InflateBufferCount,
        InflateBufferSize,
        InflateBytesIn,
        InflateBytesOut,
        InflateMemoryAllocated;

   char  *DeflateBufferPtr,
         *InflateBufferPtr;
         
   void  *DeflateZstreamPtr,
         *InflateZstreamPtr;
};
           

/***********************************/
/* WASD GZIP structure now defined */
/***********************************/

#endif /* GZIP_COMPRESS_DEFINED */

#ifndef GZIP_COMPRESS_ONLY

#ifndef GZIP_H_LOADED
#define GZIP_H_LOADED 1

/* number of bytes in the GZIP stream header */
#define GZIP_SIZE_OF_HEADER 10

/* minimum size in bytes before worrying about deflating */
#define GZIP_MIN_CONTENT_LENGTH 1400

/* maximum interval between GZIP buffer flushes (actual output) */
#define GZIP_DEFAULT_FLUSH_SECONDS 15

/* interval before initial GZIP buffer flush (get some output out there!) */
#define GZIP_INITIAL_FLUSH_SECONDS 3

/*********************/
/* ZLIB requirements */
/*********************/

/**
  Sufficient of ZLIB to build an interface to the shareable image.
  These (needless-to-say) have been (more-or-less) lifted from ZLIB.H
  version 1.2.1, November 17th, 2003
  Copyright (C) 1995-2003 Jean-loup Gailly and Mark Adler
**/

typedef struct z_stream_s 
{
    char           *next_in;   /* next input byte */
    unsigned int   avail_in;   /* number of bytes available at next_in */
    unsigned long  total_in;   /* total nb of input bytes read so far */

    char           *next_out;  /* next output byte should be put there */
    unsigned int   avail_out;  /* remaining free space at next_out */
    unsigned long  total_out;  /* total nb of bytes output so far */

    char           *msg;       /* last error message, NULL if no error */
    void           *state;     /* not visible by applications */

    void           *zalloc;    /* used to allocate the internal state */
    void           *zfree;     /* used to free the internal state */
    void           *opaque;    /* private data passed to zalloc and zfree */

    int            data_type;  /* best guess on data type: ascii or binary */
    unsigned long  adler;      /* adler32 value of the uncompressed data */
    unsigned long  reserved;   /* reserved for future use */
} z_stream;

#define ZLIB_VERSION "1.2.1"

#define Z_DEFAULT_COMPRESSION (-1)
#define Z_DEFAULT_STRATEGY 0
#define Z_DEFLATED 8

#define Z_NO_FLUSH 0
#define Z_SYNC_FLUSH 2
#define Z_FULL_FLUSH 3
#define Z_FINISH 4

#define Z_OK            0
#define Z_STREAM_END    1
#define Z_NEED_DICT     2
#define Z_ERRNO        (-1)
#define Z_STREAM_ERROR (-2)
#define Z_DATA_ERROR   (-3)
#define Z_MEM_ERROR    (-4)
#define Z_BUF_ERROR    (-5)
#define Z_VERSION_ERROR (-6)

/***********************/
/* function prototypes */
/***********************/

int GzipInit ();
int GzipInitHandler ();

BOOL GzipDeflate (REQUEST_STRUCT*, GZIP_COMPRESS*, char**, int*, char**, int*);
BOOL GzipDeflateBegin (REQUEST_STRUCT*, GZIP_COMPRESS*, int);
BOOL GzipDeflateCache (REQUEST_STRUCT*, FILE_CENTRY*);
BOOL GzipDeflateEnd (REQUEST_STRUCT*, GZIP_COMPRESS*);
BOOL GzipShouldDeflate (REQUEST_STRUCT*, char*, int);
BOOL GzipInflate (REQUEST_STRUCT*, GZIP_COMPRESS*, char**, int*);
BOOL GzipInflateBegin (REQUEST_STRUCT*, GZIP_COMPRESS*, int);
BOOL GzipInflateEnd (REQUEST_STRUCT*, GZIP_COMPRESS*);

char* GzipZlibMsg (z_stream*, int);
char* GzipAlloc (REQUEST_STRUCT*, int, int);
GzipFree (REQUEST_STRUCT*, char*);

#endif /* GZIP_H_LOADED */

#endif /* GZIP_COMPRESS_ONLY */

/*****************************************************************************/