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 IF-MIB module.
7 * $Id: if-mib-agt-stub.c 1606 2003-12-01 12:24:15Z strauss $
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_interfaces_stub(struct variable *, oid *, size_t *, int, size_t *, WriteMethod **);
28 static unsigned char *
29 read_ifEntry_stub(struct variable *, oid *, size_t *, int, size_t *, WriteMethod **);
30 static unsigned char *
31 read_ifMIBObjects_stub(struct variable *, oid *, size_t *, int, size_t *, WriteMethod **);
32 static unsigned char *
33 read_ifXEntry_stub(struct variable *, oid *, size_t *, int, size_t *, WriteMethod **);
34 static unsigned char *
35 read_ifStackEntry_stub(struct variable *, oid *, size_t *, int, size_t *, WriteMethod **);
36 static unsigned char *
37 read_ifTestEntry_stub(struct variable *, oid *, size_t *, int, size_t *, WriteMethod **);
38 static unsigned char *
39 read_ifRcvAddressEntry_stub(struct variable *, oid *, size_t *, int, size_t *, WriteMethod **);
42 * Forward declaration of write methods for writable objects:
46 write_ifAdminStatus_stub(int, u_char *, u_char, int, u_char *, oid *, int);
48 write_ifLinkUpDownTrapEnable_stub(int, u_char *, u_char, int, u_char *, oid *, int);
50 write_ifPromiscuousMode_stub(int, u_char *, u_char, int, u_char *, oid *, int);
52 write_ifAlias_stub(int, u_char *, u_char, int, u_char *, oid *, int);
54 write_ifStackStatus_stub(int, u_char *, u_char, int, u_char *, oid *, int);
56 write_ifTestId_stub(int, u_char *, u_char, int, u_char *, oid *, int);
58 write_ifTestStatus_stub(int, u_char *, u_char, int, u_char *, oid *, int);
60 write_ifTestType_stub(int, u_char *, u_char, int, u_char *, oid *, int);
62 write_ifTestOwner_stub(int, u_char *, u_char, int, u_char *, oid *, int);
64 write_ifRcvAddressStatus_stub(int, u_char *, u_char, int, u_char *, oid *, int);
66 write_ifRcvAddressType_stub(int, u_char *, u_char, int, u_char *, oid *, int);
69 * Definitions of tags that are used internally to read/write
70 * the selected object type. These tags should be unique.
75 static oid interfaces_base[] = {1, 3, 6, 1, 2, 1, 2};
77 struct variable interfaces_variables[] = {
78 { IFNUMBER, ASN_INTEGER, RONLY, read_interfaces_stub, 1, {1} },
86 #define IFPHYSADDRESS 6
87 #define IFADMINSTATUS 7
88 #define IFOPERSTATUS 8
89 #define IFLASTCHANGE 9
91 #define IFINUCASTPKTS 11
92 #define IFINNUCASTPKTS 12
93 #define IFINDISCARDS 13
95 #define IFINUNKNOWNPROTOS 15
96 #define IFOUTOCTETS 16
97 #define IFOUTUCASTPKTS 17
98 #define IFOUTNUCASTPKTS 18
99 #define IFOUTDISCARDS 19
100 #define IFOUTERRORS 20
102 #define IFSPECIFIC 22
104 static oid ifEntry_base[] = {1, 3, 6, 1, 2, 1, 2, 2, 1};
106 struct variable ifEntry_variables[] = {
107 { IFINDEX, ASN_INTEGER, RONLY, read_ifEntry_stub, 1, {1} },
108 { IFDESCR, ASN_OCTET_STR, RONLY, read_ifEntry_stub, 1, {2} },
109 { IFTYPE, ASN_INTEGER, RONLY, read_ifEntry_stub, 1, {3} },
110 { IFMTU, ASN_INTEGER, RONLY, read_ifEntry_stub, 1, {4} },
111 { IFSPEED, ASN_INTEGER, RONLY, read_ifEntry_stub, 1, {5} },
112 { IFPHYSADDRESS, ASN_OCTET_STR, RONLY, read_ifEntry_stub, 1, {6} },
113 { IFADMINSTATUS, ASN_INTEGER, RWRITE, read_ifEntry_stub, 1, {7} },
114 { IFOPERSTATUS, ASN_INTEGER, RONLY, read_ifEntry_stub, 1, {8} },
115 { IFLASTCHANGE, ASN_INTEGER, RONLY, read_ifEntry_stub, 1, {9} },
116 { IFINOCTETS, ASN_INTEGER, RONLY, read_ifEntry_stub, 1, {10} },
117 { IFINUCASTPKTS, ASN_INTEGER, RONLY, read_ifEntry_stub, 1, {11} },
118 { IFINNUCASTPKTS, ASN_INTEGER, RONLY, read_ifEntry_stub, 1, {12} },
119 { IFINDISCARDS, ASN_INTEGER, RONLY, read_ifEntry_stub, 1, {13} },
120 { IFINERRORS, ASN_INTEGER, RONLY, read_ifEntry_stub, 1, {14} },
121 { IFINUNKNOWNPROTOS, ASN_INTEGER, RONLY, read_ifEntry_stub, 1, {15} },
122 { IFOUTOCTETS, ASN_INTEGER, RONLY, read_ifEntry_stub, 1, {16} },
123 { IFOUTUCASTPKTS, ASN_INTEGER, RONLY, read_ifEntry_stub, 1, {17} },
124 { IFOUTNUCASTPKTS, ASN_INTEGER, RONLY, read_ifEntry_stub, 1, {18} },
125 { IFOUTDISCARDS, ASN_INTEGER, RONLY, read_ifEntry_stub, 1, {19} },
126 { IFOUTERRORS, ASN_INTEGER, RONLY, read_ifEntry_stub, 1, {20} },
127 { IFOUTQLEN, ASN_INTEGER, RONLY, read_ifEntry_stub, 1, {21} },
128 { IFSPECIFIC, ASN_OBJECT_ID, RONLY, read_ifEntry_stub, 1, {22} },
131 #define IFTABLELASTCHANGE 5
132 #define IFSTACKLASTCHANGE 6
134 static oid ifMIBObjects_base[] = {1, 3, 6, 1, 2, 1, 31, 1};
136 struct variable ifMIBObjects_variables[] = {
137 { IFTABLELASTCHANGE, ASN_INTEGER, RONLY, read_ifMIBObjects_stub, 1, {5} },
138 { IFSTACKLASTCHANGE, ASN_INTEGER, RONLY, read_ifMIBObjects_stub, 1, {6} },
142 #define IFINMULTICASTPKTS 2
143 #define IFINBROADCASTPKTS 3
144 #define IFOUTMULTICASTPKTS 4
145 #define IFOUTBROADCASTPKTS 5
146 #define IFHCINOCTETS 6
147 #define IFHCINUCASTPKTS 7
148 #define IFHCINMULTICASTPKTS 8
149 #define IFHCINBROADCASTPKTS 9
150 #define IFHCOUTOCTETS 10
151 #define IFHCOUTUCASTPKTS 11
152 #define IFHCOUTMULTICASTPKTS 12
153 #define IFHCOUTBROADCASTPKTS 13
154 #define IFLINKUPDOWNTRAPENABLE 14
155 #define IFHIGHSPEED 15
156 #define IFPROMISCUOUSMODE 16
157 #define IFCONNECTORPRESENT 17
159 #define IFCOUNTERDISCONTINUITYTIME 19
161 static oid ifXEntry_base[] = {1, 3, 6, 1, 2, 1, 31, 1, 1, 1};
163 struct variable ifXEntry_variables[] = {
164 { IFNAME, ASN_OCTET_STR, RONLY, read_ifXEntry_stub, 1, {1} },
165 { IFINMULTICASTPKTS, ASN_INTEGER, RONLY, read_ifXEntry_stub, 1, {2} },
166 { IFINBROADCASTPKTS, ASN_INTEGER, RONLY, read_ifXEntry_stub, 1, {3} },
167 { IFOUTMULTICASTPKTS, ASN_INTEGER, RONLY, read_ifXEntry_stub, 1, {4} },
168 { IFOUTBROADCASTPKTS, ASN_INTEGER, RONLY, read_ifXEntry_stub, 1, {5} },
169 { IFHCINOCTETS, ASN_INTEGER, RONLY, read_ifXEntry_stub, 1, {6} },
170 { IFHCINUCASTPKTS, ASN_INTEGER, RONLY, read_ifXEntry_stub, 1, {7} },
171 { IFHCINMULTICASTPKTS, ASN_INTEGER, RONLY, read_ifXEntry_stub, 1, {8} },
172 { IFHCINBROADCASTPKTS, ASN_INTEGER, RONLY, read_ifXEntry_stub, 1, {9} },
173 { IFHCOUTOCTETS, ASN_INTEGER, RONLY, read_ifXEntry_stub, 1, {10} },
174 { IFHCOUTUCASTPKTS, ASN_INTEGER, RONLY, read_ifXEntry_stub, 1, {11} },
175 { IFHCOUTMULTICASTPKTS, ASN_INTEGER, RONLY, read_ifXEntry_stub, 1, {12} },
176 { IFHCOUTBROADCASTPKTS, ASN_INTEGER, RONLY, read_ifXEntry_stub, 1, {13} },
177 { IFLINKUPDOWNTRAPENABLE, ASN_INTEGER, RWRITE, read_ifXEntry_stub, 1, {14} },
178 { IFHIGHSPEED, ASN_INTEGER, RONLY, read_ifXEntry_stub, 1, {15} },
179 { IFPROMISCUOUSMODE, ASN_INTEGER, RWRITE, read_ifXEntry_stub, 1, {16} },
180 { IFCONNECTORPRESENT, ASN_INTEGER, RONLY, read_ifXEntry_stub, 1, {17} },
181 { IFALIAS, ASN_OCTET_STR, RWRITE, read_ifXEntry_stub, 1, {18} },
182 { IFCOUNTERDISCONTINUITYTIME, ASN_INTEGER, RONLY, read_ifXEntry_stub, 1, {19} },
185 #define IFSTACKSTATUS 3
187 static oid ifStackEntry_base[] = {1, 3, 6, 1, 2, 1, 31, 1, 2, 1};
189 struct variable ifStackEntry_variables[] = {
190 { IFSTACKSTATUS, ASN_INTEGER, RWRITE, read_ifStackEntry_stub, 1, {3} },
194 #define IFTESTSTATUS 2
196 #define IFTESTRESULT 4
198 #define IFTESTOWNER 6
200 static oid ifTestEntry_base[] = {1, 3, 6, 1, 2, 1, 31, 1, 3, 1};
202 struct variable ifTestEntry_variables[] = {
203 { IFTESTID, ASN_INTEGER, RWRITE, read_ifTestEntry_stub, 1, {1} },
204 { IFTESTSTATUS, ASN_INTEGER, RWRITE, read_ifTestEntry_stub, 1, {2} },
205 { IFTESTTYPE, ASN_OBJECT_ID, RWRITE, read_ifTestEntry_stub, 1, {3} },
206 { IFTESTRESULT, ASN_INTEGER, RONLY, read_ifTestEntry_stub, 1, {4} },
207 { IFTESTCODE, ASN_OBJECT_ID, RONLY, read_ifTestEntry_stub, 1, {5} },
208 { IFTESTOWNER, ASN_OCTET_STR, RWRITE, read_ifTestEntry_stub, 1, {6} },
211 #define IFRCVADDRESSSTATUS 2
212 #define IFRCVADDRESSTYPE 3
214 static oid ifRcvAddressEntry_base[] = {1, 3, 6, 1, 2, 1, 31, 1, 4, 1};
216 struct variable ifRcvAddressEntry_variables[] = {
217 { IFRCVADDRESSSTATUS, ASN_INTEGER, RWRITE, read_ifRcvAddressEntry_stub, 1, {2} },
218 { IFRCVADDRESSTYPE, ASN_INTEGER, RWRITE, read_ifRcvAddressEntry_stub, 1, {3} },
224 * Registration functions for the various MIB groups.
227 int register_interfaces()
229 return register_mib("interfaces",
230 interfaces_variables,
231 sizeof(struct variable),
232 sizeof(interfaces_variables)/sizeof(struct variable),
234 sizeof(interfaces_base)/sizeof(oid));
238 int register_ifEntry()
240 return register_mib("ifEntry",
242 sizeof(struct variable),
243 sizeof(ifEntry_variables)/sizeof(struct variable),
245 sizeof(ifEntry_base)/sizeof(oid));
249 int register_ifMIBObjects()
251 return register_mib("ifMIBObjects",
252 ifMIBObjects_variables,
253 sizeof(struct variable),
254 sizeof(ifMIBObjects_variables)/sizeof(struct variable),
256 sizeof(ifMIBObjects_base)/sizeof(oid));
260 int register_ifXEntry()
262 return register_mib("ifXEntry",
264 sizeof(struct variable),
265 sizeof(ifXEntry_variables)/sizeof(struct variable),
267 sizeof(ifXEntry_base)/sizeof(oid));
271 int register_ifStackEntry()
273 return register_mib("ifStackEntry",
274 ifStackEntry_variables,
275 sizeof(struct variable),
276 sizeof(ifStackEntry_variables)/sizeof(struct variable),
278 sizeof(ifStackEntry_base)/sizeof(oid));
282 int register_ifTestEntry()
284 return register_mib("ifTestEntry",
285 ifTestEntry_variables,
286 sizeof(struct variable),
287 sizeof(ifTestEntry_variables)/sizeof(struct variable),
289 sizeof(ifTestEntry_base)/sizeof(oid));
293 int register_ifRcvAddressEntry()
295 return register_mib("ifRcvAddressEntry",
296 ifRcvAddressEntry_variables,
297 sizeof(struct variable),
298 sizeof(ifRcvAddressEntry_variables)/sizeof(struct variable),
299 ifRcvAddressEntry_base,
300 sizeof(ifRcvAddressEntry_base)/sizeof(oid));
305 * Read methods for groups of scalars and tables:
308 static unsigned char *
309 read_interfaces_stub(struct variable *vp,
314 WriteMethod **write_method)
316 static interfaces_t interfaces;
318 /* check whether the instance identifier is valid */
320 if (header_generic(vp, name, length, exact, var_len,
321 write_method) == MATCH_FAILED) {
325 /* call the user supplied function to retrieve values */
327 read_interfaces(&interfaces);
329 /* return the current value of the variable */
334 return (unsigned char *) &interfaces.ifNumber;
343 static unsigned char *
344 read_ifEntry_stub(struct variable *vp,
349 WriteMethod **write_method)
351 static ifEntry_t ifEntry;
353 /* call the user supplied function to retrieve values */
355 read_ifEntry(&ifEntry);
357 /* return the current value of the variable */
362 return (unsigned char *) &ifEntry.ifIndex;
365 *var_len = ifEntry._ifDescrLength;
366 return (unsigned char *) ifEntry.ifDescr;
369 return (unsigned char *) &ifEntry.ifType;
372 return (unsigned char *) &ifEntry.ifMtu;
375 return (unsigned char *) &ifEntry.ifSpeed;
378 *var_len = ifEntry._ifPhysAddressLength;
379 return (unsigned char *) ifEntry.ifPhysAddress;
382 return (unsigned char *) &ifEntry.ifAdminStatus;
385 return (unsigned char *) &ifEntry.ifOperStatus;
388 return (unsigned char *) &ifEntry.ifLastChange;
391 return (unsigned char *) &ifEntry.ifInOctets;
394 return (unsigned char *) &ifEntry.ifInUcastPkts;
397 return (unsigned char *) &ifEntry.ifInNUcastPkts;
400 return (unsigned char *) &ifEntry.ifInDiscards;
403 return (unsigned char *) &ifEntry.ifInErrors;
405 case IFINUNKNOWNPROTOS:
406 return (unsigned char *) &ifEntry.ifInUnknownProtos;
409 return (unsigned char *) &ifEntry.ifOutOctets;
412 return (unsigned char *) &ifEntry.ifOutUcastPkts;
414 case IFOUTNUCASTPKTS:
415 return (unsigned char *) &ifEntry.ifOutNUcastPkts;
418 return (unsigned char *) &ifEntry.ifOutDiscards;
421 return (unsigned char *) &ifEntry.ifOutErrors;
424 return (unsigned char *) &ifEntry.ifOutQLen;
427 *var_len = ifEntry._ifSpecificLength;
428 return (unsigned char *) ifEntry.ifSpecific;
437 static unsigned char *
438 read_ifMIBObjects_stub(struct variable *vp,
443 WriteMethod **write_method)
445 static ifMIBObjects_t ifMIBObjects;
447 /* call the user supplied function to retrieve values */
449 read_ifMIBObjects(&ifMIBObjects);
451 /* return the current value of the variable */
455 case IFTABLELASTCHANGE:
456 return (unsigned char *) &ifMIBObjects.ifTableLastChange;
458 case IFSTACKLASTCHANGE:
459 return (unsigned char *) &ifMIBObjects.ifStackLastChange;
468 static unsigned char *
469 read_ifXEntry_stub(struct variable *vp,
474 WriteMethod **write_method)
476 static ifXEntry_t ifXEntry;
478 /* call the user supplied function to retrieve values */
480 read_ifXEntry(&ifXEntry);
482 /* return the current value of the variable */
487 *var_len = ifXEntry._ifNameLength;
488 return (unsigned char *) ifXEntry.ifName;
490 case IFINMULTICASTPKTS:
491 return (unsigned char *) &ifXEntry.ifInMulticastPkts;
493 case IFINBROADCASTPKTS:
494 return (unsigned char *) &ifXEntry.ifInBroadcastPkts;
496 case IFOUTMULTICASTPKTS:
497 return (unsigned char *) &ifXEntry.ifOutMulticastPkts;
499 case IFOUTBROADCASTPKTS:
500 return (unsigned char *) &ifXEntry.ifOutBroadcastPkts;
503 /* add code to return the value here */
505 case IFHCINUCASTPKTS:
506 /* add code to return the value here */
508 case IFHCINMULTICASTPKTS:
509 /* add code to return the value here */
511 case IFHCINBROADCASTPKTS:
512 /* add code to return the value here */
515 /* add code to return the value here */
517 case IFHCOUTUCASTPKTS:
518 /* add code to return the value here */
520 case IFHCOUTMULTICASTPKTS:
521 /* add code to return the value here */
523 case IFHCOUTBROADCASTPKTS:
524 /* add code to return the value here */
526 case IFLINKUPDOWNTRAPENABLE:
527 return (unsigned char *) &ifXEntry.ifLinkUpDownTrapEnable;
530 return (unsigned char *) &ifXEntry.ifHighSpeed;
532 case IFPROMISCUOUSMODE:
533 return (unsigned char *) &ifXEntry.ifPromiscuousMode;
535 case IFCONNECTORPRESENT:
536 return (unsigned char *) &ifXEntry.ifConnectorPresent;
539 *var_len = ifXEntry._ifAliasLength;
540 return (unsigned char *) ifXEntry.ifAlias;
542 case IFCOUNTERDISCONTINUITYTIME:
543 return (unsigned char *) &ifXEntry.ifCounterDiscontinuityTime;
552 static unsigned char *
553 read_ifStackEntry_stub(struct variable *vp,
558 WriteMethod **write_method)
560 static ifStackEntry_t ifStackEntry;
562 /* call the user supplied function to retrieve values */
564 read_ifStackEntry(&ifStackEntry);
566 /* return the current value of the variable */
571 return (unsigned char *) &ifStackEntry.ifStackStatus;
580 static unsigned char *
581 read_ifTestEntry_stub(struct variable *vp,
586 WriteMethod **write_method)
588 static ifTestEntry_t ifTestEntry;
590 /* call the user supplied function to retrieve values */
592 read_ifTestEntry(&ifTestEntry);
594 /* return the current value of the variable */
599 return (unsigned char *) &ifTestEntry.ifTestId;
602 return (unsigned char *) &ifTestEntry.ifTestStatus;
605 *var_len = ifTestEntry._ifTestTypeLength;
606 return (unsigned char *) ifTestEntry.ifTestType;
609 return (unsigned char *) &ifTestEntry.ifTestResult;
612 *var_len = ifTestEntry._ifTestCodeLength;
613 return (unsigned char *) ifTestEntry.ifTestCode;
616 *var_len = ifTestEntry._ifTestOwnerLength;
617 return (unsigned char *) ifTestEntry.ifTestOwner;
626 static unsigned char *
627 read_ifRcvAddressEntry_stub(struct variable *vp,
632 WriteMethod **write_method)
634 static ifRcvAddressEntry_t ifRcvAddressEntry;
636 /* call the user supplied function to retrieve values */
638 read_ifRcvAddressEntry(&ifRcvAddressEntry);
640 /* return the current value of the variable */
644 case IFRCVADDRESSSTATUS:
645 return (unsigned char *) &ifRcvAddressEntry.ifRcvAddressStatus;
647 case IFRCVADDRESSTYPE:
648 return (unsigned char *) &ifRcvAddressEntry.ifRcvAddressType;
659 * Forward declaration of write methods for writable objects:
663 write_ifAdminStatus_stub(int action,
671 return SNMP_ERR_NOERROR;
675 write_ifLinkUpDownTrapEnable_stub(int action,
683 return SNMP_ERR_NOERROR;
687 write_ifPromiscuousMode_stub(int action,
695 return SNMP_ERR_NOERROR;
699 write_ifAlias_stub(int action,
707 return SNMP_ERR_NOERROR;
711 write_ifStackStatus_stub(int action,
719 return SNMP_ERR_NOERROR;
723 write_ifTestId_stub(int action,
731 return SNMP_ERR_NOERROR;
735 write_ifTestStatus_stub(int action,
743 return SNMP_ERR_NOERROR;
747 write_ifTestType_stub(int action,
755 return SNMP_ERR_NOERROR;
759 write_ifTestOwner_stub(int action,
767 return SNMP_ERR_NOERROR;
771 write_ifRcvAddressStatus_stub(int action,
779 return SNMP_ERR_NOERROR;
783 write_ifRcvAddressType_stub(int action,
791 return SNMP_ERR_NOERROR;