Home | History | Annotate | Line # | Download | only in ICE
      1 /******************************************************************************
      2 
      3 
      4 Copyright 1993, 1998  The Open Group
      5 
      6 Permission to use, copy, modify, distribute, and sell this software and its
      7 documentation for any purpose is hereby granted without fee, provided that
      8 the above copyright notice appear in all copies and that both that
      9 copyright notice and this permission notice appear in supporting
     10 documentation.
     11 
     12 The above copyright notice and this permission notice shall be included in
     13 all copies or substantial portions of the Software.
     14 
     15 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     16 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     17 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
     18 OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
     19 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
     20 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
     21 
     22 Except as contained in this notice, the name of The Open Group shall not be
     23 used in advertising or otherwise to promote the sale, use or other dealings
     24 in this Software without prior written authorization from The Open Group.
     25 
     26 Author: 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 
     42 typedef 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 
     57 typedef 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 unexpectedly failed, check errno */
     72 #define IceAuthLockTimeout	2   /* lock failed, timeouts expired */
     73 
     74 
     75 /*
     76  * Function Prototypes
     77  */
     78 
     79 extern char *IceAuthFileName (
     80     void
     81 );
     82 
     83 extern int IceLockAuthFile (
     84     const char *	/* file_name */,
     85     int			/* retries */,
     86     int			/* timeout */,
     87     long		/* dead */
     88 );
     89 
     90 extern void IceUnlockAuthFile (
     91     const char *	/* file_name */
     92 );
     93 
     94 extern IceAuthFileEntry *IceReadAuthFileEntry (
     95     FILE *		/* auth_file */
     96 );
     97 
     98 extern void IceFreeAuthFileEntry (
     99     IceAuthFileEntry *	/* auth */
    100 );
    101 
    102 extern Status IceWriteAuthFileEntry (
    103     FILE *		/* auth_file */,
    104     IceAuthFileEntry *	/* auth */
    105 );
    106 
    107 extern IceAuthFileEntry *IceGetAuthFileEntry (
    108     const char *	/* protocol_name */,
    109     const char *	/* network_id */,
    110     const char *	/* auth_name */
    111 );
    112 
    113 extern char *IceGenerateMagicCookie (
    114     int			/* len */
    115 );
    116 
    117 extern void IceSetPaAuthData (
    118     int			/* numEntries */,
    119     IceAuthDataEntry *	/* entries */
    120 );
    121 
    122 _XFUNCPROTOEND
    123 
    124 #endif /* _ICEUTIL_H_ */
    125