1
/* $Xorg: lbxzlib.h,v 1.3 2000/08/18 04:05:45 coskrey Exp $ */
3
* Copyright 1993 Network Computing Devices
5
* Permission to use, copy, modify, distribute, and sell this software and its
6
* documentation for any purpose is hereby granted without fee, provided that
7
* the above copyright notice appear in all copies and that both that
8
* copyright notice and this permission notice appear in supporting
9
* documentation, and that the name of NCD. not be used in advertising or
10
* publicity pertaining to distribution of the software without specific,
11
* written prior permission. NCD. makes no representations about the
12
* suitability of this software for any purpose. It is provided "as is"
13
* without express or implied warranty.
15
* NCD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
16
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NCD.
17
* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
18
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
19
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
20
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
22
* Author: Dale Tonogai, Network Computing Devices
28
#define ZLIB_STRCOMP_OPT "XC-ZLIB"
29
#define ZLIB_STRCOMP_OPT_LEN 7
31
#define ZLIB_PACKET_HDRLEN 2
32
#define ZLIB_MAX_DATALEN 0xfff
33
#define ZLIB_MAX_PLAIN 270
34
#define ZLIB_MAX_OUTLEN (ZLIB_MAX_PLAIN << 1)
36
#define ZLIB_COMPRESS_FLAG 0x80
37
#define ZLIB_DATALEN_MASK 0x0f
39
#define ZLIB_PUT_PKTHDR(p, len, compflag) \
41
(p)[0] = ((unsigned)(len)) >> 8 | ((compflag) ? ZLIB_COMPRESS_FLAG : 0);\
42
(p)[1] = (len) & 0xff; \
45
#define ZLIB_GET_DATALEN(p) \
46
((((unsigned)((p)[0] & ZLIB_DATALEN_MASK)) << 8) | (unsigned)(p)[1])
48
#define ZLIB_COMPRESSED(p) ((p)[0] & ZLIB_COMPRESS_FLAG)
52
extern void * ZlibInit ( int fd, int level );
53
extern void ZlibFree ( struct ZlibInfo *comp );
54
extern int ZlibFlush ( int fd );
55
extern int ZlibStuffInput ( int fd, unsigned char *buffer, int buflen );
56
extern void ZlibCompressOn ( int fd );
57
extern void ZlibCompressOff ( int fd );
58
extern int ZlibWrite ( int fd, unsigned char *buffer, int buflen );
59
extern int ZlibWriteV ( int fd, struct iovec *iov, int iovcnt );
60
extern int ZlibRead ( int fd, unsigned char *buffer, int buflen );
61
extern int ZlibInputAvail ( int fd );