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.

1522 lines
54 KiB

  1. /*++
  2. Copyright (c) 1996 Microsoft Corporation
  3. Module Name:
  4. nipxf.c
  5. Abstract:
  6. Novell-ipx instrumentation callbacks.
  7. Author:
  8. Vadim Eydelman (vadime) 30-May-1996
  9. Revision History:
  10. --*/
  11. #include "precomp.h"
  12. ///////////////////////////////////////////////////////////////////////////////
  13. // //
  14. // nipxSystem group (1.3.6.1.4.1.23.2.5.1) //
  15. // //
  16. ///////////////////////////////////////////////////////////////////////////////
  17. ///////////////////////////////////////////////////////////////////////////////
  18. // //
  19. // nipxBasicSysEntry table (1.3.6.1.4.1.23.2.5.1.1.1) //
  20. // //
  21. ///////////////////////////////////////////////////////////////////////////////
  22. UINT
  23. get_nipxBasicSysEntry(
  24. UINT actionId,
  25. AsnAny * objectArray,
  26. UINT * errorIndex
  27. ) {
  28. #define Bseb ((buf_nipxBasicSysEntry *)objectArray)
  29. IPX_MIB_GET_INPUT_DATA MibGetInputData;
  30. PIPXMIB_BASE Bep;
  31. DWORD rc;
  32. ULONG BeSize;
  33. if (!EnsureRouterConnection()) {
  34. *errorIndex = 0;
  35. return MIB_S_ENTRY_NOT_FOUND;
  36. }
  37. if (GetAsnInteger (&Bseb->nipxBasicSysInstance,NIPX_DEFAULT_SYS_INSTANCE)!=NIPX_DEFAULT_SYS_INSTANCE) {
  38. *errorIndex = 0;
  39. DbgTrace (DBG_NIPXBASICSYSENTRY, ("NIPX-BSE: ipxBasicSysInstance is not 0.\n"));
  40. return MIB_S_ENTRY_NOT_FOUND;
  41. }
  42. switch (actionId) {
  43. case MIB_ACTION_GETNEXT:
  44. if (!Bseb->nipxBasicSysInstance.asnType) {
  45. ForceAsnInteger (&Bseb->nipxBasicSysInstance, NIPX_DEFAULT_SYS_INSTANCE);
  46. rc = MIB_S_SUCCESS;
  47. }
  48. else {
  49. DbgTrace (DBG_NIPXBASICSYSENTRY,
  50. ("NIPX-BSE: End of table reached on GETFIRST/GETNEXT request for instance %ld.\n",
  51. GetAsnInteger (&Bseb->nipxBasicSysInstance,NIPX_INVALID_SYS_INSTANCE)));
  52. rc = MIB_S_NO_MORE_ENTRIES;
  53. break;
  54. }
  55. case MIB_ACTION_GET:
  56. MibGetInputData.TableId = IPX_BASE_ENTRY;
  57. rc = MprAdminMIBEntryGet(g_MibServerHandle,
  58. PID_IPX,
  59. IPX_PROTOCOL_BASE,
  60. &MibGetInputData,
  61. sizeof(IPX_MIB_GET_INPUT_DATA),
  62. &Bep,
  63. &BeSize);
  64. if (rc==NO_ERROR) {
  65. SetAsnInteger (&Bseb->nipxBasicSysExistState, NIPX_STATE_ON);
  66. SetAsnOctetString (&Bseb->nipxBasicSysNetNumber, Bseb->NetNumberVal,
  67. Bep->PrimaryNetNumber, sizeof (Bseb->NetNumberVal));
  68. SetAsnOctetString (&Bseb->nipxBasicSysNode, Bseb->NodeVal,
  69. Bep->Node, sizeof (Bseb->NodeVal));
  70. SetAsnDispString (&Bseb->nipxBasicSysName, Bseb->NameVal,
  71. Bep->SysName, sizeof (Bseb->NameVal));
  72. SetAsnCounter (&Bseb->nipxBasicSysInReceives, 0);
  73. SetAsnCounter (&Bseb->nipxBasicSysInHdrErrors, 0);
  74. SetAsnCounter (&Bseb->nipxBasicSysInUnknownSockets, 0);
  75. SetAsnCounter (&Bseb->nipxBasicSysInDiscards, 0);
  76. SetAsnCounter (&Bseb->nipxBasicSysInBadChecksums, 0);
  77. SetAsnCounter (&Bseb->nipxBasicSysInDelivers, 0);
  78. SetAsnCounter (&Bseb->nipxBasicSysNoRoutes, 0);
  79. SetAsnCounter (&Bseb->nipxBasicSysOutRequests, 0);
  80. SetAsnCounter (&Bseb->nipxBasicSysOutMalformedRequests, 0);
  81. SetAsnCounter (&Bseb->nipxBasicSysOutDiscards, 0);
  82. SetAsnCounter (&Bseb->nipxBasicSysOutPackets, 0);
  83. SetAsnCounter (&Bseb->nipxBasicSysConfigSockets, 0);
  84. SetAsnCounter (&Bseb->nipxBasicSysOpenSocketFails, 0);
  85. MprAdminMIBBufferFree (Bep);
  86. DbgTrace (DBG_NIPXBASICSYSENTRY, ("NIPX-BSE: Get request succeded.\n"));
  87. rc = MIB_S_SUCCESS;
  88. }
  89. else {
  90. //
  91. // pmay. Added this so mib walk wouldn't fail with
  92. // GENERR.
  93. //
  94. rc = MIB_S_NO_MORE_ENTRIES;
  95. }
  96. break;
  97. default:
  98. DbgTrace (DBG_NIPXBASICSYSENTRY,
  99. ("NIPX-BSE: Get called with unsupported action code %d.\n",
  100. actionId));
  101. rc = MIB_S_INVALID_PARAMETER;
  102. break;
  103. }
  104. return rc;
  105. #undef Bseb
  106. }
  107. /*
  108. All values in nipxBasicSysEntry are implemented as read-only
  109. UINT
  110. set_nipxBasicSysEntry(
  111. UINT actionId,
  112. AsnAny * objectArray,
  113. UINT * errorIndex
  114. ) {
  115. return MIB_S_ENTRY_NOT_FOUND;
  116. }
  117. */
  118. ///////////////////////////////////////////////////////////////////////////////
  119. // //
  120. // nipxAdvSysEntry table (1.3.6.1.4.1.23.2.5.1.2.1) //
  121. // //
  122. ///////////////////////////////////////////////////////////////////////////////
  123. UINT
  124. get_nipxAdvSysEntry(
  125. UINT actionId,
  126. AsnAny * objectArray,
  127. UINT * errorIndex
  128. ) {
  129. #define Aseb ((buf_nipxAdvSysEntry *)objectArray)
  130. IPX_MIB_GET_INPUT_DATA MibGetInputData;
  131. PIPXMIB_BASE Bep;
  132. DWORD rc;
  133. ULONG BeSize;
  134. if (!EnsureRouterConnection()) {
  135. *errorIndex = 0;
  136. return MIB_S_ENTRY_NOT_FOUND;
  137. }
  138. if (GetAsnInteger (&Aseb->nipxAdvSysInstance,NIPX_DEFAULT_SYS_INSTANCE)!=NIPX_DEFAULT_SYS_INSTANCE) {
  139. *errorIndex = 0;
  140. DbgTrace (DBG_NIPXADVSYSENTRY, ("NIPX-ASE: nipxAdvSysInstance is not 0.\n"));
  141. return MIB_S_ENTRY_NOT_FOUND;
  142. }
  143. switch (actionId) {
  144. case MIB_ACTION_GETNEXT:
  145. if (!Aseb->nipxAdvSysInstance.asnType) {
  146. ForceAsnInteger (&Aseb->nipxAdvSysInstance, NIPX_DEFAULT_SYS_INSTANCE);
  147. }
  148. else {
  149. DbgTrace (DBG_NIPXADVSYSENTRY,
  150. ("NIPX-ASE: End of table reached on GETFIRST/GETNEXT request for instance %ld.\n",
  151. GetAsnInteger (&Aseb->nipxAdvSysInstance,NIPX_INVALID_SYS_INSTANCE)));
  152. rc = MIB_S_NO_MORE_ENTRIES;
  153. break;
  154. }
  155. case MIB_ACTION_GET:
  156. MibGetInputData.TableId = IPX_BASE_ENTRY;
  157. rc = MprAdminMIBEntryGet(g_MibServerHandle,
  158. PID_IPX,
  159. IPX_PROTOCOL_BASE,
  160. &MibGetInputData,
  161. sizeof(IPX_MIB_GET_INPUT_DATA),
  162. &Bep,
  163. &BeSize);
  164. if (rc == NO_ERROR && Bep != NULL) {
  165. SetAsnInteger (&Aseb->nipxAdvSysMaxPathSplits, Bep->MaxPathSplits);
  166. SetAsnInteger (&Aseb->nipxAdvSysMaxHops, 16);
  167. SetAsnCounter (&Aseb->nipxAdvSysInTooManyHops, 0);
  168. SetAsnCounter (&Aseb->nipxAdvSysInFiltered, 0);
  169. SetAsnCounter (&Aseb->nipxAdvSysInCompressDiscards, 0);
  170. SetAsnCounter (&Aseb->nipxAdvSysNETBIOSPackets, 0);
  171. SetAsnCounter (&Aseb->nipxAdvSysForwPackets, 0);
  172. SetAsnCounter (&Aseb->nipxAdvSysOutFiltered, 0);
  173. SetAsnCounter (&Aseb->nipxAdvSysOutCompressDiscards, 0);
  174. SetAsnCounter (&Aseb->nipxAdvSysCircCount, Bep->IfCount);
  175. SetAsnCounter (&Aseb->nipxAdvSysDestCount, Bep->DestCount);
  176. SetAsnCounter (&Aseb->nipxAdvSysServCount, Bep->ServCount);
  177. MprAdminMIBBufferFree (Bep);
  178. DbgTrace (DBG_NIPXADVSYSENTRY, ("NIPX-ASE: Get request succeded.\n"));
  179. }
  180. else {
  181. //
  182. // pmay. Added this so mib walk wouldn't fail with
  183. // GENERR.
  184. //
  185. rc = MIB_S_NO_MORE_ENTRIES;
  186. }
  187. break;
  188. default:
  189. DbgTrace (DBG_NIPXADVSYSENTRY,
  190. ("NIPX-ASE: Get called with unsupported action code %d.\n",
  191. actionId));
  192. rc = MIB_S_INVALID_PARAMETER;
  193. break;
  194. }
  195. return rc;
  196. #undef Aseb
  197. }
  198. /*
  199. All values in nipxAdvSysEntry are implemented as read-only
  200. UINT
  201. set_nipxAdvSysEntry(
  202. UINT actionId,
  203. AsnAny * objectArray,
  204. UINT * errorIndex
  205. ) {
  206. return MIB_S_ENTRY_NOT_FOUND;
  207. }
  208. */
  209. ///////////////////////////////////////////////////////////////////////////////
  210. // //
  211. // nipxCircuit group (1.3.6.1.4.1.23.2.5.2) //
  212. // //
  213. ///////////////////////////////////////////////////////////////////////////////
  214. ///////////////////////////////////////////////////////////////////////////////
  215. // //
  216. // nipxCircEntry table (1.3.6.1.4.1.23.2.5.2.1.1) //
  217. // //
  218. ///////////////////////////////////////////////////////////////////////////////
  219. UINT
  220. get_nipxCircEntry(
  221. UINT actionId,
  222. AsnAny * objectArray,
  223. UINT * errorIndex
  224. ) {
  225. #define Ceb ((buf_nipxCircEntry *)objectArray)
  226. PIPX_INTERFACE Ifp;
  227. IPX_MIB_GET_INPUT_DATA MibGetInputData;
  228. DWORD rc;
  229. ULONG IfSize;
  230. if (!EnsureRouterConnection()) {
  231. *errorIndex = 0;
  232. return MIB_S_ENTRY_NOT_FOUND;
  233. }
  234. MibGetInputData.TableId = IPX_INTERFACE_TABLE;
  235. if (GetAsnInteger (&Ceb->nipxCircSysInstance, NIPX_DEFAULT_SYS_INSTANCE)!=NIPX_DEFAULT_SYS_INSTANCE) {
  236. *errorIndex = 0;
  237. DbgTrace (DBG_NIPXCIRCENTRY, ("NIPX-Circ: nipxCircSysInstance is not 0.\n"));
  238. return MIB_S_ENTRY_NOT_FOUND;
  239. }
  240. MibGetInputData.MibIndex.InterfaceTableIndex.InterfaceIndex
  241. = (ULONG)GetAsnInteger (&Ceb->nipxCircIndex, ZERO_INTERFACE_INDEX);
  242. switch (actionId) {
  243. case MIB_ACTION_GET:
  244. ASSERTMSG ("No index in GET request for table ",
  245. Ceb->nipxCircSysInstance.asnType
  246. &&Ceb->nipxCircIndex.asnType);
  247. rc = MprAdminMIBEntryGet(g_MibServerHandle,
  248. PID_IPX,
  249. IPX_PROTOCOL_BASE,
  250. &MibGetInputData,
  251. sizeof(IPX_MIB_GET_INPUT_DATA),
  252. &Ifp,
  253. &IfSize);
  254. break;
  255. case MIB_ACTION_GETNEXT:
  256. if (Ceb->nipxCircIndex.asnType) {
  257. ASSERTMSG ("Second index is present but first is not ",
  258. Ceb->nipxCircSysInstance.asnType);
  259. rc = MprAdminMIBEntryGetNext(g_MibServerHandle,
  260. PID_IPX,
  261. IPX_PROTOCOL_BASE,
  262. &MibGetInputData,
  263. sizeof(IPX_MIB_GET_INPUT_DATA),
  264. &Ifp,
  265. &IfSize);
  266. }
  267. else
  268. rc = MprAdminMIBEntryGetFirst(g_MibServerHandle,
  269. PID_IPX,
  270. IPX_PROTOCOL_BASE,
  271. &MibGetInputData,
  272. sizeof(IPX_MIB_GET_INPUT_DATA),
  273. &Ifp,
  274. &IfSize);
  275. break;
  276. default:
  277. DbgTrace (DBG_NIPXCIRCENTRY,
  278. ("NIPX-Circ: Get called with unsupported action code %d.\n",
  279. actionId));
  280. return MIB_S_INVALID_PARAMETER;
  281. }
  282. if (rc == NO_ERROR && Ifp == NULL)
  283. {
  284. rc = ERROR_CAN_NOT_COMPLETE;
  285. }
  286. switch (rc) {
  287. case NO_ERROR:
  288. DbgTrace (DBG_NIPXCIRCENTRY, ("NIPX-Circ: Get(%d) request succeded for if %ld->%ld.\n",
  289. actionId,
  290. MibGetInputData.MibIndex.InterfaceTableIndex.InterfaceIndex,
  291. Ifp->InterfaceIndex));
  292. ForceAsnInteger (&Ceb->nipxCircSysInstance, NIPX_DEFAULT_SYS_INSTANCE);
  293. ForceAsnInteger (&Ceb->nipxCircIndex, Ifp->InterfaceIndex);
  294. SetAsnInteger (&Ceb->nipxCircExistState, NIPX_STATE_ON);
  295. SetAsnInteger (&Ceb->nipxCircOperState, Ifp->IfStats.IfOperState);
  296. SetAsnInteger (&Ceb->nipxCircIfIndex, Ifp->AdapterIndex);
  297. SetAsnDispString (&Ceb->nipxCircName, Ceb->NameVal,
  298. Ifp->InterfaceName, sizeof (Ceb->NameVal));
  299. switch (Ifp->InterfaceType) {
  300. case IF_TYPE_OTHER:
  301. case IF_TYPE_INTERNAL:
  302. SetAsnInteger (&Ceb->nipxCircType, NIPX_CIRCTYPE_OTHER);
  303. SetAsnDispString (&Ceb->nipxCircDialName, Ceb->DialNameVal,
  304. "", sizeof (Ceb->DialNameVal));
  305. break;
  306. case IF_TYPE_LAN:
  307. SetAsnInteger (&Ceb->nipxCircType, NIPX_CIRCTYPE_BCAST);
  308. SetAsnDispString (&Ceb->nipxCircDialName, Ceb->DialNameVal,
  309. "", sizeof (Ceb->DialNameVal));
  310. SetAsnDispString (&Ceb->nipxCircNeighRouterName, Ceb->NeighRouterNameVal,
  311. "", sizeof (Ceb->NeighRouterNameVal));
  312. break;
  313. case IF_TYPE_WAN_ROUTER:
  314. case IF_TYPE_PERSONAL_WAN_ROUTER:
  315. SetAsnInteger (&Ceb->nipxCircType, NIPX_CIRCTYPE_DYNAMIC);
  316. SetAsnDispString (&Ceb->nipxCircDialName, Ceb->DialNameVal,
  317. Ifp->InterfaceName, sizeof (Ceb->DialNameVal));
  318. SetAsnDispString (&Ceb->nipxCircNeighRouterName, Ceb->NeighRouterNameVal,
  319. Ifp->InterfaceName, sizeof (Ceb->NeighRouterNameVal));
  320. break;
  321. case IF_TYPE_WAN_WORKSTATION:
  322. case IF_TYPE_ROUTER_WORKSTATION_DIALOUT:
  323. case IF_TYPE_STANDALONE_WORKSTATION_DIALOUT:
  324. SetAsnInteger (&Ceb->nipxCircType, NIPX_CIRCTYPE_WANWS);
  325. SetAsnDispString (&Ceb->nipxCircDialName, Ceb->DialNameVal,
  326. Ifp->InterfaceName, sizeof (Ceb->DialNameVal));
  327. SetAsnDispString (&Ceb->nipxCircNeighRouterName, Ceb->NeighRouterNameVal,
  328. "", sizeof (Ceb->NeighRouterNameVal));
  329. break;
  330. }
  331. SetAsnInteger (&Ceb->nipxCircLocalMaxPacketSize, Ifp->IfStats.MaxPacketSize);
  332. SetAsnInteger (&Ceb->nipxCircCompressState, NIPX_STATE_OFF);
  333. SetAsnInteger (&Ceb->nipxCircCompressSlots, 16);
  334. SetAsnInteger (&Ceb->nipxCircStaticStatus, NIPX_STATIC_STATUS_UNKNOWN);
  335. SetAsnCounter (&Ceb->nipxCircCompressedSent, 0);
  336. SetAsnCounter (&Ceb->nipxCircCompressedInitSent, 0);
  337. SetAsnCounter (&Ceb->nipxCircCompressedRejectsSent, 0);
  338. SetAsnCounter (&Ceb->nipxCircUncompressedSent, 0);
  339. SetAsnCounter (&Ceb->nipxCircCompressedReceived, 0);
  340. SetAsnCounter (&Ceb->nipxCircCompressedInitReceived, 0);
  341. SetAsnCounter (&Ceb->nipxCircCompressedRejectsReceived, 0);
  342. SetAsnCounter (&Ceb->nipxCircUncompressedReceived, 0);
  343. SetAsnMediaType (&Ceb->nipxCircMediaType, Ceb->MediaTypeVal, Ifp->MediaType);
  344. SetAsnOctetString (&Ceb->nipxCircNetNumber, Ceb->NetNumberVal,
  345. Ifp->NetNumber, sizeof (Ceb->NetNumberVal));
  346. SetAsnCounter (&Ceb->nipxCircStateChanges, 0);
  347. SetAsnCounter (&Ceb->nipxCircInitFails, 0);
  348. SetAsnInteger (&Ceb->nipxCircDelay, Ifp->Delay);
  349. SetAsnInteger (&Ceb->nipxCircThroughput, Ifp->Throughput);
  350. SetAsnOctetString (&Ceb->nipxCircNeighInternalNetNum, Ceb->NeighInternalNetNumVal,
  351. ZERO_NET_NUM, sizeof (Ceb->NeighInternalNetNumVal));
  352. MprAdminMIBBufferFree (Ifp);
  353. return MIB_S_SUCCESS;
  354. case ERROR_NO_MORE_ITEMS:
  355. ASSERTMSG ("ERROR_NO_MORE_ITEMS returned, but request is not GETNEXT ",
  356. actionId==MIB_ACTION_GETNEXT);
  357. DbgTrace (DBG_NIPXCIRCENTRY,
  358. ("NIPX-Circ: End of table reached on GETFIRST/GETNEXT request for if %ld.\n",
  359. MibGetInputData.MibIndex.InterfaceTableIndex.InterfaceIndex));
  360. return MIB_S_NO_MORE_ENTRIES;
  361. default:
  362. *errorIndex = 1;
  363. DbgTrace (DBG_NIPXCIRCENTRY,
  364. ("NIPX-Circ: Get request for if %ld failed with error %ld.\n",
  365. MibGetInputData.MibIndex.InterfaceTableIndex.InterfaceIndex, rc));
  366. return MIB_S_ENTRY_NOT_FOUND;
  367. }
  368. #undef Ceb
  369. }
  370. UINT
  371. set_nipxCircEntry(
  372. UINT actionId,
  373. AsnAny * objectArray,
  374. UINT * errorIndex
  375. ) {
  376. #define Ceb ((sav_nipxCircEntry *)objectArray)
  377. PIPX_INTERFACE Ifp;
  378. IPX_MIB_GET_INPUT_DATA MibGetInputData;
  379. DWORD rc;
  380. ULONG IfSize;
  381. if (!EnsureRouterConnection()) {
  382. *errorIndex = 0;
  383. return MIB_S_ENTRY_NOT_FOUND;
  384. }
  385. if (GetAsnInteger (&Ceb->nipxCircSysInstance, NIPX_INVALID_SYS_INSTANCE)!=NIPX_DEFAULT_SYS_INSTANCE) {
  386. *errorIndex = 0;
  387. DbgTrace (DBG_NIPXCIRCENTRY, ("NIPX-Circ: nipxCircSysInstance is not 0.\n"));
  388. return MIB_S_ENTRY_NOT_FOUND;
  389. }
  390. switch (actionId) {
  391. case MIB_ACTION_VALIDATE:
  392. ASSERTMSG ("No index in VALIDATE request for table ",
  393. Ceb->nipxCircSysInstance.asnType
  394. &&Ceb->nipxCircIndex.asnType);
  395. MibGetInputData.TableId = IPX_INTERFACE_TABLE;
  396. MibGetInputData.MibIndex.InterfaceTableIndex.InterfaceIndex
  397. = (ULONG)GetAsnInteger (&Ceb->nipxCircIndex, INVALID_INTERFACE_INDEX);
  398. rc = MprAdminMIBEntryGet(g_MibServerHandle,
  399. PID_IPX,
  400. IPX_PROTOCOL_BASE,
  401. &MibGetInputData,
  402. sizeof(IPX_MIB_GET_INPUT_DATA),
  403. &Ifp,
  404. &IfSize);
  405. if ((rc==NO_ERROR) && (Ifp != NULL)) {
  406. Ceb->MibSetInputData.MibRow.Interface = *Ifp;
  407. MprAdminMIBBufferFree (Ifp);
  408. if (Ceb->nipxCircOperState.asnType) {
  409. switch (GetAsnInteger(&Ceb->nipxCircOperState, OPER_STATE_SLEEPING)) {
  410. case OPER_STATE_DOWN:
  411. Ceb->MibSetInputData.MibRow.Interface.AdminState = ADMIN_STATE_DISABLED;
  412. break;
  413. case OPER_STATE_UP:
  414. Ceb->MibSetInputData.MibRow.Interface.AdminState = ADMIN_STATE_ENABLED;
  415. break;
  416. default:
  417. DbgTrace (DBG_NIPXCIRCENTRY,
  418. ("NIPX-Circ: Validate failed: invalid oper state: %d.\n",
  419. GetAsnInteger(&Ceb->nipxCircOperState, OPER_STATE_SLEEPING)));
  420. return MIB_S_INVALID_PARAMETER;
  421. }
  422. }
  423. DbgTrace (DBG_NIPXCIRCENTRY, ("NIPX-Circ: Validated if %ld.\n",
  424. MibGetInputData.MibIndex.InterfaceTableIndex.InterfaceIndex));
  425. return MIB_S_SUCCESS;
  426. }
  427. else {
  428. DbgTrace (DBG_NIPXCIRCENTRY,
  429. ("NIPX-Circ: Validate failed on if %ld with error %ld.\n",
  430. MibGetInputData.MibIndex.InterfaceTableIndex.InterfaceIndex, rc));
  431. return MIB_S_ENTRY_NOT_FOUND;
  432. }
  433. case MIB_ACTION_SET:
  434. rc = MprAdminMIBEntrySet (g_MibServerHandle,
  435. PID_IPX,
  436. IPX_PROTOCOL_BASE,
  437. &Ceb->MibSetInputData,
  438. sizeof(IPX_MIB_SET_INPUT_DATA));
  439. if (rc==NO_ERROR) {
  440. DbgTrace (DBG_NIPXCIRCENTRY, ("NIPX-Circ: Set succeded on if %ld\n",
  441. Ceb->MibSetInputData.MibRow.Interface.InterfaceIndex));
  442. return MIB_S_SUCCESS;
  443. }
  444. else {
  445. DbgTrace (DBG_NIPXCIRCENTRY,
  446. ("NIPX-Circ: Set failed on if %ld with error %ld\n",
  447. Ceb->MibSetInputData.MibRow.Interface.InterfaceIndex, rc));
  448. return MIB_S_ENTRY_NOT_FOUND;
  449. }
  450. case MIB_ACTION_CLEANUP:
  451. return MIB_S_SUCCESS;
  452. default:
  453. DbgTrace (DBG_NIPXCIRCENTRY,
  454. ("NIPX-Circ: Set called with unsupported action code %d.\n",
  455. actionId));
  456. return MIB_S_INVALID_PARAMETER;
  457. }
  458. #undef Ceb
  459. }
  460. ///////////////////////////////////////////////////////////////////////////////
  461. // //
  462. // nipxForwarding group (1.3.6.1.4.1.23.2.5.3) //
  463. // //
  464. ///////////////////////////////////////////////////////////////////////////////
  465. ///////////////////////////////////////////////////////////////////////////////
  466. // //
  467. // nipxDestEntry table (1.3.6.1.4.1.23.2.5.3.1.1) //
  468. // //
  469. ///////////////////////////////////////////////////////////////////////////////
  470. UINT
  471. get_nipxDestEntry(
  472. UINT actionId,
  473. AsnAny * objectArray,
  474. UINT * errorIndex
  475. ) {
  476. #define Deb ((buf_nipxDestEntry *)objectArray)
  477. PIPX_ROUTE Rtp;
  478. IPX_MIB_GET_INPUT_DATA MibGetInputData;
  479. DWORD rc;
  480. ULONG RtSize;
  481. if (!EnsureRouterConnection()) {
  482. *errorIndex = 0;
  483. return MIB_S_ENTRY_NOT_FOUND;
  484. }
  485. if (GetAsnInteger (&Deb->nipxDestSysInstance, NIPX_DEFAULT_SYS_INSTANCE)!=NIPX_DEFAULT_SYS_INSTANCE) {
  486. *errorIndex = 0;
  487. DbgTrace (DBG_NIPXDESTENTRY, ("NIPX-Dest: nipxDestSysInstance is not 0.\n"));
  488. return MIB_S_ENTRY_NOT_FOUND;
  489. }
  490. MibGetInputData.TableId = IPX_DEST_TABLE;
  491. GetAsnOctetString (MibGetInputData.MibIndex.RoutingTableIndex.Network,
  492. &Deb->nipxDestNetNum,
  493. sizeof (MibGetInputData.MibIndex.RoutingTableIndex.Network),
  494. ZERO_NET_NUM);
  495. switch (actionId) {
  496. case MIB_ACTION_GET:
  497. ASSERTMSG ("No index in GET request for table ",
  498. Deb->nipxDestSysInstance.asnType
  499. &&Deb->nipxDestNetNum.asnType);
  500. rc = MprAdminMIBEntryGet(g_MibServerHandle,
  501. PID_IPX,
  502. IPX_PROTOCOL_BASE,
  503. &MibGetInputData,
  504. sizeof(IPX_MIB_GET_INPUT_DATA),
  505. &Rtp,
  506. &RtSize);
  507. break;
  508. case MIB_ACTION_GETNEXT:
  509. if (Deb->nipxDestNetNum.asnType) {
  510. ASSERTMSG ("Second index is present but first is not ",
  511. Deb->nipxDestSysInstance.asnType);
  512. rc = MprAdminMIBEntryGetNext(g_MibServerHandle,
  513. PID_IPX,
  514. IPX_PROTOCOL_BASE,
  515. &MibGetInputData,
  516. sizeof(IPX_MIB_GET_INPUT_DATA),
  517. &Rtp,
  518. &RtSize);
  519. if (rc==NO_ERROR) {
  520. FreeAsnString (&Deb->nipxDestNetNum);
  521. }
  522. }
  523. else
  524. rc = MprAdminMIBEntryGetFirst (g_MibServerHandle,
  525. PID_IPX,
  526. IPX_PROTOCOL_BASE,
  527. &MibGetInputData,
  528. sizeof(IPX_MIB_GET_INPUT_DATA),
  529. &Rtp,
  530. &RtSize);
  531. break;
  532. default:
  533. DbgTrace (DBG_NIPXDESTENTRY,
  534. ("NIPX-Dest: Get called with unsupported action code %d.\n",
  535. actionId));
  536. return MIB_S_INVALID_PARAMETER;
  537. }
  538. switch (rc) {
  539. case NO_ERROR:
  540. DbgTrace (DBG_NIPXDESTENTRY,
  541. ("NIPX-Dest: Get(%d) request succeded for net"
  542. " %.2x%.2x%.2x%.2x -> %.2x%.2x%.2x%.2x.\n", actionId,
  543. MibGetInputData.MibIndex.RoutingTableIndex.Network[0],
  544. MibGetInputData.MibIndex.RoutingTableIndex.Network[1],
  545. MibGetInputData.MibIndex.RoutingTableIndex.Network[2],
  546. MibGetInputData.MibIndex.RoutingTableIndex.Network[3],
  547. Rtp->Network[0],
  548. Rtp->Network[1],
  549. Rtp->Network[2],
  550. Rtp->Network[3]));
  551. ForceAsnInteger (&Deb->nipxDestSysInstance, NIPX_DEFAULT_SYS_INSTANCE);
  552. ForceAsnOctetString (&Deb->nipxDestNetNum, Deb->NetNumVal,
  553. Rtp->Network, sizeof (Deb->NetNumVal));
  554. switch (Rtp->Protocol) {
  555. case IPX_PROTOCOL_LOCAL:
  556. SetAsnInteger (&Deb->nipxDestProtocol, 2);
  557. break;
  558. case IPX_PROTOCOL_STATIC:
  559. SetAsnInteger (&Deb->nipxDestProtocol, 5);
  560. break;
  561. case IPX_PROTOCOL_RIP:
  562. SetAsnInteger (&Deb->nipxDestProtocol, 3);
  563. break;
  564. case IPX_PROTOCOL_NLSP:
  565. SetAsnInteger (&Deb->nipxDestProtocol, 4);
  566. break;
  567. default:
  568. SetAsnInteger (&Deb->nipxDestProtocol, 1); // other
  569. break;
  570. }
  571. SetAsnInteger (&Deb->nipxDestTicks, Rtp->TickCount);
  572. SetAsnInteger (&Deb->nipxDestHopCount, Rtp->HopCount);
  573. SetAsnInteger (&Deb->nipxDestNextHopCircIndex, Rtp->InterfaceIndex);
  574. SetAsnOctetString (&Deb->nipxDestNextHopNICAddress, Deb->NextHopNICAddressVal,
  575. Rtp->NextHopMacAddress, sizeof (Deb->NextHopNICAddressVal));
  576. SetAsnOctetString (&Deb->nipxDestNextHopNetNum, Deb->NextHopNetNumVal,
  577. ZERO_NET_NUM, sizeof (Deb->NextHopNetNumVal));
  578. MprAdminMIBBufferFree (Rtp);
  579. return MIB_S_SUCCESS;
  580. case ERROR_NO_MORE_ITEMS:
  581. ASSERTMSG ("ERROR_NO_MORE_ITEMS returned, but request is not GETNEXT ",
  582. actionId==MIB_ACTION_GETNEXT);
  583. DbgTrace (DBG_NIPXDESTENTRY,
  584. ("NIPX-Dest: End of table reached on GETFIRST/GETNEXT request"
  585. " for network %.2x%.2x%.2x%.2x.\n",
  586. MibGetInputData.MibIndex.RoutingTableIndex.Network[0],
  587. MibGetInputData.MibIndex.RoutingTableIndex.Network[1],
  588. MibGetInputData.MibIndex.RoutingTableIndex.Network[2],
  589. MibGetInputData.MibIndex.RoutingTableIndex.Network[3]));
  590. return MIB_S_NO_MORE_ENTRIES;
  591. default:
  592. *errorIndex = 1;
  593. DbgTrace (DBG_NIPXDESTENTRY,
  594. ("NIPX-Dest: Get request for network %.2x%.2x%.2x%.2x"
  595. " failed with error %ld.\n",
  596. MibGetInputData.MibIndex.RoutingTableIndex.Network[0],
  597. MibGetInputData.MibIndex.RoutingTableIndex.Network[1],
  598. MibGetInputData.MibIndex.RoutingTableIndex.Network[2],
  599. MibGetInputData.MibIndex.RoutingTableIndex.Network[3], rc));
  600. return MIB_S_ENTRY_NOT_FOUND;
  601. }
  602. #undef Deb
  603. }
  604. ///////////////////////////////////////////////////////////////////////////////
  605. // //
  606. // nipxStaticRouteEntry table (1.3.6.1.4.1.23.2.5.3.1.2) //
  607. // //
  608. ///////////////////////////////////////////////////////////////////////////////
  609. UINT
  610. get_nipxStaticRouteEntry(
  611. UINT actionId,
  612. AsnAny * objectArray,
  613. UINT * errorIndex
  614. ) {
  615. #define Sreb ((buf_nipxStaticRouteEntry *)objectArray)
  616. PIPX_ROUTE Rtp;
  617. IPX_MIB_GET_INPUT_DATA MibGetInputData;
  618. DWORD rc;
  619. ULONG RtSize;
  620. if (!EnsureRouterConnection()) {
  621. *errorIndex = 0;
  622. return MIB_S_ENTRY_NOT_FOUND;
  623. }
  624. if (GetAsnInteger (&Sreb->nipxStaticRouteSysInstance, NIPX_DEFAULT_SYS_INSTANCE)!=NIPX_DEFAULT_SYS_INSTANCE) {
  625. *errorIndex = 0;
  626. DbgTrace (DBG_NIPXSTATICRTENTRY,
  627. ("NIPX-staticRoutes: nipxStaticRouteSysInstance is not 0.\n"));
  628. return MIB_S_ENTRY_NOT_FOUND;
  629. }
  630. MibGetInputData.TableId = IPX_STATIC_ROUTE_TABLE;
  631. MibGetInputData.MibIndex.StaticRoutesTableIndex.InterfaceIndex
  632. = (ULONG)GetAsnInteger (&Sreb->nipxStaticRouteCircIndex, ZERO_INTERFACE_INDEX);
  633. GetAsnOctetString (
  634. MibGetInputData.MibIndex.StaticRoutesTableIndex.Network,
  635. &Sreb->nipxStaticRouteNetNum,
  636. sizeof (MibGetInputData.MibIndex.StaticRoutesTableIndex.Network),
  637. ZERO_NET_NUM);
  638. switch (actionId) {
  639. case MIB_ACTION_GET:
  640. ASSERTMSG ("No index in GET request for table ",
  641. Sreb->nipxStaticRouteSysInstance.asnType
  642. &&Sreb->nipxStaticRouteCircIndex.asnType
  643. &&Sreb->nipxStaticRouteNetNum.asnType);
  644. rc = MprAdminMIBEntryGet(g_MibServerHandle,
  645. PID_IPX,
  646. IPX_PROTOCOL_BASE,
  647. &MibGetInputData,
  648. sizeof(IPX_MIB_GET_INPUT_DATA),
  649. &Rtp,
  650. &RtSize);
  651. break;
  652. case MIB_ACTION_GETNEXT:
  653. if (Sreb->nipxStaticRouteCircIndex.asnType) {
  654. ASSERTMSG ("Second index is present but first is not ",
  655. Sreb->nipxStaticRouteSysInstance.asnType);
  656. if (!Sreb->nipxStaticRouteNetNum.asnType) {
  657. rc = MprAdminMIBEntryGet(g_MibServerHandle,
  658. PID_IPX,
  659. IPX_PROTOCOL_BASE,
  660. &MibGetInputData,
  661. sizeof(IPX_MIB_GET_INPUT_DATA),
  662. &Rtp,
  663. &RtSize);
  664. if (rc==NO_ERROR)
  665. break;
  666. }
  667. rc = MprAdminMIBEntryGetNext(g_MibServerHandle,
  668. PID_IPX,
  669. IPX_PROTOCOL_BASE,
  670. &MibGetInputData,
  671. sizeof(IPX_MIB_GET_INPUT_DATA),
  672. &Rtp,
  673. &RtSize);
  674. if (rc==NO_ERROR) {
  675. if (Sreb->nipxStaticRouteNetNum.asnType) {
  676. FreeAsnString (&Sreb->nipxStaticRouteNetNum);
  677. }
  678. }
  679. }
  680. else {
  681. ASSERTMSG ("Third index is present but second is not ",
  682. !Sreb->nipxStaticRouteNetNum.asnType);
  683. rc = MprAdminMIBEntryGetFirst (g_MibServerHandle,
  684. PID_IPX,
  685. IPX_PROTOCOL_BASE,
  686. &MibGetInputData,
  687. sizeof(IPX_MIB_GET_INPUT_DATA),
  688. &Rtp,
  689. &RtSize);
  690. }
  691. break;
  692. default:
  693. DbgTrace (DBG_NIPXSTATICRTENTRY,
  694. ("NIPX-staticRoutes: Get called with unsupported action code %d.\n",
  695. actionId));
  696. return MIB_S_INVALID_PARAMETER;
  697. }
  698. if (rc == NO_ERROR && Rtp == NULL)
  699. {
  700. rc = ERROR_CAN_NOT_COMPLETE;
  701. }
  702. switch (rc) {
  703. case NO_ERROR:
  704. DbgTrace (DBG_NIPXSTATICRTENTRY,
  705. ("NIPX-staticRoutes: Get(%d) request succeded for net"
  706. " %.2x%.2x%.2x%.2x -> %.2x%.2x%.2x%.2x on if %ld\n", actionId,
  707. MibGetInputData.MibIndex.StaticRoutesTableIndex.Network[0],
  708. MibGetInputData.MibIndex.StaticRoutesTableIndex.Network[1],
  709. MibGetInputData.MibIndex.StaticRoutesTableIndex.Network[2],
  710. MibGetInputData.MibIndex.StaticRoutesTableIndex.Network[3],
  711. Rtp->Network[0],
  712. Rtp->Network[1],
  713. Rtp->Network[2],
  714. Rtp->Network[3],
  715. MibGetInputData.MibIndex.StaticRoutesTableIndex.InterfaceIndex));
  716. ForceAsnInteger (&Sreb->nipxStaticRouteSysInstance, NIPX_DEFAULT_SYS_INSTANCE);
  717. ForceAsnInteger (&Sreb->nipxStaticRouteCircIndex, Rtp->InterfaceIndex);
  718. ForceAsnOctetString (&Sreb->nipxStaticRouteNetNum, Sreb->NetNumVal,
  719. Rtp->Network, sizeof (Sreb->NetNumVal));
  720. SetAsnInteger (&Sreb->nipxStaticRouteExistState, NIPX_STATE_ON);
  721. SetAsnInteger (&Sreb->nipxStaticRouteTicks, Rtp->TickCount);
  722. SetAsnInteger (&Sreb->nipxStaticRouteHopCount, Rtp->HopCount);
  723. MprAdminMIBBufferFree (Rtp);
  724. return MIB_S_SUCCESS;
  725. case ERROR_NO_MORE_ITEMS:
  726. ASSERTMSG ("ERROR_NO_MORE_ITEMS returned, but request is not GETNEXT ",
  727. actionId==MIB_ACTION_GETNEXT);
  728. DbgTrace (DBG_NIPXSTATICRTENTRY,
  729. ("NIPX-staticRoutes: End of table reached on GETFIRST/GETNEXT request for network"
  730. " %.2x%.2x%.2x%.2x on if %ld.\n",
  731. MibGetInputData.MibIndex.StaticRoutesTableIndex.Network[0],
  732. MibGetInputData.MibIndex.StaticRoutesTableIndex.Network[1],
  733. MibGetInputData.MibIndex.StaticRoutesTableIndex.Network[2],
  734. MibGetInputData.MibIndex.StaticRoutesTableIndex.Network[3],
  735. MibGetInputData.MibIndex.StaticRoutesTableIndex.InterfaceIndex));
  736. return MIB_S_NO_MORE_ENTRIES;
  737. default:
  738. *errorIndex = 1;
  739. DbgTrace (DBG_NIPXSTATICRTENTRY,
  740. ("NIPX-staticRoutes: Get request for network %.2x%.2x%.2x%.2x."
  741. " on if %ld failed with error %ld.\n",
  742. MibGetInputData.MibIndex.StaticRoutesTableIndex.Network[0],
  743. MibGetInputData.MibIndex.StaticRoutesTableIndex.Network[1],
  744. MibGetInputData.MibIndex.StaticRoutesTableIndex.Network[2],
  745. MibGetInputData.MibIndex.StaticRoutesTableIndex.Network[3],
  746. MibGetInputData.MibIndex.StaticRoutesTableIndex.InterfaceIndex, rc));
  747. return MIB_S_ENTRY_NOT_FOUND;
  748. }
  749. #undef Sreb
  750. }
  751. UINT
  752. set_nipxStaticRouteEntry(
  753. UINT actionId,
  754. AsnAny * objectArray,
  755. UINT * errorIndex
  756. ) {
  757. #define Sreb ((sav_nipxStaticRouteEntry *)objectArray)
  758. PIPX_ROUTE Rtp;
  759. IPX_MIB_GET_INPUT_DATA MibGetInputData;
  760. DWORD rc;
  761. ULONG RtSize;
  762. if (!EnsureRouterConnection()) {
  763. *errorIndex = 0;
  764. return MIB_S_ENTRY_NOT_FOUND;
  765. }
  766. if (GetAsnInteger (&Sreb->nipxStaticRouteSysInstance, NIPX_INVALID_SYS_INSTANCE)!=NIPX_DEFAULT_SYS_INSTANCE) {
  767. *errorIndex = 0;
  768. DbgTrace (DBG_NIPXSTATICRTENTRY,
  769. ("NIPX-staticRoutes: nipxStaticRouteSysInstance is not 0.\n"));
  770. return MIB_S_ENTRY_NOT_FOUND;
  771. }
  772. switch (actionId) {
  773. case MIB_ACTION_VALIDATE:
  774. ASSERTMSG ("No index in VALIDATE request for table ",
  775. Sreb->nipxStaticRouteCircIndex.asnType
  776. &&Sreb->nipxStaticRouteNetNum.asnType);
  777. MibGetInputData.TableId = IPX_STATIC_ROUTE_TABLE;
  778. MibGetInputData.MibIndex.StaticRoutesTableIndex.InterfaceIndex
  779. = (ULONG)GetAsnInteger (&Sreb->nipxStaticRouteCircIndex,INVALID_INTERFACE_INDEX);
  780. GetAsnOctetString (
  781. MibGetInputData.MibIndex.StaticRoutesTableIndex.Network,
  782. &Sreb->nipxStaticRouteNetNum,
  783. sizeof (MibGetInputData.MibIndex.StaticRoutesTableIndex.Network),
  784. INVALID_NET_NUM);
  785. Sreb->ActionFlag
  786. = (BOOLEAN)GetAsnInteger (&Sreb->nipxStaticRouteExistState,
  787. NIPX_STATE_NOACTION);
  788. rc = MprAdminMIBEntryGet(g_MibServerHandle,
  789. PID_IPX,
  790. IPX_PROTOCOL_BASE,
  791. &MibGetInputData,
  792. sizeof(IPX_MIB_GET_INPUT_DATA),
  793. &Rtp,
  794. &RtSize);
  795. if (rc == NO_ERROR && Rtp == NULL)
  796. {
  797. rc = ERROR_CAN_NOT_COMPLETE;
  798. DbgTrace (DBG_NIPXSTATICRTENTRY,
  799. ("NIPX-staticRoutes: Validate failed"
  800. " for network %.2x.2x.2x.2x on if %ld with error %ld\n",
  801. MibGetInputData.MibIndex.StaticRoutesTableIndex.Network[0],
  802. MibGetInputData.MibIndex.StaticRoutesTableIndex.Network[1],
  803. MibGetInputData.MibIndex.StaticRoutesTableIndex.Network[2],
  804. MibGetInputData.MibIndex.StaticRoutesTableIndex.Network[3],
  805. MibGetInputData.MibIndex.StaticRoutesTableIndex.InterfaceIndex,rc));
  806. return MIB_S_ENTRY_NOT_FOUND;
  807. }
  808. if (rc==NO_ERROR) {
  809. Sreb->MibSetInputData.MibRow.Route = *Rtp;
  810. if (Sreb->ActionFlag == NIPX_STATE_ON)
  811. Sreb->ActionFlag = NIPX_STATE_NOACTION;
  812. MprAdminMIBBufferFree (Rtp);
  813. DbgTrace (DBG_NIPXSTATICRTENTRY,
  814. ("NIPX-staticRoutes: Validated"
  815. " network %.2x.2x.2x.2x on if %ld\n",
  816. MibGetInputData.MibIndex.StaticRoutesTableIndex.Network[0],
  817. MibGetInputData.MibIndex.StaticRoutesTableIndex.Network[1],
  818. MibGetInputData.MibIndex.StaticRoutesTableIndex.Network[2],
  819. MibGetInputData.MibIndex.StaticRoutesTableIndex.Network[3],
  820. MibGetInputData.MibIndex.StaticRoutesTableIndex.InterfaceIndex));
  821. }
  822. else if (Sreb->ActionFlag == MIPX_EXIST_STATE_CREATED) {
  823. DbgTrace (DBG_NIPXSTATICRTENTRY,
  824. ("NIPX-staticRoutes: Prepared to add"
  825. " network %.2x.2x.2x.2x on if %ld\n",
  826. MibGetInputData.MibIndex.StaticRoutesTableIndex.Network[0],
  827. MibGetInputData.MibIndex.StaticRoutesTableIndex.Network[1],
  828. MibGetInputData.MibIndex.StaticRoutesTableIndex.Network[2],
  829. MibGetInputData.MibIndex.StaticRoutesTableIndex.Network[3],
  830. MibGetInputData.MibIndex.StaticRoutesTableIndex.InterfaceIndex));
  831. Sreb->MibSetInputData.MibRow.Route.InterfaceIndex
  832. = (ULONG)GetAsnInteger (&Sreb->nipxStaticRouteCircIndex,
  833. INVALID_INTERFACE_INDEX);
  834. GetAsnOctetString (Sreb->MibSetInputData.MibRow.Route.Network,
  835. &Sreb->nipxStaticRouteNetNum,
  836. sizeof (Sreb->MibSetInputData.MibRow.Route.Network),
  837. NULL);
  838. Sreb->MibSetInputData.MibRow.Route.Protocol = IPX_PROTOCOL_STATIC;
  839. Sreb->MibSetInputData.MibRow.Route.Flags = 0;
  840. Sreb->MibSetInputData.MibRow.Route.TickCount = MAXSHORT;
  841. Sreb->MibSetInputData.MibRow.Route.HopCount = 15;
  842. memset (Sreb->MibSetInputData.MibRow.Route.NextHopMacAddress,
  843. 0xFF,
  844. sizeof (Sreb->MibSetInputData.MibRow.Route.NextHopMacAddress));
  845. }
  846. else {
  847. DbgTrace (DBG_NIPXSTATICRTENTRY,
  848. ("NIPX-staticRoutes: Validate failed"
  849. " for network %.2x.2x.2x.2x on if %ld with error %ld\n",
  850. MibGetInputData.MibIndex.StaticRoutesTableIndex.Network[0],
  851. MibGetInputData.MibIndex.StaticRoutesTableIndex.Network[1],
  852. MibGetInputData.MibIndex.StaticRoutesTableIndex.Network[2],
  853. MibGetInputData.MibIndex.StaticRoutesTableIndex.Network[3],
  854. MibGetInputData.MibIndex.StaticRoutesTableIndex.InterfaceIndex,rc));
  855. return MIB_S_ENTRY_NOT_FOUND;
  856. }
  857. Sreb->MibSetInputData.MibRow.Route.TickCount
  858. = (USHORT)GetAsnInteger (&Sreb->nipxStaticRouteTicks,
  859. Sreb->MibSetInputData.MibRow.Route.TickCount);
  860. Sreb->MibSetInputData.MibRow.Route.HopCount
  861. = (USHORT)GetAsnInteger (&Sreb->nipxStaticRouteHopCount,
  862. Sreb->MibSetInputData.MibRow.Route.HopCount);
  863. return MIB_S_SUCCESS;
  864. case MIB_ACTION_SET:
  865. switch (Sreb->ActionFlag) {
  866. case MIPX_EXIST_STATE_NOACTION:
  867. rc = MprAdminMIBEntrySet (g_MibServerHandle,
  868. PID_IPX,
  869. IPX_PROTOCOL_BASE,
  870. &Sreb->MibSetInputData,
  871. sizeof(IPX_MIB_SET_INPUT_DATA));
  872. break;
  873. case MIPX_EXIST_STATE_DELETED:
  874. rc = MprAdminMIBEntryDelete (g_MibServerHandle,
  875. PID_IPX,
  876. IPX_PROTOCOL_BASE,
  877. &Sreb->MibSetInputData,
  878. sizeof(IPX_MIB_SET_INPUT_DATA));
  879. break;
  880. case MIPX_EXIST_STATE_CREATED:
  881. rc = MprAdminMIBEntryCreate (g_MibServerHandle,
  882. PID_IPX,
  883. IPX_PROTOCOL_BASE,
  884. &Sreb->MibSetInputData,
  885. sizeof(IPX_MIB_SET_INPUT_DATA));
  886. break;
  887. }
  888. if (rc==NO_ERROR) {
  889. DbgTrace (DBG_NIPXSTATICRTENTRY,
  890. ("NIPX-staticRoutes: Set succeded for"
  891. " network %.2x.2x.2x.2x on if %ld\n",
  892. Sreb->MibSetInputData.MibRow.Route.Network[0],
  893. Sreb->MibSetInputData.MibRow.Route.Network[1],
  894. Sreb->MibSetInputData.MibRow.Route.Network[2],
  895. Sreb->MibSetInputData.MibRow.Route.Network[3],
  896. Sreb->MibSetInputData.MibRow.Route.InterfaceIndex));
  897. return MIB_S_SUCCESS;
  898. }
  899. else {
  900. DbgTrace (DBG_NIPXSTATICRTENTRY,
  901. ("NIPX-staticRoutes: Set failed for"
  902. " network %.2x.2x.2x.2x on if %ld with error %ld\n",
  903. Sreb->MibSetInputData.MibRow.Route.Network[0],
  904. Sreb->MibSetInputData.MibRow.Route.Network[1],
  905. Sreb->MibSetInputData.MibRow.Route.Network[2],
  906. Sreb->MibSetInputData.MibRow.Route.Network[3],
  907. Sreb->MibSetInputData.MibRow.Route.InterfaceIndex, rc));
  908. return MIB_S_ENTRY_NOT_FOUND;
  909. }
  910. case MIB_ACTION_CLEANUP:
  911. return MIB_S_SUCCESS;
  912. default:
  913. DbgTrace (DBG_NIPXSTATICRTENTRY,
  914. ("NIPX-staticRoutes: Set called with unsupported action code %d.\n",
  915. actionId));
  916. return MIB_S_INVALID_PARAMETER;
  917. }
  918. #undef Sreb
  919. }
  920. ///////////////////////////////////////////////////////////////////////////////
  921. // //
  922. // nipxServices group (1.3.6.1.4.1.23.2.5.4) //
  923. // //
  924. ///////////////////////////////////////////////////////////////////////////////
  925. ///////////////////////////////////////////////////////////////////////////////
  926. // //
  927. // nipxServEntry table (1.3.6.1.4.1.23.2.5.4.1.1) //
  928. // //
  929. ///////////////////////////////////////////////////////////////////////////////
  930. UINT
  931. get_nipxServEntry(
  932. UINT actionId,
  933. AsnAny * objectArray,
  934. UINT * errorIndex
  935. ) {
  936. #define Seb ((buf_nipxServEntry *)objectArray)
  937. PIPX_SERVICE Svp, SvpCur;
  938. IPX_MIB_GET_INPUT_DATA MibGetInputData;
  939. DWORD rc;
  940. ULONG SvSize;
  941. INT lenPrev, lenNext, lenCur;
  942. if (!EnsureRouterConnection()) {
  943. *errorIndex = 0;
  944. return MIB_S_ENTRY_NOT_FOUND;
  945. }
  946. if (GetAsnInteger (&Seb->nipxServSysInstance, NIPX_DEFAULT_SYS_INSTANCE)!=NIPX_DEFAULT_SYS_INSTANCE) {
  947. *errorIndex = 0;
  948. DbgTrace (DBG_NIPXSERVENTRY, ("NIPX-Serv: nipxServSysInstance is not 0.\n"));
  949. return MIB_S_ENTRY_NOT_FOUND;
  950. }
  951. MibGetInputData.TableId = IPX_SERV_TABLE;
  952. MibGetInputData.MibIndex.ServicesTableIndex.ServiceType
  953. = GetAsnServType (&Seb->nipxServType, ZERO_SERVER_TYPE);
  954. GetAsnDispString (MibGetInputData.MibIndex.ServicesTableIndex.ServiceName,
  955. &Seb->nipxServName, ZERO_SERVER_NAME);
  956. switch (actionId) {
  957. case MIB_ACTION_GET:
  958. ASSERTMSG ("No index in GET request for table ",
  959. Seb->nipxServSysInstance.asnType
  960. &&Seb->nipxServType.asnType
  961. && Seb->nipxServName.asnType);
  962. rc = MprAdminMIBEntryGet(g_MibServerHandle,
  963. PID_IPX,
  964. IPX_PROTOCOL_BASE,
  965. &MibGetInputData,
  966. sizeof(IPX_MIB_GET_INPUT_DATA),
  967. &Svp,
  968. &SvSize);
  969. break;
  970. case MIB_ACTION_GETNEXT:
  971. if (Seb->nipxServType.asnType) {
  972. ASSERTMSG ("Second index is present but first is not ",
  973. Seb->nipxServSysInstance.asnType);
  974. if (!Seb->nipxServName.asnType) {
  975. rc = MprAdminMIBEntryGet(g_MibServerHandle,
  976. PID_IPX,
  977. IPX_PROTOCOL_BASE,
  978. &MibGetInputData,
  979. sizeof(IPX_MIB_GET_INPUT_DATA),
  980. &Svp,
  981. &SvSize);
  982. if (rc==NO_ERROR) {
  983. FreeAsnString (&Seb->nipxServType);
  984. break;
  985. }
  986. }
  987. rc = MprAdminMIBEntryGetNext(g_MibServerHandle,
  988. PID_IPX,
  989. IPX_PROTOCOL_BASE,
  990. &MibGetInputData,
  991. sizeof(IPX_MIB_GET_INPUT_DATA),
  992. &Svp,
  993. &SvSize);
  994. if (rc==NO_ERROR) {
  995. FreeAsnString (&Seb->nipxServType);
  996. if (Seb->nipxServName.asnType) {
  997. FreeAsnString (&Seb->nipxServName);
  998. }
  999. }
  1000. }
  1001. else {
  1002. ASSERTMSG ("Third index is present but second is not ",
  1003. !Seb->nipxServName.asnType);
  1004. rc = MprAdminMIBEntryGetFirst(g_MibServerHandle,
  1005. PID_IPX,
  1006. IPX_PROTOCOL_BASE,
  1007. &MibGetInputData,
  1008. sizeof(IPX_MIB_GET_INPUT_DATA),
  1009. &Svp,
  1010. &SvSize);
  1011. }
  1012. break;
  1013. default:
  1014. DbgTrace (DBG_NIPXSERVENTRY,
  1015. ("NIPX-Serv: Get called with unsupported action code %d.\n",
  1016. actionId));
  1017. return MIB_S_INVALID_PARAMETER;
  1018. }
  1019. switch (rc) {
  1020. case NO_ERROR:
  1021. DbgTrace (DBG_NIPXSERVENTRY,
  1022. ("NIPX-Serv: Get(%d) request succeded for service"
  1023. " %.4x-%.48s -> %.4x-%.48s.\n", actionId,
  1024. MibGetInputData.MibIndex.ServicesTableIndex.ServiceType,
  1025. MibGetInputData.MibIndex.ServicesTableIndex.ServiceName,
  1026. Svp->Server.Type, Svp->Server.Name));
  1027. ForceAsnInteger (&Seb->nipxServSysInstance, NIPX_DEFAULT_SYS_INSTANCE);
  1028. ForceAsnServType (&Seb->nipxServType, Seb->TypeVal, Svp->Server.Type);
  1029. ForceAsnDispString (&Seb->nipxServName, Seb->NameVal,
  1030. Svp->Server.Name, sizeof (Seb->NameVal));
  1031. switch (Svp->Protocol) {
  1032. case IPX_PROTOCOL_LOCAL:
  1033. SetAsnInteger (&Seb->nipxServProtocol, 2);
  1034. break;
  1035. case IPX_PROTOCOL_STATIC:
  1036. SetAsnInteger (&Seb->nipxServProtocol, 5);
  1037. break;
  1038. case IPX_PROTOCOL_SAP:
  1039. SetAsnInteger (&Seb->nipxServProtocol, 6);
  1040. break;
  1041. case IPX_PROTOCOL_NLSP:
  1042. SetAsnInteger (&Seb->nipxServProtocol, 4);
  1043. break;
  1044. default:
  1045. SetAsnInteger (&Seb->nipxServProtocol, 1); // other
  1046. break;
  1047. }
  1048. SetAsnOctetString (&Seb->nipxServNetNum, Seb->NetNumVal,
  1049. Svp->Server.Network, sizeof (Seb->NetNumVal));
  1050. SetAsnOctetString (&Seb->nipxServNode, Seb->NodeVal,
  1051. Svp->Server.Node, sizeof (Seb->NodeVal));
  1052. SetAsnOctetString (&Seb->nipxServSocket, Seb->SocketVal,
  1053. Svp->Server.Socket, sizeof (Seb->SocketVal));
  1054. SetAsnInteger (&Seb->nipxServHopCount, Svp->Server.HopCount);
  1055. MprAdminMIBBufferFree (Svp);
  1056. return MIB_S_SUCCESS;
  1057. case ERROR_NO_MORE_ITEMS:
  1058. ASSERTMSG ("ERROR_NO_MORE_ITEMS returned, but request is not GETNEXT ",
  1059. actionId==MIB_ACTION_GETNEXT);
  1060. DbgTrace (DBG_NIPXSERVENTRY,
  1061. ("NIPX-Serv: End of table reached on GETFIRST/GETNEXT request"
  1062. " for service %.4x-%.48s.\n",
  1063. MibGetInputData.MibIndex.ServicesTableIndex.ServiceType,
  1064. MibGetInputData.MibIndex.ServicesTableIndex.ServiceName));
  1065. return MIB_S_NO_MORE_ENTRIES;
  1066. default:
  1067. *errorIndex = 0;
  1068. DbgTrace (DBG_NIPXSERVENTRY,
  1069. ("NIPX-Serv: Get request for service %.4x-%.48s"
  1070. " failed with error %ld.\n",
  1071. MibGetInputData.MibIndex.ServicesTableIndex.ServiceType,
  1072. MibGetInputData.MibIndex.ServicesTableIndex.ServiceName, rc));
  1073. return MIB_S_ENTRY_NOT_FOUND;
  1074. }
  1075. #undef Seb
  1076. }
  1077. ///////////////////////////////////////////////////////////////////////////////
  1078. // //
  1079. // nipxDestServEntry table (1.3.6.1.4.1.23.2.5.4.2.1) //
  1080. // //
  1081. ///////////////////////////////////////////////////////////////////////////////
  1082. UINT
  1083. get_nipxDestServEntry(
  1084. UINT actionId,
  1085. AsnAny * objectArray,
  1086. UINT * errorIndex
  1087. ) {
  1088. switch (actionId) {
  1089. case MIB_ACTION_GET:
  1090. return MIB_S_ENTRY_NOT_FOUND;
  1091. case MIB_ACTION_GETNEXT:
  1092. return MIB_S_NO_MORE_ENTRIES;
  1093. default:
  1094. return MIB_S_INVALID_PARAMETER;
  1095. }
  1096. }
  1097. ///////////////////////////////////////////////////////////////////////////////
  1098. // //
  1099. // nipxStaticServEntry table (1.3.6.1.4.1.23.2.5.4.3.1) //
  1100. // //
  1101. ///////////////////////////////////////////////////////////////////////////////
  1102. UINT
  1103. get_nipxStaticServEntry(
  1104. UINT actionId,
  1105. AsnAny * objectArray,
  1106. UINT * errorIndex
  1107. ) {
  1108. #define Sseb ((buf_nipxStaticServEntry *)objectArray)
  1109. PIPX_SERVICE Svp;
  1110. IPX_MIB_GET_INPUT_DATA MibGetInputData;
  1111. DWORD rc;
  1112. ULONG SvSize;
  1113. if (!EnsureRouterConnection()) {
  1114. *errorIndex = 0;
  1115. return MIB_S_ENTRY_NOT_FOUND;
  1116. }
  1117. if (GetAsnInteger (&Sseb->nipxStaticServSysInstance, NIPX_DEFAULT_SYS_INSTANCE)!=NIPX_DEFAULT_SYS_INSTANCE) {
  1118. *errorIndex = 0;
  1119. DbgTrace (DBG_NIPXSTATICSERVENTRY, ("NIPX-StaticServ: nipxStaticServSysInstance is not 0.\n"));
  1120. return MIB_S_ENTRY_NOT_FOUND;
  1121. }
  1122. MibGetInputData.TableId = IPX_STATIC_SERV_TABLE;
  1123. MibGetInputData.MibIndex.StaticServicesTableIndex.InterfaceIndex
  1124. = (ULONG)GetAsnInteger (&Sseb->nipxStaticServCircIndex,
  1125. ZERO_INTERFACE_INDEX);
  1126. MibGetInputData.MibIndex.StaticServicesTableIndex.ServiceType
  1127. = GetAsnServType (&Sseb->nipxStaticServType, ZERO_SERVER_TYPE);
  1128. GetAsnDispString (
  1129. MibGetInputData.MibIndex.StaticServicesTableIndex.ServiceName,
  1130. &Sseb->nipxStaticServName, ZERO_SERVER_NAME);
  1131. switch (actionId) {
  1132. case MIB_ACTION_GET:
  1133. ASSERTMSG ("No index in GET request for table ",
  1134. Sseb->nipxStaticServSysInstance.asnType
  1135. &&Sseb->nipxStaticServCircIndex.asnType
  1136. &&Sseb->nipxStaticServType.asnType
  1137. &&Sseb->nipxStaticServName.asnType);
  1138. rc = MprAdminMIBEntryGet(g_MibServerHandle,
  1139. PID_IPX,
  1140. IPX_PROTOCOL_BASE,
  1141. &MibGetInputData,
  1142. sizeof(IPX_MIB_GET_INPUT_DATA),
  1143. &Svp,
  1144. &SvSize);
  1145. break;
  1146. case MIB_ACTION_GETNEXT:
  1147. if (Sseb->nipxStaticServCircIndex.asnType) {
  1148. if (!Sseb->nipxStaticServType.asnType
  1149. || !Sseb->nipxStaticServName.asnType) {
  1150. rc = MprAdminMIBEntryGet(g_MibServerHandle,
  1151. PID_IPX,
  1152. IPX_PROTOCOL_BASE,
  1153. &MibGetInputData,
  1154. sizeof(IPX_MIB_GET_INPUT_DATA),
  1155. &Svp,
  1156. &SvSize);
  1157. if (rc==NO_ERROR) {
  1158. if (Sseb->nipxStaticServType.asnType) {
  1159. FreeAsnString (&Sseb->nipxStaticServType);
  1160. }
  1161. if (Sseb->nipxStaticServName.asnType) {
  1162. FreeAsnString (&Sseb->nipxStaticServName);
  1163. }
  1164. break;
  1165. }
  1166. }
  1167. rc = MprAdminMIBEntryGetNext(g_MibServerHandle,
  1168. PID_IPX,
  1169. IPX_PROTOCOL_BASE,
  1170. &MibGetInputData,
  1171. sizeof(IPX_MIB_GET_INPUT_DATA),
  1172. &Svp,
  1173. &SvSize);
  1174. if (rc==NO_ERROR) {
  1175. if (Sseb->nipxStaticServType.asnType) {
  1176. FreeAsnString (&Sseb->nipxStaticServType);
  1177. }
  1178. if (Sseb->nipxStaticServName.asnType) {
  1179. FreeAsnString (&Sseb->nipxStaticServName);
  1180. }
  1181. }
  1182. }
  1183. else {
  1184. ASSERTMSG ("Third or fourth indeces present but first is not ",
  1185. !Sseb->nipxStaticServType.asnType
  1186. &&!Sseb->nipxStaticServName.asnType);
  1187. rc = MprAdminMIBEntryGetFirst (g_MibServerHandle,
  1188. PID_IPX,
  1189. IPX_PROTOCOL_BASE,
  1190. &MibGetInputData,
  1191. sizeof(IPX_MIB_GET_INPUT_DATA),
  1192. &Svp,
  1193. &SvSize);
  1194. }
  1195. break;
  1196. default:
  1197. DbgTrace (DBG_NIPXSTATICSERVENTRY,
  1198. ("NIPX-StaticServ: Get called with unsupported action code %d.\n",
  1199. actionId));
  1200. return MIB_S_INVALID_PARAMETER;
  1201. }
  1202. if (rc == NO_ERROR && Svp == NULL)
  1203. {
  1204. rc = ERROR_CAN_NOT_COMPLETE;
  1205. }
  1206. switch (rc) {
  1207. case NO_ERROR:
  1208. DbgTrace (DBG_NIPXSTATICSERVENTRY,
  1209. ("NIPX-StaticServ: Get (%d) request succeded for service"
  1210. " %.4x-%.48s -> %.4x-%.48s on if %ld.\n", actionId,
  1211. MibGetInputData.MibIndex.StaticServicesTableIndex.ServiceType,
  1212. MibGetInputData.MibIndex.StaticServicesTableIndex.ServiceName,
  1213. Svp->Server.Type, Svp->Server.Name,
  1214. MibGetInputData.MibIndex.StaticServicesTableIndex.InterfaceIndex));
  1215. ForceAsnInteger (&Sseb->nipxStaticServSysInstance, NIPX_DEFAULT_SYS_INSTANCE);
  1216. ForceAsnInteger (&Sseb->nipxStaticServCircIndex, Svp->InterfaceIndex);
  1217. ForceAsnServType (&Sseb->nipxStaticServType, Sseb->TypeVal, Svp->Server.Type);
  1218. ForceAsnDispString (&Sseb->nipxStaticServName, Sseb->NameVal,
  1219. Svp->Server.Name, sizeof (Sseb->NameVal));
  1220. SetAsnInteger (&Sseb->nipxStaticServExistState, NIPX_STATE_ON);
  1221. SetAsnOctetString (&Sseb->nipxStaticServNetNum, Sseb->NetNumVal,
  1222. Svp->Server.Network, sizeof (Sseb->NetNumVal));
  1223. SetAsnOctetString (&Sseb->nipxStaticServNode, Sseb->NodeVal,
  1224. Svp->Server.Node, sizeof (Sseb->NodeVal));
  1225. SetAsnOctetString (&Sseb->nipxStaticServSocket, Sseb->SocketVal,
  1226. Svp->Server.Socket, sizeof (Sseb->SocketVal));
  1227. SetAsnInteger (&Sseb->nipxStaticServHopCount, Svp->Server.HopCount);
  1228. MprAdminMIBBufferFree (Svp);
  1229. return MIB_S_SUCCESS;
  1230. case ERROR_NO_MORE_ITEMS:
  1231. ASSERTMSG ("ERROR_NO_MORE_ITEMS returned, but request is not GETNEXT ",
  1232. actionId==MIB_ACTION_GETNEXT);
  1233. DbgTrace (DBG_NIPXSTATICSERVENTRY,
  1234. ("NIPX-StaticServ: End of table reached on GETFIRST/GETNEXT request"
  1235. " for service %.4x-%.48s on if %ld.\n",
  1236. MibGetInputData.MibIndex.StaticServicesTableIndex.ServiceType,
  1237. MibGetInputData.MibIndex.StaticServicesTableIndex.ServiceName,
  1238. MibGetInputData.MibIndex.StaticServicesTableIndex.InterfaceIndex));
  1239. return MIB_S_NO_MORE_ENTRIES;
  1240. default:
  1241. *errorIndex = 0;
  1242. DbgTrace (DBG_NIPXSTATICSERVENTRY,
  1243. ("NIPX-StaticServ: Get request for service %.4x-%.48s"
  1244. " on if %ld failed with error %ld.\n",
  1245. MibGetInputData.MibIndex.StaticServicesTableIndex.ServiceType,
  1246. MibGetInputData.MibIndex.StaticServicesTableIndex.ServiceName,
  1247. MibGetInputData.MibIndex.StaticServicesTableIndex.InterfaceIndex,
  1248. rc));
  1249. return MIB_S_ENTRY_NOT_FOUND;
  1250. }
  1251. #undef Sseb
  1252. }
  1253. UINT
  1254. set_nipxStaticServEntry(
  1255. UINT actionId,
  1256. AsnAny * objectArray,
  1257. UINT * errorIndex
  1258. ) {
  1259. #define Sseb ((sav_nipxStaticServEntry *)objectArray)
  1260. PIPX_SERVICE Svp;
  1261. IPX_MIB_GET_INPUT_DATA MibGetInputData;
  1262. DWORD rc;
  1263. ULONG SvSize;
  1264. if (!EnsureRouterConnection()) {
  1265. *errorIndex = 0;
  1266. return MIB_S_ENTRY_NOT_FOUND;
  1267. }
  1268. if (GetAsnInteger (&Sseb->nipxStaticServSysInstance, NIPX_INVALID_SYS_INSTANCE)!=NIPX_DEFAULT_SYS_INSTANCE) {
  1269. *errorIndex = 0;
  1270. DbgTrace (DBG_NIPXSTATICSERVENTRY, ("NIPX-StaticServ: nipxStaticServSysInstance is not 0.\n"));
  1271. return MIB_S_ENTRY_NOT_FOUND;
  1272. }
  1273. switch (actionId) {
  1274. case MIB_ACTION_VALIDATE:
  1275. ASSERTMSG ("No index in VALIDATE request for table ",
  1276. Sseb->nipxStaticServSysInstance.asnType
  1277. &&Sseb->nipxStaticServCircIndex.asnType
  1278. &&Sseb->nipxStaticServType.asnType
  1279. &&Sseb->nipxStaticServName.asnType);
  1280. MibGetInputData.TableId = IPX_STATIC_SERV_TABLE;
  1281. MibGetInputData.MibIndex.StaticServicesTableIndex.InterfaceIndex
  1282. = (ULONG)GetAsnInteger (&Sseb->nipxStaticServCircIndex,
  1283. INVALID_INTERFACE_INDEX);
  1284. MibGetInputData.MibIndex.StaticServicesTableIndex.ServiceType
  1285. = GetAsnServType (&Sseb->nipxStaticServType, INVALID_SERVER_TYPE);
  1286. GetAsnDispString (
  1287. MibGetInputData.MibIndex.StaticServicesTableIndex.ServiceName,
  1288. &Sseb->nipxStaticServName,
  1289. INVALID_SERVER_NAME);
  1290. Sseb->ActionFlag
  1291. = (BOOLEAN)GetAsnInteger (&Sseb->nipxStaticServExistState,
  1292. NIPX_STATE_NOACTION);
  1293. rc = MprAdminMIBEntryGet(g_MibServerHandle,
  1294. PID_IPX,
  1295. IPX_PROTOCOL_BASE,
  1296. &MibGetInputData,
  1297. sizeof(IPX_MIB_GET_INPUT_DATA),
  1298. &Svp,
  1299. &SvSize);
  1300. if (rc == NO_ERROR && Svp == NULL)
  1301. {
  1302. rc = ERROR_CAN_NOT_COMPLETE;
  1303. DbgTrace (DBG_NIPXSTATICSERVENTRY,
  1304. ("NIPX-StaticServ: Validate failed"
  1305. " for service %.4x-%.48s on if %ld with error %ld.\n",
  1306. MibGetInputData.MibIndex.StaticServicesTableIndex.ServiceType,
  1307. MibGetInputData.MibIndex.StaticServicesTableIndex.ServiceName,
  1308. MibGetInputData.MibIndex.StaticServicesTableIndex.InterfaceIndex,
  1309. rc));
  1310. return MIB_S_ENTRY_NOT_FOUND;
  1311. }
  1312. if (rc==NO_ERROR) {
  1313. Sseb->MibSetInputData.MibRow.Service = *Svp;
  1314. if (Sseb->ActionFlag == NIPX_STATE_ON)
  1315. Sseb->ActionFlag = NIPX_STATE_NOACTION;
  1316. MprAdminMIBBufferFree (Svp);
  1317. DbgTrace (DBG_NIPXSTATICSERVENTRY,
  1318. ("NIPX-StaticServ: Validated"
  1319. " service %.4x-%.48s on if %ld.\n",
  1320. MibGetInputData.MibIndex.StaticServicesTableIndex.ServiceType,
  1321. MibGetInputData.MibIndex.StaticServicesTableIndex.ServiceName,
  1322. MibGetInputData.MibIndex.StaticServicesTableIndex.InterfaceIndex));
  1323. }
  1324. else if (Sseb->ActionFlag == NIPX_STATE_ON) {
  1325. DbgTrace (DBG_NIPXSTATICSERVENTRY,
  1326. ("NIPX-StaticServ: Prepared to add"
  1327. " service %.4x-%.48s on if %ld.\n",
  1328. MibGetInputData.MibIndex.StaticServicesTableIndex.ServiceType,
  1329. MibGetInputData.MibIndex.StaticServicesTableIndex.ServiceName,
  1330. MibGetInputData.MibIndex.StaticServicesTableIndex.InterfaceIndex));
  1331. Sseb->MibSetInputData.MibRow.Service.InterfaceIndex
  1332. = (ULONG) GetAsnInteger (&Sseb->nipxStaticServCircIndex,
  1333. INVALID_INTERFACE_INDEX);
  1334. Sseb->MibSetInputData.MibRow.Service.Protocol = IPX_PROTOCOL_STATIC;
  1335. Sseb->MibSetInputData.MibRow.Service.Server.Type
  1336. = GetAsnServType (&Sseb->nipxStaticServType,
  1337. INVALID_SERVER_TYPE);
  1338. GetAsnDispString (
  1339. Sseb->MibSetInputData.MibRow.Service.Server.Name,
  1340. &Sseb->nipxStaticServName,
  1341. INVALID_SERVER_NAME);
  1342. memset (Sseb->MibSetInputData.MibRow.Service.Server.Network, 0,
  1343. sizeof (Sseb->MibSetInputData.MibRow.Service.Server.Network));
  1344. memset (Sseb->MibSetInputData.MibRow.Service.Server.Node, 0,
  1345. sizeof (Sseb->MibSetInputData.MibRow.Service.Server.Node));
  1346. memset (Sseb->MibSetInputData.MibRow.Service.Server.Socket, 0,
  1347. sizeof (Sseb->MibSetInputData.MibRow.Service.Server.Socket));
  1348. Sseb->MibSetInputData.MibRow.Service.Server.HopCount = 15;
  1349. }
  1350. else {
  1351. DbgTrace (DBG_NIPXSTATICSERVENTRY,
  1352. ("NIPX-StaticServ: Validate failed"
  1353. " for service %.4x-%.48s on if %ld with error %ld.\n",
  1354. MibGetInputData.MibIndex.StaticServicesTableIndex.ServiceType,
  1355. MibGetInputData.MibIndex.StaticServicesTableIndex.ServiceName,
  1356. MibGetInputData.MibIndex.StaticServicesTableIndex.InterfaceIndex,
  1357. rc));
  1358. return MIB_S_ENTRY_NOT_FOUND;
  1359. }
  1360. GetAsnOctetString (Sseb->MibSetInputData.MibRow.Service.Server.Network,
  1361. &Sseb->nipxStaticServNetNum,
  1362. sizeof (Sseb->MibSetInputData.MibRow.Service.Server.Network),
  1363. NULL);
  1364. GetAsnOctetString (Sseb->MibSetInputData.MibRow.Service.Server.Node,
  1365. &Sseb->nipxStaticServNode,
  1366. sizeof (Sseb->MibSetInputData.MibRow.Service.Server.Node),
  1367. NULL);
  1368. GetAsnOctetString (Sseb->MibSetInputData.MibRow.Service.Server.Socket,
  1369. &Sseb->nipxStaticServSocket,
  1370. sizeof (Sseb->MibSetInputData.MibRow.Service.Server.Socket),
  1371. NULL);
  1372. Sseb->MibSetInputData.MibRow.Service.Server.HopCount =
  1373. (USHORT)GetAsnInteger (&Sseb->nipxStaticServHopCount,
  1374. Sseb->MibSetInputData.MibRow.Service.Server.HopCount);
  1375. return MIB_S_SUCCESS;
  1376. case MIB_ACTION_SET:
  1377. switch (Sseb->ActionFlag) {
  1378. case NIPX_STATE_NOACTION:
  1379. rc = MprAdminMIBEntrySet (g_MibServerHandle,
  1380. PID_IPX,
  1381. IPX_PROTOCOL_BASE,
  1382. &Sseb->MibSetInputData,
  1383. sizeof(IPX_MIB_SET_INPUT_DATA));
  1384. break;
  1385. case NIPX_STATE_OFF:
  1386. rc = MprAdminMIBEntryDelete (g_MibServerHandle,
  1387. PID_IPX,
  1388. IPX_PROTOCOL_BASE,
  1389. &Sseb->MibSetInputData,
  1390. sizeof(IPX_MIB_SET_INPUT_DATA));
  1391. break;
  1392. case NIPX_STATE_ON:
  1393. rc = MprAdminMIBEntryCreate (g_MibServerHandle,
  1394. PID_IPX,
  1395. IPX_PROTOCOL_BASE,
  1396. &Sseb->MibSetInputData,
  1397. sizeof(IPX_MIB_SET_INPUT_DATA));
  1398. break;
  1399. }
  1400. if (rc==NO_ERROR) {
  1401. DbgTrace (DBG_NIPXSTATICSERVENTRY,
  1402. ("NIPX-StaticServ: Set succeded"
  1403. " for service %.4x-%.48s on if %ld.\n",
  1404. Sseb->MibSetInputData.MibRow.Service.Server.Type,
  1405. Sseb->MibSetInputData.MibRow.Service.Server.Name,
  1406. Sseb->MibSetInputData.MibRow.Service.InterfaceIndex));
  1407. return MIB_S_SUCCESS;
  1408. }
  1409. else {
  1410. DbgTrace (DBG_NIPXSTATICSERVENTRY,
  1411. ("NIPX-StaticServ: Set failed for"
  1412. " for service %.4x-%.48s on if %ld with error %ld.\n",
  1413. Sseb->MibSetInputData.MibRow.Service.Server.Type,
  1414. Sseb->MibSetInputData.MibRow.Service.Server.Name,
  1415. Sseb->MibSetInputData.MibRow.Service.InterfaceIndex,
  1416. rc));
  1417. return MIB_S_ENTRY_NOT_FOUND;
  1418. }
  1419. case MIB_ACTION_CLEANUP:
  1420. return MIB_S_SUCCESS;
  1421. default:
  1422. DbgTrace (DBG_NIPXSTATICSERVENTRY,
  1423. ("NIPX-StaticServ: Set called with unsupported action code %d.\n",
  1424. actionId));
  1425. return MIB_S_INVALID_PARAMETER;
  1426. }
  1427. #undef Sseb
  1428. }