Xauth.h revision 313a12fd
1/* 2 3Copyright 1988, 1998 The Open Group 4 5Permission to use, copy, modify, distribute, and sell this software and its 6documentation for any purpose is hereby granted without fee, provided that 7the above copyright notice appear in all copies and that both that 8copyright notice and this permission notice appear in supporting 9documentation. 10 11The above copyright notice and this permission notice shall be included in 12all copies or substantial portions of the Software. 13 14THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 18AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 19CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 20 21Except as contained in this notice, the name of The Open Group shall not be 22used in advertising or otherwise to promote the sale, use or other dealings 23in this Software without prior written authorization from The Open Group. 24 25*/ 26 27#ifndef _Xauth_h 28#define _Xauth_h 29 30/* struct xauth is full of implicit padding to properly align the pointers 31 after the length fields. We can't clean that up without breaking ABI, 32 so tell clang not to bother complaining about it. */ 33#ifdef __clang__ 34#pragma clang diagnostic push 35#pragma clang diagnostic ignored "-Wpadded" 36#endif 37 38typedef struct xauth { 39 unsigned short family; 40 unsigned short address_length; 41 char *address; 42 unsigned short number_length; 43 char *number; 44 unsigned short name_length; 45 char *name; 46 unsigned short data_length; 47 char *data; 48} Xauth; 49 50#ifdef __clang__ 51#pragma clang diagnostic pop 52#endif 53 54#ifndef _XAUTH_STRUCT_ONLY 55 56# include <X11/Xfuncproto.h> 57# include <X11/Xfuncs.h> 58 59# include <stdio.h> 60 61# define FamilyLocal (256) /* not part of X standard (i.e. X.h) */ 62# define FamilyWild (65535) 63# define FamilyNetname (254) /* not part of X standard */ 64# define FamilyKrb5Principal (253) /* Kerberos 5 principal name */ 65# define FamilyLocalHost (252) /* for local non-net authentication */ 66 67 68_XFUNCPROTOBEGIN 69 70char *XauFileName(void); 71 72Xauth *XauReadAuth( 73FILE* /* auth_file */ 74); 75 76int XauLockAuth( 77_Xconst char* /* file_name */, 78int /* retries */, 79int /* timeout */, 80long /* dead */ 81); 82 83int XauUnlockAuth( 84_Xconst char* /* file_name */ 85); 86 87int XauWriteAuth( 88FILE* /* auth_file */, 89Xauth* /* auth */ 90); 91 92Xauth *XauGetAuthByAddr( 93#if NeedWidePrototypes 94unsigned int /* family */, 95unsigned int /* address_length */, 96#else 97unsigned short /* family */, 98unsigned short /* address_length */, 99#endif 100_Xconst char* /* address */, 101#if NeedWidePrototypes 102unsigned int /* number_length */, 103#else 104unsigned short /* number_length */, 105#endif 106_Xconst char* /* number */, 107#if NeedWidePrototypes 108unsigned int /* name_length */, 109#else 110unsigned short /* name_length */, 111#endif 112_Xconst char* /* name */ 113); 114 115Xauth *XauGetBestAuthByAddr( 116#if NeedWidePrototypes 117unsigned int /* family */, 118unsigned int /* address_length */, 119#else 120unsigned short /* family */, 121unsigned short /* address_length */, 122#endif 123_Xconst char* /* address */, 124#if NeedWidePrototypes 125unsigned int /* number_length */, 126#else 127unsigned short /* number_length */, 128#endif 129_Xconst char* /* number */, 130int /* types_length */, 131char** /* type_names */, 132_Xconst int* /* type_lengths */ 133); 134 135void XauDisposeAuth( 136Xauth* /* auth */ 137); 138 139_XFUNCPROTOEND 140 141/* Return values from XauLockAuth */ 142 143# define LOCK_SUCCESS 0 /* lock succeeded */ 144# define LOCK_ERROR 1 /* lock unexpectely failed, check errno */ 145# define LOCK_TIMEOUT 2 /* lock failed, timeouts expired */ 146 147#endif /* _XAUTH_STRUCT_ONLY */ 148 149#endif /* _Xauth_h */ 150