Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

192 lines
5.3 KiB

  1. //#---------------------------------------------------------------
  2. // File: cliproto.h
  3. //
  4. // Synopsis: header for shuttle client protocol
  5. //
  6. // Copyright (C) 1995 Microsoft Corporation
  7. // All rights reserved.
  8. //
  9. // Authors: t-alexwe
  10. //----------------------------------------------------------------
  11. #ifndef _CLIPROTO_H_
  12. #define _CLIPROTO_H_
  13. #include <windows.h>
  14. #define SECURITY_WIN32
  15. #define PROXY_PROTOCOL_VERSION MAKEWORD(1, 0)
  16. #define MAXPACKETDATASIZE 960
  17. #define MAXMSGSPERPACKET 4
  18. //
  19. // make sure everything is byte aligned
  20. //
  21. #pragma pack(1)
  22. //
  23. // the message structure
  24. //
  25. typedef struct {
  26. WORD wCommand; // the command requested
  27. WORD cData; // the amount of data
  28. WORD cOffset; // the offset of the data into the
  29. // the packets pData
  30. } PROXYMESSAGE, *PPROXYMESSAGE;
  31. //
  32. // client connection protocol packet structure
  33. //
  34. // each packet contains 1 to 4 messages.
  35. //
  36. typedef struct {
  37. WORD cLength; // the length of this packet
  38. WORD cMessages; // the message count in this packet
  39. //
  40. // information for each message
  41. //
  42. PROXYMESSAGE pMessages[MAXMSGSPERPACKET];
  43. //
  44. // the packets data
  45. //
  46. BYTE pData[MAXPACKETDATASIZE];
  47. } PROXYPACKET, *PPROXYPACKET;
  48. #define PACKETHDRSIZE (sizeof(PROXYPACKET) - MAXPACKETDATASIZE)
  49. //
  50. // message types (wCommand in PROXYMESSAGE)
  51. //
  52. // format:
  53. // | 16 | 15 - 0 |
  54. //
  55. // bit 16 - if 0 then message is handled by Shuttle server, if 1 then
  56. // message is handled by client.
  57. //
  58. // generally these are laid out in the order that they are expected to be
  59. // received in. a command of type wCommand should return a message of type
  60. // wCommand | 0x8000.
  61. //
  62. // Only exception is that PROXY_NEGOTIATE can return a PROXY_CHALLENGE or
  63. // a PROXY_ACCEPT message.
  64. //
  65. #define PROXY_VERSION 0x0000
  66. #define PROXY_VERSION_RETURN 0x8000
  67. #define PROXY_NEGOTIATE 0x0001
  68. #define PROXY_CHALLENGE 0x8001
  69. #define PROXY_ACCEPT 0x8002
  70. #define PROXY_GETHOSTBYNAME 0x0003
  71. #define PROXY_GETHOSTBYNAME_RETURN 0x8003
  72. #define PROXY_CONNECT 0x0004
  73. #define PROXY_CONNECT_RETURN 0x8004
  74. #define PROXY_SETSOCKOPT 0x0005
  75. #define PROXY_SETSOCKOPT_RETURN 0x8005
  76. #define PROXY_DOGATEWAY 0x0006
  77. #define PROXY_DOGATEWAY_RETURN 0x8006
  78. #define MAX_PROXY_SRV_COMMAND PROXY_DOGATEWAY
  79. #define PROXY_NOMESSAGE 0xffff
  80. //
  81. // include the error codes from the client connection API
  82. //
  83. #include <clicnct.h>
  84. //
  85. // message data formats
  86. //
  87. // packet data sizes need to be < MAXDATASIZE bytes, so the total size
  88. // of a group of messages going in one packet should be < MAXDATASIZE bytes.
  89. //
  90. // error codes are NT/WinSock or PROXYERR error codes
  91. //
  92. #define MAXCOMPUTERNAME MAX_COMPUTERNAME_LENGTH + 1
  93. typedef struct {
  94. WORD wRequestedVersion; // requested ver of the protocol
  95. DWORD cComputerName; // length of the computer name
  96. CHAR pszComputerName[MAXCOMPUTERNAME]; // cli's comp name
  97. } PROXY_VERSION_DATA, *PPROXY_VERSION_DATA;
  98. typedef struct {
  99. DWORD dwError; // error code
  100. WORD wVersion; // version of protocol used
  101. WORD wHighVersion; // highest version supported
  102. } PROXY_VERSION_RETURN_DATA, *PPROXY_VERSION_RETURN_DATA;
  103. #define SECBUFSIZE 768
  104. typedef struct {
  105. WORD cNegotiateBuffer;
  106. BYTE pNegotiateBuffer[SECBUFSIZE];
  107. } PROXY_NEGOTIATE_DATA, *PPROXY_NEGOTIATE_DATA;
  108. typedef struct {
  109. WORD cChallengeBuffer;
  110. BYTE pChallengeBuffer[SECBUFSIZE];
  111. } PROXY_CHALLENGE_DATA, *PPROXY_CHALLENGE_DATA;
  112. typedef struct {
  113. DWORD dwError; // error code
  114. } PROXY_ACCEPT_DATA, *PPROXY_ACCEPT_DATA;
  115. #define MAXHOSTNAMELEN 512
  116. #define MAXADDRLISTSIZE 128
  117. typedef struct {
  118. WORD cHostname; // length of hostname
  119. char pszHostname[MAXHOSTNAMELEN]; // hostname
  120. } PROXY_GETHOSTBYNAME_DATA, *PPROXY_GETHOSTBYNAME_DATA;
  121. typedef struct {
  122. DWORD dwError; // error code
  123. WORD cAddr; // number of addresses
  124. WORD h_addrtype; // should always be AF_INET
  125. WORD h_length; // the length of each addr
  126. // should always be 4
  127. //
  128. // the addresses. this has cAddr addresses in it. each address is of
  129. // length h_length and the first one starts at h_addr_list[0].
  130. //
  131. BYTE h_addr_list[MAXADDRLISTSIZE];
  132. } PROXY_GETHOSTBYNAME_RETURN_DATA, *PPROXY_GETHOSTBYNAME_RETURN_DATA;
  133. typedef struct {
  134. WORD cAddr; // the length of the address (16)
  135. struct sockaddr addr; // the address
  136. } PROXY_CONNECT_DATA, *PPROXY_CONNECT_DATA;
  137. typedef struct {
  138. DWORD dwError; // error code
  139. } PROXY_CONNECT_RETURN_DATA, *PPROXY_CONNECT_RETURN_DATA;
  140. #define MAXSOCKOPTS 32 // maximum sockopts per packet
  141. #define MAXOPTVAL 16 // maximum length of optval
  142. typedef struct {
  143. WORD level; // option level
  144. WORD optname; // option name
  145. BYTE optval[MAXOPTVAL]; // option value
  146. WORD optlen; // option length (<= MAXOPTVAL)
  147. } NETSOCKOPT, *PNETSOCKOPT;
  148. typedef struct {
  149. DWORD cSockopt; // number of socket options
  150. NETSOCKOPT sockopts[MAXSOCKOPTS]; // the socket options
  151. } PROXY_SETSOCKOPT_DATA, *PPROXY_SETSOCKOPT_DATA;
  152. typedef struct {
  153. DWORD dwError; // error code
  154. } PROXY_SETSOCKOPT_RETURN_DATA, *PPROXY_SETSOCKOPT_RETURN_DATA;
  155. typedef struct {
  156. BYTE reserved; // we need some data...
  157. } PROXY_DOGATEWAY_DATA, *PPROXY_DOGATEWAY_DATA;
  158. typedef struct {
  159. DWORD dwError; // error code
  160. } PROXY_DOGATEWAY_RETURN_DATA, *PPROXY_DOGATEWAY_RETURN_DATA;
  161. #pragma pack()
  162. #endif