2 * This C file has been generated by smidump 0.4.2-pre1.
3 * It is intended to be used with the NET-SNMP agent library.
5 * This C file is derived from the SNMPv2-MIB module.
7 * $Id: snmpv2-mib-agt-stub.c 1606 2003-12-01 12:24:15Z strauss $
14 #include "snmpv2-mib.h"
16 #include <ucd-snmp/asn1.h>
17 #include <ucd-snmp/snmp.h>
18 #include <ucd-snmp/snmp_api.h>
19 #include <ucd-snmp/snmp_impl.h>
20 #include <ucd-snmp/snmp_vars.h>
23 * Forward declaration of read methods for groups of scalars and tables:
26 static unsigned char *
27 read_system_stub(struct variable *, oid *, size_t *, int, size_t *, WriteMethod **);
28 static unsigned char *
29 read_sysOREntry_stub(struct variable *, oid *, size_t *, int, size_t *, WriteMethod **);
30 static unsigned char *
31 read_snmp_stub(struct variable *, oid *, size_t *, int, size_t *, WriteMethod **);
32 static unsigned char *
33 read_snmpSet_stub(struct variable *, oid *, size_t *, int, size_t *, WriteMethod **);
36 * Forward declaration of write methods for writable objects:
40 write_sysContact_stub(int, u_char *, u_char, int, u_char *, oid *, int);
42 write_sysName_stub(int, u_char *, u_char, int, u_char *, oid *, int);
44 write_sysLocation_stub(int, u_char *, u_char, int, u_char *, oid *, int);
46 write_snmpEnableAuthenTraps_stub(int, u_char *, u_char, int, u_char *, oid *, int);
48 write_snmpSetSerialNo_stub(int, u_char *, u_char, int, u_char *, oid *, int);
51 * Definitions of tags that are used internally to read/write
52 * the selected object type. These tags should be unique.
62 #define SYSORLASTCHANGE 8
64 static oid system_base[] = {1, 3, 6, 1, 2, 1, 1};
66 struct variable system_variables[] = {
67 { SYSDESCR, ASN_OCTET_STR, RONLY, read_system_stub, 1, {1} },
68 { SYSOBJECTID, ASN_OBJECT_ID, RONLY, read_system_stub, 1, {2} },
69 { SYSUPTIME, ASN_INTEGER, RONLY, read_system_stub, 1, {3} },
70 { SYSCONTACT, ASN_OCTET_STR, RWRITE, read_system_stub, 1, {4} },
71 { SYSNAME, ASN_OCTET_STR, RWRITE, read_system_stub, 1, {5} },
72 { SYSLOCATION, ASN_OCTET_STR, RWRITE, read_system_stub, 1, {6} },
73 { SYSSERVICES, ASN_INTEGER, RONLY, read_system_stub, 1, {7} },
74 { SYSORLASTCHANGE, ASN_INTEGER, RONLY, read_system_stub, 1, {8} },
81 static oid sysOREntry_base[] = {1, 3, 6, 1, 2, 1, 1, 9, 1};
83 struct variable sysOREntry_variables[] = {
84 { SYSORID, ASN_OBJECT_ID, RONLY, read_sysOREntry_stub, 1, {2} },
85 { SYSORDESCR, ASN_OCTET_STR, RONLY, read_sysOREntry_stub, 1, {3} },
86 { SYSORUPTIME, ASN_INTEGER, RONLY, read_sysOREntry_stub, 1, {4} },
91 #define SNMPINBADVERSIONS 3
92 #define SNMPINBADCOMMUNITYNAMES 4
93 #define SNMPINBADCOMMUNITYUSES 5
94 #define SNMPINASNPARSEERRS 6
95 #define SNMPINTOOBIGS 8
96 #define SNMPINNOSUCHNAMES 9
97 #define SNMPINBADVALUES 10
98 #define SNMPINREADONLYS 11
99 #define SNMPINGENERRS 12
100 #define SNMPINTOTALREQVARS 13
101 #define SNMPINTOTALSETVARS 14
102 #define SNMPINGETREQUESTS 15
103 #define SNMPINGETNEXTS 16
104 #define SNMPINSETREQUESTS 17
105 #define SNMPINGETRESPONSES 18
106 #define SNMPINTRAPS 19
107 #define SNMPOUTTOOBIGS 20
108 #define SNMPOUTNOSUCHNAMES 21
109 #define SNMPOUTBADVALUES 22
110 #define SNMPOUTGENERRS 24
111 #define SNMPOUTGETREQUESTS 25
112 #define SNMPOUTGETNEXTS 26
113 #define SNMPOUTSETREQUESTS 27
114 #define SNMPOUTGETRESPONSES 28
115 #define SNMPOUTTRAPS 29
116 #define SNMPENABLEAUTHENTRAPS 30
117 #define SNMPSILENTDROPS 31
118 #define SNMPPROXYDROPS 32
120 static oid snmp_base[] = {1, 3, 6, 1, 2, 1, 11};
122 struct variable snmp_variables[] = {
123 { SNMPINPKTS, ASN_INTEGER, RONLY, read_snmp_stub, 1, {1} },
124 { SNMPOUTPKTS, ASN_INTEGER, RONLY, read_snmp_stub, 1, {2} },
125 { SNMPINBADVERSIONS, ASN_INTEGER, RONLY, read_snmp_stub, 1, {3} },
126 { SNMPINBADCOMMUNITYNAMES, ASN_INTEGER, RONLY, read_snmp_stub, 1, {4} },
127 { SNMPINBADCOMMUNITYUSES, ASN_INTEGER, RONLY, read_snmp_stub, 1, {5} },
128 { SNMPINASNPARSEERRS, ASN_INTEGER, RONLY, read_snmp_stub, 1, {6} },
129 { SNMPINTOOBIGS, ASN_INTEGER, RONLY, read_snmp_stub, 1, {8} },
130 { SNMPINNOSUCHNAMES, ASN_INTEGER, RONLY, read_snmp_stub, 1, {9} },
131 { SNMPINBADVALUES, ASN_INTEGER, RONLY, read_snmp_stub, 1, {10} },
132 { SNMPINREADONLYS, ASN_INTEGER, RONLY, read_snmp_stub, 1, {11} },
133 { SNMPINGENERRS, ASN_INTEGER, RONLY, read_snmp_stub, 1, {12} },
134 { SNMPINTOTALREQVARS, ASN_INTEGER, RONLY, read_snmp_stub, 1, {13} },
135 { SNMPINTOTALSETVARS, ASN_INTEGER, RONLY, read_snmp_stub, 1, {14} },
136 { SNMPINGETREQUESTS, ASN_INTEGER, RONLY, read_snmp_stub, 1, {15} },
137 { SNMPINGETNEXTS, ASN_INTEGER, RONLY, read_snmp_stub, 1, {16} },
138 { SNMPINSETREQUESTS, ASN_INTEGER, RONLY, read_snmp_stub, 1, {17} },
139 { SNMPINGETRESPONSES, ASN_INTEGER, RONLY, read_snmp_stub, 1, {18} },
140 { SNMPINTRAPS, ASN_INTEGER, RONLY, read_snmp_stub, 1, {19} },
141 { SNMPOUTTOOBIGS, ASN_INTEGER, RONLY, read_snmp_stub, 1, {20} },
142 { SNMPOUTNOSUCHNAMES, ASN_INTEGER, RONLY, read_snmp_stub, 1, {21} },
143 { SNMPOUTBADVALUES, ASN_INTEGER, RONLY, read_snmp_stub, 1, {22} },
144 { SNMPOUTGENERRS, ASN_INTEGER, RONLY, read_snmp_stub, 1, {24} },
145 { SNMPOUTGETREQUESTS, ASN_INTEGER, RONLY, read_snmp_stub, 1, {25} },
146 { SNMPOUTGETNEXTS, ASN_INTEGER, RONLY, read_snmp_stub, 1, {26} },
147 { SNMPOUTSETREQUESTS, ASN_INTEGER, RONLY, read_snmp_stub, 1, {27} },
148 { SNMPOUTGETRESPONSES, ASN_INTEGER, RONLY, read_snmp_stub, 1, {28} },
149 { SNMPOUTTRAPS, ASN_INTEGER, RONLY, read_snmp_stub, 1, {29} },
150 { SNMPENABLEAUTHENTRAPS, ASN_INTEGER, RWRITE, read_snmp_stub, 1, {30} },
151 { SNMPSILENTDROPS, ASN_INTEGER, RONLY, read_snmp_stub, 1, {31} },
152 { SNMPPROXYDROPS, ASN_INTEGER, RONLY, read_snmp_stub, 1, {32} },
156 #define SNMPSETSERIALNO 1
158 static oid snmpSet_base[] = {1, 3, 6, 1, 6, 3, 1, 1, 6};
160 struct variable snmpSet_variables[] = {
161 { SNMPSETSERIALNO, ASN_INTEGER, RWRITE, read_snmpSet_stub, 1, {1} },
167 * Registration functions for the various MIB groups.
170 int register_system()
172 return register_mib("system",
174 sizeof(struct variable),
175 sizeof(system_variables)/sizeof(struct variable),
177 sizeof(system_base)/sizeof(oid));
181 int register_sysOREntry()
183 return register_mib("sysOREntry",
184 sysOREntry_variables,
185 sizeof(struct variable),
186 sizeof(sysOREntry_variables)/sizeof(struct variable),
188 sizeof(sysOREntry_base)/sizeof(oid));
194 return register_mib("snmp",
196 sizeof(struct variable),
197 sizeof(snmp_variables)/sizeof(struct variable),
199 sizeof(snmp_base)/sizeof(oid));
203 int register_snmpTrap()
205 return register_mib("snmpTrap",
207 sizeof(struct variable),
208 sizeof(snmpTrap_variables)/sizeof(struct variable),
210 sizeof(snmpTrap_base)/sizeof(oid));
214 int register_snmpSet()
216 return register_mib("snmpSet",
218 sizeof(struct variable),
219 sizeof(snmpSet_variables)/sizeof(struct variable),
221 sizeof(snmpSet_base)/sizeof(oid));
226 * Read methods for groups of scalars and tables:
229 static unsigned char *
230 read_system_stub(struct variable *vp,
235 WriteMethod **write_method)
237 static system_t system;
239 /* check whether the instance identifier is valid */
241 if (header_generic(vp, name, length, exact, var_len,
242 write_method) == MATCH_FAILED) {
246 /* call the user supplied function to retrieve values */
248 read_system(&system);
250 /* return the current value of the variable */
255 *var_len = system._sysDescrLength;
256 return (unsigned char *) system.sysDescr;
259 *var_len = system._sysObjectIDLength;
260 return (unsigned char *) system.sysObjectID;
263 return (unsigned char *) &system.sysUpTime;
266 *var_len = system._sysContactLength;
267 return (unsigned char *) system.sysContact;
270 *var_len = system._sysNameLength;
271 return (unsigned char *) system.sysName;
274 *var_len = system._sysLocationLength;
275 return (unsigned char *) system.sysLocation;
278 return (unsigned char *) &system.sysServices;
280 case SYSORLASTCHANGE:
281 return (unsigned char *) &system.sysORLastChange;
290 static unsigned char *
291 read_sysOREntry_stub(struct variable *vp,
296 WriteMethod **write_method)
298 static sysOREntry_t sysOREntry;
300 /* call the user supplied function to retrieve values */
302 read_sysOREntry(&sysOREntry);
304 /* return the current value of the variable */
309 *var_len = sysOREntry._sysORIDLength;
310 return (unsigned char *) sysOREntry.sysORID;
313 *var_len = sysOREntry._sysORDescrLength;
314 return (unsigned char *) sysOREntry.sysORDescr;
317 return (unsigned char *) &sysOREntry.sysORUpTime;
326 static unsigned char *
327 read_snmp_stub(struct variable *vp,
332 WriteMethod **write_method)
336 /* check whether the instance identifier is valid */
338 if (header_generic(vp, name, length, exact, var_len,
339 write_method) == MATCH_FAILED) {
343 /* call the user supplied function to retrieve values */
347 /* return the current value of the variable */
352 return (unsigned char *) &snmp.snmpInPkts;
355 return (unsigned char *) &snmp.snmpOutPkts;
357 case SNMPINBADVERSIONS:
358 return (unsigned char *) &snmp.snmpInBadVersions;
360 case SNMPINBADCOMMUNITYNAMES:
361 return (unsigned char *) &snmp.snmpInBadCommunityNames;
363 case SNMPINBADCOMMUNITYUSES:
364 return (unsigned char *) &snmp.snmpInBadCommunityUses;
366 case SNMPINASNPARSEERRS:
367 return (unsigned char *) &snmp.snmpInASNParseErrs;
370 return (unsigned char *) &snmp.snmpInTooBigs;
372 case SNMPINNOSUCHNAMES:
373 return (unsigned char *) &snmp.snmpInNoSuchNames;
375 case SNMPINBADVALUES:
376 return (unsigned char *) &snmp.snmpInBadValues;
378 case SNMPINREADONLYS:
379 return (unsigned char *) &snmp.snmpInReadOnlys;
382 return (unsigned char *) &snmp.snmpInGenErrs;
384 case SNMPINTOTALREQVARS:
385 return (unsigned char *) &snmp.snmpInTotalReqVars;
387 case SNMPINTOTALSETVARS:
388 return (unsigned char *) &snmp.snmpInTotalSetVars;
390 case SNMPINGETREQUESTS:
391 return (unsigned char *) &snmp.snmpInGetRequests;
394 return (unsigned char *) &snmp.snmpInGetNexts;
396 case SNMPINSETREQUESTS:
397 return (unsigned char *) &snmp.snmpInSetRequests;
399 case SNMPINGETRESPONSES:
400 return (unsigned char *) &snmp.snmpInGetResponses;
403 return (unsigned char *) &snmp.snmpInTraps;
406 return (unsigned char *) &snmp.snmpOutTooBigs;
408 case SNMPOUTNOSUCHNAMES:
409 return (unsigned char *) &snmp.snmpOutNoSuchNames;
411 case SNMPOUTBADVALUES:
412 return (unsigned char *) &snmp.snmpOutBadValues;
415 return (unsigned char *) &snmp.snmpOutGenErrs;
417 case SNMPOUTGETREQUESTS:
418 return (unsigned char *) &snmp.snmpOutGetRequests;
420 case SNMPOUTGETNEXTS:
421 return (unsigned char *) &snmp.snmpOutGetNexts;
423 case SNMPOUTSETREQUESTS:
424 return (unsigned char *) &snmp.snmpOutSetRequests;
426 case SNMPOUTGETRESPONSES:
427 return (unsigned char *) &snmp.snmpOutGetResponses;
430 return (unsigned char *) &snmp.snmpOutTraps;
432 case SNMPENABLEAUTHENTRAPS:
433 return (unsigned char *) &snmp.snmpEnableAuthenTraps;
435 case SNMPSILENTDROPS:
436 return (unsigned char *) &snmp.snmpSilentDrops;
439 return (unsigned char *) &snmp.snmpProxyDrops;
448 static unsigned char *
449 read_snmpSet_stub(struct variable *vp,
454 WriteMethod **write_method)
456 static snmpSet_t snmpSet;
458 /* check whether the instance identifier is valid */
460 if (header_generic(vp, name, length, exact, var_len,
461 write_method) == MATCH_FAILED) {
465 /* call the user supplied function to retrieve values */
467 read_snmpSet(&snmpSet);
469 /* return the current value of the variable */
473 case SNMPSETSERIALNO:
474 return (unsigned char *) &snmpSet.snmpSetSerialNo;
485 * Forward declaration of write methods for writable objects:
489 write_sysContact_stub(int action,
497 return SNMP_ERR_NOERROR;
501 write_sysName_stub(int action,
509 return SNMP_ERR_NOERROR;
513 write_sysLocation_stub(int action,
521 return SNMP_ERR_NOERROR;
525 write_snmpEnableAuthenTraps_stub(int action,
533 return SNMP_ERR_NOERROR;
537 write_snmpSetSerialNo_stub(int action,
545 return SNMP_ERR_NOERROR;