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.

1707 lines
50 KiB

  1. /*++
  2. Copyright (c) 1995 Microsoft Corporation
  3. Module Name:
  4. ripifs.c
  5. Abstract:
  6. IPX Router Console Monitoring and Configuration tool.
  7. RIP Interface configuration and monitoring.
  8. Author:
  9. Vadim Eydelman 06/07/1996
  10. --*/
  11. #include "precomp.h"
  12. #pragma hdrstop
  13. DWORD
  14. MIBGetRipIf(
  15. PWCHAR InterfaceNamew,
  16. HANDLE hFile
  17. );
  18. DWORD
  19. CfgGetRipIf(
  20. PWCHAR InterfaceNameW,
  21. HANDLE hFile
  22. );
  23. DWORD
  24. MIBEnumRipIfs(
  25. VOID
  26. );
  27. DWORD
  28. CfgEnumRipIfs(
  29. VOID
  30. );
  31. DWORD
  32. CfgSetRipIf (
  33. LPWSTR InterfaceNameW,
  34. PULONG pAdminState OPTIONAL,
  35. PULONG pAdvertise OPTIONAL,
  36. PULONG pListen OPTIONAL,
  37. PULONG pUpdateMode OPTIONAL,
  38. PULONG pInterval OPTIONAL,
  39. PULONG pAgeMultiplier OPTIONAL,
  40. PWCHAR IfName
  41. );
  42. DWORD
  43. AdmSetRipIf (
  44. LPWSTR InterfaceNameW,
  45. PULONG pAdminState OPTIONAL,
  46. PULONG pUpdateMode OPTIONAL,
  47. PULONG pInterval OPTIONAL,
  48. PULONG pAdvertise OPTIONAL,
  49. PULONG pListen OPTIONAL,
  50. PULONG pAgeMultiplier OPTIONAL,
  51. PWCHAR IfName
  52. );
  53. DWORD
  54. GetRipClientIf(
  55. PWCHAR InterfaceNameW,
  56. UINT msg,
  57. HANDLE hFile
  58. );
  59. DWORD
  60. APIENTRY
  61. HelpRipIf (
  62. IN int argc,
  63. IN WCHAR *argv[]
  64. )
  65. {
  66. DisplayMessage (g_hModule, HLP_IPX_RIPIF);
  67. return 0;
  68. }
  69. DWORD
  70. APIENTRY
  71. ShowRipIf (
  72. IN int argc,
  73. IN WCHAR *argv[],
  74. IN HANDLE hFile
  75. )
  76. {
  77. DWORD rc;
  78. if (argc < 1)
  79. {
  80. if ( g_hMIBServer )
  81. {
  82. rc = MIBEnumRipIfs ( );
  83. if (rc == NO_ERROR)
  84. {
  85. rc = GetRipClientIf(
  86. VAL_DIALINCLIENT,
  87. MSG_CLIENT_RIPIF_MIB_TABLE_FMT,
  88. NULL
  89. );
  90. }
  91. else
  92. {
  93. goto EnumerateThroughCfg;
  94. }
  95. }
  96. else
  97. {
  98. EnumerateThroughCfg:
  99. rc = CfgEnumRipIfs ( );
  100. if (rc == NO_ERROR)
  101. {
  102. rc = GetRipClientIf(
  103. VAL_DIALINCLIENT,
  104. MSG_CLIENT_RIPIF_CFG_TABLE_FMT,
  105. NULL
  106. );
  107. }
  108. }
  109. }
  110. else
  111. {
  112. WCHAR IfName[ MAX_INTERFACE_NAME_LEN + 1 ];
  113. unsigned count, dwSize = sizeof(IfName);
  114. #define InterfaceNameW argv[0]
  115. count = wcslen( InterfaceNameW );
  116. if ( !_wcsicmp( argv[0], VAL_DIALINCLIENT ) )
  117. {
  118. rc = GetRipClientIf(
  119. VAL_DIALINCLIENT, MSG_CLIENT_RIPIF_CFG_SCREEN_FMT,
  120. hFile
  121. );
  122. }
  123. else if ((count > 0) && (count <= MAX_INTERFACE_NAME_LEN))
  124. {
  125. if (g_hMIBServer)
  126. {
  127. //======================================
  128. // Translate the Interface Name
  129. //======================================
  130. rc = IpmontrGetIfNameFromFriendlyName(
  131. InterfaceNameW, IfName, &dwSize
  132. );
  133. if ( rc == NO_ERROR )
  134. {
  135. rc = MIBGetRipIf( IfName, hFile );
  136. }
  137. if (rc != NO_ERROR)
  138. {
  139. goto GetIfFromCfg;
  140. }
  141. }
  142. else
  143. {
  144. GetIfFromCfg:
  145. //======================================
  146. // Translate the Interface Name
  147. //======================================
  148. rc = IpmontrGetIfNameFromFriendlyName(
  149. InterfaceNameW, IfName, &dwSize
  150. );
  151. if ( rc == NO_ERROR )
  152. {
  153. rc = CfgGetRipIf( IfName, hFile );
  154. }
  155. }
  156. }
  157. else
  158. {
  159. if (hFile)
  160. {
  161. DisplayIPXMessage (g_hModule, MSG_INVALID_INTERFACE_NAME);
  162. }
  163. rc = ERROR_INVALID_PARAMETER;
  164. }
  165. }
  166. return rc;
  167. #undef InterfaceNameW
  168. }
  169. DWORD
  170. APIENTRY
  171. SetRipIf(
  172. IN int argc,
  173. IN WCHAR *argv[]
  174. )
  175. {
  176. DWORD rc;
  177. if (argc >= 1)
  178. {
  179. unsigned count;
  180. BOOLEAN client = FALSE;
  181. #define InterfaceNameW argv[0]
  182. if ( !_wcsicmp( argv[0], VAL_DIALINCLIENT ) )
  183. {
  184. client = TRUE;
  185. }
  186. else
  187. {
  188. count = wcslen (InterfaceNameW);
  189. }
  190. if (client || ((count > 0) && (count <= MAX_INTERFACE_NAME_LEN)))
  191. {
  192. int i;
  193. unsigned n;
  194. ULONG adminState, updateMode, interval, ageMultiplier,
  195. advertise, listen;
  196. PULONG pAdminState = NULL, pUpdateMode = NULL, pInterval = NULL,
  197. pAgeMultiplier = NULL, pAdvertise = NULL, pListen = NULL;
  198. for (i = 1; i < argc; i++)
  199. {
  200. if ( !_wcsicmp( argv[i], TOKEN_ADMINSTATE ) )
  201. {
  202. if ((pAdminState == NULL)
  203. && (i < argc - 1)
  204. && !MatchEnumTag( g_hModule, argv[i+1],
  205. NUM_TOKENS_IN_TABLE( AdminStates ),
  206. AdminStates, &adminState))
  207. {
  208. i += 1;
  209. pAdminState = &adminState;
  210. continue;
  211. }
  212. else
  213. {
  214. break;
  215. }
  216. }
  217. if ( !_wcsicmp( argv[i], TOKEN_ADVERTISE ) )
  218. {
  219. if ((pAdvertise == NULL)
  220. && (i < argc - 1)
  221. && !MatchEnumTag( g_hModule, argv[i+1],
  222. NUM_TOKENS_IN_TABLE( AdminStates ),
  223. AdminStates, &advertise))
  224. {
  225. i += 1;
  226. pAdvertise = &advertise;
  227. continue;
  228. }
  229. else
  230. {
  231. break;
  232. }
  233. }
  234. if ( !_wcsicmp( argv[i], TOKEN_LISTEN ) )
  235. {
  236. if ((pListen == NULL)
  237. && (i < argc - 1)
  238. && !MatchEnumTag( g_hModule, argv[i+1],
  239. NUM_TOKENS_IN_TABLE( AdminStates ),
  240. AdminStates, &listen))
  241. {
  242. i += 1;
  243. pListen = &listen;
  244. continue;
  245. }
  246. else
  247. {
  248. break;
  249. }
  250. }
  251. if ( !_wcsicmp( argv[i], TOKEN_UPDATEMODE ) )
  252. {
  253. if ((pUpdateMode == NULL)
  254. && (i < argc - 1)
  255. && !MatchEnumTag( g_hModule, argv[i+1],
  256. NUM_TOKENS_IN_TABLE( UpdateModes ),
  257. UpdateModes, &updateMode
  258. ))
  259. {
  260. i += 1;
  261. pUpdateMode = &updateMode;
  262. continue;
  263. }
  264. }
  265. if ( !_wcsicmp( argv[i], TOKEN_INTERVAL ) )
  266. {
  267. if ((pInterval == NULL)
  268. && (i < argc - 1)
  269. && (swscanf (argv[i+1], L"%ld%n", &interval, &n) == 1)
  270. && (n == wcslen(argv[i+1])))
  271. {
  272. i += 1;
  273. pInterval = &interval;
  274. continue;
  275. }
  276. else
  277. {
  278. break;
  279. }
  280. }
  281. if ( !_wcsicmp( argv[i], TOKEN_AGEMULTIPLIER ) )
  282. {
  283. if ((pAgeMultiplier == NULL)
  284. && (i < argc - 1)
  285. && (swscanf (argv[i+1], L"%ld%n", &ageMultiplier, &n) == 1)
  286. && (n == wcslen(argv[i+1])))
  287. {
  288. i += 1;
  289. pAgeMultiplier = &ageMultiplier;
  290. continue;
  291. }
  292. else
  293. {
  294. break;
  295. }
  296. }
  297. if (pAdminState == NULL)
  298. {
  299. if ( !MatchEnumTag (g_hModule, argv[i],
  300. NUM_TOKENS_IN_TABLE( AdminStates ),
  301. AdminStates, &adminState))
  302. {
  303. pAdminState = &adminState;
  304. }
  305. else
  306. {
  307. break;
  308. }
  309. }
  310. else if (pAdvertise == NULL)
  311. {
  312. if ( !MatchEnumTag (g_hModule, argv[i],
  313. NUM_TOKENS_IN_TABLE( AdminStates ),
  314. AdminStates, &advertise))
  315. {
  316. pAdvertise = &advertise;
  317. }
  318. else
  319. {
  320. break;
  321. }
  322. }
  323. else if (pListen == NULL)
  324. {
  325. if ( !MatchEnumTag (g_hModule, argv[i],
  326. NUM_TOKENS_IN_TABLE( AdminStates ),
  327. AdminStates, &listen))
  328. {
  329. pListen = &listen;
  330. }
  331. else
  332. {
  333. break;
  334. }
  335. }
  336. else if (pUpdateMode == NULL)
  337. {
  338. if ( !MatchEnumTag (g_hModule, argv[i],
  339. NUM_TOKENS_IN_TABLE( UpdateModes ),
  340. UpdateModes, &updateMode))
  341. {
  342. pUpdateMode = &updateMode;
  343. }
  344. else
  345. {
  346. break;
  347. }
  348. }
  349. else if (pInterval == NULL)
  350. {
  351. if ((swscanf ( argv[i], L"%ld%n", &interval, &n) == 1)
  352. && (n == wcslen(argv[i])))
  353. {
  354. pInterval = &interval;
  355. }
  356. else
  357. {
  358. break;
  359. }
  360. }
  361. else if (pAgeMultiplier == NULL)
  362. {
  363. if ( (swscanf (argv[i], L"%ld%n", &ageMultiplier, &n) == 1) &&
  364. (n == wcslen(argv[i]) ) )
  365. {
  366. pAgeMultiplier = &ageMultiplier;
  367. }
  368. else
  369. {
  370. break;
  371. }
  372. }
  373. else
  374. {
  375. break;
  376. }
  377. }
  378. if (i == argc)
  379. {
  380. if (!client)
  381. {
  382. WCHAR IfName[ MAX_INTERFACE_NAME_LEN + 1 ];
  383. DWORD rc2, dwSize = sizeof(IfName);
  384. //======================================
  385. // Translate the Interface Name
  386. //======================================
  387. rc = IpmontrGetIfNameFromFriendlyName(
  388. InterfaceNameW, IfName, &dwSize
  389. );
  390. if ( rc == NO_ERROR )
  391. {
  392. rc2 = CfgSetRipIf(
  393. IfName, pAdminState, pAdvertise, pListen,
  394. pUpdateMode, pInterval, pAgeMultiplier,
  395. InterfaceNameW
  396. );
  397. if (rc2 == NO_ERROR)
  398. {
  399. if (g_hMprAdmin)
  400. {
  401. rc = AdmSetRipIf(
  402. IfName, pAdminState, pAdvertise,
  403. pListen, pUpdateMode, pInterval,
  404. pAgeMultiplier, InterfaceNameW
  405. );
  406. }
  407. }
  408. else
  409. {
  410. rc = rc2;
  411. }
  412. }
  413. }
  414. else
  415. {
  416. rc = CfgSetRipIf(
  417. NULL, pAdminState, pAdvertise, pListen,
  418. pUpdateMode, pInterval, pAgeMultiplier,
  419. InterfaceNameW
  420. );
  421. if (rc == NO_ERROR)
  422. {
  423. if (g_hMprAdmin)
  424. {
  425. rc = AdmSetRipIf(
  426. NULL, pAdminState, pAdvertise, pListen,
  427. pUpdateMode, pInterval, pAgeMultiplier,
  428. InterfaceNameW
  429. );
  430. }
  431. }
  432. }
  433. }
  434. else
  435. {
  436. DisplayMessage (g_hModule, HLP_IPX_RIPIF);
  437. rc = ERROR_INVALID_PARAMETER;
  438. }
  439. }
  440. else
  441. {
  442. DisplayIPXMessage (g_hModule, MSG_INVALID_INTERFACE_NAME);
  443. rc = ERROR_INVALID_PARAMETER;
  444. }
  445. }
  446. else
  447. {
  448. DisplayMessage (g_hModule, HLP_IPX_RIPIF);
  449. rc = ERROR_INVALID_PARAMETER;
  450. }
  451. return rc;
  452. #undef InterfaceNameW
  453. }
  454. DWORD
  455. MIBGetRipIf (
  456. PWCHAR InterfaceNameW,
  457. HANDLE hFile
  458. )
  459. {
  460. DWORD rc;
  461. DWORD sz;
  462. RIP_MIB_GET_INPUT_DATA MibGetInputData;
  463. PRIP_INTERFACE pIf;
  464. WCHAR IfName[ MAX_INTERFACE_NAME_LEN + 1 ];
  465. DWORD dwSize = sizeof(IfName);
  466. MibGetInputData.TableId = RIP_INTERFACE_TABLE;
  467. rc = GetIpxInterfaceIndex(
  468. g_hMIBServer, InterfaceNameW,
  469. &MibGetInputData.InterfaceIndex
  470. );
  471. if (rc == NO_ERROR)
  472. {
  473. rc = MprAdminMIBEntryGet(
  474. g_hMIBServer, PID_IPX, IPX_PROTOCOL_RIP, &MibGetInputData,
  475. sizeof(RIP_MIB_GET_INPUT_DATA), (LPVOID * ) & pIf, &sz
  476. );
  477. if (rc == NO_ERROR)
  478. {
  479. DWORD i;
  480. PWCHAR buffer[5];
  481. //======================================
  482. // Translate the Interface Name
  483. //======================================
  484. rc = IpmontrGetFriendlyNameFromIfName(
  485. InterfaceNameW, IfName, &dwSize
  486. );
  487. if ( rc == NO_ERROR )
  488. {
  489. buffer[ 0 ] = GetEnumString(
  490. g_hModule, pIf->RipIfInfo.AdminState,
  491. NUM_TOKENS_IN_TABLE( AdminStates ),
  492. AdminStates
  493. );
  494. buffer[ 1 ] = GetEnumString(
  495. g_hModule, pIf->RipIfInfo.Supply,
  496. NUM_TOKENS_IN_TABLE( AdminStates ),
  497. AdminStates
  498. );
  499. buffer[ 2 ] = GetEnumString(
  500. g_hModule, pIf->RipIfInfo.Listen,
  501. NUM_TOKENS_IN_TABLE( AdminStates ),
  502. AdminStates
  503. );
  504. buffer[ 3 ] = GetEnumString(
  505. g_hModule, pIf->RipIfInfo.UpdateMode,
  506. NUM_TOKENS_IN_TABLE( UpdateModes ),
  507. UpdateModes
  508. );
  509. buffer[ 4 ] = GetEnumString(
  510. g_hModule, pIf->RipIfStats.RipIfOperState,
  511. NUM_TOKENS_IN_TABLE( OperStates ),
  512. OperStates
  513. );
  514. if ( buffer [ 0 ] && buffer[ 1 ] && buffer[ 2 ] &&
  515. buffer[ 3 ] && buffer[ 4 ] )
  516. {
  517. if ( hFile )
  518. {
  519. DisplayMessageT(
  520. DMP_IPX_RIP_SET_INTERFACE, IfName,
  521. buffer[ 0 ], buffer[1], buffer[ 2 ],
  522. buffer[3], pIf->RipIfInfo.PeriodicUpdateInterval,
  523. pIf->RipIfInfo.AgeIntervalMultiplier
  524. );
  525. }
  526. else
  527. {
  528. DisplayIPXMessage(
  529. g_hModule, MSG_RIPIF_MIB_SCREEN_FMT,
  530. IfName, buffer[ 0 ], buffer[1], buffer[ 2 ],
  531. buffer[3], pIf->RipIfInfo.PeriodicUpdateInterval,
  532. pIf->RipIfInfo.AgeIntervalMultiplier,
  533. buffer[4], pIf->RipIfStats.RipIfInputPackets,
  534. pIf->RipIfStats.RipIfOutputPackets
  535. );
  536. }
  537. }
  538. else
  539. {
  540. rc = ERROR_NOT_ENOUGH_MEMORY;
  541. if ( !hFile )
  542. DisplayError( g_hModule, rc );
  543. }
  544. }
  545. MprAdminMIBBufferFree( pIf );
  546. }
  547. else
  548. {
  549. if ( !hFile )
  550. DisplayError( g_hModule, rc);
  551. }
  552. }
  553. else
  554. {
  555. if ( !hFile )
  556. DisplayError( g_hModule, rc);
  557. }
  558. return rc;
  559. }
  560. DWORD
  561. CfgGetRipIf (
  562. LPWSTR InterfaceNameW,
  563. HANDLE hFile
  564. )
  565. {
  566. DWORD rc;
  567. DWORD sz;
  568. HANDLE hIfCfg;
  569. WCHAR IfName[ MAX_INTERFACE_NAME_LEN + 1 ];
  570. DWORD dwSize = sizeof(IfName);
  571. rc = MprConfigInterfaceGetHandle(
  572. g_hMprConfig, InterfaceNameW, &hIfCfg
  573. );
  574. if (rc == NO_ERROR)
  575. {
  576. HANDLE hIfTrCfg;
  577. rc = MprConfigInterfaceTransportGetHandle(
  578. g_hMprConfig, hIfCfg, PID_IPX, &hIfTrCfg
  579. );
  580. if (rc == NO_ERROR)
  581. {
  582. LPBYTE pIfBlock;
  583. rc = MprConfigInterfaceTransportGetInfo(
  584. g_hMprConfig, hIfCfg, hIfTrCfg, &pIfBlock, &sz
  585. );
  586. if (rc == NO_ERROR)
  587. {
  588. PIPX_TOC_ENTRY pRipToc;
  589. pRipToc = GetIPXTocEntry(
  590. (PIPX_INFO_BLOCK_HEADER)pIfBlock,
  591. IPX_PROTOCOL_RIP
  592. );
  593. if (pRipToc != NULL)
  594. {
  595. PRIP_IF_CONFIG pRipCfg;
  596. PWCHAR buffer[4];
  597. DWORD i;
  598. pRipCfg = (PRIP_IF_CONFIG)
  599. (pIfBlock + pRipToc->Offset);
  600. //======================================
  601. // Translate the Interface Name
  602. //======================================
  603. rc = IpmontrGetFriendlyNameFromIfName(
  604. InterfaceNameW, IfName, &dwSize
  605. );
  606. if ( rc == NO_ERROR )
  607. {
  608. buffer[ 0 ] = GetEnumString(
  609. g_hModule, pRipCfg->RipIfInfo.AdminState,
  610. NUM_TOKENS_IN_TABLE( AdminStates ),
  611. AdminStates
  612. );
  613. buffer[ 1 ] = GetEnumString(
  614. g_hModule, pRipCfg->RipIfInfo.Supply,
  615. NUM_TOKENS_IN_TABLE( AdminStates ),
  616. AdminStates
  617. );
  618. buffer[ 2 ] = GetEnumString(
  619. g_hModule, pRipCfg->RipIfInfo.Listen,
  620. NUM_TOKENS_IN_TABLE( AdminStates ),
  621. AdminStates
  622. );
  623. buffer[ 3 ] = GetEnumString(
  624. g_hModule, pRipCfg->RipIfInfo.UpdateMode,
  625. NUM_TOKENS_IN_TABLE( UpdateModes ),
  626. UpdateModes
  627. );
  628. //======================================
  629. if ( buffer [ 0 ] && buffer[ 1 ] && buffer[ 2 ] &&
  630. buffer[ 3 ] )
  631. {
  632. if ( hFile )
  633. {
  634. DisplayMessageT(
  635. DMP_IPX_RIP_SET_INTERFACE, IfName,
  636. buffer[ 0 ], buffer[1], buffer[ 2 ],
  637. buffer[3], pRipCfg->RipIfInfo.PeriodicUpdateInterval,
  638. pRipCfg->RipIfInfo.AgeIntervalMultiplier
  639. );
  640. }
  641. else
  642. {
  643. DisplayIPXMessage(
  644. g_hModule, MSG_RIPIF_CFG_SCREEN_FMT,
  645. IfName, buffer[0], buffer[1],
  646. buffer[2], buffer[3],
  647. pRipCfg->RipIfInfo.PeriodicUpdateInterval,
  648. pRipCfg->RipIfInfo.AgeIntervalMultiplier
  649. );
  650. }
  651. }
  652. else
  653. {
  654. rc = ERROR_NOT_ENOUGH_MEMORY;
  655. if ( !hFile ) { DisplayError( g_hModule, rc ); }
  656. }
  657. }
  658. else
  659. {
  660. if ( !hFile ) { DisplayError( g_hModule, rc ); }
  661. }
  662. }
  663. else
  664. {
  665. if ( !hFile ) { DisplayIPXMessage (g_hModule, MSG_INTERFACE_INFO_CORRUPTED); }
  666. rc = ERROR_INVALID_DATA;
  667. }
  668. }
  669. else
  670. {
  671. if ( !hFile ) { DisplayError( g_hModule, rc); }
  672. }
  673. }
  674. else
  675. {
  676. if ( !hFile ) { DisplayError( g_hModule, rc); }
  677. }
  678. }
  679. else
  680. {
  681. if ( !hFile ) { DisplayError( g_hModule, rc); }
  682. }
  683. return rc;
  684. }
  685. DWORD
  686. GetRipClientIf(
  687. LPWSTR InterfaceName,
  688. UINT msg,
  689. HANDLE hFile
  690. )
  691. {
  692. DWORD rc;
  693. LPBYTE pClBlock;
  694. HANDLE hTrCfg;
  695. DWORD sz;
  696. hTrCfg = NULL;
  697. if (g_hMprAdmin)
  698. {
  699. rc = MprAdminTransportGetInfo(
  700. g_hMprAdmin, PID_IPX, NULL, NULL, &pClBlock, &sz
  701. );
  702. if (rc == NO_ERROR)
  703. {
  704. NOTHING;
  705. }
  706. else
  707. {
  708. if ( !hFile ) { DisplayError( g_hModule, rc); }
  709. goto GetFromCfg;
  710. }
  711. }
  712. else
  713. {
  714. GetFromCfg:
  715. rc = MprConfigTransportGetHandle(
  716. g_hMprConfig, PID_IPX, &hTrCfg
  717. );
  718. if (rc == NO_ERROR)
  719. {
  720. rc = MprConfigTransportGetInfo(
  721. g_hMprConfig, hTrCfg, NULL, NULL, &pClBlock, &sz, NULL
  722. );
  723. if (rc == NO_ERROR)
  724. {
  725. NOTHING;
  726. }
  727. else
  728. {
  729. if ( !hFile ) { DisplayError( g_hModule, rc); }
  730. }
  731. }
  732. else
  733. {
  734. if ( !hFile ) { DisplayError( g_hModule, rc); }
  735. }
  736. }
  737. if (rc == NO_ERROR)
  738. {
  739. PIPX_TOC_ENTRY pRipToc;
  740. pRipToc = GetIPXTocEntry(
  741. (PIPX_INFO_BLOCK_HEADER)pClBlock,
  742. IPX_PROTOCOL_RIP
  743. );
  744. if ( pRipToc != NULL )
  745. {
  746. PRIP_IF_CONFIG pRipCfg;
  747. PWCHAR buffer[4];
  748. DWORD i;
  749. pRipCfg = (PRIP_IF_CONFIG)
  750. (pClBlock + pRipToc->Offset);
  751. buffer[ 0 ] = GetEnumString(
  752. g_hModule, pRipCfg->RipIfInfo.AdminState,
  753. NUM_TOKENS_IN_TABLE( AdminStates ),
  754. AdminStates
  755. );
  756. buffer[ 1 ] = GetEnumString(
  757. g_hModule, pRipCfg->RipIfInfo.Supply,
  758. NUM_TOKENS_IN_TABLE( AdminStates ),
  759. AdminStates
  760. );
  761. buffer[ 2 ] = GetEnumString(
  762. g_hModule, pRipCfg->RipIfInfo.Listen,
  763. NUM_TOKENS_IN_TABLE( AdminStates ),
  764. AdminStates
  765. );
  766. buffer[ 3 ] = GetEnumString(
  767. g_hModule, pRipCfg->RipIfInfo.UpdateMode,
  768. NUM_TOKENS_IN_TABLE( UpdateModes ),
  769. UpdateModes
  770. );
  771. switch (msg)
  772. {
  773. case MSG_CLIENT_RIPIF_MIB_TABLE_FMT:
  774. case MSG_CLIENT_RIPIF_CFG_TABLE_FMT:
  775. if ( buffer[ 3 ] && buffer[ 0 ] )
  776. {
  777. DisplayIPXMessage(
  778. g_hModule, msg, InterfaceName,
  779. buffer[3], buffer[0]
  780. );
  781. }
  782. else
  783. {
  784. rc = ERROR_NOT_ENOUGH_MEMORY;
  785. DisplayError( g_hModule, rc );
  786. }
  787. break;
  788. case MSG_CLIENT_RIPIF_MIB_SCREEN_FMT:
  789. case MSG_CLIENT_RIPIF_CFG_SCREEN_FMT:
  790. if ( buffer[ 0 ] && buffer[ 1 ] && buffer[ 2 ] && buffer[ 3 ] )
  791. {
  792. if ( hFile )
  793. {
  794. DisplayMessageT(
  795. DMP_IPX_RIP_SET_INTERFACE, InterfaceName,
  796. buffer[ 0 ], buffer[1], buffer[ 2 ],
  797. buffer[3], pRipCfg->RipIfInfo.PeriodicUpdateInterval,
  798. pRipCfg->RipIfInfo.AgeIntervalMultiplier
  799. );
  800. }
  801. else
  802. {
  803. DisplayIPXMessage(
  804. g_hModule, msg, InterfaceName,
  805. buffer[0], buffer[1], buffer[2], buffer[3],
  806. pRipCfg->RipIfInfo.PeriodicUpdateInterval,
  807. pRipCfg->RipIfInfo.AgeIntervalMultiplier
  808. );
  809. }
  810. }
  811. else
  812. {
  813. rc = ERROR_NOT_ENOUGH_MEMORY;
  814. if ( !hFile ) { DisplayError( g_hModule, rc ); }
  815. }
  816. break;
  817. }
  818. }
  819. else
  820. {
  821. if ( !hFile ) { DisplayIPXMessage (g_hModule, MSG_INTERFACE_INFO_CORRUPTED); }
  822. rc = ERROR_INVALID_DATA;
  823. }
  824. if (hTrCfg != NULL)
  825. {
  826. MprConfigBufferFree (pClBlock);
  827. }
  828. else
  829. {
  830. MprAdminBufferFree (pClBlock);
  831. }
  832. }
  833. return rc;
  834. }
  835. /*
  836. BOOL IsIpxRipInterface(HANDLE hIf) {
  837. LPBYTE pIfBlock;
  838. DWORD dwSize;
  839. DWORD dwErr;
  840. BOOL ret;
  841. PIPX_TOC_ENTRY pRipToc;
  842. dwErr = MprAdminInterfaceTransportGetInfo(
  843. g_hMprAdmin,
  844. hIf,
  845. PID_IPX,
  846. &pIfBlock,
  847. &dwSize);
  848. if (dwErr==NO_ERROR)
  849. ret=TRUE;
  850. else
  851. ret=FALSE;
  852. if (ret) {
  853. pRipToc = GetIPXTocEntry((PIPX_INFO_BLOCK_HEADER)pIfBlock,IPX_PROTOCOL_RIP);
  854. if (pRipToc!=NULL)
  855. ret=TRUE;
  856. else
  857. ret=FALSE;
  858. }
  859. MprAdminBufferFree(pIfBlock);
  860. return ret;
  861. }
  862. DWORD
  863. MIBEnumRipIfs (VOID) {
  864. PMPR_INTERFACE_0 IfList=NULL;
  865. DWORD dwErr=0, dwRead, dwTot,i;
  866. WCHAR buffer[4][MAX_VALUE];
  867. DisplayIPXMessage (g_hModule, MSG_RIPIF_MIB_TABLE_HDR);
  868. dwErr=MprAdminInterfaceEnum(g_hMprAdmin,0,(unsigned char **)&IfList,4096,&dwRead,&dwTot,NULL);
  869. if (dwErr!=NO_ERROR)
  870. return dwErr;
  871. for (i=0; i<dwRead; i++) {
  872. if (IsIpxRipInterface(IfList[i].hInterface)) {
  873. //======================================
  874. // Translate the Interface Name
  875. //======================================
  876. if ((dwErr=(*(Params->IfName2DescW))(IfList[i].wszInterfaceName,
  877. Params->IfNamBuffer,
  878. &Params->IfNamBufferLength)) != NO_ERROR) {
  879. return dwErr;
  880. }
  881. wcstombs(Params->IfNamBufferA,Params->IfNamBuffer,Params->IfNamBufferLength);
  882. //======================================
  883. //printf("Ifname= %s\n",Params->IfNamBufferA);
  884. DisplayIPXMessage (g_hModule,
  885. MSG_RIPIF_MIB_TABLE_FMT,
  886. GetValueString (g_hModule, Utils, InterfaceStates,
  887. IfList[i].dwConnectionState, buffer[3]),
  888. GetValueString (g_hModule, Utils, InterfaceEnableStatus,
  889. IfList[i].fEnabled ? 0 : 1, buffer[2]),
  890. GetValueString (g_hModule, Utils, InterfaceTypes,
  891. IfList[i].dwIfType, buffer[0]),
  892. Params->IfNamBufferA);
  893. }
  894. }
  895. return NO_ERROR;
  896. }
  897. */
  898. /*
  899. DWORD
  900. MIBEnumRipIfs (
  901. VOID
  902. ) {
  903. DWORD rc;
  904. DWORD sz;
  905. RIP_MIB_GET_INPUT_DATA MibGetInputData;
  906. PRIP_INTERFACE pIf;
  907. DisplayIPXMessage (g_hModule, MSG_RIPIF_MIB_TABLE_HDR);
  908. MibGetInputData.TableId = RIP_INTERFACE_TABLE;
  909. rc = MprAdminMIBEntryGetFirst (
  910. g_hMIBServer,
  911. PID_IPX,
  912. IPX_PROTOCOL_RIP,
  913. &MibGetInputData,
  914. sizeof(RIP_MIB_GET_INPUT_DATA),
  915. (LPVOID *)&pIf,
  916. &sz);
  917. while (rc==NO_ERROR) {
  918. //CHAR InterfaceNameA[IPX_INTERFACE_ANSI_NAME_LEN+1];
  919. CHAR InterfaceNameA[MAX_INTERFACE_NAME_LEN+1];
  920. DWORD rc1;
  921. //rc1 = GetIpxInterfaceName (g_hMIBServer,
  922. // pIf->InterfaceIndex,
  923. // InterfaceNameA);
  924. rc1=(*(Params->IfInd2IfNameA))(pIf->InterfaceIndex, InterfaceNameA, &(Params->IfNamBufferLength));
  925. if (rc1==NO_ERROR) {
  926. WCHAR buffer[3][MAX_VALUE];
  927. HANDLE hIfCfg;
  928. WCHAR InterfaceNameW[MAX_INTERFACE_NAME_LEN+1];
  929. mbstowcs (InterfaceNameW, InterfaceNameA, sizeof (InterfaceNameW));
  930. if (MprConfigInterfaceGetHandle (
  931. g_hMprConfig,
  932. InterfaceNameW,
  933. &hIfCfg)==NO_ERROR) {
  934. //======================================
  935. // Translate the Interface Name
  936. //======================================
  937. if ((rc=(*(Params->IfName2DescA))(InterfaceNameA,
  938. Params->IfNamBufferA,
  939. &Params->IfNamBufferLength)) != NO_ERROR) {
  940. return rc;
  941. }
  942. //======================================
  943. DisplayIPXMessage (g_hModule,
  944. MSG_RIPIF_MIB_TABLE_FMT,
  945. Params->IfNamBufferA, //InterfaceNameA,
  946. GetValueString (g_hModule, Utils, UpdateModes,
  947. pIf->RipIfInfo.UpdateMode, buffer[0]),
  948. GetValueString (g_hModule, Utils, AdminStates,
  949. pIf->RipIfInfo.AdminState, buffer[1]),
  950. GetValueString (g_hModule, Utils, OperStates,
  951. pIf->RipIfStats.RipIfOperState, buffer[2])
  952. );
  953. }
  954. }
  955. else
  956. DisplayError( g_hModule, rc1);
  957. MibGetInputData.InterfaceIndex
  958. = pIf->InterfaceIndex;
  959. MprAdminMIBBufferFree (pIf);
  960. rc = MprAdminMIBEntryGetNext (
  961. g_hMIBServer,
  962. PID_IPX,
  963. IPX_PROTOCOL_RIP,
  964. &MibGetInputData,
  965. sizeof(RIP_MIB_GET_INPUT_DATA),
  966. (LPVOID *)&pIf,
  967. &sz);
  968. }
  969. if (rc==ERROR_NO_MORE_ITEMS)
  970. return NO_ERROR;
  971. else {
  972. DisplayError( g_hModule, rc);
  973. return rc;
  974. }
  975. }
  976. */
  977. PRIP_IF_CONFIG
  978. GetIpxRipInterface(
  979. HANDLE hIf,
  980. LPBYTE *pIfBlock
  981. )
  982. {
  983. DWORD dwSize;
  984. DWORD dwErr;
  985. PIPX_TOC_ENTRY pIpxToc;
  986. dwErr = MprAdminInterfaceTransportGetInfo(
  987. g_hMprAdmin, hIf, PID_IPX, pIfBlock, &dwSize
  988. );
  989. if (dwErr != NO_ERROR)
  990. {
  991. return NULL;
  992. }
  993. pIpxToc = GetIPXTocEntry(
  994. (PIPX_INFO_BLOCK_HEADER)(*pIfBlock),
  995. IPX_PROTOCOL_RIP
  996. );
  997. if (!pIpxToc)
  998. {
  999. return NULL;
  1000. }
  1001. return (PRIP_IF_CONFIG)((*pIfBlock) + (pIpxToc->Offset));
  1002. }
  1003. DWORD
  1004. MIBEnumRipIfs (
  1005. VOID
  1006. )
  1007. {
  1008. PMPR_INTERFACE_0 IfList = NULL;
  1009. DWORD dwErr = 0, dwRead, dwTot, i, j, rc;
  1010. PWCHAR buffer[4];
  1011. LPBYTE buf = NULL;
  1012. WCHAR IfName[ MAX_INTERFACE_NAME_LEN + 1 ];
  1013. PRIP_IF_CONFIG pRipCfg;
  1014. DWORD dwSize = sizeof(IfName);
  1015. DisplayIPXMessage (g_hModule, MSG_RIPIF_MIB_TABLE_HDR);
  1016. dwErr = MprAdminInterfaceEnum(
  1017. g_hMprAdmin, 0, (unsigned char **) & IfList,
  1018. MAXULONG, &dwRead, &dwTot, NULL
  1019. );
  1020. if (dwErr != NO_ERROR)
  1021. {
  1022. return dwErr;
  1023. }
  1024. for (i = 0; i < dwRead; i++)
  1025. {
  1026. if ( (pRipCfg = GetIpxRipInterface(IfList[i].hInterface, &buf)) != NULL )
  1027. {
  1028. //======================================
  1029. // Translate the Interface Name
  1030. //======================================
  1031. dwErr = IpmontrGetFriendlyNameFromIfName(
  1032. IfList[i].wszInterfaceName,
  1033. IfName, &dwSize
  1034. );
  1035. if ( dwErr == NO_ERROR )
  1036. {
  1037. buffer[ 0 ] = GetEnumString(
  1038. g_hModule, pRipCfg->RipIfInfo.AdminState,
  1039. NUM_TOKENS_IN_TABLE( AdminStates ),
  1040. AdminStates
  1041. );
  1042. buffer[ 1 ] = GetEnumString(
  1043. g_hModule, pRipCfg->RipIfInfo.UpdateMode,
  1044. NUM_TOKENS_IN_TABLE( UpdateModes ),
  1045. UpdateModes
  1046. );
  1047. buffer[ 2 ] = GetEnumString(
  1048. g_hModule, IfList[i].dwConnectionState,
  1049. NUM_TOKENS_IN_TABLE( InterfaceStates ),
  1050. InterfaceStates
  1051. );
  1052. if ( buffer[ 0 ] && buffer[ 1 ] && buffer[ 2 ] )
  1053. {
  1054. DisplayIPXMessage(
  1055. g_hModule, MSG_RIPIF_MIB_TABLE_FMT,
  1056. buffer[ 2 ], buffer[ 0 ], buffer[ 1 ],
  1057. IfName
  1058. );
  1059. }
  1060. else
  1061. {
  1062. rc = ERROR_NOT_ENOUGH_MEMORY;
  1063. DisplayError( g_hModule, rc );
  1064. }
  1065. }
  1066. else
  1067. {
  1068. DisplayError( g_hModule, rc );
  1069. }
  1070. }
  1071. if (buf)
  1072. {
  1073. MprAdminBufferFree(buf);
  1074. }
  1075. buf = NULL;
  1076. }
  1077. return NO_ERROR;
  1078. }
  1079. DWORD
  1080. CfgEnumRipIfs (
  1081. VOID
  1082. )
  1083. {
  1084. DWORD rc = NO_ERROR;
  1085. DWORD read, total, processed = 0, i;
  1086. DWORD hResume = 0;
  1087. DWORD sz;
  1088. PMPR_INTERFACE_0 pRi0;
  1089. WCHAR IfName[ MAX_INTERFACE_NAME_LEN + 1 ];
  1090. DWORD dwSize = sizeof(IfName);
  1091. DisplayIPXMessage (g_hModule, MSG_RIPIF_CFG_TABLE_HDR);
  1092. do
  1093. {
  1094. rc = MprConfigInterfaceEnum (
  1095. g_hMprConfig, 0, (LPBYTE * ) & pRi0, MAXULONG, &read,
  1096. &total, &hResume
  1097. );
  1098. if (rc == NO_ERROR)
  1099. {
  1100. for (i = 0; i < read; i++)
  1101. {
  1102. HANDLE hIfTrCfg;
  1103. rc = MprConfigInterfaceTransportGetHandle (
  1104. g_hMprConfig, pRi0[i].hInterface, PID_IPX, &hIfTrCfg
  1105. );
  1106. if (rc == NO_ERROR)
  1107. {
  1108. LPBYTE pIfBlock;
  1109. rc = MprConfigInterfaceTransportGetInfo(
  1110. g_hMprConfig, pRi0[i].hInterface, hIfTrCfg,
  1111. &pIfBlock, &sz
  1112. );
  1113. if (rc == NO_ERROR)
  1114. {
  1115. PIPX_TOC_ENTRY pRipToc;
  1116. pRipToc = GetIPXTocEntry(
  1117. (PIPX_INFO_BLOCK_HEADER)pIfBlock,
  1118. IPX_PROTOCOL_RIP
  1119. );
  1120. if (pRipToc != NULL)
  1121. {
  1122. PRIP_IF_CONFIG pRipCfg;
  1123. PWCHAR buffer[2];
  1124. pRipCfg = (PRIP_IF_CONFIG)
  1125. (pIfBlock + pRipToc->Offset);
  1126. //======================================
  1127. // Translate the Interface Name
  1128. //======================================
  1129. rc = IpmontrGetFriendlyNameFromIfName(
  1130. pRi0[i].wszInterfaceName,
  1131. IfName, &dwSize
  1132. );
  1133. if ( rc == NO_ERROR )
  1134. {
  1135. buffer[ 0 ] = GetEnumString(
  1136. g_hModule, pRipCfg->RipIfInfo.AdminState,
  1137. NUM_TOKENS_IN_TABLE( AdminStates ),
  1138. AdminStates
  1139. );
  1140. buffer[ 1 ] = GetEnumString(
  1141. g_hModule, pRipCfg->RipIfInfo.UpdateMode,
  1142. NUM_TOKENS_IN_TABLE( UpdateModes ),
  1143. UpdateModes
  1144. );
  1145. if ( buffer [ 0 ] && buffer [ 1 ] )
  1146. {
  1147. DisplayIPXMessage(
  1148. g_hModule, MSG_RIPIF_CFG_TABLE_FMT,
  1149. buffer[ 0 ], buffer[ 1 ],
  1150. IfName
  1151. );
  1152. }
  1153. else
  1154. {
  1155. rc = ERROR_NOT_ENOUGH_MEMORY;
  1156. DisplayError( g_hModule, rc );
  1157. }
  1158. }
  1159. else
  1160. {
  1161. DisplayError( g_hModule, rc );
  1162. }
  1163. }
  1164. else
  1165. {
  1166. DisplayIPXMessage (g_hModule, MSG_INTERFACE_INFO_CORRUPTED);
  1167. rc = ERROR_INVALID_DATA;
  1168. }
  1169. }
  1170. else
  1171. {
  1172. DisplayError( g_hModule, rc);
  1173. }
  1174. }
  1175. else
  1176. {
  1177. //DisplayError( g_hModule, rc);
  1178. }
  1179. }
  1180. processed += read;
  1181. MprConfigBufferFree (pRi0);
  1182. }
  1183. else
  1184. {
  1185. DisplayError( g_hModule, rc);
  1186. break;
  1187. }
  1188. } while (processed < total);
  1189. return rc;
  1190. }
  1191. DWORD
  1192. CfgSetRipIf (
  1193. LPWSTR InterfaceNameW,
  1194. PULONG pAdminState OPTIONAL,
  1195. PULONG pAdvertise OPTIONAL,
  1196. PULONG pListen OPTIONAL,
  1197. PULONG pUpdateMode OPTIONAL,
  1198. PULONG pInterval OPTIONAL,
  1199. PULONG pAgeMultiplier OPTIONAL,
  1200. PWCHAR IfName
  1201. )
  1202. {
  1203. DWORD rc;
  1204. DWORD sz;
  1205. HANDLE hTrCfg;
  1206. HANDLE hIfCfg;
  1207. HANDLE hIfTrCfg;
  1208. LPBYTE pIfBlock;
  1209. if (InterfaceNameW != NULL)
  1210. {
  1211. rc = MprConfigInterfaceGetHandle (
  1212. g_hMprConfig, InterfaceNameW, &hIfCfg
  1213. );
  1214. if (rc == NO_ERROR)
  1215. {
  1216. rc = MprConfigInterfaceTransportGetHandle (
  1217. g_hMprConfig, hIfCfg, PID_IPX, &hIfTrCfg
  1218. );
  1219. if (rc == NO_ERROR)
  1220. {
  1221. rc = MprConfigInterfaceTransportGetInfo(
  1222. g_hMprConfig, hIfCfg, hIfTrCfg, &pIfBlock, &sz
  1223. );
  1224. }
  1225. }
  1226. }
  1227. else
  1228. {
  1229. rc = MprConfigTransportGetHandle (
  1230. g_hMprConfig, PID_IPX, &hTrCfg
  1231. );
  1232. if (rc == NO_ERROR)
  1233. {
  1234. rc = MprConfigTransportGetInfo (
  1235. g_hMprConfig, hTrCfg, NULL, NULL, &pIfBlock, &sz, NULL
  1236. );
  1237. }
  1238. }
  1239. if (rc == NO_ERROR)
  1240. {
  1241. PIPX_TOC_ENTRY pRipToc;
  1242. pRipToc = GetIPXTocEntry (
  1243. (PIPX_INFO_BLOCK_HEADER)pIfBlock,
  1244. IPX_PROTOCOL_RIP
  1245. );
  1246. if (pRipToc != NULL)
  1247. {
  1248. PRIP_IF_CONFIG pRipCfg;
  1249. pRipCfg = (PRIP_IF_CONFIG)
  1250. (pIfBlock + pRipToc->Offset);
  1251. if (ARGUMENT_PRESENT (pAdminState))
  1252. {
  1253. pRipCfg->RipIfInfo.AdminState = *pAdminState;
  1254. }
  1255. if (ARGUMENT_PRESENT (pAdvertise))
  1256. {
  1257. pRipCfg->RipIfInfo.Supply = *pAdvertise;
  1258. }
  1259. if (ARGUMENT_PRESENT (pListen))
  1260. {
  1261. pRipCfg->RipIfInfo.Listen = *pListen;
  1262. }
  1263. if (ARGUMENT_PRESENT (pUpdateMode))
  1264. {
  1265. pRipCfg->RipIfInfo.UpdateMode = *pUpdateMode;
  1266. }
  1267. if (ARGUMENT_PRESENT (pInterval))
  1268. {
  1269. pRipCfg->RipIfInfo.PeriodicUpdateInterval = *pInterval;
  1270. }
  1271. if (ARGUMENT_PRESENT (pAgeMultiplier))
  1272. {
  1273. pRipCfg->RipIfInfo.AgeIntervalMultiplier = *pAgeMultiplier;
  1274. }
  1275. if (InterfaceNameW != NULL)
  1276. {
  1277. rc = MprConfigInterfaceTransportSetInfo (
  1278. g_hMprConfig, hIfCfg, hIfTrCfg, pIfBlock, sz
  1279. );
  1280. }
  1281. else
  1282. {
  1283. rc = MprConfigTransportSetInfo (
  1284. g_hMprConfig, hTrCfg, NULL, 0, pIfBlock, sz, NULL
  1285. );
  1286. }
  1287. if (rc == NO_ERROR)
  1288. {
  1289. if (InterfaceNameW != NULL)
  1290. {
  1291. DisplayIPXMessage (
  1292. g_hModule, MSG_RIPIF_SET_CFG, IfName
  1293. );
  1294. }
  1295. else
  1296. {
  1297. DisplayIPXMessage (
  1298. g_hModule, MSG_CLIENT_RIPIF_SET_CFG
  1299. );
  1300. }
  1301. }
  1302. else
  1303. {
  1304. DisplayError( g_hModule, rc);
  1305. }
  1306. }
  1307. else
  1308. {
  1309. DisplayIPXMessage (g_hModule, MSG_INTERFACE_INFO_CORRUPTED);
  1310. rc = ERROR_INVALID_DATA;
  1311. }
  1312. MprConfigBufferFree (pIfBlock);
  1313. }
  1314. else
  1315. {
  1316. DisplayError( g_hModule, rc);
  1317. }
  1318. return rc;
  1319. }
  1320. DWORD
  1321. AdmSetRipIf (
  1322. LPWSTR InterfaceNameW,
  1323. PULONG pAdminState OPTIONAL,
  1324. PULONG pAdvertise OPTIONAL,
  1325. PULONG pListen OPTIONAL,
  1326. PULONG pUpdateMode OPTIONAL,
  1327. PULONG pInterval OPTIONAL,
  1328. PULONG pAgeMultiplier OPTIONAL,
  1329. PWCHAR IfName
  1330. )
  1331. {
  1332. DWORD rc;
  1333. DWORD sz;
  1334. HANDLE hIfAdm;
  1335. LPBYTE pIfBlock;
  1336. if (InterfaceNameW != NULL)
  1337. {
  1338. rc = MprAdminInterfaceGetHandle (
  1339. g_hMprAdmin, InterfaceNameW, &hIfAdm, FALSE
  1340. );
  1341. if (rc == NO_ERROR)
  1342. {
  1343. rc = MprAdminInterfaceTransportGetInfo (
  1344. g_hMprAdmin, hIfAdm, PID_IPX, &pIfBlock, &sz
  1345. );
  1346. }
  1347. }
  1348. else
  1349. {
  1350. rc = MprAdminTransportGetInfo (
  1351. g_hMprAdmin, PID_IPX, NULL, NULL, &pIfBlock, &sz
  1352. );
  1353. }
  1354. if (rc == NO_ERROR)
  1355. {
  1356. PIPX_TOC_ENTRY pRipToc;
  1357. pRipToc = GetIPXTocEntry (
  1358. (PIPX_INFO_BLOCK_HEADER)pIfBlock,
  1359. IPX_PROTOCOL_RIP
  1360. );
  1361. if (pRipToc != NULL)
  1362. {
  1363. PRIP_IF_CONFIG pRipCfg;
  1364. pRipCfg = (PRIP_IF_CONFIG)
  1365. (pIfBlock + pRipToc->Offset);
  1366. if (ARGUMENT_PRESENT (pAdminState))
  1367. {
  1368. pRipCfg->RipIfInfo.AdminState = *pAdminState;
  1369. }
  1370. if (ARGUMENT_PRESENT (pAdvertise))
  1371. {
  1372. pRipCfg->RipIfInfo.Supply = *pAdvertise;
  1373. }
  1374. if (ARGUMENT_PRESENT (pListen))
  1375. {
  1376. pRipCfg->RipIfInfo.Listen = *pListen;
  1377. }
  1378. if (ARGUMENT_PRESENT (pUpdateMode))
  1379. {
  1380. pRipCfg->RipIfInfo.UpdateMode = *pUpdateMode;
  1381. }
  1382. if (ARGUMENT_PRESENT (pInterval))
  1383. {
  1384. pRipCfg->RipIfInfo.PeriodicUpdateInterval = *pInterval;
  1385. }
  1386. if (ARGUMENT_PRESENT (pAgeMultiplier))
  1387. {
  1388. pRipCfg->RipIfInfo.AgeIntervalMultiplier = *pAgeMultiplier;
  1389. }
  1390. if (InterfaceNameW != NULL)
  1391. {
  1392. rc = MprAdminInterfaceTransportSetInfo (
  1393. g_hMprAdmin,
  1394. hIfAdm,
  1395. PID_IPX,
  1396. pIfBlock,
  1397. ((PIPX_INFO_BLOCK_HEADER)pIfBlock)->Size
  1398. );
  1399. }
  1400. else
  1401. {
  1402. rc = MprAdminTransportSetInfo (
  1403. g_hMprAdmin,
  1404. PID_IPX,
  1405. NULL, 0,
  1406. pIfBlock,
  1407. ((PIPX_INFO_BLOCK_HEADER)pIfBlock)->Size
  1408. );
  1409. }
  1410. if (rc == NO_ERROR)
  1411. {
  1412. if (InterfaceNameW != NULL)
  1413. {
  1414. DisplayIPXMessage (
  1415. g_hModule, MSG_RIPIF_SET_ADM, IfName
  1416. );
  1417. }
  1418. else
  1419. {
  1420. DisplayIPXMessage(
  1421. g_hModule, MSG_CLIENT_RIPIF_SET_ADM
  1422. );
  1423. }
  1424. }
  1425. else
  1426. {
  1427. DisplayError( g_hModule, rc);
  1428. }
  1429. }
  1430. else
  1431. {
  1432. DisplayIPXMessage (g_hModule, MSG_INTERFACE_INFO_CORRUPTED);
  1433. rc = ERROR_INVALID_DATA;
  1434. }
  1435. MprAdminBufferFree (pIfBlock);
  1436. }
  1437. else
  1438. {
  1439. DisplayError( g_hModule, rc);
  1440. }
  1441. return rc;
  1442. }