agent_trap.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. #ifndef AGENT_TRAP_H
  2. #define AGENT_TRAP_H
  3. /*
  4. * Portions of this file are copyrighted by:
  5. * Copyright (c) 2016 VMware, Inc. All rights reserved.
  6. * Use is subject to license terms specified in the COPYING file
  7. * distributed with the Net-SNMP package.
  8. */
  9. #ifdef __cplusplus
  10. extern "C" {
  11. #endif
  12. struct agent_add_trap_args {
  13. netsnmp_session *ss;
  14. int confirm;
  15. const char *nameData; /* notification target addr name */
  16. int nameLen;
  17. const char *tagData; /* notification tag */
  18. int tagLen;
  19. const char *profileData; /* filter profile */
  20. int profileLen;
  21. int rc;
  22. };
  23. void init_traps(void);
  24. void send_easy_trap(int, int);
  25. void send_trap_pdu(netsnmp_pdu *);
  26. void send_v2trap(netsnmp_variable_list *);
  27. void send_v3trap(netsnmp_variable_list *vars, const char *context);
  28. void send_trap_vars(int, int, netsnmp_variable_list *);
  29. void send_trap_vars_with_context(int trap, int specific,
  30. netsnmp_variable_list *vars,
  31. const char *context);
  32. void send_enterprise_trap_vars(int trap, int specific,
  33. const oid * enterprise,
  34. int enterprise_length,
  35. netsnmp_variable_list * vars);
  36. int netsnmp_send_traps(int trap, int specific,
  37. const oid * enterprise, int enterprise_length,
  38. netsnmp_variable_list * vars,
  39. /* flags are currently unused */
  40. const char * context, int flags);
  41. void snmpd_parse_config_authtrap(const char *, char *);
  42. void snmpd_parse_config_trapsink(const char *, char *);
  43. void snmpd_parse_config_trap2sink(const char *, char *);
  44. void snmpd_parse_config_informsink(const char *, char *);
  45. void snmpd_parse_config_trapsess(const char *, char *);
  46. void snmpd_free_trapsinks(void);
  47. void snmpd_parse_config_trapcommunity(const char *, char *);
  48. void snmpd_free_trapcommunity(void);
  49. void send_trap_to_sess(netsnmp_session * sess,
  50. netsnmp_pdu *template_pdu);
  51. int create_trap_session(char *, u_short, char *, int, int);
  52. int create_trap_session_with_src(const char *, const char *,
  53. const char *, const char *,
  54. int, int);
  55. int add_trap_session(netsnmp_session *, int, int, int);
  56. int remove_trap_session(netsnmp_session *);
  57. netsnmp_session *netsnmp_create_v1v2_notification_session(const char *,
  58. const char*,
  59. const char *,
  60. const char *,
  61. int, int,
  62. const char *,
  63. const char *,
  64. const char*);
  65. netsnmp_session *netsnmp_create_v3user_notification_session(const char *dst,
  66. const char *user,
  67. int lvl,
  68. const char *ctx,
  69. int pdutype,
  70. const u_char *eid,
  71. size_t eidl,
  72. const char *src,
  73. const char *name,
  74. const char *tag,
  75. const char *prof);
  76. int netsnmp_add_notification_session(netsnmp_session *, int, int,
  77. int, const char*, const char*,
  78. const char*);
  79. void netsnmp_unregister_notification(const char *, u_char);
  80. int netsnmp_build_trap_oid(netsnmp_pdu *pdu, oid *, size_t *);
  81. void convert_v2_to_v1(netsnmp_variable_list *, netsnmp_pdu *);
  82. netsnmp_variable_list *convert_v1_to_v2(netsnmp_pdu *);
  83. netsnmp_pdu *convert_v2pdu_to_v1(netsnmp_pdu *);
  84. netsnmp_pdu *convert_v1pdu_to_v2(netsnmp_pdu *);
  85. #ifdef __cplusplus
  86. }
  87. #endif
  88. #endif /* AGENT_TRAP_H */