]> git.sesse.net Git - rdpsrv/blob - Xserver/lib/Xdmcp/Xdmcp.h
ae9d476395fbf820cb8a3aa12330b34ac2a8dcab
[rdpsrv] / Xserver / lib / Xdmcp / Xdmcp.h
1 /* $XConsortium: Xdmcp.h,v 1.9 95/06/07 18:30:59 gildea Exp $ */
2 /* $XFree86: xc/lib/Xdmcp/Xdmcp.h,v 3.1 1996/01/05 13:12:04 dawes Exp $ */
3 /*
4  * Copyright 1989 Network Computing Devices, Inc., Mountain View, California.
5  *
6  * Permission to use, copy, modify, and distribute this software and its
7  * documentation for any purpose and without fee is hereby granted, provided
8  * that the above copyright notice appear in all copies and that both that
9  * copyright notice and this permission notice appear in supporting
10  * documentation, and that the name of N.C.D. not be used in advertising or
11  * publicity pertaining to distribution of the software without specific,
12  * written prior permission.  N.C.D. makes no representations about the
13  * suitability of this software for any purpose.  It is provided "as is"
14  * without express or implied warranty.
15  *
16  */
17
18 #ifndef _XDMCP_H_
19 #define _XDMCP_H_
20 #define XDM_PROTOCOL_VERSION    1
21 #define XDM_UDP_PORT            177
22 #define XDM_MAX_MSGLEN          8192
23 #define XDM_MIN_RTX             2
24 #define XDM_MAX_RTX             32
25 #define XDM_RTX_LIMIT           7
26 #define XDM_KA_RTX_LIMIT        4
27 #define XDM_DEF_DORMANCY        (3 * 60)        /* 3 minutes */
28 #define XDM_MAX_DORMANCY        (24 * 60 * 60)  /* 24 hours */
29
30 typedef enum {
31     BROADCAST_QUERY = 1, QUERY, INDIRECT_QUERY, FORWARD_QUERY,
32     WILLING, UNWILLING, REQUEST, ACCEPT, DECLINE, MANAGE, REFUSE, 
33     FAILED, KEEPALIVE, ALIVE 
34 } xdmOpCode;
35
36 typedef enum {
37     XDM_QUERY, XDM_BROADCAST, XDM_INDIRECT, XDM_COLLECT_QUERY,
38     XDM_COLLECT_BROADCAST_QUERY, XDM_COLLECT_INDIRECT_QUERY,
39     XDM_START_CONNECTION, XDM_AWAIT_REQUEST_RESPONSE,
40     XDM_AWAIT_MANAGE_RESPONSE, XDM_MANAGE, XDM_RUN_SESSION, XDM_OFF,
41     XDM_AWAIT_USER_INPUT, XDM_KEEPALIVE, XDM_AWAIT_ALIVE_RESPONSE
42 } xdmcp_states;
43
44 #ifdef NOTDEF
45 /* table of hosts */
46
47 #define XDM_MAX_STR_LEN 21
48 #define XDM_MAX_HOSTS 20
49 struct xdm_host_table {
50   struct sockaddr_in sockaddr;
51   char name[XDM_MAX_STR_LEN];
52   char status[XDM_MAX_STR_LEN];
53 };
54 #endif /* NOTDEF */
55
56 typedef CARD8   *CARD8Ptr;
57 typedef CARD16  *CARD16Ptr;
58 typedef CARD32  *CARD32Ptr;
59
60 typedef struct _ARRAY8 {
61     CARD16      length;
62     CARD8Ptr    data;
63 } ARRAY8, *ARRAY8Ptr;
64
65 typedef struct _ARRAY16 {
66     CARD8       length;
67     CARD16Ptr   data;
68 } ARRAY16, *ARRAY16Ptr;
69
70 typedef struct _ARRAY32 {
71     CARD8       length;
72     CARD32Ptr   data;
73 } ARRAY32, *ARRAY32Ptr;
74
75 typedef struct _ARRAYofARRAY8 {
76     CARD8       length;
77     ARRAY8Ptr   data;
78 } ARRAYofARRAY8, *ARRAYofARRAY8Ptr;
79
80 typedef struct _XdmcpHeader {
81     CARD16  version, opcode, length;
82 } XdmcpHeader, *XdmcpHeaderPtr;
83
84 typedef struct _XdmcpBuffer {
85     BYTE    *data;
86     int     size;               /* size of buffer pointed by to data */
87     int     pointer;            /* current index into data */
88     int     count;              /* bytes read from network into data */
89 } XdmcpBuffer, *XdmcpBufferPtr;
90
91 typedef struct _XdmAuthKey {
92     BYTE    data[8];
93 } XdmAuthKeyRec, *XdmAuthKeyPtr;
94
95
96 /* implementation-independent network address structure.
97    Equiv to sockaddr* for sockets and netbuf* for STREAMS. */
98
99 typedef char *XdmcpNetaddr;
100
101
102 extern int XdmcpWriteCARD8(),           XdmcpWriteCARD16();
103 extern int XdmcpWriteCARD32();
104 extern int XdmcpWriteARRAY8(),          XdmcpWriteARRAY16();
105 extern int XdmcpWriteARRAY32(),         XdmcpWriteARRAYofARRAY8();
106 extern int XdmcpWriteHeader(),          XdmcpFlush();
107
108 extern int XdmcpReadCARD8(),            XdmcpReadCARD16();
109 extern int XdmcpReadCARD32();
110 extern int XdmcpReadARRAY8(),           XdmcpReadARRAY16();
111 extern int XdmcpReadARRAY32(),          XdmcpReadARRAYofARRAY8();
112 extern int XdmcpReadHeader(),           XdmcpFill();
113
114 extern int  XdmcpReadRemaining();
115
116 extern void XdmcpDisposeARRAY8(),       XdmcpDisposeARRAY16();
117 extern void XdmcpDisposeARRAY32(),      XdmcpDisposeARRAYofARRAY8();
118
119 extern int XdmcpCopyARRAY8();
120
121 extern int XdmcpARRAY8Equal();
122
123 #ifdef HASXDMAUTH
124 extern void XdmcpGenerateKey();
125 extern void XdmcpIncrementKey();
126 extern void XdmcpDecrementKey();
127 extern void XdmcpWrap();
128 extern void XdmcpUnwrap();
129 #endif
130
131 #ifndef TRUE
132 #define TRUE    1
133 #define FALSE   0
134 #endif
135
136 #if !defined(Xalloc) && !defined(xalloc) && !defined(Xrealloc)
137 extern long *Xalloc (), *Xrealloc ();
138 extern void Xfree();
139 #endif
140
141 #endif /* _XDMCP_H_ */