ICEutil.h revision 266e564d
1/* $Xorg: ICEutil.h,v 1.5 2001/02/09 02:03:26 xorgcvs Exp $ */
2/******************************************************************************
3
4
5Copyright 1993, 1998  The Open Group
6
7Permission to use, copy, modify, distribute, and sell this software and its
8documentation for any purpose is hereby granted without fee, provided that
9the above copyright notice appear in all copies and that both that
10copyright notice and this permission notice appear in supporting
11documentation.
12
13The above copyright notice and this permission notice shall be included in
14all copies or substantial portions of the Software.
15
16THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
19OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
20AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
23Except as contained in this notice, the name of The Open Group shall not be
24used in advertising or otherwise to promote the sale, use or other dealings
25in this Software without prior written authorization from The Open Group.
26
27Author: Ralph Mor, X Consortium
28******************************************************************************/
29/* $XFree86: xc/lib/ICE/ICEutil.h,v 1.4 2001/12/20 19:40:59 tsi Exp $ */
30
31#ifndef _ICEUTIL_H_
32#define _ICEUTIL_H_
33
34#include <X11/Xfuncproto.h>
35
36#include <stdio.h>
37
38_XFUNCPROTOBEGIN
39
40/*
41 * Data structure for entry in ICE authority file
42 */
43
44typedef struct {
45    char    	    *protocol_name;
46    unsigned short  protocol_data_length;
47    char   	    *protocol_data;
48    char    	    *network_id;
49    char    	    *auth_name;
50    unsigned short  auth_data_length;
51    char   	    *auth_data;
52} IceAuthFileEntry;
53
54
55/*
56 * Authentication data maintained in memory.
57 */
58
59typedef struct {
60    char    	    *protocol_name;
61    char	    *network_id;
62    char    	    *auth_name;
63    unsigned short  auth_data_length;
64    char   	    *auth_data;
65} IceAuthDataEntry;
66
67
68/*
69 * Return values from IceLockAuthFile
70 */
71
72#define IceAuthLockSuccess	0   /* lock succeeded */
73#define IceAuthLockError	1   /* lock unexpectely failed, check errno */
74#define IceAuthLockTimeout	2   /* lock failed, timeouts expired */
75
76
77/*
78 * Function Prototypes
79 */
80
81extern char *IceAuthFileName (
82    void
83);
84
85extern int IceLockAuthFile (
86    char *		/* file_name */,
87    int			/* retries */,
88    int			/* timeout */,
89    long		/* dead */
90);
91
92extern void IceUnlockAuthFile (
93    char *		/* file_name */
94);
95
96extern IceAuthFileEntry *IceReadAuthFileEntry (
97    FILE *		/* auth_file */
98);
99
100extern void IceFreeAuthFileEntry (
101    IceAuthFileEntry *	/* auth */
102);
103
104extern Status IceWriteAuthFileEntry (
105    FILE *		/* auth_file */,
106    IceAuthFileEntry *	/* auth */
107);
108
109extern IceAuthFileEntry *IceGetAuthFileEntry (
110    char *		/* protocol_name */,
111    char *		/* network_id */,
112    char *		/* auth_name */
113);
114
115extern char *IceGenerateMagicCookie (
116    int			/* len */
117);
118
119extern void IceSetPaAuthData (
120    int			/* numEntries */,
121    IceAuthDataEntry *	/* entries */
122);
123
124_XFUNCPROTOEND
125
126#endif /* _ICEUTIL_H_ */
127