Mercurial > repos > rliterman > csp2
comparison CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce/include/X11/Xdmcp.h @ 69:33d812a61356
planemo upload commit 2e9511a184a1ca667c7be0c6321a36dc4e3d116d
author | jpayne |
---|---|
date | Tue, 18 Mar 2025 17:55:14 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
67:0e9998148a16 | 69:33d812a61356 |
---|---|
1 /* | |
2 * Copyright 1989 Network Computing Devices, Inc., Mountain View, California. | |
3 * | |
4 * Permission to use, copy, modify, and distribute this software and its | |
5 * documentation for any purpose and without fee is hereby granted, provided | |
6 * that the above copyright notice appear in all copies and that both that | |
7 * copyright notice and this permission notice appear in supporting | |
8 * documentation, and that the name of N.C.D. not be used in advertising or | |
9 * publicity pertaining to distribution of the software without specific, | |
10 * written prior permission. N.C.D. makes no representations about the | |
11 * suitability of this software for any purpose. It is provided "as is" | |
12 * without express or implied warranty. | |
13 * | |
14 */ | |
15 | |
16 #ifndef _XDMCP_H_ | |
17 #define _XDMCP_H_ | |
18 | |
19 #include <X11/Xmd.h> | |
20 | |
21 #include <X11/Xfuncproto.h> | |
22 | |
23 _XFUNCPROTOBEGIN | |
24 | |
25 #define XDM_PROTOCOL_VERSION 1 | |
26 #define XDM_UDP_PORT 177 | |
27 | |
28 /* IANA has assigned FF0X:0:0:0:0:0:0:12B as the permanently assigned | |
29 * multicast addresses for XDMCP, where X in the prefix may be replaced | |
30 * by any valid scope identifier, such as 1 for Node-Local, 2 for Link-Local, | |
31 * 5 for Site-Local, and so on. We set the default here to the Link-Local | |
32 * version to most closely match the old IPv4 subnet broadcast behavior. | |
33 * Both xdm and X -query allow specifying a different address if a different | |
34 * scope is defined. | |
35 */ | |
36 #define XDM_DEFAULT_MCAST_ADDR6 "ff02:0:0:0:0:0:0:12b" | |
37 | |
38 #define XDM_MAX_MSGLEN 8192 | |
39 #define XDM_MIN_RTX 2 | |
40 #define XDM_MAX_RTX 32 | |
41 #define XDM_RTX_LIMIT 7 | |
42 #define XDM_KA_RTX_LIMIT 4 | |
43 #define XDM_DEF_DORMANCY (3 * 60) /* 3 minutes */ | |
44 #define XDM_MAX_DORMANCY (24 * 60 * 60) /* 24 hours */ | |
45 | |
46 typedef enum { | |
47 BROADCAST_QUERY = 1, QUERY, INDIRECT_QUERY, FORWARD_QUERY, | |
48 WILLING, UNWILLING, REQUEST, ACCEPT, DECLINE, MANAGE, REFUSE, | |
49 FAILED, KEEPALIVE, ALIVE | |
50 } xdmOpCode; | |
51 | |
52 typedef enum { | |
53 XDM_QUERY, XDM_BROADCAST, XDM_INDIRECT, XDM_COLLECT_QUERY, | |
54 XDM_COLLECT_BROADCAST_QUERY, XDM_COLLECT_INDIRECT_QUERY, | |
55 XDM_START_CONNECTION, XDM_AWAIT_REQUEST_RESPONSE, | |
56 XDM_AWAIT_MANAGE_RESPONSE, XDM_MANAGE, XDM_RUN_SESSION, XDM_OFF, | |
57 XDM_AWAIT_USER_INPUT, XDM_KEEPALIVE, XDM_AWAIT_ALIVE_RESPONSE, | |
58 #if defined(IPv6) && defined(AF_INET6) | |
59 XDM_MULTICAST, XDM_COLLECT_MULTICAST_QUERY, | |
60 #endif | |
61 XDM_KEEP_ME_LAST | |
62 } xdmcp_states; | |
63 | |
64 #ifdef NOTDEF | |
65 /* table of hosts */ | |
66 | |
67 #define XDM_MAX_STR_LEN 21 | |
68 #define XDM_MAX_HOSTS 20 | |
69 struct xdm_host_table { | |
70 struct sockaddr_in sockaddr; | |
71 char name[XDM_MAX_STR_LEN]; | |
72 char status[XDM_MAX_STR_LEN]; | |
73 }; | |
74 #endif /* NOTDEF */ | |
75 | |
76 typedef CARD8 *CARD8Ptr; | |
77 typedef CARD16 *CARD16Ptr; | |
78 typedef CARD32 *CARD32Ptr; | |
79 | |
80 typedef struct _ARRAY8 { | |
81 CARD16 length; | |
82 CARD8Ptr data; | |
83 } ARRAY8, *ARRAY8Ptr; | |
84 | |
85 typedef struct _ARRAY16 { | |
86 CARD8 length; | |
87 CARD16Ptr data; | |
88 } ARRAY16, *ARRAY16Ptr; | |
89 | |
90 typedef struct _ARRAY32 { | |
91 CARD8 length; | |
92 CARD32Ptr data; | |
93 } ARRAY32, *ARRAY32Ptr; | |
94 | |
95 typedef struct _ARRAYofARRAY8 { | |
96 CARD8 length; | |
97 ARRAY8Ptr data; | |
98 } ARRAYofARRAY8, *ARRAYofARRAY8Ptr; | |
99 | |
100 typedef struct _XdmcpHeader { | |
101 CARD16 version, opcode, length; | |
102 } XdmcpHeader, *XdmcpHeaderPtr; | |
103 | |
104 typedef struct _XdmcpBuffer { | |
105 BYTE *data; | |
106 int size; /* size of buffer pointed by to data */ | |
107 int pointer; /* current index into data */ | |
108 int count; /* bytes read from network into data */ | |
109 } XdmcpBuffer, *XdmcpBufferPtr; | |
110 | |
111 typedef struct _XdmAuthKey { | |
112 BYTE data[8]; | |
113 } XdmAuthKeyRec, *XdmAuthKeyPtr; | |
114 | |
115 | |
116 /* implementation-independent network address structure. | |
117 Equiv to sockaddr* for sockets. */ | |
118 | |
119 typedef char *XdmcpNetaddr; | |
120 | |
121 #ifndef __has_attribute | |
122 # define __has_attribute(x) 0 /* Compatibility with older compilers */ | |
123 #endif | |
124 | |
125 #if __has_attribute(access) | |
126 # define XDM_ACCESS_ATTRIBUTE(X) __attribute__((access X)) | |
127 #else | |
128 # define XDM_ACCESS_ATTRIBUTE(X) | |
129 #endif | |
130 | |
131 XDM_ACCESS_ATTRIBUTE((read_write, 1)) XDM_ACCESS_ATTRIBUTE((read_only, 2)) | |
132 extern int XdmcpWriteARRAY16(XdmcpBufferPtr buffer, const ARRAY16Ptr array); | |
133 XDM_ACCESS_ATTRIBUTE((read_write, 1)) XDM_ACCESS_ATTRIBUTE((read_only, 2)) | |
134 extern int XdmcpWriteARRAY32(XdmcpBufferPtr buffer, const ARRAY32Ptr array); | |
135 XDM_ACCESS_ATTRIBUTE((read_write, 1)) XDM_ACCESS_ATTRIBUTE((read_only, 2)) | |
136 extern int XdmcpWriteARRAY8(XdmcpBufferPtr buffer, const ARRAY8Ptr array); | |
137 XDM_ACCESS_ATTRIBUTE((read_write, 1)) XDM_ACCESS_ATTRIBUTE((read_only, 2)) | |
138 extern int XdmcpWriteARRAYofARRAY8(XdmcpBufferPtr buffer, const ARRAYofARRAY8Ptr array); | |
139 XDM_ACCESS_ATTRIBUTE((read_write, 1)) | |
140 extern int XdmcpWriteCARD16(XdmcpBufferPtr buffer, unsigned value); | |
141 XDM_ACCESS_ATTRIBUTE((read_write, 1)) | |
142 extern int XdmcpWriteCARD32(XdmcpBufferPtr buffer, unsigned value); | |
143 XDM_ACCESS_ATTRIBUTE((read_write, 1)) | |
144 extern int XdmcpWriteCARD8(XdmcpBufferPtr buffer, unsigned value); | |
145 XDM_ACCESS_ATTRIBUTE((read_write, 1)) XDM_ACCESS_ATTRIBUTE((read_only, 2)) | |
146 extern int XdmcpWriteHeader(XdmcpBufferPtr buffer, const XdmcpHeaderPtr header); | |
147 | |
148 XDM_ACCESS_ATTRIBUTE((read_only, 2)) | |
149 extern int XdmcpFlush(int fd, XdmcpBufferPtr buffer, XdmcpNetaddr to, int tolen); | |
150 | |
151 XDM_ACCESS_ATTRIBUTE((read_write, 1)) XDM_ACCESS_ATTRIBUTE((write_only, 2)) | |
152 extern int XdmcpReadARRAY16(XdmcpBufferPtr buffer, ARRAY16Ptr array); | |
153 XDM_ACCESS_ATTRIBUTE((read_write, 1)) XDM_ACCESS_ATTRIBUTE((write_only, 2)) | |
154 extern int XdmcpReadARRAY32(XdmcpBufferPtr buffer, ARRAY32Ptr array); | |
155 XDM_ACCESS_ATTRIBUTE((read_write, 1)) XDM_ACCESS_ATTRIBUTE((write_only, 2)) | |
156 extern int XdmcpReadARRAY8(XdmcpBufferPtr buffer, ARRAY8Ptr array); | |
157 XDM_ACCESS_ATTRIBUTE((read_write, 1)) XDM_ACCESS_ATTRIBUTE((write_only, 2)) | |
158 extern int XdmcpReadARRAYofARRAY8(XdmcpBufferPtr buffer, ARRAYofARRAY8Ptr array); | |
159 XDM_ACCESS_ATTRIBUTE((read_write, 1)) XDM_ACCESS_ATTRIBUTE((write_only, 2)) | |
160 extern int XdmcpReadCARD16(XdmcpBufferPtr buffer, CARD16Ptr valuep); | |
161 XDM_ACCESS_ATTRIBUTE((read_write, 1)) XDM_ACCESS_ATTRIBUTE((write_only, 2)) | |
162 extern int XdmcpReadCARD32(XdmcpBufferPtr buffer, CARD32Ptr valuep); | |
163 XDM_ACCESS_ATTRIBUTE((read_write, 1)) XDM_ACCESS_ATTRIBUTE((write_only, 2)) | |
164 extern int XdmcpReadCARD8(XdmcpBufferPtr buffer, CARD8Ptr valuep); | |
165 XDM_ACCESS_ATTRIBUTE((read_write, 1)) XDM_ACCESS_ATTRIBUTE((write_only, 2)) | |
166 extern int XdmcpReadHeader(XdmcpBufferPtr buffer, XdmcpHeaderPtr header); | |
167 | |
168 XDM_ACCESS_ATTRIBUTE((read_write, 2)) | |
169 extern int XdmcpFill(int fd, XdmcpBufferPtr buffer, XdmcpNetaddr from, int *fromlen); | |
170 | |
171 XDM_ACCESS_ATTRIBUTE((read_only, 1)) | |
172 extern int XdmcpReadRemaining(const XdmcpBufferPtr buffer); | |
173 | |
174 XDM_ACCESS_ATTRIBUTE((read_write, 1)) | |
175 extern void XdmcpDisposeARRAY8(ARRAY8Ptr array); | |
176 XDM_ACCESS_ATTRIBUTE((read_write, 1)) | |
177 extern void XdmcpDisposeARRAY16(ARRAY16Ptr array); | |
178 XDM_ACCESS_ATTRIBUTE((read_write, 1)) | |
179 extern void XdmcpDisposeARRAY32(ARRAY32Ptr array); | |
180 XDM_ACCESS_ATTRIBUTE((read_write, 1)) | |
181 extern void XdmcpDisposeARRAYofARRAY8(ARRAYofARRAY8Ptr array); | |
182 | |
183 XDM_ACCESS_ATTRIBUTE((read_only, 1)) XDM_ACCESS_ATTRIBUTE((write_only, 2)) | |
184 extern int XdmcpCopyARRAY8(const ARRAY8Ptr src, ARRAY8Ptr dst); | |
185 | |
186 XDM_ACCESS_ATTRIBUTE((read_only, 1)) XDM_ACCESS_ATTRIBUTE((read_only, 2)) | |
187 extern int XdmcpARRAY8Equal(const ARRAY8Ptr array1, const ARRAY8Ptr array2); | |
188 | |
189 XDM_ACCESS_ATTRIBUTE((write_only, 1)) | |
190 extern void XdmcpGenerateKey (XdmAuthKeyPtr key); | |
191 extern void XdmcpIncrementKey (XdmAuthKeyPtr key); | |
192 extern void XdmcpDecrementKey (XdmAuthKeyPtr key); | |
193 #ifdef HASXDMAUTH | |
194 extern void XdmcpWrap(unsigned char *input, unsigned char *wrapper, unsigned char *output, int bytes); | |
195 extern void XdmcpUnwrap(unsigned char *input, unsigned char *wrapper, unsigned char *output, int bytes); | |
196 #endif | |
197 | |
198 #ifndef TRUE | |
199 #define TRUE 1 | |
200 #define FALSE 0 | |
201 #endif | |
202 | |
203 XDM_ACCESS_ATTRIBUTE((read_only, 1)) XDM_ACCESS_ATTRIBUTE((read_only, 2)) | |
204 extern int XdmcpCompareKeys (const XdmAuthKeyPtr a, const XdmAuthKeyPtr b); | |
205 | |
206 XDM_ACCESS_ATTRIBUTE((write_only, 1)) | |
207 extern int XdmcpAllocARRAY16 (ARRAY16Ptr array, int length); | |
208 XDM_ACCESS_ATTRIBUTE((write_only, 1)) | |
209 extern int XdmcpAllocARRAY32 (ARRAY32Ptr array, int length); | |
210 XDM_ACCESS_ATTRIBUTE((write_only, 1)) | |
211 extern int XdmcpAllocARRAY8 (ARRAY8Ptr array, int length); | |
212 XDM_ACCESS_ATTRIBUTE((write_only, 1)) | |
213 extern int XdmcpAllocARRAYofARRAY8 (ARRAYofARRAY8Ptr array, int length); | |
214 | |
215 XDM_ACCESS_ATTRIBUTE((read_write, 1)) | |
216 extern int XdmcpReallocARRAY16 (ARRAY16Ptr array, int length); | |
217 XDM_ACCESS_ATTRIBUTE((read_write, 1)) | |
218 extern int XdmcpReallocARRAY32 (ARRAY32Ptr array, int length); | |
219 XDM_ACCESS_ATTRIBUTE((read_write, 1)) | |
220 extern int XdmcpReallocARRAY8 (ARRAY8Ptr array, int length); | |
221 XDM_ACCESS_ATTRIBUTE((read_write, 1)) | |
222 extern int XdmcpReallocARRAYofARRAY8 (ARRAYofARRAY8Ptr array, int length); | |
223 | |
224 _XFUNCPROTOEND | |
225 | |
226 #endif /* _XDMCP_H_ */ |