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