1bbe1b32bSmrg/* 2bbe1b32bSmrg 3bbe1b32bSmrgCopyright 1990, 1991, 1998 The Open Group 4bbe1b32bSmrg 5bbe1b32bSmrgPermission to use, copy, modify, distribute, and sell this software and its 6bbe1b32bSmrgdocumentation for any purpose is hereby granted without fee, provided that 7bbe1b32bSmrgthe above copyright notice appear in all copies and that both that 8bbe1b32bSmrgcopyright notice and this permission notice appear in supporting 9bbe1b32bSmrgdocumentation. 10bbe1b32bSmrg 11bbe1b32bSmrgThe above copyright notice and this permission notice shall be included in 12bbe1b32bSmrgall copies or substantial portions of the Software. 13bbe1b32bSmrg 14bbe1b32bSmrgTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15bbe1b32bSmrgIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16bbe1b32bSmrgFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17bbe1b32bSmrgOPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 18bbe1b32bSmrgAN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 19bbe1b32bSmrgCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 20bbe1b32bSmrg 21bbe1b32bSmrgExcept as contained in this notice, the name of The Open Group shall not be 22bbe1b32bSmrgused in advertising or otherwise to promote the sale, use or other dealings 23bbe1b32bSmrgin this Software without prior written authorization from The Open Group. 24bbe1b32bSmrg 25bbe1b32bSmrg * Copyright 1990, 1991 Network Computing Devices; 26bbe1b32bSmrg * Portions Copyright 1987 by Digital Equipment Corporation 27bbe1b32bSmrg * 28bbe1b32bSmrg * Permission to use, copy, modify, distribute, and sell this software and 29bbe1b32bSmrg * its documentation for any purpose is hereby granted without fee, provided 30bbe1b32bSmrg * that the above copyright notice appear in all copies and that both that 31bbe1b32bSmrg * copyright notice and this permission notice appear in supporting 32bbe1b32bSmrg * documentation, and that the names of Network Computing Devices, or Digital 33bbe1b32bSmrg * not be used in advertising or publicity pertaining to distribution 34bbe1b32bSmrg * of the software without specific, written prior permission. 35bbe1b32bSmrg * 36bbe1b32bSmrg * NETWORK COMPUTING DEVICES, AND DIGITAL DISCLAIM ALL WARRANTIES WITH 37bbe1b32bSmrg * REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF 38bbe1b32bSmrg * MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NETWORK COMPUTING DEVICES, 39bbe1b32bSmrg * OR DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL 40bbe1b32bSmrg * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR 41bbe1b32bSmrg * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS 42bbe1b32bSmrg * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF 43bbe1b32bSmrg * THIS SOFTWARE. 44bbe1b32bSmrg */ 45bbe1b32bSmrg 46bbe1b32bSmrg#ifndef _CLIENT_H_ 47bbe1b32bSmrg#define _CLIENT_H_ 48bbe1b32bSmrg 49bbe1b32bSmrg#ifndef _XTYPEDEF_CLIENTPTR 50bbe1b32bSmrgtypedef struct _Client *ClientPtr; 51bbe1b32bSmrg#define _XTYPEDEF_CLIENTPTR 52bbe1b32bSmrg#endif 53bbe1b32bSmrg 54bbe1b32bSmrg#include <misc.h> 55bbe1b32bSmrg 56bbe1b32bSmrgextern ClientPtr *clients; 57bbe1b32bSmrgextern ClientPtr serverClient; 58bbe1b32bSmrg 59bbe1b32bSmrg#define NullClient ((ClientPtr) NULL) 60bbe1b32bSmrg 61bbe1b32bSmrg#define SERVER_CLIENT 0 62bbe1b32bSmrg#define MINCLIENT 1 63bbe1b32bSmrg 64bbe1b32bSmrg#define CLIENT_ALIVE 0 65bbe1b32bSmrg#define CLIENT_GONE 1 66bbe1b32bSmrg#define CLIENT_AGED 2 67bbe1b32bSmrg#define CLIENT_TIMED_OUT 4 68bbe1b32bSmrg 69bbe1b32bSmrg#define REQUEST(type) \ 70bbe1b32bSmrg type *stuff = (type *)client->requestBuffer 71bbe1b32bSmrg 72bbe1b32bSmrg#define REQUEST_FIXED_SIZE(fs_req, n) \ 73bbe1b32bSmrg if (((SIZEOF(fs_req) >> 2) > stuff->length) || \ 74bbe1b32bSmrg (((SIZEOF(fs_req) + (n) + 3) >> 2) != stuff->length)) { \ 75bbe1b32bSmrg int lengthword = stuff->length; \ 76bbe1b32bSmrg SendErrToClient(client, FSBadLength, (pointer)&lengthword); \ 77bbe1b32bSmrg return (FSBadLength); \ 78bbe1b32bSmrg } 79bbe1b32bSmrg 80bbe1b32bSmrg#define REQUEST_SIZE_MATCH(fs_req) \ 81bbe1b32bSmrg if ((SIZEOF(fs_req) >> 2) != stuff->length) { \ 82bbe1b32bSmrg int lengthword = stuff->length; \ 83bbe1b32bSmrg SendErrToClient(client, FSBadLength, (pointer)&lengthword); \ 84bbe1b32bSmrg return (FSBadLength); \ 85bbe1b32bSmrg } 86bbe1b32bSmrg 87bbe1b32bSmrg#define REQUEST_AT_LEAST_SIZE(fs_req) \ 88bbe1b32bSmrg if ((SIZEOF(fs_req) >> 2) > stuff->length) { \ 89bbe1b32bSmrg int lengthword = stuff->length; \ 90bbe1b32bSmrg SendErrToClient(client, FSBadLength, (pointer)&lengthword); \ 91bbe1b32bSmrg return (FSBadLength); \ 92bbe1b32bSmrg } 93bbe1b32bSmrg 94bbe1b32bSmrg#define WriteReplyToClient(client, size, reply) \ 95bbe1b32bSmrg if ((client)->swapped) \ 96bbe1b32bSmrg (*ReplySwapVector[((fsReq *)(client)->requestBuffer)->reqType]) \ 97bbe1b32bSmrg (client, (int)(size), reply); \ 98bbe1b32bSmrg else (void)WriteToClient(client, (int)(size), (char *)(reply)); 99bbe1b32bSmrg 100bbe1b32bSmrg#define WriteSwappedDataToClient(client, size, pbuf) \ 101bbe1b32bSmrg if ((client)->swapped) \ 102bbe1b32bSmrg (*(client)->pSwapReplyFunc)(client, (int)(size), pbuf); \ 103bbe1b32bSmrg else (void) WriteToClient(client, (int)(size), (char *)(pbuf)); 104bbe1b32bSmrg 105bbe1b32bSmrg 106bbe1b32bSmrgtypedef struct _WorkQueue *WorkQueuePtr; 107bbe1b32bSmrg 108bbe1b32bSmrg#include <difsutils.h> /* for ProcessWorkQueue(void) */ 109bbe1b32bSmrg 110bbe1b32bSmrgextern int (*ProcVector[]) (ClientPtr); 111bbe1b32bSmrgextern int (*SwappedProcVector[]) (ClientPtr); 112bbe1b32bSmrg 113bbe1b32bSmrg#endif /* _CLIENT_H_ */ 114