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