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