| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | |
| 15 | |
| 16 | |
| 17 | |
| 18 | |
| 19 | |
| 20 | |
| 21 | |
| 22 | |
| 23 | |
| 24 | |
| 25 | |
| 26 | |
| 27 | #ifndef _Xauth_h |
| 28 | #define _Xauth_h |
| 29 | |
| 30 | |
| 31 | |
| 32 | |
| 33 | #ifdef __clang__ |
| 34 | #pragma clang diagnostic push |
| 35 | #pragma clang diagnostic ignored "-Wpadded" |
| 36 | #endif |
| 37 | |
| 38 | typedef 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) |
| 62 | # define FamilyWild (65535) |
| 63 | # define FamilyNetname (254) |
| 64 | # define FamilyKrb5Principal (253) |
| 65 | # define FamilyLocalHost (252) |
| 66 | |
| 67 | |
| 68 | _XFUNCPROTOBEGIN |
| 69 | |
| 70 | #ifndef __has_attribute |
| 71 | # define __has_attribute(x) 0 |
| 72 | #endif |
| 73 | |
| 74 | #if __has_attribute(access) |
| 75 | # define XAU_ACCESS_ATTRIBUTE(X) __attribute__((access X)) |
| 76 | #else |
| 77 | # define XAU_ACCESS_ATTRIBUTE(X) |
| 78 | #endif |
| 79 | |
| 80 | #if __has_attribute(malloc) |
| 81 | # if defined(__clang__) || (defined(__GNUC__) && __GNUC__ < 11) |
| 82 | |
| 83 | # define XAU_MALLOC_ATTRIBUTE(X) __attribute__((malloc)) |
| 84 | # else |
| 85 | # define XAU_MALLOC_ATTRIBUTE(X) __attribute__((malloc X)) |
| 86 | # endif |
| 87 | #else |
| 88 | # define XAU_MALLOC_ATTRIBUTE(X) |
| 89 | #endif |
| 90 | |
| 91 | char *XauFileName(void); |
| 92 | |
| 93 | void XauDisposeAuth( |
| 94 | Xauth* |
| 95 | ); |
| 96 | |
| 97 | XAU_MALLOC_ATTRIBUTE((XauDisposeAuth, 1)) |
| 98 | Xauth *XauReadAuth( |
| 99 | FILE* |
| 100 | ); |
| 101 | |
| 102 | XAU_ACCESS_ATTRIBUTE((read_only, 1)) |
| 103 | int XauLockAuth( |
| 104 | _Xconst char* , |
| 105 | int , |
| 106 | int , |
| 107 | long |
| 108 | ); |
| 109 | |
| 110 | XAU_ACCESS_ATTRIBUTE((read_only, 1)) |
| 111 | int XauUnlockAuth( |
| 112 | _Xconst char* |
| 113 | ); |
| 114 | |
| 115 | XAU_ACCESS_ATTRIBUTE((read_only, 2)) |
| 116 | int XauWriteAuth( |
| 117 | FILE* , |
| 118 | Xauth* |
| 119 | ); |
| 120 | |
| 121 | XAU_ACCESS_ATTRIBUTE((read_only, 3, 2)) |
| 122 | XAU_ACCESS_ATTRIBUTE((read_only, 5, 4)) |
| 123 | XAU_ACCESS_ATTRIBUTE((read_only, 7, 6)) |
| 124 | Xauth *XauGetAuthByAddr( |
| 125 | #if NeedWidePrototypes |
| 126 | unsigned int , |
| 127 | unsigned int , |
| 128 | #else |
| 129 | unsigned short , |
| 130 | unsigned short , |
| 131 | #endif |
| 132 | _Xconst char* , |
| 133 | #if NeedWidePrototypes |
| 134 | unsigned int , |
| 135 | #else |
| 136 | unsigned short , |
| 137 | #endif |
| 138 | _Xconst char* , |
| 139 | #if NeedWidePrototypes |
| 140 | unsigned int , |
| 141 | #else |
| 142 | unsigned short , |
| 143 | #endif |
| 144 | _Xconst char* |
| 145 | ); |
| 146 | |
| 147 | XAU_ACCESS_ATTRIBUTE((read_only, 3, 2)) |
| 148 | XAU_ACCESS_ATTRIBUTE((read_only, 5, 4)) |
| 149 | XAU_ACCESS_ATTRIBUTE((read_only, 7, 6)) |
| 150 | XAU_ACCESS_ATTRIBUTE((read_only, 8, 6)) |
| 151 | Xauth *XauGetBestAuthByAddr( |
| 152 | #if NeedWidePrototypes |
| 153 | unsigned int , |
| 154 | unsigned int , |
| 155 | #else |
| 156 | unsigned short , |
| 157 | unsigned short , |
| 158 | #endif |
| 159 | _Xconst char* , |
| 160 | #if NeedWidePrototypes |
| 161 | unsigned int , |
| 162 | #else |
| 163 | unsigned short , |
| 164 | #endif |
| 165 | _Xconst char* , |
| 166 | int , |
| 167 | char** , |
| 168 | _Xconst int* |
| 169 | ); |
| 170 | |
| 171 | _XFUNCPROTOEND |
| 172 | |
| 173 | |
| 174 | |
| 175 | # define LOCK_SUCCESS 0 |
| 176 | # define LOCK_ERROR 1 |
| 177 | # define LOCK_TIMEOUT 2 |
| 178 | |
| 179 | #endif |
| 180 | |
| 181 | #endif |