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.

227 lines
5.9 KiB

  1. /*++
  2. Copyright (c) 2000-2001 Microsoft Corporation
  3. Module Name :
  4. Ultci.h
  5. Abstract:
  6. This module implements a wrapper for QoS TC ( Traffic Control )
  7. Interface since the Kernel level API don't exist at this time.
  8. Any HTTP module might use this interface to make QoS calls.
  9. Author:
  10. Ali Ediz Turkoglu (aliTu) 28-Jul-2000
  11. Project:
  12. Internet Information Server 6.0 - HTTP.SYS
  13. Revision History:
  14. -
  15. --*/
  16. #ifndef __ULTCI_H__
  17. #define __ULTCI_H__
  18. #ifdef __cplusplus
  19. extern "C" {
  20. #endif
  21. //
  22. // UL does not use GPC_CF_CLASS_MAP client, all of the interfaces
  23. // assumed to be using GPC_CF_QOS client type. And it's registered
  24. // for all interfaces.
  25. //
  26. // #define MAX_STRING_LENGTH (256) from traffic.h
  27. //
  28. // The interface objects get allocated during initialization.
  29. // They hold the necessary information to create other
  30. // QoS structures like flow & filter
  31. //
  32. typedef struct _UL_TCI_INTERFACE
  33. {
  34. ULONG Signature; // UL_TC_INTERFACE_POOL_TAG
  35. LIST_ENTRY Linkage; // Linkage for the list of interfaces
  36. BOOLEAN IsQoSEnabled; // To see if QoS enabled or not for this interface
  37. ULONG IpAddr; // Interface IP address - although exist inside
  38. // the addrList, copied here for fast lookup
  39. ULONG IfIndex; // Interface Index from TCPIP
  40. ULONG SpecificLinkCtx;
  41. ULONG MTUSize; // Need to get this from TCPIP
  42. USHORT NameLength; // Friendly name of the interface
  43. WCHAR Name[MAX_STRING_LENGTH];
  44. USHORT InstanceIDLength; // ID from our WMI provider the beloved PSched
  45. WCHAR InstanceID[MAX_STRING_LENGTH];
  46. PUL_TCI_FLOW pGlobalFlow; // The flow for the global bandwidth throttling
  47. LIST_ENTRY FlowList; // List of site flows on this interface
  48. ULONG FlowListSize;
  49. ULONG AddrListBytesCount; // Address list acquired from tc with Wmi call
  50. PADDRESS_LIST_DESCRIPTOR pAddressListDesc; // Points just after us
  51. } UL_TCI_INTERFACE, *PUL_TCI_INTERFACE;
  52. #define IS_VALID_TCI_INTERFACE( entry ) \
  53. ( (entry != NULL) && ((entry)->Signature == UL_TCI_INTERFACE_POOL_TAG) )
  54. //
  55. // The structure to hold the all of the flow related info.
  56. // Each site may have one flow on each interface plus one
  57. // extra global flow on each interface.
  58. //
  59. typedef struct _UL_TCI_FLOW
  60. {
  61. ULONG Signature; // UL_TC_FLOW_POOL_TAG
  62. HANDLE FlowHandle; // Flow handle from TC
  63. LIST_ENTRY Linkage; // Links us to flow list of "the interface"
  64. // we have installed on
  65. PUL_TCI_INTERFACE pInterface; // Back ptr to interface struc. Necessary to gather
  66. // some information occasionally
  67. LIST_ENTRY Siblings; // Links us to flow list of "the cgroup"
  68. // In other words all the flows of the site. This
  69. // is to prevent the side lookup.
  70. PUL_CONFIG_GROUP_OBJECT pConfigGroup; // The refcounted cgroup back pointer for cleanup
  71. TC_GEN_FLOW GenFlow; // The details of the flowspec is stored in here
  72. UL_SPIN_LOCK FilterListSpinLock; // To LOCK the filterlist & its counter
  73. LIST_ENTRY FilterList; // The list of filters on this flow
  74. ULONGLONG FilterListSize; // The number filters installed
  75. } UL_TCI_FLOW, *PUL_TCI_FLOW;
  76. #define IS_VALID_TCI_FLOW( entry ) \
  77. ( (entry != NULL) && ((entry)->Signature == UL_TCI_FLOW_POOL_TAG) )
  78. //
  79. // The structure to hold the filter information.
  80. // Each connection can only have one filter at a time.
  81. //
  82. typedef struct _UL_TCI_FILTER
  83. {
  84. ULONG Signature; // UL_TC_FILTER_POOL_TAG
  85. HANDLE FilterHandle; // GPC handle
  86. PUL_HTTP_CONNECTION pHttpConnection; // For proper cleanup and
  87. // to avoid the race conditions
  88. LIST_ENTRY Linkage; // Next filter on the flow
  89. } UL_TCI_FILTER, *PUL_TCI_FILTER;
  90. #define IS_VALID_TCI_FILTER( entry ) \
  91. ( (entry != NULL) && ((entry)->Signature == UL_TCI_FILTER_POOL_TAG) )
  92. //
  93. // To identify the local_loopbacks. This is a translation of
  94. // 127.0.0.1.
  95. //
  96. #define LOOPBACK_ADDR (0x0100007f)
  97. //
  98. // The functionality we expose
  99. //
  100. /* Generic */
  101. BOOLEAN
  102. UlTcPSchedInstalled(
  103. VOID
  104. );
  105. /* Filters */
  106. NTSTATUS
  107. UlTcAddFilter(
  108. IN PUL_HTTP_CONNECTION pHttpConnection,
  109. IN PUL_CONFIG_GROUP_OBJECT pCgroup
  110. );
  111. NTSTATUS
  112. UlTcDeleteFilter(
  113. IN PUL_HTTP_CONNECTION pHttpConnection
  114. );
  115. /* Global Flows */
  116. __inline BOOLEAN
  117. UlTcGlobalThrottlingEnabled(
  118. VOID
  119. );
  120. NTSTATUS
  121. UlTcAddGlobalFlows(
  122. IN HTTP_BANDWIDTH_LIMIT MaxBandwidth
  123. );
  124. NTSTATUS
  125. UlTcModifyGlobalFlows(
  126. IN HTTP_BANDWIDTH_LIMIT NewBandwidth
  127. );
  128. NTSTATUS
  129. UlTcRemoveGlobalFlows(
  130. VOID
  131. );
  132. /* Site Flows */
  133. NTSTATUS
  134. UlTcAddFlowsForSite(
  135. IN PUL_CONFIG_GROUP_OBJECT pConfigGroup,
  136. IN HTTP_BANDWIDTH_LIMIT MaxBandwidth
  137. );
  138. NTSTATUS
  139. UlTcModifyFlowsForSite(
  140. IN PUL_CONFIG_GROUP_OBJECT pConfigGroup,
  141. IN HTTP_BANDWIDTH_LIMIT NewBandwidth
  142. );
  143. NTSTATUS
  144. UlTcRemoveFlowsForSite(
  145. IN PUL_CONFIG_GROUP_OBJECT pConfigGroup
  146. );
  147. /* Init & Terminate */
  148. NTSTATUS
  149. UlTcInitialize(
  150. VOID
  151. );
  152. VOID
  153. UlTcTerminate(
  154. VOID
  155. );
  156. #ifdef __cplusplus
  157. }; // extern "C"
  158. #endif
  159. #endif // __ULTCI_H__