Home | History | Annotate | Download | only in extensions
      1 /* $Xorg: lbxopts.h,v 1.3 2000/08/18 04:05:45 coskrey Exp $ */
      2 /*
      3  * Copyright 1994 Network Computing Devices, Inc.
      4  *
      5  * Permission to use, copy, modify, distribute, and sell this software and
      6  * its documentation for any purpose is hereby granted without fee, provided
      7  * that 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 Network Computing Devices, Inc. not be
     10  * used in advertising or publicity pertaining to distribution of this
     11  * software without specific, written prior permission.
     12  *
     13  * THIS SOFTWARE IS PROVIDED `AS-IS'.  NETWORK COMPUTING DEVICES, INC.,
     14  * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING WITHOUT
     15  * LIMITATION ALL IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
     16  * PARTICULAR PURPOSE, OR NONINFRINGEMENT.  IN NO EVENT SHALL NETWORK
     17  * COMPUTING DEVICES, INC., BE LIABLE FOR ANY DAMAGES WHATSOEVER, INCLUDING
     18  * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS OF USE, DATA,
     19  * OR PROFITS, EVEN IF ADVISED OF THE POSSIBILITY THEREOF, AND REGARDLESS OF
     20  * WHETHER IN AN ACTION IN CONTRACT, TORT OR NEGLIGENCE, ARISING OUT OF OR IN
     21  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
     22  *
     23  */
     24 /* $XFree86: xc/include/extensions/lbxopts.h,v 1.5 2001/01/17 17:53:21 dawes Exp $ */
     25 
     26 #ifndef _LBX_OPTS_H_
     27 #define _LBX_OPTS_H_
     28 
     29 /*
     30  * Negotiable configuration options
     31  */
     32 #define LBX_OPT_DELTA_PROXY		0
     33 #define LBX_OPT_DELTA_SERVER		1
     34 #define LBX_OPT_STREAM_COMP		2
     35 #define LBX_OPT_BITMAP_COMP		3
     36 #define LBX_OPT_PIXMAP_COMP		4
     37 #define LBX_OPT_MSG_COMP		5	/* aka "squishing" */
     38 #define LBX_OPT_USE_TAGS		6
     39 #define LBX_OPT_CMAP_ALL		7
     40 #define LBX_OPT_EXTENSION		255
     41 
     42 /*
     43  * Length fields are encoded in 1 or 3 bytes
     44  */
     45 #define LBX_OPT_SMALLLEN_SIZE		1
     46 #define LBX_OPT_BIGLEN_SIZE		3
     47 #define LBX_OPT_BIGLEN_MIN		256
     48 
     49 #define LBX_OPT_DECODE_LEN(p, len, size) \
     50     if ((p)[0]) { \
     51 	(len) = (p)[0]; \
     52 	(size) = LBX_OPT_SMALLLEN_SIZE; \
     53     } \
     54     else { \
     55 	(len) = ((LBX_OPT_BIGLEN_MIN + (p)[1]) << 8) | (p)[2]; \
     56 	(size) = LBX_OPT_BIGLEN_SIZE; \
     57     }
     58 
     59 /*
     60  * Option header lengths
     61  */
     62 #define LBX_OPT_SMALLHDR_LEN		(1 + LBX_OPT_SMALLLEN_SIZE)
     63 #define LBX_OPT_BIGHDR_LEN		(1 + LBX_OPT_BIGLEN_SIZE)
     64 
     65 /*
     66  * Delta compression parameters
     67  */
     68 #define LBX_OPT_DELTA_REQLEN		6
     69 #define LBX_OPT_DELTA_REPLYLEN		2
     70 #define LBX_OPT_DELTA_NCACHE_DFLT	16
     71 #define LBX_OPT_DELTA_MSGLEN_MIN	32
     72 #define LBX_OPT_DELTA_MSGLEN_DFLT	64
     73 
     74 
     75 /*
     76  * Stream compression opts
     77  */
     78 
     79 #include <sys/types.h>
     80 
     81 #if defined(WIN32) || (defined(USG) && !defined(CRAY) && !defined(umips) && !defined(MOTOROLA) && !defined(uniosu) && !defined(__sxg__))
     82 
     83 struct iovec {
     84     caddr_t iov_base;
     85     int iov_len;
     86 };
     87 
     88 #else
     89 #ifndef Lynx
     90 #include <sys/uio.h>
     91 #else
     92 #include <uio.h>
     93 #endif
     94 #endif
     95 
     96 typedef void *LbxStreamCompHandle;
     97 
     98 typedef struct _LbxStreamOpts {
     99     LbxStreamCompHandle	(*streamCompInit)(int fd, pointer arg);
    100     pointer		streamCompArg;
    101     int			(*streamCompStuffInput)(
    102 			    int fd,
    103 			    unsigned char *buf,
    104 			    int buflen
    105 			);
    106     int			(*streamCompInputAvail)(
    107 			    int fd
    108 			);
    109     int			(*streamCompFlush)(
    110 			    int fd
    111 			);
    112     int			(*streamCompRead)(
    113 			    int fd,
    114 			    unsigned char *buf,
    115 			    int buflen
    116 			);
    117     int         	(*streamCompWriteV)(
    118 			    int fd,
    119 			    struct iovec *iov,
    120 			    int iovcnt
    121 			);
    122     void		(*streamCompOn)(
    123 			    int fd
    124 			);
    125     void		(*streamCompOff)(
    126 			    int fd
    127 			);
    128     void		(*streamCompFreeHandle)(
    129 			    LbxStreamCompHandle handle
    130 			);
    131 } LbxStreamOpts;
    132 
    133 #endif /* _LBX_OPTS_H_ */
    134