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.

212 lines
7.6 KiB

  1. /*++
  2. Copyright (c) Microsoft Corporation. All rights reserved.
  3. Module Name:
  4. ntddtcp.h
  5. Abstract:
  6. This header file defines constants and types for accessing the NT
  7. TCP driver.
  8. Author:
  9. Mike Massa (mikemas) 13-Aug-1993
  10. Revision History:
  11. --*/
  12. #pragma once
  13. #ifndef _NTDDTCP_
  14. #define _NTDDTCP_
  15. #pragma warning(push)
  16. #pragma warning(disable:4201) // nameless struct/union
  17. //
  18. // Device Name - this string is the name of the device. It is the name
  19. // that should be passed to NtCreateFile when accessing the device.
  20. //
  21. #define DD_TCP_DEVICE_NAME L"\\Device\\Tcp"
  22. #define DD_UDP_DEVICE_NAME L"\\Device\\Udp"
  23. #define DD_RAW_IP_DEVICE_NAME L"\\Device\\RawIp"
  24. #define DD_TCP_SYMBOLIC_DEVICE_NAME L"\\DosDevices\\Tcp"
  25. //
  26. // Security Filter Support
  27. //
  28. // Security filters provide a mechanism by which the transport protocol
  29. // traffic accepted on IP interfaces may be controlled. Security filtering
  30. // is globally enabled or disabled for all IP interfaces and transports.
  31. // If filtering is enabled, incoming traffic is filtered based on registered
  32. // {interface, protocol, transport value} tuples. The tuples specify
  33. // permissible traffic. All other values will be rejected. For UDP datagrams
  34. // and TCP connections, the transport value is the port number. For RawIP
  35. // datagrams, the transport value is the IP protocol number. An entry exists
  36. // in the filter database for all active interfaces and protocols in the
  37. // system.
  38. //
  39. // The following ioctls may be used to access the security filter
  40. // database. The ioctls may be issued on any TCP/IP device object. All of them
  41. // require Administrator privilege. These ioctls do not update the registry
  42. // parameters used to initialize security filtering when an interface is
  43. // installed.
  44. //
  45. // The TCP_QUERY_SECURITY_FILTER_STATUS ioctl returns the current status of
  46. // security filtering - enabled or disabled.
  47. //
  48. // The TCP_SET_SECURITY_FILTER_STATUS ioctl modifies the status of security
  49. // filtering. Changing the filtering status does not change the contents of
  50. // the filter database.
  51. //
  52. // The following ioctls manipulate the filter database. They operate the same
  53. // whether security filtering is enabled or disabled. If filtering is disabled,
  54. // any changes will take effect only when filtering is enabled.
  55. //
  56. // The TCP_ADD_SECURITY_FILTER ioctl registers an {Interface, Protocol, Value}
  57. // tuple. The TCP_DELETE_SECURITY_FILTER ioctl deregisters an
  58. // {Interface, Protocol, Value} tuple. The TCP_ENUMERATE_SECURITY_FILTER ioctl
  59. // returns the list of {Interface, Protocol, Value} filters currently
  60. // registered.
  61. //
  62. // Each of these ioctls takes an {Interface, Protocol, Value} tuple as an input
  63. // parameter. Zero is a wildcard value. If the Interface or Protocol elements
  64. // are zero, the operation applies to all interfaces or protocols, as
  65. // appropriate. The meaning of a zero Value element depends on the ioctl.
  66. // For an ADD, a zero Value causes all values to be permissible. For a DELETE,
  67. // a zero Value causes all all values to be rejected. In both cases, any
  68. // previously registered values are purged from the database. For an
  69. // ENUMERATE, a zero Value just causes all registered values to be enumerated,
  70. // as opposed to a specific value.
  71. //
  72. // For all ioctls, a return code of STATUS_INVALID_ADDRESS indicates that
  73. // the IP address submitted in the input buffer does not correspond to
  74. // an interface which exists in the system. A code of
  75. // STATUS_INVALID_PARAMETER possibly indicates that the Protocol number
  76. // submitted in the input buffer does not correspond to a transport protocol
  77. // available in the system.
  78. //
  79. //
  80. // Structures used in Security Filter IOCTLs.
  81. //
  82. //
  83. // Structure contained in the input buffer of
  84. // TCP_SET_SECURITY_FILTER_STATUS ioctls and the output buffer of
  85. // TCP_QUERY_SECURITY_FILTER_STATUS ioctls.
  86. //
  87. struct tcp_security_filter_status {
  88. ULONG FilteringEnabled; // FALSE if filtering is (to be) disabled.
  89. }; // Any other value indicates that filtering
  90. // is (to be) enabled.
  91. typedef struct tcp_security_filter_status
  92. TCP_SECURITY_FILTER_STATUS,
  93. *PTCP_SECURITY_FILTER_STATUS;
  94. //
  95. // The TCPSecurityFilterEntry structure, defined in tcpinfo.h, is contained in
  96. // the input buffer of TCP_[ADD|DELETE|ENUMERATE]_SECURITY_FILTER ioctls.
  97. //
  98. //
  99. // The TCPSecurityFilterEnum structure, defined in tcpinfo.h, is contained
  100. // in the output buffer of TCP_ENUMERATE_SECURITY_FILTER ioctls. The output
  101. // buffer passed in the ioctl must be large enough to contain at least this
  102. // structure or the call will fail. The structure is followed immediately in
  103. // the buffer by an array of zero or more TCPSecurityFilterEntry structures.
  104. // The number of TCPSecurityFilterEntry structures is specified by the
  105. // tfe_entries_returned field of the TCPSecurityFilterEnum.
  106. //
  107. typedef struct tcp_blockports_request {
  108. unsigned long ReservePorts; // TRUE if reserve; FALSE otherwise
  109. union
  110. {
  111. unsigned long NumberofPorts; // numberofports to reserve
  112. unsigned long StartHandle; // handle to be used to unreserve
  113. };
  114. } TCP_BLOCKPORTS_REQUEST, *PTCP_BLOCKPORTS_REQUEST;
  115. typedef struct tcp_findtcb_request {
  116. unsigned long Src;
  117. unsigned long Dest;
  118. unsigned short DestPort;
  119. unsigned short SrcPort;
  120. } TCP_FINDTCB_REQUEST, *PTCP_FINDTCB_REQUEST;
  121. typedef struct tcp_findtcb_response {
  122. ULONG_PTR tcb_addr;
  123. unsigned long tcb_senduna;
  124. unsigned long tcb_sendnext;
  125. unsigned long tcb_sendmax;
  126. unsigned long tcb_sendwin;
  127. unsigned long tcb_unacked;
  128. unsigned long tcb_maxwin;
  129. unsigned long tcb_cwin;
  130. unsigned short tcb_mss;
  131. unsigned long tcb_rtt;
  132. unsigned short tcb_smrtt;
  133. unsigned short tcb_rexmitcnt;
  134. unsigned short tcb_rexmittimer;
  135. unsigned short tcb_rexmit;
  136. unsigned long tcb_retrans;
  137. unsigned short tcb_state;
  138. unsigned long tcb_copied;
  139. } TCP_FINDTCB_RESPONSE, *PTCP_FINDTCB_RESPONSE;
  140. //
  141. // TCP/UDP/RawIP IOCTL code definitions
  142. //
  143. #define FSCTL_TCP_BASE FILE_DEVICE_NETWORK
  144. #define _TCP_CTL_CODE(function, method, access) \
  145. CTL_CODE(FSCTL_TCP_BASE, function, method, access)
  146. #define IOCTL_TCP_QUERY_INFORMATION_EX \
  147. _TCP_CTL_CODE(0, METHOD_NEITHER, FILE_ANY_ACCESS)
  148. #define IOCTL_TCP_SET_INFORMATION_EX \
  149. _TCP_CTL_CODE(1, METHOD_BUFFERED, FILE_WRITE_ACCESS)
  150. #define IOCTL_TCP_QUERY_SECURITY_FILTER_STATUS \
  151. _TCP_CTL_CODE(2, METHOD_BUFFERED, FILE_WRITE_ACCESS)
  152. #define IOCTL_TCP_SET_SECURITY_FILTER_STATUS \
  153. _TCP_CTL_CODE(3, METHOD_BUFFERED, FILE_WRITE_ACCESS)
  154. #define IOCTL_TCP_ADD_SECURITY_FILTER \
  155. _TCP_CTL_CODE(4, METHOD_BUFFERED, FILE_WRITE_ACCESS)
  156. #define IOCTL_TCP_DELETE_SECURITY_FILTER \
  157. _TCP_CTL_CODE(5, METHOD_BUFFERED, FILE_WRITE_ACCESS)
  158. #define IOCTL_TCP_ENUMERATE_SECURITY_FILTER \
  159. _TCP_CTL_CODE(6, METHOD_BUFFERED, FILE_WRITE_ACCESS)
  160. #define IOCTL_TCP_RESERVE_PORT_RANGE \
  161. _TCP_CTL_CODE(7, METHOD_BUFFERED, FILE_WRITE_ACCESS)
  162. #define IOCTL_TCP_UNRESERVE_PORT_RANGE \
  163. _TCP_CTL_CODE(8, METHOD_BUFFERED, FILE_WRITE_ACCESS)
  164. #define IOCTL_TCP_BLOCK_PORTS \
  165. _TCP_CTL_CODE(9, METHOD_BUFFERED, FILE_WRITE_ACCESS)
  166. #define IOCTL_TCP_WSH_SET_INFORMATION_EX \
  167. _TCP_CTL_CODE(10, METHOD_BUFFERED, FILE_ANY_ACCESS)
  168. #define IOCTL_TCP_FINDTCB \
  169. _IP_CTL_CODE(21, METHOD_BUFFERED, FILE_ANY_ACCESS)
  170. #pragma warning(pop)
  171. #endif // _NTDDTCP_