ICEutil.h revision 266e564d
1266e564dSmrg/* $Xorg: ICEutil.h,v 1.5 2001/02/09 02:03:26 xorgcvs Exp $ */
2266e564dSmrg/******************************************************************************
3266e564dSmrg
4266e564dSmrg
5266e564dSmrgCopyright 1993, 1998  The Open Group
6266e564dSmrg
7266e564dSmrgPermission to use, copy, modify, distribute, and sell this software and its
8266e564dSmrgdocumentation for any purpose is hereby granted without fee, provided that
9266e564dSmrgthe above copyright notice appear in all copies and that both that
10266e564dSmrgcopyright notice and this permission notice appear in supporting
11266e564dSmrgdocumentation.
12266e564dSmrg
13266e564dSmrgThe above copyright notice and this permission notice shall be included in
14266e564dSmrgall copies or substantial portions of the Software.
15266e564dSmrg
16266e564dSmrgTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17266e564dSmrgIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18266e564dSmrgFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
19266e564dSmrgOPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
20266e564dSmrgAN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21266e564dSmrgCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22266e564dSmrg
23266e564dSmrgExcept as contained in this notice, the name of The Open Group shall not be
24266e564dSmrgused in advertising or otherwise to promote the sale, use or other dealings
25266e564dSmrgin this Software without prior written authorization from The Open Group.
26266e564dSmrg
27266e564dSmrgAuthor: Ralph Mor, X Consortium
28266e564dSmrg******************************************************************************/
29266e564dSmrg/* $XFree86: xc/lib/ICE/ICEutil.h,v 1.4 2001/12/20 19:40:59 tsi Exp $ */
30266e564dSmrg
31266e564dSmrg#ifndef _ICEUTIL_H_
32266e564dSmrg#define _ICEUTIL_H_
33266e564dSmrg
34266e564dSmrg#include <X11/Xfuncproto.h>
35266e564dSmrg
36266e564dSmrg#include <stdio.h>
37266e564dSmrg
38266e564dSmrg_XFUNCPROTOBEGIN
39266e564dSmrg
40266e564dSmrg/*
41266e564dSmrg * Data structure for entry in ICE authority file
42266e564dSmrg */
43266e564dSmrg
44266e564dSmrgtypedef struct {
45266e564dSmrg    char    	    *protocol_name;
46266e564dSmrg    unsigned short  protocol_data_length;
47266e564dSmrg    char   	    *protocol_data;
48266e564dSmrg    char    	    *network_id;
49266e564dSmrg    char    	    *auth_name;
50266e564dSmrg    unsigned short  auth_data_length;
51266e564dSmrg    char   	    *auth_data;
52266e564dSmrg} IceAuthFileEntry;
53266e564dSmrg
54266e564dSmrg
55266e564dSmrg/*
56266e564dSmrg * Authentication data maintained in memory.
57266e564dSmrg */
58266e564dSmrg
59266e564dSmrgtypedef struct {
60266e564dSmrg    char    	    *protocol_name;
61266e564dSmrg    char	    *network_id;
62266e564dSmrg    char    	    *auth_name;
63266e564dSmrg    unsigned short  auth_data_length;
64266e564dSmrg    char   	    *auth_data;
65266e564dSmrg} IceAuthDataEntry;
66266e564dSmrg
67266e564dSmrg
68266e564dSmrg/*
69266e564dSmrg * Return values from IceLockAuthFile
70266e564dSmrg */
71266e564dSmrg
72266e564dSmrg#define IceAuthLockSuccess	0   /* lock succeeded */
73266e564dSmrg#define IceAuthLockError	1   /* lock unexpectely failed, check errno */
74266e564dSmrg#define IceAuthLockTimeout	2   /* lock failed, timeouts expired */
75266e564dSmrg
76266e564dSmrg
77266e564dSmrg/*
78266e564dSmrg * Function Prototypes
79266e564dSmrg */
80266e564dSmrg
81266e564dSmrgextern char *IceAuthFileName (
82266e564dSmrg    void
83266e564dSmrg);
84266e564dSmrg
85266e564dSmrgextern int IceLockAuthFile (
86266e564dSmrg    char *		/* file_name */,
87266e564dSmrg    int			/* retries */,
88266e564dSmrg    int			/* timeout */,
89266e564dSmrg    long		/* dead */
90266e564dSmrg);
91266e564dSmrg
92266e564dSmrgextern void IceUnlockAuthFile (
93266e564dSmrg    char *		/* file_name */
94266e564dSmrg);
95266e564dSmrg
96266e564dSmrgextern IceAuthFileEntry *IceReadAuthFileEntry (
97266e564dSmrg    FILE *		/* auth_file */
98266e564dSmrg);
99266e564dSmrg
100266e564dSmrgextern void IceFreeAuthFileEntry (
101266e564dSmrg    IceAuthFileEntry *	/* auth */
102266e564dSmrg);
103266e564dSmrg
104266e564dSmrgextern Status IceWriteAuthFileEntry (
105266e564dSmrg    FILE *		/* auth_file */,
106266e564dSmrg    IceAuthFileEntry *	/* auth */
107266e564dSmrg);
108266e564dSmrg
109266e564dSmrgextern IceAuthFileEntry *IceGetAuthFileEntry (
110266e564dSmrg    char *		/* protocol_name */,
111266e564dSmrg    char *		/* network_id */,
112266e564dSmrg    char *		/* auth_name */
113266e564dSmrg);
114266e564dSmrg
115266e564dSmrgextern char *IceGenerateMagicCookie (
116266e564dSmrg    int			/* len */
117266e564dSmrg);
118266e564dSmrg
119266e564dSmrgextern void IceSetPaAuthData (
120266e564dSmrg    int			/* numEntries */,
121266e564dSmrg    IceAuthDataEntry *	/* entries */
122266e564dSmrg);
123266e564dSmrg
124266e564dSmrg_XFUNCPROTOEND
125266e564dSmrg
126266e564dSmrg#endif /* _ICEUTIL_H_ */
127