pduMIB_trap.c 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. /*
  2. * Note: this file originally auto-generated by mib2c
  3. * using mib2c.notify.conf
  4. */
  5. #include <net-snmp/net-snmp-config.h>
  6. #include <net-snmp/net-snmp-includes.h>
  7. #include <net-snmp/agent/net-snmp-agent-includes.h>
  8. #include "pduMIB_trap.h"
  9. extern const oid snmptrap_oid[];
  10. extern const size_t snmptrap_oid_len;
  11. int
  12. send_pduAlarmAdded_trap( void )
  13. {
  14. netsnmp_variable_list *var_list = NULL;
  15. const oid pduAlarmAdded_oid[] = { 1,3,6,1,4,1,2024,2,1 };
  16. const oid pduAlarmType_oid[] = { 1,3,6,1,4,1,2024,1,6,1,1,2, /* insert index here */ };
  17. const oid pduAlarmContext_oid[] = { 1,3,6,1,4,1,2024,1,6,1,1,3, /* insert index here */ };
  18. const oid pduAlarmAction_oid[] = { 1,3,6,1,4,1,2024,1,6,1,1,4, /* insert index here */ };
  19. const oid pduAlarmActionPara_oid[] = { 1,3,6,1,4,1,2024,1,6,1,1,5, /* insert index here */ };
  20. const oid pduAlarmDate_oid[] = { 1,3,6,1,4,1,2024,1,6,1,1,6, /* insert index here */ };
  21. const oid pduAlarmTime_oid[] = { 1,3,6,1,4,1,2024,1,6,1,1,7, /* insert index here */ };
  22. /*
  23. * Set the snmpTrapOid.0 value
  24. */
  25. snmp_varlist_add_variable(&var_list,
  26. snmptrap_oid, snmptrap_oid_len,
  27. ASN_OBJECT_ID,
  28. pduAlarmAdded_oid, sizeof(pduAlarmAdded_oid));
  29. /*
  30. * Add any objects from the trap definition
  31. */
  32. snmp_varlist_add_variable(&var_list,
  33. pduAlarmType_oid, OID_LENGTH(pduAlarmType_oid),
  34. ASN_INTEGER,
  35. /* Set an appropriate value for pduAlarmType */
  36. NULL, 0);
  37. snmp_varlist_add_variable(&var_list,
  38. pduAlarmContext_oid, OID_LENGTH(pduAlarmContext_oid),
  39. ASN_OCTET_STR,
  40. /* Set an appropriate value for pduAlarmContext */
  41. NULL, 0);
  42. snmp_varlist_add_variable(&var_list,
  43. pduAlarmAction_oid, OID_LENGTH(pduAlarmAction_oid),
  44. ASN_INTEGER,
  45. /* Set an appropriate value for pduAlarmAction */
  46. NULL, 0);
  47. snmp_varlist_add_variable(&var_list,
  48. pduAlarmActionPara_oid, OID_LENGTH(pduAlarmActionPara_oid),
  49. ASN_INTEGER,
  50. /* Set an appropriate value for pduAlarmActionPara */
  51. NULL, 0);
  52. snmp_varlist_add_variable(&var_list,
  53. pduAlarmDate_oid, OID_LENGTH(pduAlarmDate_oid),
  54. ASN_OCTET_STR,
  55. /* Set an appropriate value for pduAlarmDate */
  56. NULL, 0);
  57. snmp_varlist_add_variable(&var_list,
  58. pduAlarmTime_oid, OID_LENGTH(pduAlarmTime_oid),
  59. ASN_OCTET_STR,
  60. /* Set an appropriate value for pduAlarmTime */
  61. NULL, 0);
  62. /*
  63. * Add any extra (optional) objects here
  64. */
  65. /*
  66. * Send the trap to the list of configured destinations
  67. * and clean up
  68. */
  69. send_v2trap( var_list );
  70. snmp_free_varbind( var_list );
  71. return SNMP_ERR_NOERROR;
  72. }
  73. int
  74. send_pduAlarmRemoved_trap( void )
  75. {
  76. netsnmp_variable_list *var_list = NULL;
  77. const oid pduAlarmRemoved_oid[] = { 1,3,6,1,4,1,2024,2,2 };
  78. const oid pduAlarmContext_oid[] = { 1,3,6,1,4,1,2024,1,6,1,1,3, /* insert index here */ };
  79. /*
  80. * Set the snmpTrapOid.0 value
  81. */
  82. snmp_varlist_add_variable(&var_list,
  83. snmptrap_oid, snmptrap_oid_len,
  84. ASN_OBJECT_ID,
  85. pduAlarmRemoved_oid, sizeof(pduAlarmRemoved_oid));
  86. /*
  87. * Add any objects from the trap definition
  88. */
  89. snmp_varlist_add_variable(&var_list,
  90. pduAlarmContext_oid, OID_LENGTH(pduAlarmContext_oid),
  91. ASN_OCTET_STR,
  92. /* Set an appropriate value for pduAlarmContext */
  93. NULL, 0);
  94. /*
  95. * Add any extra (optional) objects here
  96. */
  97. /*
  98. * Send the trap to the list of configured destinations
  99. * and clean up
  100. */
  101. send_v2trap( var_list );
  102. snmp_free_varbind( var_list );
  103. return SNMP_ERR_NOERROR;
  104. }