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.

167 lines
3.3 KiB

  1. #define ADDR_LENGTH 24
  2. //
  3. // Misc macros
  4. //
  5. #define IfutlDispTokenErrMsg(hModule, dwMsgId, pwszTag, pwszValue) \
  6. DisplayMessage( hModule, dwMsgId, pwszValue, pwszTag)
  7. #define BREAK_ON_DWERR(x) if ((x) != NO_ERROR) break;
  8. //
  9. // Macros for dealing with IFMON_CMD_ARGS
  10. //
  11. #define IFMON_CMD_ARG_GetPsz(pArg) \
  12. (((pArg)->rgTag.bPresent) ? (pArg)->Val.pszValue : NULL)
  13. #define IFMON_CMD_ARG_GetDword(pArg) \
  14. (((pArg)->rgTag.bPresent) ? (pArg)->Val.dwValue : 0)
  15. //
  16. // Enumerations for types of arguments (see RASMON_CMD_ARG)
  17. //
  18. #define IFMON_CMD_TYPE_STRING 0x1
  19. #define IFMON_CMD_TYPE_ENUM 0x2
  20. #define CHECK_UNICAST_IP_ADDR(Addr) \
  21. (((DWORD)((Addr) & 0x000000E0) >= (DWORD)0x000000E0) or \
  22. ((DWORD)((Addr) & 0x000000FF) == (DWORD)0x0000007F) or \
  23. ((Addr) == 0))
  24. BOOL
  25. CheckMask(
  26. DWORD Mask
  27. );
  28. #define CHECK_NETWORK_MASK(Mask) \
  29. (CheckMask(Mask) || (Mask==0xFFFFFFFF) || (Mask==0))
  30. //
  31. // Structure defining a command line argument
  32. //
  33. typedef struct _IFMON_CMD_ARG
  34. {
  35. IN DWORD dwType; // RASMONTR_CMD_TYPE_*
  36. IN TAG_TYPE rgTag; // The tag for this command
  37. IN TOKEN_VALUE* rgEnums; // The enumerations for this arg
  38. IN DWORD dwEnumCount; // Count of enums
  39. union
  40. {
  41. OUT PWCHAR pszValue; // Valid only for RASMONTR_CMD_TYPE_STRING
  42. OUT DWORD dwValue; // Valid only for RASMONTR_CMD_TYPE_ENUM
  43. } Val;
  44. } IFMON_CMD_ARG, *PIFMON_CMD_ARG;
  45. DWORD
  46. IfutlGetTagToken(
  47. IN HANDLE hModule,
  48. IN PWCHAR *ppwcArguments,
  49. IN DWORD dwCurrentIndex,
  50. IN DWORD dwArgCount,
  51. IN PTAG_TYPE pttTagToken,
  52. IN DWORD dwNumTags,
  53. OUT PDWORD pdwOut
  54. );
  55. VOID
  56. IfutlGetInterfaceName(
  57. IN PWCHAR pwszIfDesc,
  58. OUT PWCHAR pwszIfName,
  59. IN PDWORD pdwSize
  60. );
  61. VOID
  62. IfutlGetInterfaceDescription(
  63. IN PWCHAR pwszIfName,
  64. OUT PWCHAR pwszIfDesc,
  65. IN PDWORD pdwSize
  66. );
  67. PVOID
  68. WINAPI
  69. IfutlAlloc(
  70. IN DWORD dwBytes,
  71. IN BOOL bZero
  72. );
  73. VOID
  74. WINAPI
  75. IfutlFree(
  76. IN PVOID pvData
  77. );
  78. PWCHAR
  79. WINAPI
  80. IfutlStrDup(
  81. IN LPCWSTR pwszSrc
  82. );
  83. DWORD
  84. IfutlParse(
  85. IN PWCHAR* ppwcArguments,
  86. IN DWORD dwCurrentIndex,
  87. IN DWORD dwArgCount,
  88. IN BOOL* pbDone,
  89. OUT IFMON_CMD_ARG* pIfArgs,
  90. IN DWORD dwIfArgCount);
  91. BOOL
  92. IfutlIsRouterRunning(
  93. VOID
  94. );
  95. DWORD
  96. GetIpAddress(
  97. PWCHAR ppwcArg,
  98. PIPV4_ADDRESS ipAddress
  99. );
  100. DWORD
  101. IfutlGetIfIndexFromInterfaceName(
  102. IN PWCHAR pwszGuid,
  103. OUT PDWORD pdwIfIndex
  104. );
  105. DWORD
  106. WINAPI
  107. InterfaceEnum(
  108. OUT PBYTE *ppb,
  109. OUT PDWORD pdwCount,
  110. OUT PDWORD pdwTotal
  111. );
  112. DWORD
  113. IfutlGetIfIndexFromFriendlyName(
  114. PWCHAR IfFriendlyName,
  115. PULONG pdwIfIndex
  116. );
  117. VOID
  118. MakeAddressStringW(
  119. OUT PWCHAR pwcPrefixStr,
  120. IN IPV4_ADDRESS ipAddr
  121. );
  122. DWORD
  123. IfutlGetFriendlyNameFromIfIndex(
  124. IN MIB_SERVER_HANDLE hMibServer,
  125. IN DWORD dwIfIndex,
  126. OUT PWCHAR pwszBuffer,
  127. IN DWORD dwBufferSize
  128. );
  129. DWORD
  130. MibGet(
  131. DWORD dwTransportId,
  132. DWORD dwRoutingPid,
  133. LPVOID lpInEntry,
  134. DWORD dwInEntrySize,
  135. LPVOID *lplpOutEntry,
  136. LPDWORD lpdwOutEntrySize
  137. );