2 ######################################################################
4 ######################################################################
7 * Note: this file originally auto-generated by mib2c using
8 * $Id: mib2c.old-api.conf,v 1.3 2002/10/17 09:40:46 dts12 Exp $
13 /* function declarations */
14 void init_$name(void);
15 FindVarMethod var_$name;
17 FindVarMethod var_${i};
21 WriteMethod write_${i};
27 WriteMethod write_${c};
32 #endif /* $name.uc_H */
33 ######################################################################
35 ######################################################################
38 * Note: this file originally auto-generated by mib2c using
39 * $Id: mib2c.old-api.conf,v 1.3 2002/10/17 09:40:46 dts12 Exp $
42 #include <net-snmp/net-snmp-config.h>
43 #include <net-snmp/net-snmp-includes.h>
44 #include <net-snmp/agent/net-snmp-agent-includes.h>
48 * ${name}_variables_oid:
49 * this is the top level oid that we want to register under. This
50 * is essentially a prefix, with the suffix appearing in the
54 oid ${name}_variables_oid[] = { $name.commaoid };
57 * variable4 ${name}_variables:
58 * this variable defines function callbacks and type return information
59 * for the $outputName mib section
62 struct variable4 ${name}_variables[] = {
63 /* magic number , variable type , ro/rw , callback fn , L, oidsuffix */
66 @eval $magic = $magic + 1@
69 {$i.uc, $i.type, RWRITE, var_${name}, 1, { $i.subid }},
72 {$i.uc, $i.type, RONLY , var_${name}, 1, { $i.subid }},
78 @eval $magic = $magic + 1@
81 {$c.uc, $c.type, RWRITE, var_${i}, 3, { $i.subid, 1, $c.subid }},
84 {$c.uc, $c.type, RONLY, var_${i}, 3, { $i.subid, 1, $c.subid }},
89 /* (L = length of the oidsuffix) */
92 /** Initializes the $name module */
97 DEBUGMSGTL(("$name", "Initializing\n"));
99 /* register ourselves with the agent to handle our mib tree */
100 REGISTER_MIB("$name", ${name}_variables, variable4,
101 ${name}_variables_oid);
103 /* place any other initialization junk you need here */
108 * This function is called every time the agent gets a request for
109 * a scalar variable that might be found within your mib section
110 * registered above. It is up to you to do the right thing and
111 * return the correct value.
112 * You should also correct the value of "var_len" if necessary.
114 * Please see the documentation for more information about writing
115 * module extensions, and check out the examples in the examples
116 * and mibII directories.
119 var_$name(struct variable *vp,
124 WriteMethod **write_method)
126 /* variables we may use later */
127 static long long_ret;
128 static u_long ulong_ret;
129 static unsigned char string[SPRINT_MAX_LEN];
130 static oid objid[MAX_OID_LEN];
131 static struct counter64 c64;
133 if (header_generic(vp,name,length,exact,var_len,write_method)
138 * this is where we do the value assignments for the mib results.
144 *write_method = write_${i};
146 VAR = VALUE; /* XXX */
147 return (u_char*) &VAR;
159 * Handle this table separately from the scalar value case.
160 * The workings of this are basically the same as for var_$outputName above.
163 var_$i(struct variable *vp,
168 WriteMethod **write_method)
170 /* variables we may use later */
171 static long long_ret;
172 static u_long ulong_ret;
173 static unsigned char string[SPRINT_MAX_LEN];
174 static oid objid[MAX_OID_LEN];
175 static struct counter64 c64;
178 * This assumes that the table is a 'simple' table.
179 * See the implementation documentation for the meaning of this.
180 * You will need to provide the correct value for the TABLE_SIZE parameter
182 * If this table does not meet the requirements for a simple table,
183 * you will need to provide the replacement code yourself.
184 * Mib2c is not smart enough to write this for you.
185 * Again, see the implementation documentation for what is required.
187 if (header_simple_table(vp,name,length,exact,var_len,write_method, TABLE_SIZE)
192 * this is where we do the value assignments for the mib results.
198 *write_method = write_${c};
200 VAR = VALUE; /* XXX */
201 return (u_char*) &VAR;
228 if (var_val_type != $i.type) {
229 fprintf(stderr, "write to $name not $i.type\n");
230 return SNMP_ERR_WRONGTYPE;
232 if (var_val_len > sizeof($i.decl)) {
233 fprintf(stderr,"write to $name: bad length\n");
234 return SNMP_ERR_WRONGLENGTH;
240 value = * ($i.decl *) var_val;
245 /* Release any resources that have been allocated */
250 * The variable has been stored in 'value' for you to use,
251 * and you have just been asked to do something with it.
252 * Note that anything done here must be reversable in the UNDO case
257 /* Back out any changes made in the ACTION case */
262 * Things are working well, so it's now safe to make the change
263 * permanently. Make sure that anything done here can't fail!
267 return SNMP_ERR_NOERROR;
289 if (var_val_type != $c.type) {
290 fprintf(stderr, "write to $name not $c.type\n");
291 return SNMP_ERR_WRONGTYPE;
293 if (var_val_len > sizeof($c.decl)) {
294 fprintf(stderr,"write to $name: bad length\n");
295 return SNMP_ERR_WRONGLENGTH;
301 value = * ($c.decl *) var_val;
306 /* Release any resources that have been allocated */
311 * The variable has been stored in 'value' for you to use,
312 * and you have just been asked to do something with it.
313 * Note that anything done here must be reversable in the UNDO case
318 /* Back out any changes made in the ACTION case */
323 * Things are working well, so it's now safe to make the change
324 * permanently. Make sure that anything done here can't fail!
328 return SNMP_ERR_NOERROR;