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.

308 lines
5.7 KiB

  1. /*++
  2. Copyright (c) 1998 Microsoft Corporation
  3. Module Name:
  4. routing\netsh\if\ifhandle.c
  5. Abstract:
  6. Handlers for commands
  7. Revision History:
  8. AmritanR
  9. --*/
  10. #include "precomp.h"
  11. #pragma hdrstop
  12. //
  13. // Remove this when one can change interface friendly names
  14. //
  15. #define CANT_RENAME_IFS
  16. extern ULONG g_ulNumTopCmds;
  17. extern ULONG g_ulNumGroups;
  18. extern CMD_GROUP_ENTRY g_IfCmdGroups[];
  19. extern CMD_ENTRY g_IfCmds[];
  20. DWORD
  21. HandleIfAddIf(
  22. IN LPCWSTR pwszMachine,
  23. IN OUT LPWSTR *ppwcArguments,
  24. IN DWORD dwCurrentIndex,
  25. IN DWORD dwArgCount,
  26. IN DWORD dwFlags,
  27. IN LPCVOID pvData,
  28. OUT BOOL *pbDone
  29. )
  30. /*++
  31. Routine Description:
  32. Handler for adding an interface
  33. Arguments:
  34. ppwcArguments - Argument array
  35. dwCurrentIndex - ppwcArguments[dwCurrentIndex] is the first arg
  36. dwArgCount - ppwcArguments[dwArgCount - 1] is the last arg
  37. Return Value:
  38. NO_ERROR
  39. --*/
  40. {
  41. return RtrHandleAdd(
  42. ppwcArguments,
  43. dwCurrentIndex,
  44. dwArgCount,
  45. pbDone);
  46. }
  47. DWORD
  48. HandleIfDelIf(
  49. IN LPCWSTR pwszMachine,
  50. IN OUT LPWSTR *ppwcArguments,
  51. IN DWORD dwCurrentIndex,
  52. IN DWORD dwArgCount,
  53. IN DWORD dwFlags,
  54. IN LPCVOID pvData,
  55. OUT BOOL *pbDone
  56. )
  57. /*++
  58. Routine Description:
  59. Handler for deleting an interface
  60. Arguments:
  61. ppwcArguments - Argument array
  62. dwCurrentIndex - ppwcArguments[dwCurrentIndex] is the first arg
  63. dwArgCount - ppwcArguments[dwArgCount - 1] is the last arg
  64. Return Value:
  65. NO_ERROR
  66. --*/
  67. {
  68. return RtrHandleDel(
  69. ppwcArguments,
  70. dwCurrentIndex,
  71. dwArgCount,
  72. pbDone);
  73. }
  74. DWORD
  75. HandleIfShowIf(
  76. IN LPCWSTR pwszMachine,
  77. IN OUT LPWSTR *ppwcArguments,
  78. IN DWORD dwCurrentIndex,
  79. IN DWORD dwArgCount,
  80. IN DWORD dwFlags,
  81. IN LPCVOID pvData,
  82. OUT BOOL *pbDone
  83. )
  84. /*++
  85. Routine Description:
  86. Handler for displaying interfaces
  87. Arguments:
  88. ppwcArguments - Argument array
  89. dwCurrentIndex - ppwcArguments[dwCurrentIndex] is the first arg
  90. dwArgCount - ppwcArguments[dwArgCount - 1] is the last arg
  91. Return Value:
  92. NO_ERROR
  93. --*/
  94. {
  95. if (dwArgCount == dwCurrentIndex)
  96. {
  97. DisplayMessage(g_hModule, MSG_IF_TABLE_HDR);
  98. }
  99. return RtrHandleShow(
  100. ppwcArguments,
  101. dwCurrentIndex,
  102. dwArgCount,
  103. pbDone);
  104. }
  105. DWORD
  106. HandleIfShowCredentials(
  107. IN LPCWSTR pwszMachine,
  108. IN OUT LPWSTR *ppwcArguments,
  109. IN DWORD dwCurrentIndex,
  110. IN DWORD dwArgCount,
  111. IN DWORD dwFlags,
  112. IN LPCVOID pvData,
  113. OUT BOOL *pbDone
  114. )
  115. /*++
  116. Routine Description:
  117. Handler for showing credentials of an interface
  118. Arguments:
  119. ppwcArguments - Argument array
  120. dwCurrentIndex - ppwcArguments[dwCurrentIndex] is the first arg
  121. dwArgCount - ppwcArguments[dwArgCount - 1] is the last arg
  122. Return Value:
  123. NO_ERROR
  124. --*/
  125. {
  126. return RtrHandleShowCredentials(
  127. ppwcArguments,
  128. dwCurrentIndex,
  129. dwArgCount,
  130. pbDone);
  131. }
  132. DWORD
  133. HandleIfSetCredentials(
  134. IN LPCWSTR pwszMachine,
  135. IN OUT LPWSTR *ppwcArguments,
  136. IN DWORD dwCurrentIndex,
  137. IN DWORD dwArgCount,
  138. IN DWORD dwFlags,
  139. IN LPCVOID pvData,
  140. OUT BOOL *pbDone
  141. )
  142. /*++
  143. Routine Description:
  144. Handler for displaying interfaces
  145. Arguments:
  146. ppwcArguments - Argument array
  147. dwCurrentIndex - ppwcArguments[dwCurrentIndex] is the first arg
  148. dwArgCount - ppwcArguments[dwArgCount - 1] is the last arg
  149. Return Value:
  150. NO_ERROR
  151. --*/
  152. {
  153. return RtrHandleSetCredentials(
  154. ppwcArguments,
  155. dwCurrentIndex,
  156. dwArgCount,
  157. pbDone);
  158. }
  159. DWORD
  160. HandleIfSet(
  161. IN LPCWSTR pwszMachine,
  162. IN OUT LPWSTR *ppwcArguments,
  163. IN DWORD dwCurrentIndex,
  164. IN DWORD dwArgCount,
  165. IN DWORD dwFlags,
  166. IN LPCVOID pvData,
  167. OUT BOOL *pbDone
  168. )
  169. /*++
  170. Routine Description:
  171. Handler for displaying interfaces
  172. Arguments:
  173. ppwcArguments - Argument array
  174. dwCurrentIndex - ppwcArguments[dwCurrentIndex] is the first arg
  175. dwArgCount - ppwcArguments[dwArgCount - 1] is the last arg
  176. Return Value:
  177. NO_ERROR
  178. --*/
  179. {
  180. return RtrHandleSet(
  181. ppwcArguments,
  182. dwCurrentIndex,
  183. dwArgCount,
  184. pbDone);
  185. }
  186. DWORD
  187. HandleIfResetAll(
  188. IN LPCWSTR pwszMachine,
  189. IN OUT LPWSTR *ppwcArguments,
  190. IN DWORD dwCurrentIndex,
  191. IN DWORD dwArgCount,
  192. IN DWORD dwFlags,
  193. IN LPCVOID pvData,
  194. OUT BOOL *pbDone
  195. )
  196. /*++
  197. Routine Description:
  198. Handler for resetting everything.
  199. Arguments:
  200. ppwcArguments - Argument array
  201. dwCurrentIndex - ppwcArguments[dwCurrentIndex] is the first arg
  202. dwArgCount - ppwcArguments[dwArgCount - 1] is the last arg
  203. Return Value:
  204. NO_ERROR
  205. --*/
  206. {
  207. return RtrHandleResetAll(
  208. ppwcArguments,
  209. dwCurrentIndex,
  210. dwArgCount,
  211. pbDone);
  212. }
  213. DWORD
  214. IfDump(
  215. IN LPCWSTR pwszRouter,
  216. IN LPWSTR *ppwcArguments,
  217. IN DWORD dwArgCount,
  218. IN LPCVOID pvData
  219. )
  220. {
  221. DWORD dwErr;
  222. dwErr = ConnectToRouter(pwszRouter);
  223. if (dwErr)
  224. {
  225. return dwErr;
  226. }
  227. return RtrDump(
  228. ppwcArguments,
  229. dwArgCount
  230. );
  231. }