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.

418 lines
8.8 KiB

  1. /***************************************************************************
  2. *
  3. * Copyright (C) 1999 - 2001 Microsoft Corporation. All Rights Reserved.
  4. *
  5. * File: pastmsgs.h
  6. *
  7. * Content: Messages for PAST (Protocol for Address Space Traversal).
  8. *
  9. * History:
  10. * Date By Reason
  11. * ======== ======== =========
  12. * 12/07/99 AaronO Original.
  13. * 03/17/00 JohnKan Modified for DPlay8.
  14. * 02/05/01 VanceO Moved to DPNATHLP.DLL.
  15. * 04/16/01 VanceO Moved to DPNHPAST.DLL.
  16. *
  17. ***************************************************************************/
  18. //=============================================================================
  19. // Constant definitions
  20. //=============================================================================
  21. #define PAST_VERSION 1
  22. #define PAST_HOST_PORT 2234
  23. #define PAST_ANY_ADDRESS 0
  24. #define PAST_ANY_PORT 0
  25. #define PAST_MS_VENDOR_ID 734
  26. //=============================================================================
  27. // Parameter types
  28. //=============================================================================
  29. //
  30. // Tunnel types
  31. //
  32. enum
  33. {
  34. PAST_TUNNEL_RESERVED = 0,
  35. PAST_TUNNEL_IP_IP = 1,
  36. PAST_TUNNEL_GRE = 2, // PPTP
  37. PAST_TUNNEL_L2TP = 3,
  38. //PAST_TUNNEL_NONE = 4, // THIS IS NOT PART OF THE SPEC
  39. };
  40. //
  41. // PAST methods
  42. //
  43. enum
  44. {
  45. PAST_METHOD_RESERVED = 0,
  46. PAST_METHOD_RSA_IP = 1,
  47. PAST_METHOD_RSAP_IP = 2,
  48. PAST_METHOD_RSA_IP_IPSEC = 3,
  49. PAST_METHOD_RSAP_IP_IPSEC = 4,
  50. };
  51. //
  52. // Flow types
  53. //
  54. enum
  55. {
  56. PAST_FLOW_RESERVED = 0,
  57. PAST_FLOW_MACRO = 1,
  58. PAST_FLOW_MICRO = 2,
  59. PAST_FLOW_NONE = 3,
  60. };
  61. //
  62. // Address types
  63. //
  64. enum
  65. {
  66. PAST_ADDRESSTYPE_RESERVED = 0,
  67. PAST_ADDRESSTYPE_IPV4 = 1, // 4 bytes
  68. PAST_ADDRESSTYPE_IPV4_NETMASK = 2, // 4 bytes
  69. PAST_ADDRESSTYPE_IPV6 = 3, // 16 bytes
  70. PAST_ADDRESSTYPE_IPV6_NETMASK = 4, // 16 bytes
  71. PAST_ADDRESSTYPE_FQDN = 5, // varies
  72. };
  73. //
  74. // MS specific Vendor Codes
  75. //
  76. enum
  77. {
  78. PAST_VC_MS_NO_TUNNEL = 1,
  79. PAST_VC_MS_TCP_PORT = 2,
  80. PAST_VC_MS_UDP_PORT = 3,
  81. PAST_VC_MS_SHARED_UDP_LISTENER = 4,
  82. PAST_VC_MS_QUERY_MAPPING = 5,
  83. };
  84. //=============================================================================
  85. // Message IDs
  86. //=============================================================================
  87. enum
  88. {
  89. PAST_MSGID_ERROR_RESPONSE = 1,
  90. PAST_MSGID_REGISTER_REQUEST = 2,
  91. PAST_MSGID_REGISTER_RESPONSE = 3,
  92. PAST_MSGID_DEREGISTER_REQUEST = 4,
  93. PAST_MSGID_DEREGISTER_RESPONSE = 5,
  94. PAST_MSGID_ASSIGN_REQUEST_RSA_IP = 6,
  95. PAST_MSGID_ASSIGN_RESPONSE_RSA_IP = 7,
  96. PAST_MSGID_ASSIGN_REQUEST_RSAP_IP = 8,
  97. PAST_MSGID_ASSIGN_RESPONSE_RSAP_IP = 9,
  98. PAST_MSGID_EXTEND_REQUEST = 10,
  99. PAST_MSGID_EXTEND_RESPONSE = 11,
  100. PAST_MSGID_FREE_REQUEST = 12,
  101. PAST_MSGID_FREE_RESPONSE = 13,
  102. PAST_MSGID_QUERY_REQUEST = 14,
  103. PAST_MSGID_QUERY_RESPONSE = 15,
  104. PAST_MSGID_DEALLOCATE = 16,
  105. PAST_MSGID_OK = 17,
  106. PAST_MSGID_LISTEN_REQUEST = 18,
  107. PAST_MSGID_LISTEN_RESPONSE = 19,
  108. };
  109. //=============================================================================
  110. // Message parameters
  111. //=============================================================================
  112. enum
  113. {
  114. PAST_PARAMID_ADDRESS = 1,
  115. PAST_PARAMID_PORTS = 2,
  116. PAST_PARAMID_LEASE = 3,
  117. PAST_PARAMID_CLIENTID = 4,
  118. PAST_PARAMID_BINDID = 5,
  119. PAST_PARAMID_MESSAGEID = 6,
  120. PAST_PARAMID_TUNNELTYPE = 7,
  121. PAST_PARAMID_PASTMETHOD = 8,
  122. PAST_PARAMID_ERROR = 9,
  123. PAST_PARAMID_FLOWPOLICY = 10,
  124. PAST_PARAMID_VENDOR = 11,
  125. };
  126. //=============================================================================
  127. // Structures
  128. //=============================================================================
  129. #pragma pack(push,1)
  130. typedef struct _PAST_PARAM
  131. {
  132. CHAR code;
  133. WORD len;
  134. } PAST_PARAM, *PPAST_PARAM;
  135. typedef struct _PAST_PARAM_MESSAGEID
  136. {
  137. CHAR code;
  138. WORD len;
  139. DWORD msgid;
  140. } PAST_PARAM_MESSAGEID, *PPAST_PARAM_MESSAGEID;
  141. typedef struct _PAST_PARAM_CLIENTID
  142. {
  143. CHAR code;
  144. WORD len;
  145. DWORD clientid;
  146. } PAST_PARAM_CLIENTID, *PPAST_PARAM_CLIENTID;
  147. typedef struct _PAST_PARAM_ADDRESS
  148. {
  149. CHAR code;
  150. WORD len;
  151. CHAR version; // ADDRESSTYPE_IPV4 == 1 == v4
  152. DWORD addr;
  153. } PAST_PARAM_ADDRESS, *PPAST_PARAM_ADDRESS;
  154. typedef struct _PAST_PARAM_PORTS
  155. {
  156. CHAR code;
  157. WORD len;
  158. CHAR nports; // we only do 1 port at a time
  159. WORD port; // NOTE: they appear to be transferred in x86 byte order, contrary to the spec, which says network byte order
  160. } PAST_PARAM_PORTS, *PPAST_PARAM_PORTS;
  161. typedef struct _PAST_PARAM_LEASE
  162. {
  163. CHAR code;
  164. WORD len;
  165. DWORD leasetime;
  166. } PAST_PARAM_LEASE, *PPAST_PARAM_LEASE;
  167. typedef struct _PAST_PARAM_BINDID
  168. {
  169. CHAR code;
  170. WORD len;
  171. DWORD bindid;
  172. } PAST_PARAM_BINDID, *PPAST_PARAM_BINDID;
  173. typedef struct _PAST_PARAM_TUNNELTYPE
  174. {
  175. CHAR code;
  176. WORD len;
  177. CHAR tunneltype;
  178. } PAST_PARAM_TUNNELTYPE, *PPAST_PARAM_TUNNELTYPE;
  179. typedef struct _PAST_PARAM_MSVENDOR_CODE {
  180. CHAR code;
  181. WORD len;
  182. WORD vendorid;
  183. WORD option;
  184. } PAST_PARAM_MSVENDOR_CODE, *PPAST_MSVENDOR_CODE;
  185. //
  186. // PAST Message templates
  187. //
  188. typedef struct _PAST_MSG
  189. {
  190. CHAR version;
  191. CHAR msgtype;
  192. } PAST_MSG, *PPAST_MSG;
  193. typedef struct _PAST_MSG_REGISTER_REQUEST
  194. {
  195. CHAR version;
  196. CHAR command;
  197. PAST_PARAM_MESSAGEID msgid;
  198. } PAST_MSG_REGISTER, *PPAST_MSG_REGISTER_REQUEST;
  199. typedef struct _PAST_MSG_DEREGISTER_REQUEST
  200. {
  201. CHAR version;
  202. CHAR command;
  203. PAST_PARAM_CLIENTID clientid;
  204. PAST_PARAM_MESSAGEID msgid;
  205. } PAST_MSG_DEREGISTER_REQUEST, *PPAST_MSG_DEREGISTER_REQUEST;
  206. typedef struct _PAST_MSG_ASSIGN_REQUEST_RSAP_IP
  207. {
  208. CHAR version;
  209. CHAR command;
  210. PAST_PARAM_CLIENTID clientid;
  211. PAST_PARAM_ADDRESS laddress; // local
  212. PAST_PARAM_PORTS lport;
  213. PAST_PARAM_ADDRESS raddress; // remote
  214. PAST_PARAM_PORTS rport;
  215. PAST_PARAM_LEASE lease;
  216. PAST_PARAM_TUNNELTYPE tunneltype;
  217. PAST_PARAM_MESSAGEID msgid;
  218. PAST_PARAM_MSVENDOR_CODE porttype;
  219. PAST_PARAM_MSVENDOR_CODE tunneloptions;
  220. } PAST_MSG_ASSIGN_REQUEST_RSAP_IP, *PPAST_MSG_ASSIGN_REQUEST_RSAP_IP;
  221. typedef struct _PAST_MSG_LISTEN_REQUEST
  222. {
  223. CHAR version;
  224. CHAR command;
  225. PAST_PARAM_CLIENTID clientid;
  226. PAST_PARAM_ADDRESS laddress; // local
  227. PAST_PARAM_PORTS lport;
  228. PAST_PARAM_ADDRESS raddress; // remote
  229. PAST_PARAM_PORTS rport;
  230. PAST_PARAM_LEASE lease;
  231. PAST_PARAM_TUNNELTYPE tunneltype;
  232. PAST_PARAM_MESSAGEID msgid;
  233. PAST_PARAM_MSVENDOR_CODE porttype;
  234. PAST_PARAM_MSVENDOR_CODE tunneloptions;
  235. } PAST_MSG_LISTEN_REQUEST, *PPAST_MSG_LISTEN_REQUEST;
  236. //
  237. // This isn't a real message, it's the same thing as LISTEN, but with an
  238. // extra vendor option.
  239. //
  240. typedef struct _PAST_MSG_LISTEN_REQUEST_SHARED
  241. {
  242. CHAR version;
  243. CHAR command;
  244. PAST_PARAM_CLIENTID clientid;
  245. PAST_PARAM_ADDRESS laddress; // local
  246. PAST_PARAM_PORTS lport;
  247. PAST_PARAM_ADDRESS raddress; // remote
  248. PAST_PARAM_PORTS rport;
  249. PAST_PARAM_LEASE lease;
  250. PAST_PARAM_TUNNELTYPE tunneltype;
  251. PAST_PARAM_MESSAGEID msgid;
  252. PAST_PARAM_MSVENDOR_CODE porttype;
  253. PAST_PARAM_MSVENDOR_CODE tunneloptions;
  254. PAST_PARAM_MSVENDOR_CODE listentype;
  255. } PAST_MSG_LISTEN_REQUEST_SHARED, *PPAST_MSG_LISTEN_REQUEST_SHARED;
  256. //
  257. // Take advantage of fact that ASSIGN, LISTEN, SHAREDLISTEN look almost
  258. // identical.
  259. //
  260. typedef struct _PAST_MSG_ASSIGNORLISTEN_REQUEST
  261. {
  262. union
  263. {
  264. PAST_MSG_ASSIGN_REQUEST_RSAP_IP assign;
  265. PAST_MSG_LISTEN_REQUEST listen;
  266. PAST_MSG_LISTEN_REQUEST_SHARED sharedlisten;
  267. };
  268. } PAST_MSG_ASSIGNORLISTEN_REQUEST, *PPAST_MSG_ASSIGNORLISTEN_REQUEST;
  269. typedef struct _PAST_MSG_EXTEND_REQUEST
  270. {
  271. CHAR version;
  272. CHAR command;
  273. PAST_PARAM_CLIENTID clientid;
  274. PAST_PARAM_BINDID bindid;
  275. PAST_PARAM_LEASE lease;
  276. PAST_PARAM_MESSAGEID msgid;
  277. } PAST_MSG_EXTEND_REQUEST, *PPAST_MSG_EXTEND_REQUEST;
  278. typedef struct _PAST_MSG_FREE_REQUEST
  279. {
  280. CHAR version;
  281. CHAR command;
  282. PAST_PARAM_CLIENTID clientid;
  283. PAST_PARAM_BINDID bindid;
  284. PAST_PARAM_MESSAGEID msgid;
  285. } PAST_MSG_FREE_REQUEST, *PPAST_MSG_FREE_REQUEST;
  286. typedef struct _PAST_MSG_QUERY_REQUEST_PORTS
  287. {
  288. CHAR version;
  289. CHAR command;
  290. PAST_PARAM_CLIENTID clientid;
  291. PAST_PARAM_ADDRESS address;
  292. PAST_PARAM_PORTS port;
  293. PAST_PARAM_MSVENDOR_CODE porttype;
  294. PAST_PARAM_MSVENDOR_CODE querytype;
  295. PAST_PARAM_MESSAGEID msgid;
  296. } PAST_MSG_QUERY_REQUEST_PORTS, *PPAST_MSG_QUERY_REQUEST_PORTS;
  297. typedef struct _PAST_MSG_QUERY_REQUEST_ADDRONLY
  298. {
  299. CHAR version;
  300. CHAR command;
  301. PAST_PARAM_CLIENTID clientid;
  302. PAST_PARAM_ADDRESS address;
  303. PAST_PARAM_MESSAGEID msgid;
  304. } PAST_MSG_QUERY_REQUEST_ADDRONLY, *PPAST_MSG_QUERY_REQUEST_ADDRONLY;
  305. #pragma pack(pop)
  306. //=============================================================================
  307. // Errors
  308. //=============================================================================
  309. enum
  310. {
  311. PASTERR_UNKNOWNERROR = 1,
  312. PASTERR_BADBINDID = 2,
  313. PASTERR_BADCLIENTID = 3,
  314. PASTERR_MISSINGPARAM = 4,
  315. PASTERR_DUPLICATEPARAM = 5,
  316. PASTERR_ILLEGALPARAM = 6,
  317. PASTERR_ILLEGALMESSAGE = 7,
  318. PASTERR_REGISTERFIRST = 8,
  319. PASTERR_BADMESSAGEID = 9,
  320. PASTERR_ALREADYREGISTERED = 10,
  321. PASTERR_ALREADYUNREGISTERED = 11,
  322. PASTERR_BADTUNNELTYPE = 12,
  323. PASTERR_ADDRUNAVAILABLE = 13,
  324. PASTERR_PORTUNAVAILABLE = 14,
  325. };