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