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.

386 lines
9.4 KiB

  1. /*++
  2. Copyright (c) 1998-2001 Microsoft Corporation
  3. Module Name:
  4. cgroup.h
  5. Abstract:
  6. The public definition of config group interfaces.
  7. Author:
  8. Paul McDaniel (paulmcd) 11-Jan-1999
  9. Revision History:
  10. --*/
  11. #ifndef _CGROUP_H_
  12. #define _CGROUP_H_
  13. #ifdef __cplusplus
  14. extern "C" {
  15. #endif
  16. //
  17. // Forwarders.
  18. //
  19. typedef struct _UL_CONNECTION_COUNT_ENTRY *PUL_CONNECTION_COUNT_ENTRY;
  20. typedef struct _UL_CG_URL_TREE_HEADER *PUL_CG_URL_TREE_HEADER;
  21. typedef struct _UL_CG_URL_TREE_ENTRY *PUL_CG_URL_TREE_ENTRY;
  22. typedef struct _UL_CONTROL_CHANNEL *PUL_CONTROL_CHANNEL;
  23. typedef struct _UL_APP_POOL_OBJECT *PUL_APP_POOL_OBJECT;
  24. typedef struct _UL_INTERNAL_RESPONSE *PUL_INTERNAL_RESPONSE;
  25. typedef struct _UL_LOG_FILE_ENTRY *PUL_LOG_FILE_ENTRY;
  26. typedef struct _UL_SITE_COUNTER_ENTRY *PUL_SITE_COUNTER_ENTRY;
  27. typedef struct _UL_HTTP_CONNECTION *PUL_HTTP_CONNECTION;
  28. //
  29. // Kernel mode mappings to the user mode set defined in ulapi.h :
  30. //
  31. // IRQL == PASSIVE_LEVEL
  32. //
  33. NTSTATUS
  34. UlCreateConfigGroup(
  35. IN PUL_CONTROL_CHANNEL pControlChannel,
  36. OUT HTTP_CONFIG_GROUP_ID * pConfigGroupId
  37. );
  38. // IRQL == PASSIVE_LEVEL
  39. //
  40. NTSTATUS
  41. UlDeleteConfigGroup(
  42. IN HTTP_CONFIG_GROUP_ID ConfigGroupId
  43. );
  44. // IRQL == PASSIVE_LEVEL
  45. //
  46. NTSTATUS
  47. UlAddUrlToConfigGroup(
  48. IN HTTP_CONFIG_GROUP_ID ConfigGroupId,
  49. IN PUNICODE_STRING pUrl,
  50. IN HTTP_URL_CONTEXT UrlContext
  51. );
  52. // IRQL == PASSIVE_LEVEL
  53. //
  54. NTSTATUS
  55. UlRemoveUrlFromConfigGroup(
  56. IN HTTP_CONFIG_GROUP_ID ConfigGroupId,
  57. IN PUNICODE_STRING pUrl
  58. );
  59. // IRQL == PASSIVE_LEVEL
  60. //
  61. NTSTATUS
  62. UlRemoveAllUrlsFromConfigGroup(
  63. IN HTTP_CONFIG_GROUP_ID ConfigGroupId
  64. );
  65. // IRQL == PASSIVE_LEVEL
  66. //
  67. NTSTATUS
  68. UlAddTransientUrl(
  69. PUL_APP_POOL_OBJECT pAppPool,
  70. PUNICODE_STRING pUrl
  71. );
  72. // IRQL == PASSIVE_LEVEL
  73. //
  74. NTSTATUS
  75. UlRemoveTransientUrl(
  76. PUL_APP_POOL_OBJECT pAppPool,
  77. PUNICODE_STRING pUrl
  78. );
  79. // IRQL == PASSIVE_LEVEL
  80. //
  81. NTSTATUS
  82. UlQueryConfigGroupInformation(
  83. IN HTTP_CONFIG_GROUP_ID ConfigGroupId,
  84. IN HTTP_CONFIG_GROUP_INFORMATION_CLASS InformationClass,
  85. IN PVOID pConfigGroupInformation,
  86. IN ULONG Length,
  87. OUT PULONG pReturnLength OPTIONAL
  88. );
  89. // IRQL == PASSIVE_LEVEL
  90. //
  91. NTSTATUS
  92. UlSetConfigGroupInformation(
  93. IN HTTP_CONFIG_GROUP_ID ConfigGroupId,
  94. IN HTTP_CONFIG_GROUP_INFORMATION_CLASS InformationClass,
  95. IN PVOID pConfigGroupInformation,
  96. IN ULONG Length
  97. );
  98. //
  99. // This structure represents an internal cfg group object. These are linked
  100. // and owned by control channels via a LIST_ENTRY list.
  101. //
  102. #define IS_VALID_CONFIG_GROUP(pObject) \
  103. (((pObject) != NULL) && ((pObject)->Signature == UL_CG_OBJECT_POOL_TAG))
  104. typedef struct _UL_CONFIG_GROUP_OBJECT
  105. {
  106. //
  107. // PagedPool
  108. //
  109. ULONG Signature; // UL_CG_OBJECT_POOL_TAG
  110. LONG RefCount;
  111. HTTP_CONFIG_GROUP_ID ConfigGroupId;
  112. UL_NOTIFY_ENTRY HandleEntry; // Links us to an apool or
  113. // control channel handle
  114. UL_NOTIFY_ENTRY ParentEntry; // Links transient groups
  115. // to their static parents
  116. UL_NOTIFY_HEAD ChildHead; // Links transient children
  117. // into this group
  118. LIST_ENTRY ControlChannelEntry;// Links into the
  119. // control channel
  120. PUL_CONTROL_CHANNEL pControlChannel; // the control channel
  121. LIST_ENTRY UrlListHead; // Links UL_CG_URL_TREE_ENTRY
  122. // into this group
  123. HTTP_PROPERTY_FLAGS AppPoolFlags;
  124. PUL_APP_POOL_OBJECT pAppPool; // Maps to our app
  125. // pool.
  126. PUL_INTERNAL_RESPONSE pAutoResponse; // The kernel version
  127. // of the auto-response.
  128. HTTP_CONFIG_GROUP_MAX_BANDWIDTH MaxBandwidth; // Applies all the flows below
  129. LIST_ENTRY FlowListHead; // Links our flows to us so we can
  130. // do a faster lookup and cleanup.
  131. HTTP_CONFIG_GROUP_MAX_CONNECTIONS MaxConnections;
  132. PUL_CONNECTION_COUNT_ENTRY pConnectionCountEntry;
  133. HTTP_CONFIG_GROUP_STATE State; // The current state
  134. // (active, etc.)
  135. HTTP_CONFIG_GROUP_SECURITY Security; // Security descriptor for
  136. // transient registrations
  137. HTTP_CONFIG_GROUP_LOGGING LoggingConfig; // logging config for the
  138. // site�s root app. //
  139. PUL_LOG_FILE_ENTRY pLogFileEntry;
  140. PUL_SITE_COUNTER_ENTRY pSiteCounters; // Perfmon Counters (ref'd)
  141. LONGLONG ConnectionTimeout; // Connection Timeout override
  142. // in 100ns ticks
  143. } UL_CONFIG_GROUP_OBJECT, *PUL_CONFIG_GROUP_OBJECT;
  144. //
  145. // Public functions for config group objects:
  146. //
  147. //
  148. // IRQL == PASSIVE_LEVEL
  149. //
  150. VOID
  151. UlReferenceConfigGroup(
  152. IN PVOID pObject
  153. REFERENCE_DEBUG_FORMAL_PARAMS
  154. );
  155. #define REFERENCE_CONFIG_GROUP( pConfigGroup ) \
  156. UlReferenceConfigGroup( \
  157. (pConfigGroup) \
  158. REFERENCE_DEBUG_ACTUAL_PARAMS \
  159. )
  160. //
  161. // IRQL == PASSIVE_LEVEL
  162. //
  163. VOID
  164. UlDereferenceConfigGroup(
  165. PUL_CONFIG_GROUP_OBJECT pConfigGroup
  166. REFERENCE_DEBUG_FORMAL_PARAMS
  167. );
  168. #define DEREFERENCE_CONFIG_GROUP( pConfigGroup ) \
  169. UlDereferenceConfigGroup( \
  170. (pConfigGroup) \
  171. REFERENCE_DEBUG_ACTUAL_PARAMS \
  172. )
  173. //
  174. // IRQL == PASSIVE_LEVEL
  175. //
  176. HTTP_CONFIG_GROUP_ID
  177. UlConfigGroupFromListEntry(
  178. IN PLIST_ENTRY pControlChannelEntry
  179. );
  180. //
  181. // This info is built for an URL, and returned from UlGetConfigGroupForUrl
  182. //
  183. #define IS_VALID_URL_CONFIG_GROUP_INFO(pInfo) \
  184. (((pInfo) != NULL) && ((pInfo)->Signature == UL_CG_URL_INFO_POOL_TAG))
  185. typedef struct _UL_URL_CONFIG_GROUP_INFO
  186. {
  187. //
  188. // NonPagedPool
  189. //
  190. //
  191. // UL_CG_URL_INFO_POOL_TAG
  192. //
  193. ULONG Signature;
  194. //
  195. // used by the cache mgr and need to be live from the
  196. // real config group objects
  197. //
  198. PUL_CONFIG_GROUP_OBJECT pMaxBandwidth;
  199. PUL_CONFIG_GROUP_OBJECT pMaxConnections;
  200. PUL_CONNECTION_COUNT_ENTRY pConnectionCountEntry;
  201. PUL_CONFIG_GROUP_OBJECT pCurrentState;
  202. PUL_CONFIG_GROUP_OBJECT pLoggingConfig;
  203. //
  204. // Site Counters (ref'd)
  205. //
  206. ULONG SiteId;
  207. PUL_SITE_COUNTER_ENTRY pSiteCounters;
  208. //
  209. // Connection Timeout (100ns Ticks)
  210. //
  211. LONGLONG ConnectionTimeout;
  212. //
  213. // used by the http engine routing to the app pool, no
  214. // need to be live. copies work great.
  215. //
  216. HTTP_ENABLED_STATE CurrentState; // a copy of the above, for
  217. // callers that don't need
  218. // live access
  219. PUL_CONTROL_CHANNEL pControlChannel;
  220. HTTP_URL_CONTEXT UrlContext; // The context for the url.
  221. // NULL = not set
  222. PUL_APP_POOL_OBJECT pAppPool; // Points the app pool
  223. // associated with this url
  224. PUL_INTERNAL_RESPONSE pAutoResponse; // The kernel version of the
  225. // auto-response.
  226. } UL_URL_CONFIG_GROUP_INFO, *PUL_URL_CONFIG_GROUP_INFO;
  227. //
  228. // IRQL == PASSIVE_LEVEL
  229. //
  230. NTSTATUS
  231. UlGetConfigGroupInfoForUrl(
  232. IN PWSTR pUrl,
  233. IN PUL_HTTP_CONNECTION pHttpConn,
  234. OUT PUL_URL_CONFIG_GROUP_INFO pInfo
  235. );
  236. //
  237. // IRQL == PASSIVE_LEVEL
  238. //
  239. NTSTATUS
  240. UlInitializeCG(
  241. VOID
  242. );
  243. VOID
  244. UlTerminateCG(
  245. VOID
  246. );
  247. BOOLEAN
  248. UlNotifyOrphanedConfigGroup(
  249. IN PUL_NOTIFY_ENTRY pEntry,
  250. IN PVOID pHost,
  251. IN PVOID pv
  252. );
  253. //
  254. // url info helpers
  255. //
  256. NTSTATUS
  257. UlpSetUrlInfo(
  258. IN OUT PUL_URL_CONFIG_GROUP_INFO pInfo,
  259. IN PUL_CG_URL_TREE_ENTRY pMatchEntry
  260. );
  261. __inline
  262. VOID
  263. FASTCALL
  264. UlpInitializeUrlInfo(
  265. OUT PUL_URL_CONFIG_GROUP_INFO pInfo
  266. )
  267. {
  268. ASSERT(pInfo != NULL);
  269. RtlZeroMemory(
  270. (PCHAR)pInfo,
  271. sizeof(UL_URL_CONFIG_GROUP_INFO)
  272. );
  273. pInfo->Signature = UL_CG_URL_INFO_POOL_TAG;
  274. pInfo->CurrentState = HttpEnabledStateInactive;
  275. }
  276. //
  277. // IRQL == PASSIVE_LEVEL
  278. //
  279. NTSTATUS
  280. UlpConfigGroupInfoRelease(
  281. IN PUL_URL_CONFIG_GROUP_INFO pInfo
  282. );
  283. NTSTATUS
  284. UlpConfigGroupInfoDeepCopy(
  285. IN const PUL_URL_CONFIG_GROUP_INFO pOrigInfo,
  286. IN OUT PUL_URL_CONFIG_GROUP_INFO pNewInfo
  287. );
  288. #ifdef __cplusplus
  289. }; // extern "C"
  290. #endif
  291. #endif // _CGROUP_H_