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.

308 lines
7.3 KiB

  1. /*++
  2. Copyright (c) 2000-2002 Microsoft Corporation
  3. Module Name :
  4. Ultcip.h
  5. Abstract:
  6. Private definitions comes here
  7. Author:
  8. Ali Ediz Turkoglu (aliTu) 28-Jul-2000
  9. Project:
  10. Internet Information Server 6.0 - HTTP.SYS
  11. Revision History:
  12. -
  13. --*/
  14. #ifndef __ULTCIP_H__
  15. #define __ULTCIP_H__
  16. #define OffsetToPtr(Base, Offset) ((PUCHAR) ((PUCHAR)Base + Offset))
  17. #define IPPROTO_TCP (6)
  18. //
  19. // Set and Get macros for the QoS FlowSpec for the flows.
  20. // Nt QoS team recommends following FlowSpec for limiting the
  21. // maximum bandwidth;
  22. //
  23. // ServiceType = Best Effort
  24. // TokenRate = Throttling rate
  25. // PeakRate = Throttling Rate
  26. // MinPolicedSize = 40
  27. // MaxSduSize = QOS_NOT_SPECIFIED
  28. // BucketSize = TokenRate (bucket to hold upto 1 sec worth of data)
  29. //
  30. #define UL_SET_FLOWSPEC(Flow,BW) do { \
  31. \
  32. (Flow).SendingFlowspec.ServiceType = SERVICETYPE_BESTEFFORT; \
  33. (Flow).SendingFlowspec.TokenRate = (BW); /* In Bytes/sec */ \
  34. (Flow).SendingFlowspec.PeakBandwidth = (BW); /* In Bytes/sec */ \
  35. (Flow).SendingFlowspec.MinimumPolicedSize= 40; /* In Bytes. perhaps 128*/ \
  36. (Flow).SendingFlowspec.MaxSduSize = QOS_NOT_SPECIFIED; \
  37. (Flow).SendingFlowspec.TokenBucketSize = (BW); /* In Bytes */ \
  38. (Flow).SendingFlowspec.Latency = 0; /* In microseconds */ \
  39. (Flow).SendingFlowspec.DelayVariation = 0; /* In microseconds */ \
  40. \
  41. } while (FALSE, FALSE)
  42. #define UL_GET_BW_FRM_FLOWSPEC(Flow) \
  43. ((HTTP_BANDWIDTH_LIMIT) (Flow.SendingFlowspec.TokenRate))
  44. #define UL_DEFAULT_WMI_QUERY_BUFFER_SIZE (2*1024);
  45. //
  46. // For Interface Change Notifications
  47. //
  48. typedef
  49. VOID
  50. (*PUL_TC_NOTIF_HANDLER)(
  51. IN PWSTR Name,
  52. IN ULONG NameSize,
  53. IN PTC_INDICATION_BUFFER pTcBuffer,
  54. IN ULONG BufferSize
  55. );
  56. //
  57. // Macro to compare QoS GUIDs
  58. //
  59. #define UL_COMPARE_QOS_NOTIFICATION(rguid1, rguid2) \
  60. (RtlCompareMemory((PVOID)rguid1,(PVOID)rguid2,sizeof(GUID)) == sizeof(GUID))
  61. //
  62. // Macro to check the validity of a flow owner.
  63. //
  64. #define ASSERT_FLOW_OWNER(pOwner) \
  65. ASSERT( \
  66. NULL != (pOwner) && \
  67. (IS_VALID_CONFIG_GROUP((PUL_CONFIG_GROUP_OBJECT)(pOwner)) \
  68. || IS_VALID_CONTROL_CHANNEL((PUL_CONTROL_CHANNEL)(pOwner)) \
  69. ) \
  70. )
  71. //
  72. // Private function prototypes
  73. //
  74. NTSTATUS
  75. UlpTcInitializeGpc(
  76. VOID
  77. );
  78. NTSTATUS
  79. UlpTcRegisterGpcClient(
  80. IN ULONG CfInfoType
  81. );
  82. NTSTATUS
  83. UlpTcDeRegisterGpcClient(
  84. VOID
  85. );
  86. NTSTATUS
  87. UlpTcInitializeTcpDevice(
  88. VOID
  89. );
  90. PUL_TCI_INTERFACE
  91. UlpTcAllocateInterface(
  92. IN ULONG DescSize,
  93. IN PADDRESS_LIST_DESCRIPTOR Desc,
  94. IN ULONG NameLength,
  95. IN PUCHAR Name,
  96. IN ULONG InstanceIDLength,
  97. IN PUCHAR InstanceID
  98. );
  99. NTSTATUS
  100. UlpTcGetInterfaceIndex(
  101. IN PUL_TCI_INTERFACE pIntfc
  102. );
  103. NTSTATUS
  104. UlpTcGetFriendlyNames(
  105. VOID
  106. );
  107. NTSTATUS
  108. UlpTcReleaseAll(
  109. VOID
  110. );
  111. NTSTATUS
  112. UlpTcCloseInterface(
  113. PUL_TCI_INTERFACE pInterface
  114. );
  115. NTSTATUS
  116. UlpTcCloseAllInterfaces(
  117. VOID
  118. );
  119. NTSTATUS
  120. UlpTcWalkWnode(
  121. IN PWNODE_HEADER pWnodeHdr,
  122. IN PUL_TC_NOTIF_HANDLER pNotifHandler
  123. );
  124. VOID
  125. UlpTcHandleIfcUp(
  126. IN PWSTR Name,
  127. IN ULONG NameSize,
  128. IN PTC_INDICATION_BUFFER pTcBuffer,
  129. IN ULONG BufferSize
  130. );
  131. VOID
  132. UlpTcHandleIfcDown(
  133. IN PWSTR Name,
  134. IN ULONG NameSize,
  135. IN PTC_INDICATION_BUFFER pTcBuffer,
  136. IN ULONG BufferSize
  137. );
  138. VOID
  139. UlpTcHandleIfcChange(
  140. IN PWSTR Name,
  141. IN ULONG NameSize,
  142. IN PTC_INDICATION_BUFFER pTcBuffer,
  143. IN ULONG BufferSize
  144. );
  145. NTSTATUS
  146. UlpTcRegisterForCallbacks(
  147. VOID
  148. );
  149. NTSTATUS
  150. UlpTcDeleteFlow(
  151. IN PUL_TCI_FLOW pFlow
  152. );
  153. NTSTATUS
  154. UlpTcDeleteGpcFlow(
  155. HANDLE FlowHandle
  156. );
  157. PUL_TCI_FLOW
  158. UlpTcAllocateFlow(
  159. IN HTTP_BANDWIDTH_LIMIT MaxBandwidth
  160. );
  161. NTSTATUS
  162. UlpModifyFlow(
  163. IN PUL_TCI_INTERFACE pInterface,
  164. IN PUL_TCI_FLOW pFlow
  165. );
  166. NTSTATUS
  167. UlpAddFlow(
  168. IN PUL_TCI_INTERFACE pInterface,
  169. IN PUL_TCI_FLOW pGenericFlow,
  170. OUT PHANDLE pHandle
  171. );
  172. NTSTATUS
  173. UlpTcAddFilter(
  174. IN PUL_TCI_FLOW pFlow,
  175. IN PTC_GEN_FILTER pGenericFilter,
  176. IN ULONG LinkId,
  177. OUT PUL_TCI_FILTER *ppFilter
  178. );
  179. NTSTATUS
  180. UlpTcDeleteFilter(
  181. IN PUL_TCI_FLOW pFlow,
  182. IN PUL_TCI_FILTER pFilter
  183. );
  184. NTSTATUS
  185. UlpTcDeleteGpcFilter(
  186. IN HANDLE FilterHandle
  187. );
  188. VOID
  189. UlpInsertFilterEntry(
  190. IN PUL_TCI_FILTER pEntry,
  191. IN OUT PUL_TCI_FLOW pFlow
  192. );
  193. VOID
  194. UlpRemoveFilterEntry(
  195. IN PUL_TCI_FILTER pEntry,
  196. IN OUT PUL_TCI_FLOW pFlow
  197. );
  198. PUL_TCI_FLOW
  199. UlpFindFlow(
  200. IN PVOID pOwner,
  201. IN BOOLEAN Global,
  202. IN ULONG InterfaceId,
  203. IN ULONG LinkId
  204. );
  205. PUL_TCI_INTERFACE
  206. UlpFindInterface(
  207. IN ULONG IpAddr
  208. );
  209. NTSTATUS
  210. UlpTcDeviceControl(
  211. IN HANDLE FileHandle,
  212. IN HANDLE EventHandle,
  213. IN PIO_APC_ROUTINE ApcRoutine,
  214. IN PVOID ApcContext,
  215. OUT PIO_STATUS_BLOCK pIoStatBlock,
  216. IN ULONG Ioctl,
  217. IN PVOID InBuffer,
  218. IN ULONG InBufferSize,
  219. IN PVOID OutBuffer,
  220. IN ULONG OutBufferSize
  221. );
  222. VOID
  223. UlDumpTCInterface(
  224. PUL_TCI_INTERFACE pTcIfc
  225. );
  226. VOID
  227. UlDumpTCFlow(
  228. PUL_TCI_FLOW pFlow
  229. );
  230. VOID
  231. UlDumpTCFilter(
  232. PUL_TCI_FILTER pFilter
  233. );
  234. BOOLEAN
  235. UlpMatchTcInterface(
  236. IN PUL_TCI_INTERFACE pIntfc,
  237. IN ULONG InterfaceId,
  238. IN ULONG LinkId
  239. );
  240. // Some helper dumpers
  241. #if DBG
  242. #define UL_DUMP_TC_INTERFACE( pTcIfc ) \
  243. UlDumpTCInterface( \
  244. (pTcIfc) \
  245. )
  246. #define UL_DUMP_TC_FLOW( pFlow ) \
  247. UlDumpTCFlow( \
  248. (pFlow) \
  249. )
  250. #define UL_DUMP_TC_FILTER( pFilter ) \
  251. UlDumpTCFilter( \
  252. (pFilter) \
  253. )
  254. #else // !DBG
  255. #define UL_DUMP_TC_INTERFACE( pTcIfc ) NOP_FUNCTION
  256. #define UL_DUMP_TC_FLOW( pFlow ) NOP_FUNCTION
  257. #define UL_DUMP_TC_FILTER( pFilter ) NOP_FUNCTION
  258. #endif // !DBG
  259. #endif // __ULTCIP_H__