Leaked source code of windows server 2003
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.

323 lines
11 KiB

  1. /********************************************************************/
  2. /** Microsoft LAN Manager **/
  3. /** Copyright (c) Microsoft Corporation. All rights reserved. **/
  4. /********************************************************************/
  5. /* :ts=4 */
  6. //** TCPINFO.H - TDI Query/SetInfo and Action definitons.
  7. //
  8. // This file contains definitions for information returned from TCP/UDP.
  9. //
  10. #pragma once
  11. #ifndef TCP_INFO_INCLUDED
  12. #define TCP_INFO_INCLUDED
  13. #include "ipinfo.h"
  14. #ifndef CTE_TYPEDEFS_DEFINED
  15. #define CTE_TYPEDEFS_DEFINED
  16. typedef unsigned long ulong;
  17. typedef unsigned short ushort;
  18. typedef unsigned char uchar;
  19. typedef unsigned int uint;
  20. #endif // CTE_TYPEDEFS_DEFINED
  21. typedef struct TCPStats {
  22. ulong ts_rtoalgorithm;
  23. ulong ts_rtomin;
  24. ulong ts_rtomax;
  25. ulong ts_maxconn;
  26. ulong ts_activeopens;
  27. ulong ts_passiveopens;
  28. ulong ts_attemptfails;
  29. ulong ts_estabresets;
  30. ulong ts_currestab;
  31. ulong ts_insegs;
  32. ulong ts_outsegs;
  33. ulong ts_retranssegs;
  34. ulong ts_inerrs;
  35. ulong ts_outrsts;
  36. ulong ts_numconns;
  37. } TCPStats;
  38. #define TCP_RTO_OTHER 1
  39. #define TCP_RTO_CONSTANT 2
  40. #define TCP_RTO_RSRE 3
  41. #define TCP_RTO_VANJ 4
  42. #define TCP_MAXCONN_DYNAMIC -1
  43. typedef struct UDPStats {
  44. ulong us_indatagrams;
  45. ulong us_noports;
  46. ulong us_inerrors;
  47. ulong us_outdatagrams;
  48. ulong us_numaddrs;
  49. } UDPStats;
  50. typedef struct TCPConnTableEntry {
  51. ulong tct_state;
  52. ulong tct_localaddr;
  53. ulong tct_localport;
  54. ulong tct_remoteaddr;
  55. ulong tct_remoteport;
  56. } TCPConnTableEntry;
  57. typedef struct TCP6ConnTableEntry {
  58. struct in6_addr tct_localaddr;
  59. ulong tct_localscopeid;
  60. ulong tct_localport;
  61. struct in6_addr tct_remoteaddr;
  62. ulong tct_remotescopeid;
  63. ulong tct_remoteport;
  64. ulong tct_state;
  65. ulong tct_owningpid;
  66. } TCP6ConnTableEntry, *PTCP6ConnTableEntry;
  67. //* Definitions for the tct_state variable.
  68. #define TCP_CONN_CLOSED 1 // Closed.
  69. #define TCP_CONN_LISTEN 2 // Listening.
  70. #define TCP_CONN_SYN_SENT 3 // SYN Sent.
  71. #define TCP_CONN_SYN_RCVD 4 // SYN received.
  72. #define TCP_CONN_ESTAB 5 // Established.
  73. #define TCP_CONN_FIN_WAIT1 6 // FIN-WAIT-1
  74. #define TCP_CONN_FIN_WAIT2 7 // FIN-WAIT-2
  75. #define TCP_CONN_CLOSE_WAIT 8 // Close waiting.
  76. #define TCP_CONN_CLOSING 9 // Closing state.
  77. #define TCP_CONN_LAST_ACK 10 // Last ack state.
  78. #define TCP_CONN_TIME_WAIT 11 // Time wait state.
  79. #define TCP_DELETE_TCB 12 // Set to delete this TCB.
  80. typedef struct TCPConnTableEntryEx {
  81. TCPConnTableEntry tcte_basic;
  82. ulong tcte_owningpid;
  83. } TCPConnTableEntryEx;
  84. typedef struct _TCP_EX_TABLE
  85. {
  86. ulong dwNumEntries;
  87. TCPConnTableEntryEx table[1];
  88. } TCP_EX_TABLE;
  89. typedef struct _TCP6_EX_TABLE
  90. {
  91. ulong dwNumEntries;
  92. TCP6ConnTableEntry table[1];
  93. } TCP6_EX_TABLE, *PTCP6_EX_TABLE;
  94. typedef struct UDPEntry {
  95. ulong ue_localaddr;
  96. ulong ue_localport;
  97. } UDPEntry;
  98. typedef struct UDPEntryEx {
  99. UDPEntry uee_basic;
  100. ulong uee_owningpid;
  101. } UDPEntryEx;
  102. typedef struct _UDP_EX_TABLE
  103. {
  104. ulong dwNumEntries;
  105. UDPEntryEx table[1];
  106. } UDP_EX_TABLE;
  107. typedef struct UDP6ListenerEntry {
  108. struct in6_addr ule_localaddr;
  109. ulong ule_localscopeid;
  110. ulong ule_localport;
  111. ulong ule_owningpid;
  112. } UDP6ListenerEntry, *PUDP6ListenerEntry;
  113. typedef struct _UDP6_LISTENER_TABLE
  114. {
  115. ulong dwNumEntries;
  116. UDP6ListenerEntry table[1];
  117. } UDP6_LISTENER_TABLE, *PUDP6_LISTENER_TABLE;
  118. #define TCP_MIB_STAT_ID 1
  119. #define UDP_MIB_STAT_ID 1
  120. #define TCP_MIB_TABLE_ID 0x101
  121. #define UDP_MIB_TABLE_ID 0x101
  122. #define TCP_EX_TABLE_ID 0x102
  123. #define UDP_EX_TABLE_ID 0x102
  124. // Sockets based identifiers for connections.
  125. typedef struct TCPSocketOption {
  126. ulong tso_value;
  127. } TCPSocketOption;
  128. typedef struct TCPKeepalive {
  129. ulong onoff;
  130. ulong keepalivetime;
  131. ulong keepaliveinterval;
  132. } TCPKeepalive;
  133. //* Structure passed in/returned from the SOCKET_ATMARK call. The tsa_offset
  134. // field indicate how far back or forward in the data stream urgent data
  135. // was or will be returned. A negative value means inline urgent data has
  136. // already been given to the client, -tsa_offset bytes ago. A positive value
  137. // means that inline urgent data is available tsa_offset bytes down the
  138. // data stream. The tsa_size field is the size in bytes of the urgent data.
  139. // This call when always return a 0 size and offset if the connection is not
  140. // in the urgent inline mode.
  141. typedef struct TCPSocketAMInfo {
  142. ulong tsa_size; // Size of urgent data returned.
  143. long tsa_offset; // Offset of urgent data returned.
  144. } TCPSocketAMInfo;
  145. #define TCP_SOCKET_NODELAY 1
  146. #define TCP_SOCKET_KEEPALIVE 2
  147. #define TCP_SOCKET_OOBINLINE 3
  148. #define TCP_SOCKET_BSDURGENT 4
  149. #define TCP_SOCKET_ATMARK 5
  150. #define TCP_SOCKET_WINDOW 6
  151. #define TCP_SOCKET_KEEPALIVE_VALS 7
  152. #define TCP_SOCKET_TOS 8
  153. #define TCP_SOCKET_SCALE_CWIN 9
  154. // Address object identifies. All but AO_OPTION_MCASTIF take single boolean
  155. // character value. That one expects a pointer to an IP address.
  156. #define AO_OPTION_TTL 1
  157. #define AO_OPTION_MCASTTTL 2
  158. #define AO_OPTION_MCASTIF 3
  159. #define AO_OPTION_XSUM 4
  160. #define AO_OPTION_IPOPTIONS 5
  161. #define AO_OPTION_ADD_MCAST 6
  162. #define AO_OPTION_DEL_MCAST 7
  163. #define AO_OPTION_TOS 8
  164. #define AO_OPTION_IP_DONTFRAGMENT 9
  165. #define AO_OPTION_MCASTLOOP 10
  166. #define AO_OPTION_BROADCAST 11
  167. #define AO_OPTION_IP_HDRINCL 12
  168. #define AO_OPTION_RCVALL 13
  169. #define AO_OPTION_RCVALL_MCAST 14
  170. #define AO_OPTION_RCVALL_IGMPMCAST 15
  171. #define AO_OPTION_UNNUMBEREDIF 16
  172. #define AO_OPTION_IP_UCASTIF 17
  173. #define AO_OPTION_ABSORB_RTRALERT 18
  174. #define AO_OPTION_LIMIT_BCASTS 19
  175. #define AO_OPTION_INDEX_BIND 20
  176. #define AO_OPTION_INDEX_MCASTIF 21
  177. #define AO_OPTION_INDEX_ADD_MCAST 22
  178. #define AO_OPTION_INDEX_DEL_MCAST 23
  179. #define AO_OPTION_IFLIST 24
  180. #define AO_OPTION_ADD_IFLIST 25
  181. #define AO_OPTION_DEL_IFLIST 26
  182. #define AO_OPTION_IP_PKTINFO 27
  183. #define AO_OPTION_ADD_MCAST_SRC 28
  184. #define AO_OPTION_DEL_MCAST_SRC 29
  185. #define AO_OPTION_MCAST_FILTER 30
  186. #define AO_OPTION_BLOCK_MCAST_SRC 31
  187. #define AO_OPTION_UNBLOCK_MCAST_SRC 32
  188. #define AO_OPTION_UDP_CKSUM_COVER 33
  189. #define AO_OPTION_WINDOW 34
  190. #define AO_OPTION_SCALE_CWIN 35
  191. #define AO_OPTION_RCV_HOPLIMIT 36
  192. #define AO_OPTION_UNBIND 37
  193. #define AO_OPTION_PROTECT 38
  194. // Values used with AO_OPTION_RCVALL*
  195. // These must match the values defined in mstcpip.h
  196. #define RCVALL_OFF 0
  197. #define RCVALL_ON 1
  198. #define RCVALL_SOCKETLEVELONLY 2
  199. // Values used with AO_OPTION_PROTECT
  200. // These must match the values defined in ws2tcpip.h
  201. #define PROTECTION_LEVEL_UNRESTRICTED 10 // For peer-to-peer apps.
  202. #define PROTECTION_LEVEL_DEFAULT 20 // Default level.
  203. #define PROTECTION_LEVEL_RESTRICTED 30 // For Intranet apps.
  204. //* Information relating to setting/deleting IP multicast addresses.
  205. typedef struct UDPMCastReq {
  206. ulong umr_addr; // MCast address to add/delete.
  207. ulong umr_if; // I/F on which to join.
  208. } UDPMCastReq;
  209. //* Information relating to setting/deleting IP multicast source/group
  210. // addresses. This must match ip_mreq_source.
  211. typedef struct UDPMCastSrcReq {
  212. ulong umr_addr; // MCast address to add/delete.
  213. ulong umr_src; // Source address to add/delete.
  214. ulong umr_if; // I/F on which to join.
  215. } UDPMCastSrcReq;
  216. //* Information relating to setting/deleting IP multicast source filters.
  217. // This must match ip_msfilter.
  218. typedef struct UDPMCastFilter {
  219. ulong umf_addr; // MCast address to apply source to.
  220. ulong umf_if; // I/F on which to join.
  221. ulong umf_fmode; // Filter mode (TRUE=exclude)
  222. ulong umf_numsrc; // Number of sources.
  223. ulong umf_srclist[1]; // Source array.
  224. } UDPMCastFilter;
  225. #define UDPMCAST_FILTER_SIZE(numsrc) \
  226. ((ulong)FIELD_OFFSET (UDPMCastFilter, umf_srclist[numsrc]))
  227. //* Structure defining what is passed in to AO_OPTION_MCASTIF request.
  228. typedef struct UDPMCastIFReq {
  229. IPAddr umi_addr;
  230. } UDPMCastIFReq;
  231. //* Structures used in security filter enumeration.
  232. // All values are in HOST byte order!!!
  233. typedef struct TCPSecurityFilterEntry {
  234. ulong tsf_address; // IP interface address
  235. ulong tsf_protocol; // Transport protocol number
  236. ulong tsf_value; // Transport filter value (e.g. TCP port)
  237. } TCPSecurityFilterEntry;
  238. typedef struct TCPSecurityFilterEnum {
  239. ULONG tfe_entries_returned; // The number of TCPSecurityFilterEntry structs
  240. // returned in the subsequent array.
  241. ULONG tfe_entries_available; // The number of TCPSecurityFilterEntry structs
  242. // currently available from the transport.
  243. } TCPSecurityFilterEnum;
  244. //* Structures used in connection list enumeration.
  245. // All values are in HOST byte order!!!
  246. typedef struct TCPConnectionListEntry {
  247. IPAddr tcf_address; // IP address
  248. uint tcf_ticks; // Tick Count remaining
  249. } TCPConnectionListEntry;
  250. typedef struct TCPConnectionListEnum {
  251. ULONG tce_entries_returned; // The number of TCPConnectionListEntry structs
  252. // returned in the subsequent array.
  253. ULONG tce_entries_available; // The number of TCPConnectionListEntry structs
  254. // currently available from the transport.
  255. } TCPConnectionListEnum;
  256. //* Connection Callback object for TCP.
  257. #define TCP_CCB_NAME L"\\Callback\\TcpConnectionCallback"
  258. //* Address information for TCP connections.
  259. typedef struct TCPAddrInfo {
  260. ulong tai_daddr; // Destination IP address.
  261. ulong tai_saddr; // Source IP address.
  262. ushort tai_dport; // Destination port.
  263. ushort tai_sport; // Source port.
  264. } TCPAddrInfo;
  265. //* Connection callback information for TCP connections.
  266. typedef struct TCPCcbInfo {
  267. ulong tci_prevstate; // Previous state.
  268. ulong tci_currstate; // Current state.
  269. ulong tci_incomingif; // Incoming interface id.
  270. TCPAddrInfo *tci_connaddr; // Connection addres pointer.
  271. } TCPCcbInfo;
  272. #endif // TCP_INFO_INCLUDED