1bbe1b32bSmrg/*
2bbe1b32bSmrgCopyright (c) 1987  X Consortium
3bbe1b32bSmrg
4bbe1b32bSmrgPermission is hereby granted, free of charge, to any person obtaining a copy
5bbe1b32bSmrgof this software and associated documentation files (the "Software"), to deal
6bbe1b32bSmrgin the Software without restriction, including without limitation the rights
7bbe1b32bSmrgto use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8bbe1b32bSmrgcopies of the Software, and to permit persons to whom the Software is
9bbe1b32bSmrgfurnished to do so, subject to the following conditions:
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
17bbe1b32bSmrgX CONSORTIUM 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 X Consortium 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 X Consortium.
24bbe1b32bSmrg * Copyright 1990, 1991 Network Computing Devices;
25bbe1b32bSmrg * Portions Copyright 1987 by Digital Equipment Corporation
26bbe1b32bSmrg *
27bbe1b32bSmrg * Permission to use, copy, modify, distribute, and sell this software and its
28bbe1b32bSmrg * documentation for any purpose is hereby granted without fee, provided that
29bbe1b32bSmrg * the above copyright notice appear in all copies and that both that
30bbe1b32bSmrg * copyright notice and this permission notice appear in supporting
31bbe1b32bSmrg * documentation, and that the names of Network Computing Devices,
32bbe1b32bSmrg * or Digital not be used in advertising or
33bbe1b32bSmrg * publicity pertaining to distribution of the software without specific,
34bbe1b32bSmrg * written prior permission.  Network Computing Devices, or Digital
35bbe1b32bSmrg * make no representations about the
36bbe1b32bSmrg * suitability of this software for any purpose.  It is provided "as is"
37bbe1b32bSmrg * without express or implied warranty.
38bbe1b32bSmrg *
39bbe1b32bSmrg * NETWORK COMPUTING DEVICES, AND DIGITAL DISCLAIM ALL WARRANTIES WITH
40bbe1b32bSmrg * REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
41bbe1b32bSmrg * AND FITNESS, IN NO EVENT SHALL NETWORK COMPUTING DEVICES, DIGITAL OR MIT BE
42bbe1b32bSmrg * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
43bbe1b32bSmrg * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
44bbe1b32bSmrg * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
45bbe1b32bSmrg * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
46bbe1b32bSmrg *
47bbe1b32bSmrg */
48bbe1b32bSmrg
49bbe1b32bSmrg#ifndef _RESOURCE_H_
50bbe1b32bSmrg#define _RESOURCE_H_
51bbe1b32bSmrg
52bbe1b32bSmrg#include	"misc.h"
53bbe1b32bSmrg
54bbe1b32bSmrgtypedef unsigned long RESTYPE;
55bbe1b32bSmrg
56bbe1b32bSmrg#define	RC_VANILLA	((RESTYPE)0)
57bbe1b32bSmrg#define	RC_CACHED	((RESTYPE)1<<31)
58bbe1b32bSmrg#define	RC_LASTPREDEF	RC_CACHED
59bbe1b32bSmrg#define	RC_ANY		(~(RESTYPE)0)
60bbe1b32bSmrg
61bbe1b32bSmrg#define	RT_FONT		((RESTYPE)1)
62bbe1b32bSmrg#define	RT_AUTHCONT	((RESTYPE)2)
63bbe1b32bSmrg#define	RT_LASTPREDEF	RT_AUTHCONT
64bbe1b32bSmrg#define	RT_NONE		((RESTYPE)0)
65bbe1b32bSmrg
66bbe1b32bSmrg#define	CLIENTOFFSET		22
67bbe1b32bSmrg#define	RESOURCE_ID_MASK	0x3FFFFF
68bbe1b32bSmrg#define	CLIENT_BITS(id)		((id) & 0x1fc00000)
69bbe1b32bSmrg#define	CLIENT_ID(id)		((int)(CLIENT_BITS(id) >> CLIENTOFFSET))
70bbe1b32bSmrg#define	SERVER_BIT		0x20000000
71bbe1b32bSmrg
72bbe1b32bSmrg#define	INVALID			(0)
73bbe1b32bSmrg
74bbe1b32bSmrg#define	BAD_RESOURCE		0xe0000000
75bbe1b32bSmrg
76bbe1b32bSmrg
77bbe1b32bSmrgextern Bool AddResource(int cid, FSID id, RESTYPE type, pointer value);
78bbe1b32bSmrgextern Bool InitClientResources(ClientPtr client);
79bbe1b32bSmrgextern FSID FakeClientID(int client);
80bbe1b32bSmrgextern pointer LookupIDByType(int cid, FSID id, RESTYPE rtype);
81bbe1b32bSmrgextern void FreeAllResources(void);
82bbe1b32bSmrgextern void FreeClientResources(ClientPtr client);
83bbe1b32bSmrgextern void FreeResource(int cid, FSID id, RESTYPE skipDeleteFuncType);
84bbe1b32bSmrgint NoneDeleteFunc (void *ptr, FSID id);
85bbe1b32bSmrg
86bbe1b32bSmrg#endif				/* _RESOURCE_H_ */
87