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.

65 lines
1.5 KiB

  1. /*++
  2. Copyright (c) 1998 Microsoft Corporation
  3. Module Name:
  4. Abstract:
  5. Revision history:
  6. --*/
  7. #include <snmp.h>
  8. #include <snmpexts.h>
  9. #include "mibfuncs.h"
  10. extern PSNMP_MGMTVARS ge_pMgmtVars;
  11. UINT
  12. snmpMibGetHandler(
  13. UINT actionId,
  14. AsnAny *objectArray,
  15. UINT *errorIndex)
  16. {
  17. int i, j, k;
  18. if (ge_pMgmtVars == NULL)
  19. return MIB_S_ENTRY_NOT_FOUND;
  20. // get the number of AsnAny structures we have in the MIB's data buffer
  21. // and be careful not too scan further (it might be that there are more
  22. // management variables than objects supported by the MIB).
  23. k = sizeof(SNMPMIB_MGMTVARS) / sizeof(AsnAny);
  24. for (i = 0; k != 0 && i < NC_MAX_COUNT; i++, k--)
  25. {
  26. if (objectArray[i].asnType == ge_pMgmtVars->AsnCounterPool[i].asnType)
  27. {
  28. objectArray[i].asnValue = ge_pMgmtVars->AsnCounterPool[i].asnValue;
  29. }
  30. }
  31. for (j = 0; k != 0 && j < NI_MAX_COUNT; j++, k--)
  32. {
  33. if (objectArray[i + j].asnType == ge_pMgmtVars->AsnIntegerPool[j].asnType)
  34. {
  35. objectArray[i + j].asnValue = ge_pMgmtVars->AsnIntegerPool[j].asnValue;
  36. }
  37. }
  38. return MIB_S_SUCCESS;
  39. }
  40. UINT
  41. snmpMibSetHandler(
  42. UINT actionId,
  43. AsnAny *objectArray,
  44. UINT *errorIndex)
  45. {
  46. // this function is called only for one object: snmpEnableAuthenTraps
  47. ge_pMgmtVars->AsnIntegerPool[IsnmpEnableAuthenTraps].asnValue = objectArray[NC_MAX_COUNT + IsnmpEnableAuthenTraps].asnValue;
  48. return MIB_S_SUCCESS;
  49. }