2 ######################################################################
4 ######################################################################
7 * Note: this file originally auto-generated by mib2c using
8 * $Id: mib2c.scalar.conf,v 1.5 2002/07/18 14:18:52 dts12 Exp $
13 /* function declarations */
14 void init_$name(void);
17 Netsnmp_Node_Handler do_${i};
20 Netsnmp_Node_Handler get_${i};
24 #endif /* $name.uc_H */
25 ######################################################################
27 ######################################################################
30 * Note: this file originally auto-generated by mib2c using
31 * $Id: mib2c.scalar.conf,v 1.5 2002/07/18 14:18:52 dts12 Exp $
34 #include <net-snmp/net-snmp-config.h>
35 #include <net-snmp/net-snmp-includes.h>
36 #include <net-snmp/agent/net-snmp-agent-includes.h>
39 /** Initializes the $name module */
44 static oid ${i}_oid[] = { $i.commaoid, 0 };
47 DEBUGMSGTL(("$name", "Initializing\n"));
51 netsnmp_register_read_only_instance(netsnmp_create_handler_registration
59 netsnmp_register_instance(netsnmp_create_handler_registration
72 get_$i(netsnmp_mib_handler *handler,
75 do_$i(netsnmp_mib_handler *handler,
77 netsnmp_handler_registration *reginfo,
78 netsnmp_agent_request_info *reqinfo,
79 netsnmp_request_info *requests)
81 /* We are never called for a GETNEXT if it's registered as a
82 "instance", as it's "magically" handled for us. */
84 /* a instance handler also only hands us one request at a time, so
85 we don't need to loop over a list of requests; we'll only get one. */
87 switch(reqinfo->mode) {
90 snmp_set_var_typed_value(requests->requestvb, $i.type, (u_char *) /* XXX: a pointer to the scalar's data */, /* XXX: the length of the data in bytes */);
97 * multiple states in the transaction. See:
98 * http://www.net-snmp.org/tutorial-5/toolkit/mib_module/set-actions.jpg
100 case MODE_SET_RESERVE1:
101 if (/* XXX: check incoming data in requests->requestvb->val.XXX for failures, like an incorrect type or an illegal value or ... */) {
102 netsnmp_set_request_error(reqinfo, requests, /* XXX: set error code depending on problem (like SNMP_ERR_WRONGTYPE or SNMP_ERR_WRONGVALUE or ... */);
106 case MODE_SET_RESERVE2:
107 /* XXX malloc "undo" storage buffer */
108 if (/* XXX if malloc, or whatever, failed: */) {
109 netsnmp_set_request_error(reqinfo, requests, SNMP_ERR_RESOURCESUNAVAILABLE);
114 /* XXX: free resources allocated in RESERVE1 and/or
115 RESERVE2. Something failed somewhere, and the states
116 below won't be called. */
119 case MODE_SET_ACTION:
120 /* XXX: perform the value change here */
121 if (/* XXX: error? */) {
122 netsnmp_set_request_error(reqinfo, requests, /* some error */);
126 case MODE_SET_COMMIT:
127 /* XXX: delete temporary storage */
128 if (/* XXX: error? */) {
129 /* try _really_really_ hard to never get to this point */
130 netsnmp_set_request_error(reqinfo, requests, SNMP_ERR_COMMITFAILED);
135 /* XXX: UNDO and return to previous value for the object */
136 if (/* XXX: error? */) {
137 /* try _really_really_ hard to never get to this point */
138 netsnmp_set_request_error(reqinfo, requests, SNMP_ERR_UNDOFAILED);
144 /* we should never get here, so this is a really bad error */
145 return SNMP_ERR_GENERR;
148 return SNMP_ERR_NOERROR;