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.

223 lines
5.8 KiB

  1. /*++
  2. Copyright (c) 1998 Microsoft Corporation
  3. Module Name:
  4. net\routing\monitor\ip\showmib.h
  5. Abstract:
  6. Author:
  7. Anand Mahalingam 7/10/98
  8. Revision History:
  9. --*/
  10. #ifndef __IPMON_SHOWMIB_H__
  11. #define __IPMON_SHOWMIB_H__
  12. #define MAX_NUM_INDICES 6
  13. typedef
  14. DWORD
  15. (*PGET_OPT_FN)(
  16. IN PTCHAR *pptcArguments,
  17. IN DWORD dwCurrentIndex,
  18. OUT PDWORD pdwIndices,
  19. OUT PDWORD pdwNumParsed
  20. );
  21. typedef struct _MIB_OBJECT_PARSER
  22. {
  23. PWCHAR pwszMIBObj;
  24. DWORD dwMinOptArg;
  25. PGET_OPT_FN pfnMIBObjParser;
  26. } MIB_OBJECT_PARSER,*PMIB_OBJECT_PARSER;
  27. DWORD
  28. GetMIBIfIndex(
  29. IN PTCHAR *pptcArguments,
  30. IN DWORD dwCurrentIndex,
  31. OUT PDWORD pdwIndices,
  32. OUT PDWORD pdwNumParsed
  33. );
  34. DWORD
  35. GetMIBIpAddress(
  36. IN PTCHAR *pptcArguments,
  37. IN DWORD dwCurrentIndex,
  38. OUT PDWORD pdwIndices,
  39. OUT PDWORD pdwNumParsed
  40. );
  41. DWORD
  42. GetMIBIpFwdIndex(
  43. IN PTCHAR *pptcArguments,
  44. IN DWORD dwCurrentIndex,
  45. OUT PDWORD pdwIndices,
  46. OUT PDWORD pdwNumParsed
  47. );
  48. DWORD
  49. GetMIBIpNetIndex(
  50. IN PTCHAR *pptcArguments,
  51. IN DWORD dwCurrentIndex,
  52. OUT PDWORD pdwIndices,
  53. OUT PDWORD pdwNumParsed
  54. );
  55. DWORD
  56. GetMIBTcpConnIndex(
  57. IN PTCHAR *pptcArguments,
  58. IN DWORD dwCurrentIndex,
  59. OUT PDWORD pdwIndices,
  60. OUT PDWORD pdwNumParsed
  61. );
  62. DWORD
  63. GetMIBUdpConnIndex(
  64. IN PTCHAR *pptcArguments,
  65. IN DWORD dwCurrentIndex,
  66. OUT PDWORD pdwIndices,
  67. OUT PDWORD pdwNumParsed
  68. );
  69. extern MIB_OBJECT_PARSER MIBObjectMap[];
  70. extern ULONG g_ulNumMibObjects;
  71. extern HANDLE g_hConsole;
  72. typedef
  73. VOID
  74. (PRINT_FN)(
  75. IN MIB_SERVER_HANDLE hMibServer,
  76. IN PMIB_OPAQUE_INFO pInfo
  77. );
  78. PRINT_FN PrintIpForwardTable;
  79. PRINT_FN PrintIpForwardRow;
  80. VOID
  81. PrintMfeTable(
  82. MIB_SERVER_HANDLE hMibServer,
  83. PMIB_OPAQUE_INFO prpcInfo,
  84. PDWORD pdwLastGrp,
  85. PDWORD pdwLastSrc,
  86. PDWORD pdwLastSrcMask,
  87. DWORD dwRangeGrp,
  88. DWORD dwRangeGrpMask,
  89. DWORD dwRangeSrc,
  90. DWORD dwRangeSrcMask,
  91. DWORD dwType,
  92. PBOOL pbDone
  93. );
  94. VOID
  95. PrintMfeStatsTable(
  96. MIB_SERVER_HANDLE hMibServer,
  97. PMIB_OPAQUE_INFO prpcInfo,
  98. PDWORD pdwLastGrp,
  99. PDWORD pdwLastSrc,
  100. PDWORD pdwLastSrcMask,
  101. DWORD dwRangeGrp,
  102. DWORD dwRangeGrpMask,
  103. DWORD dwRangeSrc,
  104. DWORD dwRangeSrcMask,
  105. DWORD dwType,
  106. PBOOL pbDone,
  107. BOOL bStatsAll
  108. );
  109. DWORD
  110. GetMfe(
  111. MIB_SERVER_HANDLE hMIBServer,
  112. BOOL bIndexPresent,
  113. PTCHAR *pptcAruments,
  114. DWORD dwNumArg,
  115. BOOL bIncludeStats
  116. );
  117. DWORD
  118. GetPrintDestinationInfo(
  119. MIB_SERVER_HANDLE hMprMIB,
  120. BOOL bIndexPresent,
  121. PWCHAR *ppwcArguments,
  122. DWORD dwArgCount
  123. );
  124. DWORD
  125. GetPrintRouteInfo(
  126. MIB_SERVER_HANDLE hMprMIB,
  127. BOOL bIndexPresent,
  128. PWCHAR *ppwcArguments,
  129. DWORD dwArgCount
  130. );
  131. void cls(HANDLE hConsole);
  132. BOOL WINAPI HandlerRoutine(
  133. DWORD dwCtrlType // control signal type
  134. );
  135. #define PRINT_IPADDR(x) \
  136. ((x)&0x000000ff),(((x)&0x0000ff00)>>8),(((x)&0x00ff0000)>>16),(((x)&0xff000000)>>24)
  137. typedef PRINT_FN *PPRINT_FN;
  138. typedef struct _MAGIC_TABLE
  139. {
  140. DWORD dwId;
  141. PPRINT_FN pfnPrintFunction;
  142. }MAGIC_TABLE, *PMAGIC_TABLE;
  143. extern MAGIC_TABLE MIBVar[];
  144. #define IGMP_GETMODE_EXACT 0
  145. #define IGMP_GETMODE_FIRST 1
  146. #define IGMP_GETMODE_NEXT 2
  147. #define DISPLAYLEN_PHYSADDR 3*MAXLEN_PHYSADDR + 8
  148. #ifdef UNICODE
  149. #define MakeUnicodePhysAddr(ptszUnicode,pszAddr,dwLen) \
  150. { \
  151. CHAR __szTemp[DISPLAYLEN_PHYSADDR + 1]; \
  152. DWORD __i,__dwTempLen; \
  153. __dwTempLen = (((dwLen) <= MAXLEN_PHYSADDR) ? (dwLen) : MAXLEN_PHYSADDR); \
  154. for(__i = 0; __i < __dwTempLen; __i++) \
  155. { \
  156. sprintf(&(__szTemp[3*__i]),"%02X-",pszAddr[__i]); \
  157. } \
  158. MultiByteToWideChar(GetConsoleOutputCP(), \
  159. 0, \
  160. (__szTemp), \
  161. -1, \
  162. (ptszUnicode), \
  163. 3*__i); \
  164. ptszUnicode[(3*__i) - 1] = TEXT('\0'); \
  165. }
  166. #else
  167. #define MakeUnicodePhysAddr(ptszUnicode,pszAddr,dwLen) \
  168. { \
  169. CHAR __szTemp[DISPLAYLEN_PHYSADDR + 1]; \
  170. DWORD __i,__dwTempLen; \
  171. __dwTempLen = (((dwLen) <= MAXLEN_PHYSADDR) ? (dwLen) : MAXLEN_PHYSADDR); \
  172. for(__i = 0; __i < __dwTempLen; __i++) \
  173. { \
  174. sprintf(&(__szTemp[3*__i]),"%02X-",pszAddr[__i]); \
  175. } \
  176. strncpy((ptszUnicode),__szTemp,3*__i); \
  177. ptszUnicode[(3*__i) - 1] = TEXT('\0'); \
  178. }
  179. #endif //UNICODE
  180. FN_HANDLE_CMD HandleIpMibShowObject;
  181. #endif // __IPMON_SHOWMIB_H__