Xauth.h revision e19dfac4
1/* $Xorg: Xauth.h,v 1.4 2001/02/09 02:03:42 xorgcvs Exp $ */
2
3/*
4
5Copyright 1988, 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
27*/
28
29/* $XFree86: xc/lib/Xau/Xauth.h,v 1.5 2001/12/14 19:54:36 dawes Exp $ */
30
31#ifndef _Xauth_h
32#define _Xauth_h
33
34typedef struct xauth {
35    unsigned short   family;
36    unsigned short   address_length;
37    char    	    *address;
38    unsigned short   number_length;
39    char    	    *number;
40    unsigned short   name_length;
41    char    	    *name;
42    unsigned short   data_length;
43    char   	    *data;
44} Xauth;
45
46#ifndef _XAUTH_STRUCT_ONLY
47
48# include   <X11/Xfuncproto.h>
49# include   <X11/Xfuncs.h>
50
51# include   <stdio.h>
52
53# define FamilyLocal (256)	/* not part of X standard (i.e. X.h) */
54# define FamilyWild  (65535)
55# define FamilyNetname    (254)   /* not part of X standard */
56# define FamilyKrb5Principal (253) /* Kerberos 5 principal name */
57# define FamilyLocalHost (252)	/* for local non-net authentication */
58
59
60_XFUNCPROTOBEGIN
61
62char *XauFileName(void);
63
64Xauth *XauReadAuth(
65FILE*	/* auth_file */
66);
67
68int XauLockAuth(
69_Xconst char*	/* file_name */,
70int		/* retries */,
71int		/* timeout */,
72long		/* dead */
73);
74
75int XauUnlockAuth(
76_Xconst char*	/* file_name */
77);
78
79int XauWriteAuth(
80FILE*		/* auth_file */,
81Xauth*		/* auth */
82);
83
84Xauth *XauGetAuthByAddr(
85#if NeedWidePrototypes
86unsigned int	/* family */,
87unsigned int	/* address_length */,
88#else
89unsigned short	/* family */,
90unsigned short	/* address_length */,
91#endif
92_Xconst char*	/* address */,
93#if NeedWidePrototypes
94unsigned int	/* number_length */,
95#else
96unsigned short	/* number_length */,
97#endif
98_Xconst char*	/* number */,
99#if NeedWidePrototypes
100unsigned int	/* name_length */,
101#else
102unsigned short	/* name_length */,
103#endif
104_Xconst char*	/* name */
105);
106
107Xauth *XauGetBestAuthByAddr(
108#if NeedWidePrototypes
109unsigned int	/* family */,
110unsigned int	/* address_length */,
111#else
112unsigned short	/* family */,
113unsigned short	/* address_length */,
114#endif
115_Xconst char*	/* address */,
116#if NeedWidePrototypes
117unsigned int	/* number_length */,
118#else
119unsigned short	/* number_length */,
120#endif
121_Xconst char*	/* number */,
122int		/* types_length */,
123char**		/* type_names */,
124_Xconst int*	/* type_lengths */
125);
126
127void XauDisposeAuth(
128Xauth*		/* auth */
129);
130
131_XFUNCPROTOEND
132
133/* Return values from XauLockAuth */
134
135# define LOCK_SUCCESS	0	/* lock succeeded */
136# define LOCK_ERROR	1	/* lock unexpectely failed, check errno */
137# define LOCK_TIMEOUT	2	/* lock failed, timeouts expired */
138
139#endif /* _XAUTH_STRUCT_ONLY */
140
141#endif /* _Xauth_h */
142