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.

386 lines
10 KiB

  1. /*++
  2. Copyright (c) 1998 Microsoft Corporation
  3. Module Name:
  4. qosp.h
  5. Abstract:
  6. Includes for QOS netsh extension
  7. Revision History:
  8. --*/
  9. #ifndef __QOSP_H
  10. #define __QOSP_H
  11. //
  12. // Constants and Defines
  13. //
  14. #define QOS_LOG_MASK 0x00000001
  15. #define QOS_IF_STATE_MASK 0x00000001
  16. #define DIRECTION_INBOUND 0x00000001
  17. #define DIRECTION_OUTBOUND 0x00000002
  18. #define DIRECTION_BIDIRECTIONAL (DIRECTION_INBOUND | DIRECTION_OUTBOUND)
  19. #define MAX_WSTR_LENGTH (MAX_STRING_LENGTH * sizeof(WCHAR))
  20. //
  21. // Extern Global Variables
  22. //
  23. extern ULONG g_ulQosNumTopCmds;
  24. extern CMD_ENTRY g_QosCmds[];
  25. extern ULONG g_ulQosNumGroups;
  26. extern CMD_GROUP_ENTRY g_QosCmdGroups[];
  27. extern ULONG g_dwNumQosTableEntries; // Num of sub-helpers
  28. #ifdef ALLOW_CHILD_HELPERS
  29. extern ULONG g_dwNumQosContexts; // Num of sub-contexts
  30. extern PIP_CONTEXT_TABLE_ENTRY g_QosContextTable;
  31. #endif
  32. //
  33. // Function Prototypes
  34. //
  35. // Exported Entry Points
  36. NS_CONTEXT_DUMP_FN QosDump;
  37. // Command Handlers
  38. FN_HANDLE_CMD HandleQosInstall;
  39. FN_HANDLE_CMD HandleQosUninstall;
  40. FN_HANDLE_CMD HandleQosAddHelper;
  41. FN_HANDLE_CMD HandleQosDelHelper;
  42. FN_HANDLE_CMD HandleQosShowHelper;
  43. FN_HANDLE_CMD HandleQosSetGlobal;
  44. FN_HANDLE_CMD HandleQosShowGlobal;
  45. FN_HANDLE_CMD HandleQosAddFlowspec;
  46. FN_HANDLE_CMD HandleQosDelFlowspec;
  47. FN_HANDLE_CMD HandleQosShowFlowspec;
  48. FN_HANDLE_CMD HandleQosDelQosObject;
  49. FN_HANDLE_CMD HandleQosShowQosObject;
  50. FN_HANDLE_CMD HandleQosAddSdMode;
  51. FN_HANDLE_CMD HandleQosShowSdMode;
  52. FN_HANDLE_CMD HandleQosAddDsRule;
  53. FN_HANDLE_CMD HandleQosDelDsRule;
  54. FN_HANDLE_CMD HandleQosShowDsMap;
  55. FN_HANDLE_CMD HandleQosAddIf;
  56. FN_HANDLE_CMD HandleQosSetIf;
  57. FN_HANDLE_CMD HandleQosDelIf;
  58. FN_HANDLE_CMD HandleQosShowIf;
  59. FN_HANDLE_CMD HandleQosDump;
  60. FN_HANDLE_CMD HandleQosHelp;
  61. FN_HANDLE_CMD HandleQosAddFlowOnIf;
  62. FN_HANDLE_CMD HandleQosDelFlowOnIf;
  63. FN_HANDLE_CMD HandleQosShowFlowOnIf;
  64. FN_HANDLE_CMD HandleQosAddFlowspecOnIfFlow;
  65. FN_HANDLE_CMD HandleQosDelFlowspecOnIfFlow;
  66. FN_HANDLE_CMD HandleQosAddQosObjectOnIfFlow;
  67. FN_HANDLE_CMD HandleQosDelQosObjectOnIfFlow;
  68. FN_HANDLE_CMD HandleQosAttachFilterToFlow;
  69. FN_HANDLE_CMD HandleQosDetachFilterFromFlow;
  70. FN_HANDLE_CMD HandleQosModifyFilterOnFlow;
  71. FN_HANDLE_CMD HandleQosShowFilterOnFlow;
  72. FN_HANDLE_CMD HandleQosMibHelp;
  73. FN_HANDLE_CMD HandleQosMibShowObject;
  74. // Helper Helper functions
  75. BOOL
  76. IsQosCommand(
  77. IN PWCHAR pwszCmd
  78. );
  79. // Info Helper functions
  80. DWORD
  81. UpdateAllInterfaceConfigs(
  82. VOID
  83. );
  84. DWORD
  85. MakeQosGlobalInfo(
  86. OUT PBYTE *ppbStart,
  87. OUT PDWORD pdwSize
  88. );
  89. DWORD
  90. MakeQosInterfaceInfo(
  91. IN ROUTER_INTERFACE_TYPE rifType,
  92. OUT PBYTE *ppbStart,
  93. OUT PDWORD pdwSize
  94. );
  95. DWORD
  96. ShowQosGlobalInfo (
  97. IN HANDLE hFile
  98. );
  99. DWORD
  100. ShowQosInterfaceInfo(
  101. IN HANDLE hFile,
  102. IN PWCHAR pwszIfName
  103. );
  104. DWORD
  105. ShowQosAllInterfaceInfo(
  106. IN HANDLE hFile
  107. );
  108. DWORD
  109. UpdateQosGlobalConfig(
  110. IN PIPQOS_GLOBAL_CONFIG pigcGlobalCfg,
  111. IN DWORD dwBitVector
  112. );
  113. DWORD
  114. UpdateQosInterfaceConfig(
  115. IN PWCHAR pwszIfName,
  116. IN PIPQOS_IF_CONFIG pChangeCfg,
  117. IN DWORD dwBitVector,
  118. IN BOOL bAddSet
  119. );
  120. DWORD
  121. GetQosSetIfOpt(
  122. IN PTCHAR *pptcArguments,
  123. IN DWORD dwCurrentIndex,
  124. IN DWORD dwArgCount,
  125. IN PWCHAR wszIfName,
  126. IN DWORD dwSizeOfwszIfName,
  127. OUT PIPQOS_IF_CONFIG pChangeCfg,
  128. OUT DWORD *pdwBitVector,
  129. IN BOOL bAddSet
  130. );
  131. DWORD
  132. GetQosAddDelIfFlowOpt(
  133. IN PTCHAR *pptcArguments,
  134. IN DWORD dwCurrentIndex,
  135. IN DWORD dwArgCount,
  136. IN BOOL bAdd
  137. );
  138. DWORD
  139. ShowQosFlows(
  140. IN HANDLE hFile,
  141. IN PWCHAR pwszIfGuid,
  142. IN PWCHAR wszFlowName
  143. );
  144. DWORD
  145. ShowQosFlowsOnIf(
  146. IN HANDLE hFile,
  147. IN PWCHAR pwszIfGuid,
  148. IN PWCHAR wszFlowName
  149. );
  150. DWORD
  151. GetQosAddDelFlowspecOpt(
  152. IN PTCHAR *pptcArguments,
  153. IN DWORD dwCurrentIndex,
  154. IN DWORD dwArgCount,
  155. IN BOOL bAdd
  156. );
  157. DWORD
  158. ShowQosFlowspecs(
  159. IN HANDLE hFile,
  160. IN PWCHAR wszFlowspecName
  161. );
  162. DWORD
  163. GetQosAddDelFlowspecOnFlowOpt(
  164. IN PTCHAR *pptcArguments,
  165. IN DWORD dwCurrentIndex,
  166. IN DWORD dwArgCount,
  167. IN BOOL bAdd
  168. );
  169. DWORD
  170. GetQosAddDelDsRuleOpt(
  171. IN PTCHAR *pptcArguments,
  172. IN DWORD dwCurrentIndex,
  173. IN DWORD dwArgCount,
  174. IN BOOL bAdd
  175. );
  176. DWORD
  177. HandleQosShowGenericQosObject(
  178. IN DWORD dwQosObjectType,
  179. IN PTCHAR *pptcArguments,
  180. IN DWORD dwCurrentIndex,
  181. IN DWORD dwArgCount,
  182. IN BOOL *pbDone
  183. );
  184. typedef
  185. DWORD
  186. (*PSHOW_QOS_OBJECT)(
  187. IN HANDLE hFile,
  188. IN PWCHAR wszGenObjName,
  189. IN QOS_OBJECT_HDR *pGenObj
  190. );
  191. DWORD
  192. ShowQosDsMap(
  193. IN HANDLE hFile,
  194. IN PWCHAR wszDsMapName,
  195. IN QOS_OBJECT_HDR *pDsMap
  196. );
  197. DWORD
  198. ShowQosSdMode(
  199. IN HANDLE hFile,
  200. IN PWCHAR wszSdModeName,
  201. IN QOS_OBJECT_HDR *pSdMode
  202. );
  203. DWORD
  204. GetQosAddDelQosObject(
  205. IN PWCHAR pwszQosObjectName,
  206. IN QOS_OBJECT_HDR *pQosObject,
  207. IN BOOL bAdd
  208. );
  209. DWORD
  210. GetQosAddDelQosObjectOnFlowOpt(
  211. IN PTCHAR *pptcArguments,
  212. IN DWORD dwCurrentIndex,
  213. IN DWORD dwArgCount,
  214. IN BOOL bAdd
  215. );
  216. DWORD
  217. ShowQosObjects(
  218. IN HANDLE hFile,
  219. IN PWCHAR wszQosObjectName,
  220. IN ULONG dwQosObjectType
  221. );
  222. DWORD
  223. ShowQosGenObj(
  224. IN HANDLE hFile,
  225. IN PWCHAR wszGenObjName,
  226. IN QOS_OBJECT_HDR *pGenObj
  227. );
  228. // Help Helper Functions
  229. DWORD
  230. ShowQosHelp(
  231. IN DWORD dwDisplayFlags,
  232. IN DWORD dwCmdFlags,
  233. IN DWORD dwArgsRemaining,
  234. IN PWCHAR pwszGroup
  235. );
  236. DWORD
  237. WINAPI
  238. DisplayQosHelp(
  239. VOID
  240. );
  241. // Dump Helper functions
  242. DWORD
  243. DumpQosInformation (
  244. IN HANDLE hFile
  245. );
  246. DWORD
  247. DumpQosHelperInformation (
  248. IN HANDLE hFile
  249. );
  250. // MIB Helper defs
  251. typedef
  252. VOID
  253. (*PQOS_PRINT_FN)(
  254. IN PIPQOS_MIB_GET_OUTPUT_DATA pgodInfo
  255. );
  256. typedef struct _QOS_MAGIC_TABLE
  257. {
  258. DWORD dwId;
  259. PQOS_PRINT_FN pfnPrintFunction;
  260. }QOS_MAGIC_TABLE, *PQOS_MAGIC_TABLE;
  261. // MIB Helper functions
  262. VOID
  263. PrintQosGlobalStats(
  264. IN PIPQOS_MIB_GET_OUTPUT_DATA pgodInfo
  265. );
  266. VOID
  267. PrintQosIfStats(
  268. IN PIPQOS_MIB_GET_OUTPUT_DATA pgodInfo
  269. );
  270. DWORD
  271. GetQosMIBIfIndex(
  272. IN PTCHAR *pptcArguments,
  273. IN DWORD dwCurrentIndex,
  274. OUT PDWORD pdwIndices,
  275. OUT PDWORD pdwNumParsed
  276. );
  277. //
  278. // Common Macros
  279. //
  280. #define GET_ENUM_TAG_VALUE() \
  281. dwErr = MatchEnumTag(g_hModule, \
  282. pptcArguments[i + dwCurrentIndex], \
  283. NUM_TOKENS_IN_TABLE(rgEnums), \
  284. rgEnums, \
  285. &dwRes); \
  286. \
  287. if (dwErr != NO_ERROR) \
  288. { \
  289. DispTokenErrMsg(g_hModule, \
  290. EMSG_BAD_OPTION_VALUE, \
  291. pttTags[pdwTagType[i]].pwszTag, \
  292. pptcArguments[i + dwCurrentIndex]); \
  293. \
  294. DisplayMessage(g_hModule, \
  295. EMSG_BAD_OPTION_ENUMERATION, \
  296. pttTags[pdwTagType[i]].pwszTag); \
  297. \
  298. for ( j = 0; j < NUM_TOKENS_IN_TABLE(rgEnums); j++ ) \
  299. { \
  300. DisplayMessageT( L" %1!s!\n", rgEnums[j].pwszToken ); \
  301. } \
  302. \
  303. i = dwNumArg; \
  304. dwErr = ERROR_SUPPRESS_OUTPUT; \
  305. break; \
  306. } \
  307. #endif // __QOSP_H