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.

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