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.

322 lines
7.0 KiB

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