baby_steps.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. /*
  2. * $Id$
  3. */
  4. #ifndef BABY_STEPS_H
  5. #define BABY_STEPS_H
  6. #ifdef __cplusplus
  7. extern "C" {
  8. #endif
  9. #include <net-snmp/agent/agent_handler.h>
  10. /*
  11. * Flags for baby step modes
  12. */
  13. #define BABY_STEP_NONE 0
  14. #define BABY_STEP_PRE_REQUEST (0x1 << 1)
  15. #define BABY_STEP_OBJECT_LOOKUP (0x1 << 2)
  16. #ifndef NETSNMP_NO_WRITE_SUPPORT
  17. #define BABY_STEP_CHECK_VALUE (0x1 << 3)
  18. #define BABY_STEP_ROW_CREATE (0x1 << 4)
  19. #define BABY_STEP_UNDO_SETUP (0x1 << 5)
  20. #define BABY_STEP_SET_VALUE (0x1 << 6)
  21. #define BABY_STEP_CHECK_CONSISTENCY (0x1 << 7)
  22. #define BABY_STEP_UNDO_SET (0x1 << 8)
  23. #define BABY_STEP_COMMIT (0x1 << 9)
  24. #define BABY_STEP_UNDO_COMMIT (0x1 << 10)
  25. #define BABY_STEP_IRREVERSIBLE_COMMIT (0x1 << 11)
  26. #define BABY_STEP_UNDO_CLEANUP (0x1 << 12)
  27. #endif /* NETSNMP_NO_WRITE_SUPPORT */
  28. #define BABY_STEP_POST_REQUEST (0x1 << 13)
  29. #define BABY_STEP_ALL (0xffffffff)
  30. #ifndef NETSNMP_NO_WRITE_SUPPORT
  31. #define BABY_STEP_CHECK_OBJECT BABY_STEP_CHECK_VALUE
  32. #define BABY_STEP_SET_VALUES BABY_STEP_SET_VALUE
  33. #define BABY_STEP_UNDO_SETS BABY_STEP_UNDO_SET
  34. #endif /* NETSNMP_NO_WRITE_SUPPORT */
  35. /** @name baby_steps
  36. *
  37. * This helper expands the original net-snmp set modes into the newer, finer
  38. * grained modes.
  39. *
  40. * @{ */
  41. typedef struct netsnmp_baby_steps_modes_s {
  42. /** Number of handlers whose myvoid pointer points at this object. */
  43. int refcnt;
  44. u_int registered;
  45. u_int completed;
  46. } netsnmp_baby_steps_modes;
  47. void netsnmp_baby_steps_init(void);
  48. netsnmp_mib_handler *netsnmp_baby_steps_handler_get(u_long modes);
  49. /** @} */
  50. /** @name access_multiplexer
  51. *
  52. * This helper calls individual access methods based on the mode. All
  53. * access methods share the same handler, and the same myvoid pointer.
  54. * If you need individual myvoid pointers, check out the multiplexer
  55. * handler (though it currently only works for traditional modes).
  56. *
  57. * @{ */
  58. /** @struct netsnmp_mib_handler_access_methods
  59. * Defines the access methods to be called by the access_multiplexer helper
  60. */
  61. typedef struct netsnmp_baby_steps_access_methods_s {
  62. /*
  63. * baby step modes
  64. */
  65. Netsnmp_Node_Handler *pre_request;
  66. Netsnmp_Node_Handler *object_lookup;
  67. Netsnmp_Node_Handler *get_values;
  68. #ifndef NETSNMP_NO_WRITE_SUPPORT
  69. Netsnmp_Node_Handler *object_syntax_checks;
  70. Netsnmp_Node_Handler *row_creation;
  71. Netsnmp_Node_Handler *undo_setup;
  72. Netsnmp_Node_Handler *set_values;
  73. Netsnmp_Node_Handler *consistency_checks;
  74. Netsnmp_Node_Handler *commit;
  75. Netsnmp_Node_Handler *undo_sets;
  76. Netsnmp_Node_Handler *undo_cleanup;
  77. Netsnmp_Node_Handler *undo_commit;
  78. Netsnmp_Node_Handler *irreversible_commit;
  79. #endif /* NETSNMP_NO_WRITE_SUPPORT */
  80. Netsnmp_Node_Handler *post_request;
  81. void *my_access_void;
  82. } netsnmp_baby_steps_access_methods;
  83. netsnmp_mib_handler * netsnmp_baby_steps_access_multiplexer_get(
  84. netsnmp_baby_steps_access_methods *);
  85. int netsnmp_baby_step_mode2flag( u_int mode );
  86. /** @} */
  87. /** backwards compatability. don't use in new code */
  88. #define netsnmp_get_baby_steps_handler netsnmp_baby_steps_handler_get
  89. #define netsnmp_init_baby_steps_helper netsnmp_baby_steps_handler_init
  90. #ifdef __cplusplus
  91. }
  92. #endif
  93. #endif /* baby_steps */