1 | /* $Xorg: lbxzlib.h,v 1.3 2000/08/18 04:05:45 coskrey Exp $ */
|
---|
2 | /*
|
---|
3 | * Copyright 1993 Network Computing Devices
|
---|
4 | *
|
---|
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.
|
---|
14 | *
|
---|
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.
|
---|
21 | *
|
---|
22 | * Author: Dale Tonogai, Network Computing Devices
|
---|
23 | */
|
---|
24 |
|
---|
25 | #ifndef _ZLIB_H_
|
---|
26 | #define _ZLIB_H_
|
---|
27 |
|
---|
28 | #define ZLIB_STRCOMP_OPT "XC-ZLIB"
|
---|
29 | #define ZLIB_STRCOMP_OPT_LEN 7
|
---|
30 |
|
---|
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)
|
---|
35 |
|
---|
36 | #define ZLIB_COMPRESS_FLAG 0x80
|
---|
37 | #define ZLIB_DATALEN_MASK 0x0f
|
---|
38 |
|
---|
39 | #define ZLIB_PUT_PKTHDR(p, len, compflag) \
|
---|
40 | { \
|
---|
41 | (p)[0] = ((unsigned)(len)) >> 8 | ((compflag) ? ZLIB_COMPRESS_FLAG : 0);\
|
---|
42 | (p)[1] = (len) & 0xff; \
|
---|
43 | }
|
---|
44 |
|
---|
45 | #define ZLIB_GET_DATALEN(p) \
|
---|
46 | ((((unsigned)((p)[0] & ZLIB_DATALEN_MASK)) << 8) | (unsigned)(p)[1])
|
---|
47 |
|
---|
48 | #define ZLIB_COMPRESSED(p) ((p)[0] & ZLIB_COMPRESS_FLAG)
|
---|
49 |
|
---|
50 | struct ZlibInfo;
|
---|
51 |
|
---|
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 );
|
---|
62 |
|
---|
63 |
|
---|
64 | #endif /* _ZLIB_H_ */
|
---|