Xauth.h 3.7 KB

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