1 /* $XConsortium: lbxzlib.h /main/2 1996/10/27 15:39:45 rws $ */
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)