2
######################################################################
4
######################################################################
7
* Note: this file originally auto-generated by mib2c using
8
* $Id: mib2c.scalar.conf,v 1.7 2003/04/08 14:57:04 dts12 Exp $
13
/* function declarations */
14
void init_$name(void);
16
Netsnmp_Node_Handler handle_${i};
19
#endif /* $name.uc_H */
20
######################################################################
22
######################################################################
25
* Note: this file originally auto-generated by mib2c using
26
* $Id: mib2c.scalar.conf,v 1.7 2003/04/08 14:57:04 dts12 Exp $
29
#include <net-snmp/net-snmp-config.h>
30
#include <net-snmp/net-snmp-includes.h>
31
#include <net-snmp/agent/net-snmp-agent-includes.h>
34
/** Initializes the $name module */
39
static oid ${i}_oid[] = { $i.commaoid };
42
DEBUGMSGTL(("$name", "Initializing\n"));
45
netsnmp_register_scalar(
46
netsnmp_create_handler_registration("$i", handle_$i,
47
${i}_oid, OID_LENGTH(${i}_oid),
60
handle_$i(netsnmp_mib_handler *handler,
61
netsnmp_handler_registration *reginfo,
62
netsnmp_agent_request_info *reqinfo,
63
netsnmp_request_info *requests)
65
/* We are never called for a GETNEXT if it's registered as a
66
"instance", as it's "magically" handled for us. */
68
/* a instance handler also only hands us one request at a time, so
69
we don't need to loop over a list of requests; we'll only get one. */
71
switch(reqinfo->mode) {
74
snmp_set_var_typed_value(requests->requestvb, $i.type,
75
(u_char *) /* XXX: a pointer to the scalar's data */,
76
/* XXX: the length of the data in bytes */);
83
* multiple states in the transaction. See:
84
* http://www.net-snmp.org/tutorial-5/toolkit/mib_module/set-actions.jpg
86
case MODE_SET_RESERVE1:
87
if (/* XXX: check incoming data in requests->requestvb->val.XXX for failures, like an incorrect type or an illegal value or ... */) {
88
netsnmp_set_request_error(reqinfo, requests, /* XXX: set error code depending on problem (like SNMP_ERR_WRONGTYPE or SNMP_ERR_WRONGVALUE or ... */);
92
case MODE_SET_RESERVE2:
93
/* XXX malloc "undo" storage buffer */
94
if (/* XXX if malloc, or whatever, failed: */) {
95
netsnmp_set_request_error(reqinfo, requests, SNMP_ERR_RESOURCEUNAVAILABLE);
100
/* XXX: free resources allocated in RESERVE1 and/or
101
RESERVE2. Something failed somewhere, and the states
102
below won't be called. */
105
case MODE_SET_ACTION:
106
/* XXX: perform the value change here */
107
if (/* XXX: error? */) {
108
netsnmp_set_request_error(reqinfo, requests, /* some error */);
112
case MODE_SET_COMMIT:
113
/* XXX: delete temporary storage */
114
if (/* XXX: error? */) {
115
/* try _really_really_ hard to never get to this point */
116
netsnmp_set_request_error(reqinfo, requests, SNMP_ERR_COMMITFAILED);
121
/* XXX: UNDO and return to previous value for the object */
122
if (/* XXX: error? */) {
123
/* try _really_really_ hard to never get to this point */
124
netsnmp_set_request_error(reqinfo, requests, SNMP_ERR_UNDOFAILED);
130
/* we should never get here, so this is a really bad error */
131
return SNMP_ERR_GENERR;
134
return SNMP_ERR_NOERROR;