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.

482 lines
14 KiB

  1. /*++
  2. Copyright (c) 1999, Microsoft Corporation
  3. Module Name:
  4. qosmmain.h
  5. Abstract:
  6. The file contains the global structure
  7. definitions for QOS Mgr protocol.
  8. Revision History:
  9. --*/
  10. #ifndef __QOSMMAIN_H
  11. #define __QOSMMAIN_H
  12. //
  13. // Global information for the QOS Mgr
  14. //
  15. #define IF_HASHTABLE_SIZE 16
  16. typedef struct _QOSMGR_GLOBALS
  17. {
  18. HANDLE LoggingHandle; //
  19. ULONG LoggingLevel; // Handles to debugging functionality
  20. ULONG TracingHandle; //
  21. DWORD TracingFlags; // Flags that control debug tracing
  22. HANDLE GlobalHeap; // Handle to the private memory heap
  23. //
  24. HANDLE NotificationEvnt;// Callbacks and events to interact
  25. SUPPORT_FUNCTIONS SupportFunctions;// with the router manager (See API)
  26. //
  27. READ_WRITE_LOCK GlobalsLock; // Lock protecting all the info below
  28. ULONG ConfigSize; // Number of bytes in global config
  29. PIPQOS_GLOBAL_CONFIG
  30. GlobalConfig; // Pointer to global configuration
  31. IPQOS_GLOBAL_STATS
  32. GlobalStats; // Global statistics
  33. ULONG State; // State of the QOS Mgr component
  34. HANDLE TciHandle; // Traffic Control Registration Handle
  35. ULONG NumIfs; // Num of Ifs on which QOS is active
  36. LIST_ENTRY IfList; // List of Ifs sorted by index
  37. }
  38. QOSMGR_GLOBALS, *PQOSMGR_GLOBALS;
  39. //
  40. // Codes describing states of IPQOSMGR.
  41. //
  42. #define IPQOSMGR_STATE_STOPPED 0
  43. #define IPQOSMGR_STATE_STARTING 1
  44. #define IPQOSMGR_STATE_RUNNING 2
  45. #define IPQOSMGR_STATE_STOPPING 3
  46. //
  47. // Per Interface Information for QOS Mgr
  48. //
  49. typedef struct _QOSMGR_INTERFACE_ENTRY
  50. {
  51. LIST_ENTRY ListByIndexLE; // Linkage into index sorted list
  52. DWORD InterfaceIndex; // Interface index for this entry
  53. WCHAR InterfaceName[MAX_STRING_LENGTH];
  54. // Router name for the interface
  55. READ_WRITE_LOCK InterfaceLock; // Lock protecting all info below
  56. DWORD Flags; // ACTIVE, MULTIACCESS ...
  57. DWORD State; // QOS Enabled or Disabled
  58. ULONG ConfigSize; // Num of bytes in interface config
  59. PIPQOS_IF_CONFIG InterfaceConfig; // Interface configuration
  60. IPQOS_IF_STATS InterfaceStats; // Interface statistics
  61. HANDLE TciIfHandle; // Handle to corr. TC interface
  62. WCHAR AlternateName[MAX_STRING_LENGTH];
  63. // Traffic Control name for 'if'
  64. ULONG NumFlows; // Number of flows configured on 'if'
  65. LIST_ENTRY FlowList; // List of configured flows on 'if'
  66. }
  67. QOSMGR_INTERFACE_ENTRY, *PQOSMGR_INTERFACE_ENTRY;
  68. #define IF_FLAG_ACTIVE ((DWORD)0x00000001)
  69. #define IF_FLAG_MULTIACCESS ((DWORD)0x00000002)
  70. #define INTERFACE_IS_ACTIVE(i) \
  71. ((i)->Flags & IF_FLAG_ACTIVE)
  72. #define INTERFACE_IS_INACTIVE(i) \
  73. !INTERFACE_IS_ACTIVE(i)
  74. #define INTERFACE_IS_MULTIACCESS(i) \
  75. ((i)->Flags & IF_FLAG_MULTIACCESS)
  76. #define INTERFACE_IS_POINTTOPOINT(i) \
  77. !INTERFACE_IS_MULTIACCESS(i)
  78. //
  79. // Per Flow Information in QOS Mgr
  80. //
  81. typedef struct _QOSMGR_FLOW_ENTRY
  82. {
  83. LIST_ENTRY OnInterfaceLE; // Linkage into index sorted list
  84. HANDLE TciFlowHandle; // Handle to the flow in TC API
  85. DWORD Flags; // Flags for certain flow properties
  86. ULONG FlowSize; // Size of the flow's information
  87. PTC_GEN_FLOW FlowInfo; // Flow information - flowspecs etc.
  88. WCHAR FlowName[MAX_STRING_LENGTH];
  89. // Router name for the diffserv flow
  90. }
  91. QOSMGR_FLOW_ENTRY, *PQOSMGR_FLOW_ENTRY;
  92. #define FLOW_FLAG_DELETE ((DWORD)0x00000001)
  93. //
  94. // Global Extern Declarations
  95. //
  96. extern QOSMGR_GLOBALS Globals;
  97. //
  98. // Macros used in allocating and operating on memory
  99. //
  100. #define ZeroMemory RtlZeroMemory
  101. #define CopyMemory RtlCopyMemory
  102. #define FillMemory RtlFillMemory
  103. #define EqualMemory RtlEqualMemory
  104. #define AllocOnStack(nb) _alloca((nb))
  105. #define AllocMemory(nb) HeapAlloc(Globals.GlobalHeap, \
  106. 0, \
  107. (nb))
  108. #define ReallocMemory(nb) HeapReAlloc(Globals.GlobalHeap, \
  109. 0, \
  110. (nb))
  111. #define AllocNZeroMemory(nb) HeapAlloc(Globals.GlobalHeap, \
  112. HEAP_ZERO_MEMORY, \
  113. (nb))
  114. #define FreeMemory(ptr) HeapFree(Globals.GlobalHeap, \
  115. 0, \
  116. (ptr))
  117. #define FreeNotNullMemory(ptr) { \
  118. if (!(ptr)) FreeMemory((ptr)); \
  119. }
  120. //
  121. // Prototypes relating to global lock management
  122. //
  123. #define ACQUIRE_GLOBALS_READ_LOCK() \
  124. ACQUIRE_READ_LOCK(&Globals.GlobalsLock)
  125. #define RELEASE_GLOBALS_READ_LOCK() \
  126. RELEASE_READ_LOCK(&Globals.GlobalsLock)
  127. #define ACQUIRE_GLOBALS_WRITE_LOCK() \
  128. ACQUIRE_WRITE_LOCK(&Globals.GlobalsLock)
  129. #define RELEASE_GLOBALS_WRITE_LOCK() \
  130. RELEASE_WRITE_LOCK(&Globals.GlobalsLock)
  131. //
  132. // Prototypes relating to interface lock management
  133. //
  134. #define ACQUIRE_INTERFACE_READ_LOCK(Interface) \
  135. ACQUIRE_READ_LOCK(&Interface->InterfaceLock)
  136. #define RELEASE_INTERFACE_READ_LOCK(Interface) \
  137. RELEASE_READ_LOCK(&Interface->InterfaceLock)
  138. #define ACQUIRE_INTERFACE_WRITE_LOCK(Interface) \
  139. ACQUIRE_WRITE_LOCK(&Interface->InterfaceLock)
  140. #define RELEASE_INTERFACE_WRITE_LOCK(Interface) \
  141. RELEASE_WRITE_LOCK(&Interface->InterfaceLock)
  142. //
  143. // Prototypes relating to DLL startup, cleanup
  144. //
  145. BOOL
  146. QosmDllStartup(
  147. VOID
  148. );
  149. BOOL
  150. QosmDllCleanup(
  151. VOID
  152. );
  153. //
  154. // Prototypes for router manager interface
  155. //
  156. DWORD
  157. APIENTRY
  158. RegisterProtocol(
  159. IN OUT PMPR_ROUTING_CHARACTERISTICS RoutingChar,
  160. IN OUT PMPR_SERVICE_CHARACTERISTICS ServiceChar
  161. );
  162. DWORD
  163. WINAPI
  164. StartProtocol (
  165. IN HANDLE NotificationEvent,
  166. IN PSUPPORT_FUNCTIONS SupportFunctions,
  167. IN LPVOID GlobalInfo,
  168. IN ULONG StructureVersion,
  169. IN ULONG StructureSize,
  170. IN ULONG StructureCount
  171. );
  172. DWORD
  173. WINAPI
  174. StartComplete (
  175. VOID
  176. );
  177. DWORD
  178. WINAPI
  179. StopProtocol (
  180. VOID
  181. );
  182. DWORD
  183. WINAPI
  184. GetGlobalInfo (
  185. IN PVOID GlobalInfo,
  186. IN OUT PULONG BufferSize,
  187. OUT PULONG StructureVersion,
  188. OUT PULONG StructureSize,
  189. OUT PULONG StructureCount
  190. );
  191. DWORD
  192. WINAPI
  193. SetGlobalInfo (
  194. IN PVOID GlobalInfo,
  195. IN ULONG StructureVersion,
  196. IN ULONG StructureSize,
  197. IN ULONG StructureCount
  198. );
  199. DWORD
  200. WINAPI
  201. AddInterface (
  202. IN LPWSTR InterfaceName,
  203. IN ULONG InterfaceIndex,
  204. IN NET_INTERFACE_TYPE InterfaceType,
  205. IN DWORD MediaType,
  206. IN WORD AccessType,
  207. IN WORD ConnectionType,
  208. IN PVOID InterfaceInfo,
  209. IN ULONG StructureVersion,
  210. IN ULONG StructureSize,
  211. IN ULONG StructureCount
  212. );
  213. DWORD
  214. WINAPI
  215. DeleteInterface (
  216. IN ULONG InterfaceIndex
  217. );
  218. DWORD
  219. WINAPI
  220. InterfaceStatus (
  221. IN ULONG InterfaceIndex,
  222. IN BOOL InterfaceActive,
  223. IN DWORD StatusType,
  224. IN PVOID StatusInfo
  225. );
  226. DWORD
  227. WINAPI
  228. GetInterfaceInfo (
  229. IN ULONG InterfaceIndex,
  230. IN PVOID InterfaceInfo,
  231. IN OUT PULONG BufferSize,
  232. OUT PULONG StructureVersion,
  233. OUT PULONG StructureSize,
  234. OUT PULONG StructureCount
  235. );
  236. DWORD
  237. WINAPI
  238. SetInterfaceInfo (
  239. IN ULONG InterfaceIndex,
  240. IN PVOID InterfaceInfo,
  241. IN ULONG StructureVersion,
  242. IN ULONG StructureSize,
  243. IN ULONG StructureCount
  244. );
  245. DWORD
  246. WINAPI
  247. GetEventMessage (
  248. OUT ROUTING_PROTOCOL_EVENTS *Event,
  249. OUT MESSAGE *Result
  250. );
  251. DWORD
  252. WINAPI
  253. UpdateRoutes (
  254. IN ULONG InterfaceIndex
  255. );
  256. DWORD
  257. WINAPI
  258. MibCreateEntry (
  259. IN ULONG InputDataSize,
  260. IN PVOID InputData
  261. );
  262. DWORD
  263. WINAPI
  264. MibDeleteEntry (
  265. IN ULONG InputDataSize,
  266. IN PVOID InputData
  267. );
  268. DWORD
  269. WINAPI
  270. MibGetEntry (
  271. IN ULONG InputDataSize,
  272. IN PVOID InputData,
  273. OUT PULONG OutputDataSize,
  274. OUT PVOID OutputData
  275. );
  276. DWORD
  277. WINAPI
  278. MibSetEntry (
  279. IN ULONG InputDataSize,
  280. IN PVOID InputData
  281. );
  282. DWORD
  283. WINAPI
  284. MibGetFirstEntry (
  285. IN ULONG InputDataSize,
  286. IN PVOID InputData,
  287. OUT PULONG OutputDataSize,
  288. OUT PVOID OutputData
  289. );
  290. DWORD
  291. WINAPI
  292. MibGetNextEntry (
  293. IN ULONG InputDataSize,
  294. IN PVOID InputData,
  295. OUT PULONG OutputDataSize,
  296. OUT PVOID OutputData
  297. );
  298. DWORD
  299. WINAPI
  300. MibSetTrapInfo (
  301. IN HANDLE Event,
  302. IN ULONG InputDataSize,
  303. IN PVOID InputData,
  304. OUT PULONG OutputDataSize,
  305. OUT PVOID OutputData
  306. );
  307. DWORD
  308. WINAPI
  309. MibGetTrapInfo (
  310. IN ULONG InputDataSize,
  311. IN PVOID InputData,
  312. OUT PULONG OutputDataSize,
  313. OUT PVOID OutputData
  314. );
  315. //
  316. // Helper functions to operate on info blocks
  317. //
  318. DWORD
  319. WINAPI
  320. QosmGetGlobalInfo (
  321. IN PVOID GlobalInfo,
  322. IN OUT PULONG BufferSize,
  323. OUT PULONG InfoSize
  324. );
  325. DWORD
  326. WINAPI
  327. QosmSetGlobalInfo (
  328. IN PVOID GlobalInfo,
  329. IN ULONG InfoSize
  330. );
  331. DWORD
  332. WINAPI
  333. QosmGetInterfaceInfo (
  334. IN QOSMGR_INTERFACE_ENTRY *Interface,
  335. IN PVOID InterfaceInfo,
  336. IN OUT PULONG BufferSize,
  337. OUT PULONG InfoSize
  338. );
  339. DWORD
  340. WINAPI
  341. QosmSetInterfaceInfo (
  342. IN QOSMGR_INTERFACE_ENTRY *Interface,
  343. IN PVOID InterfaceInfo,
  344. IN ULONG InfoSize
  345. );
  346. //
  347. // Prototypes relating to TC functionality
  348. //
  349. VOID
  350. TcNotifyHandler(
  351. IN HANDLE ClRegCtx,
  352. IN HANDLE ClIfcCtx,
  353. IN ULONG Event,
  354. IN HANDLE SubCode,
  355. IN ULONG BufSize,
  356. IN PVOID Buffer
  357. );
  358. DWORD
  359. QosmOpenTcInterface(
  360. IN PQOSMGR_INTERFACE_ENTRY Interface
  361. );
  362. DWORD
  363. GetFlowFromDescription(
  364. IN PIPQOS_NAMED_FLOW FlowDesc,
  365. OUT PTC_GEN_FLOW *FlowInfo,
  366. OUT ULONG *FlowSize
  367. );
  368. FLOWSPEC *
  369. GetFlowspecFromGlobalConfig(
  370. IN PWCHAR FlowspecName
  371. );
  372. QOS_OBJECT_HDR *
  373. GetQosObjectFromGlobalConfig(
  374. IN PWCHAR QosObjectName
  375. );
  376. #endif // __QOSMMAIN_H