Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-18 09:37:05

0001 /*
0002 
0003 Copyright 1988, 1998  The Open Group
0004 
0005 Permission to use, copy, modify, distribute, and sell this software and its
0006 documentation for any purpose is hereby granted without fee, provided that
0007 the above copyright notice appear in all copies and that both that
0008 copyright notice and this permission notice appear in supporting
0009 documentation.
0010 
0011 The above copyright notice and this permission notice shall be included in
0012 all copies or substantial portions of the Software.
0013 
0014 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
0015 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
0016 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
0017 OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
0018 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
0019 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
0020 
0021 Except as contained in this notice, the name of The Open Group shall not be
0022 used in advertising or otherwise to promote the sale, use or other dealings
0023 in this Software without prior written authorization from The Open Group.
0024 
0025 */
0026 
0027 #ifndef _Xauth_h
0028 #define _Xauth_h
0029 
0030 /* struct xauth is full of implicit padding to properly align the pointers
0031    after the length fields.   We can't clean that up without breaking ABI,
0032    so tell clang not to bother complaining about it. */
0033 #ifdef __clang__
0034 #pragma clang diagnostic push
0035 #pragma clang diagnostic ignored "-Wpadded"
0036 #endif
0037 
0038 typedef struct xauth {
0039     unsigned short   family;
0040     unsigned short   address_length;
0041     char            *address;
0042     unsigned short   number_length;
0043     char            *number;
0044     unsigned short   name_length;
0045     char            *name;
0046     unsigned short   data_length;
0047     char        *data;
0048 } Xauth;
0049 
0050 #ifdef __clang__
0051 #pragma clang diagnostic pop
0052 #endif
0053 
0054 #ifndef _XAUTH_STRUCT_ONLY
0055 
0056 # include   <X11/Xfuncproto.h>
0057 # include   <X11/Xfuncs.h>
0058 
0059 # include   <stdio.h>
0060 
0061 # define FamilyLocal (256)  /* not part of X standard (i.e. X.h) */
0062 # define FamilyWild  (65535)
0063 # define FamilyNetname    (254)   /* not part of X standard */
0064 # define FamilyKrb5Principal (253) /* Kerberos 5 principal name */
0065 # define FamilyLocalHost (252)  /* for local non-net authentication */
0066 
0067 
0068 _XFUNCPROTOBEGIN
0069 
0070 #ifndef __has_attribute
0071 # define __has_attribute(x) 0  /* Compatibility with older compilers */
0072 #endif
0073 
0074 #if __has_attribute(access)
0075 # define XAU_ACCESS_ATTRIBUTE(X) __attribute__((access X))
0076 #else
0077 # define XAU_ACCESS_ATTRIBUTE(X)
0078 #endif
0079 
0080 #if __has_attribute(malloc)
0081 # if defined(__clang__) || (defined(__GNUC__) && __GNUC__ < 11)
0082 /* Clang or gcc do not support the optional deallocator argument */
0083 #  define XAU_MALLOC_ATTRIBUTE(X) __attribute__((malloc))
0084 # else
0085 #  define XAU_MALLOC_ATTRIBUTE(X) __attribute__((malloc X))
0086 # endif
0087 #else
0088 # define XAU_MALLOC_ATTRIBUTE(X)
0089 #endif
0090 
0091 char *XauFileName(void);
0092 
0093 void XauDisposeAuth(
0094 Xauth*      /* auth */
0095 );
0096 
0097 XAU_MALLOC_ATTRIBUTE((XauDisposeAuth, 1))
0098 Xauth *XauReadAuth(
0099 FILE*   /* auth_file */
0100 );
0101 
0102 XAU_ACCESS_ATTRIBUTE((read_only, 1)) /* file_name */
0103 int XauLockAuth(
0104 _Xconst char*   /* file_name */,
0105 int     /* retries */,
0106 int     /* timeout */,
0107 long        /* dead */
0108 );
0109 
0110 XAU_ACCESS_ATTRIBUTE((read_only, 1)) /* file_name */
0111 int XauUnlockAuth(
0112 _Xconst char*   /* file_name */
0113 );
0114 
0115 XAU_ACCESS_ATTRIBUTE((read_only, 2)) /* auth */
0116 int XauWriteAuth(
0117 FILE*       /* auth_file */,
0118 Xauth*      /* auth */
0119 );
0120 
0121 XAU_ACCESS_ATTRIBUTE((read_only, 3, 2)) /* address */
0122 XAU_ACCESS_ATTRIBUTE((read_only, 5, 4)) /* number */
0123 XAU_ACCESS_ATTRIBUTE((read_only, 7, 6)) /* name */
0124 Xauth *XauGetAuthByAddr(
0125 #if NeedWidePrototypes
0126 unsigned int    /* family */,
0127 unsigned int    /* address_length */,
0128 #else
0129 unsigned short  /* family */,
0130 unsigned short  /* address_length */,
0131 #endif
0132 _Xconst char*   /* address */,
0133 #if NeedWidePrototypes
0134 unsigned int    /* number_length */,
0135 #else
0136 unsigned short  /* number_length */,
0137 #endif
0138 _Xconst char*   /* number */,
0139 #if NeedWidePrototypes
0140 unsigned int    /* name_length */,
0141 #else
0142 unsigned short  /* name_length */,
0143 #endif
0144 _Xconst char*   /* name */
0145 );
0146 
0147 XAU_ACCESS_ATTRIBUTE((read_only, 3, 2)) /* address */
0148 XAU_ACCESS_ATTRIBUTE((read_only, 5, 4)) /* number */
0149 XAU_ACCESS_ATTRIBUTE((read_only, 7, 6)) /* type_names */
0150 XAU_ACCESS_ATTRIBUTE((read_only, 8, 6)) /* type_lengths */
0151 Xauth *XauGetBestAuthByAddr(
0152 #if NeedWidePrototypes
0153 unsigned int    /* family */,
0154 unsigned int    /* address_length */,
0155 #else
0156 unsigned short  /* family */,
0157 unsigned short  /* address_length */,
0158 #endif
0159 _Xconst char*   /* address */,
0160 #if NeedWidePrototypes
0161 unsigned int    /* number_length */,
0162 #else
0163 unsigned short  /* number_length */,
0164 #endif
0165 _Xconst char*   /* number */,
0166 int     /* types_length */,
0167 char**      /* type_names */,
0168 _Xconst int*    /* type_lengths */
0169 );
0170 
0171 _XFUNCPROTOEND
0172 
0173 /* Return values from XauLockAuth */
0174 
0175 # define LOCK_SUCCESS   0   /* lock succeeded */
0176 # define LOCK_ERROR 1   /* lock unexpectedly failed, check errno */
0177 # define LOCK_TIMEOUT   2   /* lock failed, timeouts expired */
0178 
0179 #endif /* _XAUTH_STRUCT_ONLY */
0180 
0181 #endif /* _Xauth_h */