3 * [EXPERIMENTAL] Management Information Base II (RFC1213) objects and functions
7 * Copyright (c) 2006 Axon Digital Design B.V., The Netherlands.
10 * Redistribution and use in source and binary forms, with or without modification,
11 * are permitted provided that the following conditions are met:
13 * 1. Redistributions of source code must retain the above copyright notice,
14 * this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright notice,
16 * this list of conditions and the following disclaimer in the documentation
17 * and/or other materials provided with the distribution.
18 * 3. The name of the author may not be used to endorse or promote products
19 * derived from this software without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
22 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
23 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
24 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
26 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
29 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
32 * Author: Christiaan Simons <christiaan.simons@axon.tv>
37 #include "lwip/snmp.h"
38 #include "lwip/netif.h"
39 #include "netif/etharp.h"
41 #include "lwip/ip_frag.h"
43 #include "lwip/snmp_asn1.h"
44 #include "lwip/snmp_structs.h"
49 * IANA assigned enterprise ID for lwIP is 26381
50 * @see http://www.iana.org/assignments/enterprise-numbers
52 * @note this enterprise ID is assigned to the lwIP project,
53 * all object identifiers living under this ID are assigned
54 * by the lwIP maintainers (contact Christiaan Simons)!
55 * @note don't change this define, use snmp_set_sysobjid()
57 * If you need to create your own private MIB you'll need
58 * to apply for your own enterprise ID with IANA:
59 * http://www.iana.org/numbers.html
61 #define SNMP_ENTERPRISE_ID 26381
62 #define SNMP_SYSOBJID_LEN 7
63 #define SNMP_SYSOBJID {1, 3, 6, 1, 4, 1, SNMP_ENTERPRISE_ID}
65 #ifndef SNMP_SYSSERVICES
66 #define SNMP_SYSSERVICES ((1 << 6) | (1 << 3) | ((IP_FORWARD) << 2))
69 /** @todo export this in snmp_structs.h (for use in private mib) */
70 void noleafs_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od);
71 void noleafs_get_value(struct obj_def *od, u16_t len, void *value);
73 static void system_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od);
74 static void system_get_value(struct obj_def *od, u16_t len, void *value);
75 static void interfaces_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od);
76 static void interfaces_get_value(struct obj_def *od, u16_t len, void *value);
77 static void ifentry_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od);
78 static void ifentry_get_value(struct obj_def *od, u16_t len, void *value);
79 static void atentry_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od);
80 static void atentry_get_value(struct obj_def *od, u16_t len, void *value);
81 static void ip_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od);
82 static void ip_get_value(struct obj_def *od, u16_t len, void *value);
83 static void ip_addrentry_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od);
84 static void ip_addrentry_get_value(struct obj_def *od, u16_t len, void *value);
85 static void ip_rteentry_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od);
86 static void ip_rteentry_get_value(struct obj_def *od, u16_t len, void *value);
87 static void ip_ntomentry_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od);
88 static void ip_ntomentry_get_value(struct obj_def *od, u16_t len, void *value);
89 static void icmp_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od);
90 static void icmp_get_value(struct obj_def *od, u16_t len, void *value);
92 static void tcp_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od);
93 static void tcp_get_value(struct obj_def *od, u16_t len, void *value);
94 static void tcpconnentry_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od);
95 static void tcpconnentry_get_value(struct obj_def *od, u16_t len, void *value);
97 static void udp_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od);
98 static void udp_get_value(struct obj_def *od, u16_t len, void *value);
99 static void udpentry_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od);
100 static void udpentry_get_value(struct obj_def *od, u16_t len, void *value);
101 static void snmp_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od);
102 static void snmp_get_value(struct obj_def *od, u16_t len, void *value);
104 /* snmp .1.3.6.1.2.1.11 */
105 const s32_t snmp_ids[28] = {
106 1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15, 16,
107 17, 18, 19, 20, 21, 22, 24, 25, 26, 27, 28, 29, 30
109 struct mib_node* const snmp_nodes[28] = {
110 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
111 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
113 const struct mib_array_node snmp = {
114 &snmp_get_object_def,
122 /* dot3 and EtherLike MIB not planned. (transmission .1.3.6.1.2.1.10) */
123 /* historical (some say hysterical). (cmot .1.3.6.1.2.1.9) */
124 /* lwIP has no EGP, thus may not implement it. (egp .1.3.6.1.2.1.8) */
126 /* udp .1.3.6.1.2.1.7 */
127 const s32_t udpentry_ids[2] = { 1, 2 };
128 struct mib_node* const udpentry_nodes[2] = {
131 const struct mib_array_node udpentry = {
132 &udpentry_get_object_def,
140 const s32_t udptable_id = 1;
141 struct mib_node* const udptable_node = (struct mib_node* const)&udpentry;
142 const struct mib_array_node udptable = {
143 &noleafs_get_object_def,
151 const s32_t udp_ids[5] = { 1, 2, 3, 4, 5 };
152 struct mib_node* const udp_nodes[5] = {
153 NULL, NULL, NULL, NULL, (struct mib_node* const)&udptable
155 const struct mib_array_node udp = {
164 /* tcp .1.3.6.1.2.1.6 */
166 /* only if the TCP protocol is available may implement this group */
167 const s32_t tcpconnentry_ids[5] = { 1, 2, 3, 4, 5 };
168 struct mib_node* const tcpconnentry_nodes[5] = {
169 NULL, NULL, NULL, NULL, NULL
171 const struct mib_array_node tcpconnentry = {
172 &tcpconnentry_get_object_def,
173 &tcpconnentry_get_value,
180 const s32_t tcpconntable_id = 1;
181 struct mib_node* const tcpconntable_node = (struct mib_node* const)&tcpconnentry;
182 const struct mib_array_node tcpconntable = {
183 &noleafs_get_object_def,
191 const s32_t tcp_ids[15] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
192 struct mib_node* const tcp_nodes[15] = {
193 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
194 (struct mib_node* const)&tcpconntable, NULL, NULL
196 const struct mib_array_node tcp = {
206 /* icmp .1.3.6.1.2.1.5 */
207 const s32_t icmp_ids[26] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 };
208 struct mib_node* const icmp_nodes[26] = {
209 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
210 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
212 const struct mib_array_node icmp = {
213 &icmp_get_object_def,
221 const s32_t ipntomentry_ids[4] = { 1, 2, 3, 4 };
222 struct mib_node* const ipntomentry_nodes[4] = {
223 NULL, NULL, NULL, NULL
225 const struct mib_array_node ipntomentry = {
226 &ip_ntomentry_get_object_def,
227 &ip_ntomentry_get_value,
234 const s32_t ipntomtable_id = 1;
235 struct mib_node* const ipntomtable_node = (struct mib_node* const)&ipntomentry;
236 const struct mib_array_node ipntomtable = {
237 &noleafs_get_object_def,
245 const s32_t iprteentry_ids[13] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 };
246 struct mib_node* const iprteentry_nodes[13] = {
247 NULL, NULL, NULL, NULL, NULL, NULL, NULL,
248 NULL, NULL, NULL, NULL, NULL, NULL
250 const struct mib_array_node iprteentry = {
251 &ip_rteentry_get_object_def,
252 &ip_rteentry_get_value,
259 const s32_t iprtetable_id = 1;
260 struct mib_node* const iprtetable_node = (struct mib_node* const)&iprteentry;
261 const struct mib_array_node iprtetable = {
262 &noleafs_get_object_def,
270 const s32_t ipaddrentry_ids[5] = { 1, 2, 3, 4, 5 };
271 struct mib_node* const ipaddrentry_nodes[5] = {
272 NULL, NULL, NULL, NULL, NULL
274 const struct mib_array_node ipaddrentry = {
275 &ip_addrentry_get_object_def,
276 &ip_addrentry_get_value,
283 const s32_t ipaddrtable_id = 1;
284 struct mib_node* const ipaddrtable_node = (struct mib_node* const)&ipaddrentry;
285 const struct mib_array_node ipaddrtable = {
286 &noleafs_get_object_def,
294 /* ip .1.3.6.1.2.1.4 */
295 const s32_t ip_ids[23] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23 };
296 struct mib_node* const ip_nodes[23] = {
297 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
298 NULL, NULL, NULL, NULL, NULL, NULL, NULL, (struct mib_node* const)&ipaddrtable,
299 (struct mib_node* const)&iprtetable, (struct mib_node* const)&ipntomtable, NULL
301 const struct mib_array_node ip = {
310 const s32_t atentry_ids[3] = { 1, 2, 3 };
311 struct mib_node* const atentry_nodes[3] = {
314 const struct mib_array_node atentry = {
315 &atentry_get_object_def,
323 const s32_t attable_id = 1;
324 struct mib_node* const attable_node = (struct mib_node* const)&atentry;
325 const struct mib_array_node attable = {
326 &noleafs_get_object_def,
334 /* at .1.3.6.1.2.1.3 */
335 const s32_t at_id = 1;
336 struct mib_node* const at_node = (struct mib_node* const)&attable;
337 const struct mib_array_node at = {
338 &noleafs_get_object_def,
346 const s32_t ifentry_ids[22] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22 };
347 struct mib_node* const ifentry_nodes[22] = {
348 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
349 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
351 const struct mib_array_node ifentry = {
352 &ifentry_get_object_def,
360 const s32_t iftable_id = 1;
361 struct mib_node* const iftable_node = (struct mib_node* const)&ifentry;
362 const struct mib_array_node iftable = {
363 &noleafs_get_object_def,
371 /* interfaces .1.3.6.1.2.1.2 */
372 const s32_t interfaces_ids[2] = { 1, 2 };
373 struct mib_node* const interfaces_nodes[2] = { NULL, (struct mib_node* const)&iftable };
374 const struct mib_array_node interfaces = {
375 &interfaces_get_object_def,
376 &interfaces_get_value,
384 /* system .1.3.6.1.2.1.1 */
385 const s32_t sys_tem_ids[7] = { 1, 2, 3, 4, 5, 6, 7 };
386 struct mib_node* const sys_tem_nodes[7] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL };
387 /* work around name issue with 'sys_tem', some compiler(s?) seem to reserve 'system' */
388 const struct mib_array_node sys_tem = {
389 &system_get_object_def,
397 /* mib-2 .1.3.6.1.2.1 */
399 #define MIB2_GROUPS 8
401 #define MIB2_GROUPS 7
403 const s32_t mib2_ids[MIB2_GROUPS] =
416 struct mib_node* const mib2_nodes[MIB2_GROUPS] = {
417 (struct mib_node* const)&sys_tem,
418 (struct mib_node* const)&interfaces,
419 (struct mib_node* const)&at,
420 (struct mib_node* const)&ip,
421 (struct mib_node* const)&icmp,
423 (struct mib_node* const)&tcp,
425 (struct mib_node* const)&udp,
426 (struct mib_node* const)&snmp
429 const struct mib_array_node mib2 = {
430 &noleafs_get_object_def,
438 /* mgmt .1.3.6.1.2 */
439 const s32_t mgmt_ids[1] = { 1 };
440 struct mib_node* const mgmt_nodes[1] = { (struct mib_node* const)&mib2 };
441 const struct mib_array_node mgmt = {
442 &noleafs_get_object_def,
450 /* internet .1.3.6.1 */
452 s32_t internet_ids[2] = { 2, 4 };
453 struct mib_node* const internet_nodes[2] = { (struct mib_node* const)&mgmt, (struct mib_node* const)&private };
454 const struct mib_array_node internet = {
455 &noleafs_get_object_def,
463 const s32_t internet_ids[1] = { 2 };
464 struct mib_node* const internet_nodes[1] = { (struct mib_node* const)&mgmt };
465 const struct mib_array_node internet = {
466 &noleafs_get_object_def,
475 /** mib-2.system.sysObjectID */
476 static struct snmp_obj_id sysobjid = {SNMP_SYSOBJID_LEN, SNMP_SYSOBJID};
477 /** enterprise ID for generic TRAPs, .iso.org.dod.internet.mgmt.mib-2.snmp */
478 static struct snmp_obj_id snmpgrp_id = {7,{1,3,6,1,2,1,11}};
479 /** mib-2.system.sysServices */
480 static const s32_t sysservices = SNMP_SYSSERVICES;
482 /** mib-2.system.sysDescr */
483 static const u8_t sysdescr_len_default = 4;
484 static const u8_t sysdescr_default[] = "lwIP";
485 static u8_t* sysdescr_len_ptr = (u8_t*)&sysdescr_len_default;
486 static u8_t* sysdescr_ptr = (u8_t*)&sysdescr_default[0];
487 /** mib-2.system.sysContact */
488 static const u8_t syscontact_len_default = 0;
489 static const u8_t syscontact_default[] = "";
490 static u8_t* syscontact_len_ptr = (u8_t*)&syscontact_len_default;
491 static u8_t* syscontact_ptr = (u8_t*)&syscontact_default[0];
492 /** mib-2.system.sysName */
493 static const u8_t sysname_len_default = 8;
494 static const u8_t sysname_default[] = "FQDN-unk";
495 static u8_t* sysname_len_ptr = (u8_t*)&sysname_len_default;
496 static u8_t* sysname_ptr = (u8_t*)&sysname_default[0];
497 /** mib-2.system.sysLocation */
498 static const u8_t syslocation_len_default = 0;
499 static const u8_t syslocation_default[] = "";
500 static u8_t* syslocation_len_ptr = (u8_t*)&syslocation_len_default;
501 static u8_t* syslocation_ptr = (u8_t*)&syslocation_default[0];
502 /** mib-2.snmp.snmpEnableAuthenTraps */
503 static const u8_t snmpenableauthentraps_default = 2; /* disabled */
504 static u8_t* snmpenableauthentraps_ptr = (u8_t*)&snmpenableauthentraps_default;
506 /** mib-2.interfaces.ifTable.ifEntry.ifSpecific (zeroDotZero) */
507 static const struct snmp_obj_id ifspecific = {2, {0, 0}};
508 /** mib-2.ip.ipRouteTable.ipRouteEntry.ipRouteInfo (zeroDotZero) */
509 static const struct snmp_obj_id iprouteinfo = {2, {0, 0}};
510 /** mib-2.snmp.snmpEnableAuthenTraps 1 = enabled 2 = disabled */
512 /* mib-2.system counter(s) */
513 static u32_t sysuptime = 0;
515 /* mib-2.ip counter(s) */
516 static u32_t ipinreceives = 0,
520 ipinunknownprotos = 0,
532 iproutingdiscards = 0;
533 /* mib-2.icmp counter(s) */
534 static u32_t icmpinmsgs = 0,
536 icmpindestunreachs = 0,
539 icmpinsrcquenchs = 0,
543 icmpintimestamps = 0,
544 icmpintimestampreps = 0,
546 icmpinaddrmaskreps = 0,
549 icmpoutdestunreachs = 0,
550 icmpouttimeexcds = 0,
551 icmpoutparmprobs = 0,
552 icmpoutsrcquenchs = 0,
553 icmpoutredirects = 0,
556 icmpouttimestamps = 0,
557 icmpouttimestampreps = 0,
558 icmpoutaddrmasks = 0,
559 icmpoutaddrmaskreps = 0;
560 /* mib-2.tcp counter(s) */
561 static u32_t tcpactiveopens = 0,
571 /* mib-2.udp counter(s) */
572 static u32_t udpindatagrams = 0,
576 /* mib-2.snmp counter(s) */
577 static u32_t snmpinpkts = 0,
579 snmpinbadversions = 0,
580 snmpinbadcommunitynames = 0,
581 snmpinbadcommunityuses = 0,
582 snmpinasnparseerrs = 0,
584 snmpinnosuchnames = 0,
588 snmpintotalreqvars = 0,
589 snmpintotalsetvars = 0,
590 snmpingetrequests = 0,
592 snmpinsetrequests = 0,
593 snmpingetresponses = 0,
596 snmpoutnosuchnames = 0,
597 snmpoutbadvalues = 0,
599 snmpoutgetrequests = 0,
601 snmpoutsetrequests = 0,
602 snmpoutgetresponses = 0,
607 /* prototypes of the following functions are in lwip/src/include/lwip/snmp.h */
611 * @param dst points to destination
612 * @param src points to source
613 * @param n number of octets to copy.
615 void ocstrncpy(u8_t *dst, u8_t *src, u8_t n)
625 * Copy object identifier (s32_t) array.
627 * @param dst points to destination
628 * @param src points to source
629 * @param n number of sub identifiers to copy.
631 void objectidncpy(s32_t *dst, s32_t *src, u8_t n)
641 * Initializes sysDescr pointers.
643 * @param str if non-NULL then copy str pointer
644 * @param strlen points to string length, excluding zero terminator
646 void snmp_set_sysdesr(u8_t *str, u8_t *strlen)
651 sysdescr_len_ptr = strlen;
655 void snmp_get_sysobjid_ptr(struct snmp_obj_id **oid)
661 * Initializes sysObjectID value.
663 * @param oid points to stuct snmp_obj_id to copy
665 void snmp_set_sysobjid(struct snmp_obj_id *oid)
671 * Must be called at regular 10 msec interval from a timer interrupt
672 * or signal handler depending on your runtime environment.
674 void snmp_inc_sysuptime(void)
679 void snmp_get_sysuptime(u32_t *value)
685 * Initializes sysContact pointers,
686 * e.g. ptrs to non-volatile memory external to lwIP.
688 * @param str if non-NULL then copy str pointer
689 * @param strlen points to string length, excluding zero terminator
691 void snmp_set_syscontact(u8_t *ocstr, u8_t *ocstrlen)
695 syscontact_ptr = ocstr;
696 syscontact_len_ptr = ocstrlen;
701 * Initializes sysName pointers,
702 * e.g. ptrs to non-volatile memory external to lwIP.
704 * @param str if non-NULL then copy str pointer
705 * @param strlen points to string length, excluding zero terminator
707 void snmp_set_sysname(u8_t *ocstr, u8_t *ocstrlen)
712 sysname_len_ptr = ocstrlen;
717 * Initializes sysLocation pointers,
718 * e.g. ptrs to non-volatile memory external to lwIP.
720 * @param str if non-NULL then copy str pointer
721 * @param strlen points to string length, excluding zero terminator
723 void snmp_set_syslocation(u8_t *ocstr, u8_t *ocstrlen)
727 syslocation_ptr = ocstr;
728 syslocation_len_ptr = ocstrlen;
733 void snmp_add_ifinoctets(struct netif *ni, u32_t value)
735 ni->ifinoctets += value;
738 void snmp_inc_ifinucastpkts(struct netif *ni)
740 (ni->ifinucastpkts)++;
743 void snmp_inc_ifinnucastpkts(struct netif *ni)
745 (ni->ifinnucastpkts)++;
748 void snmp_inc_ifindiscards(struct netif *ni)
750 (ni->ifindiscards)++;
753 void snmp_add_ifoutoctets(struct netif *ni, u32_t value)
755 ni->ifoutoctets += value;
758 void snmp_inc_ifoutucastpkts(struct netif *ni)
760 (ni->ifoutucastpkts)++;
763 void snmp_inc_ifoutnucastpkts(struct netif *ni)
765 (ni->ifoutnucastpkts)++;
768 void snmp_inc_ifoutdiscards(struct netif *ni)
770 (ni->ifoutdiscards)++;
773 void snmp_inc_ipinreceives(void)
778 void snmp_inc_ipinhdrerrors(void)
783 void snmp_inc_ipinaddrerrors(void)
788 void snmp_inc_ipforwdatagrams(void)
793 void snmp_inc_ipinunknownprotos(void)
798 void snmp_inc_ipindiscards(void)
803 void snmp_inc_ipindelivers(void)
808 void snmp_inc_ipoutrequests(void)
813 void snmp_inc_ipoutdiscards(void)
818 void snmp_inc_ipoutnoroutes(void)
823 void snmp_inc_ipreasmreqds(void)
828 void snmp_inc_ipreasmoks(void)
833 void snmp_inc_ipreasmfails(void)
838 void snmp_inc_ipfragoks(void)
843 void snmp_inc_ipfragfails(void)
848 void snmp_inc_ipfragcreates(void)
853 void snmp_inc_iproutingdiscards(void)
859 void snmp_inc_icmpinmsgs(void)
864 void snmp_inc_icmpinerrors(void)
869 void snmp_inc_icmpindestunreachs(void)
871 icmpindestunreachs++;
874 void snmp_inc_icmpintimeexcds(void)
879 void snmp_inc_icmpinparmprobs(void)
884 void snmp_inc_icmpinsrcquenchs(void)
889 void snmp_inc_icmpinredirects(void)
894 void snmp_inc_icmpinechos(void)
899 void snmp_inc_icmpinechoreps(void)
904 void snmp_inc_icmpintimestamps(void)
909 void snmp_inc_icmpintimestampreps(void)
911 icmpintimestampreps++;
914 void snmp_inc_icmpinaddrmasks(void)
919 void snmp_inc_icmpinaddrmaskreps(void)
921 icmpinaddrmaskreps++;
924 void snmp_inc_icmpoutmsgs(void)
929 void snmp_inc_icmpouterrors(void)
934 void snmp_inc_icmpoutdestunreachs(void)
936 icmpoutdestunreachs++;
939 void snmp_inc_icmpouttimeexcds(void)
944 void snmp_inc_icmpoutparmprobs(void)
949 void snmp_inc_icmpoutsrcquenchs(void)
954 void snmp_inc_icmpoutredirects(void)
959 void snmp_inc_icmpoutechos(void)
964 void snmp_inc_icmpoutechoreps(void)
969 void snmp_inc_icmpouttimestamps(void)
974 void snmp_inc_icmpouttimestampreps(void)
976 icmpouttimestampreps++;
979 void snmp_inc_icmpoutaddrmasks(void)
984 void snmp_inc_icmpoutaddrmaskreps(void)
986 icmpoutaddrmaskreps++;
989 void snmp_inc_tcpactiveopens(void)
994 void snmp_inc_tcppassiveopens(void)
999 void snmp_inc_tcpattemptfails(void)
1004 void snmp_inc_tcpestabresets(void)
1009 void snmp_inc_tcpcurrestab(void)
1014 void snmp_inc_tcpinsegs(void)
1019 void snmp_inc_tcpoutsegs(void)
1024 void snmp_inc_tcpretranssegs(void)
1029 void snmp_inc_tcpinerrs(void)
1034 void snmp_inc_tcpoutrsts(void)
1039 void snmp_inc_udpindatagrams(void)
1044 void snmp_inc_udpnoports(void)
1049 void snmp_inc_udpinerrors(void)
1054 void snmp_inc_udpoutdatagrams(void)
1059 void snmp_inc_snmpinpkts(void)
1064 void snmp_inc_snmpoutpkts(void)
1069 void snmp_inc_snmpinbadversions(void)
1071 snmpinbadversions++;
1074 void snmp_inc_snmpinbadcommunitynames(void)
1076 snmpinbadcommunitynames++;
1079 void snmp_inc_snmpinbadcommunityuses(void)
1081 snmpinbadcommunityuses++;
1084 void snmp_inc_snmpinasnparseerrs(void)
1086 snmpinasnparseerrs++;
1089 void snmp_inc_snmpintoobigs(void)
1094 void snmp_inc_snmpinnosuchnames(void)
1096 snmpinnosuchnames++;
1099 void snmp_inc_snmpinbadvalues(void)
1104 void snmp_inc_snmpinreadonlys(void)
1109 void snmp_inc_snmpingenerrs(void)
1114 void snmp_add_snmpintotalreqvars(u8_t value)
1116 snmpintotalreqvars += value;
1119 void snmp_add_snmpintotalsetvars(u8_t value)
1121 snmpintotalsetvars += value;
1124 void snmp_inc_snmpingetrequests(void)
1126 snmpingetrequests++;
1129 void snmp_inc_snmpingetnexts(void)
1134 void snmp_inc_snmpinsetrequests(void)
1136 snmpinsetrequests++;
1139 void snmp_inc_snmpingetresponses(void)
1141 snmpingetresponses++;
1144 void snmp_inc_snmpintraps(void)
1149 void snmp_inc_snmpouttoobigs(void)
1154 void snmp_inc_snmpoutnosuchnames(void)
1156 snmpoutnosuchnames++;
1159 void snmp_inc_snmpoutbadvalues(void)
1164 void snmp_inc_snmpoutgenerrs(void)
1169 void snmp_inc_snmpoutgetrequests(void)
1171 snmpoutgetrequests++;
1174 void snmp_inc_snmpoutgetnexts(void)
1179 void snmp_inc_snmpoutsetrequests(void)
1181 snmpoutsetrequests++;
1184 void snmp_inc_snmpoutgetresponses(void)
1186 snmpoutgetresponses++;
1189 void snmp_inc_snmpouttraps(void)
1194 void snmp_get_snmpgrpid_ptr(struct snmp_obj_id **oid)
1199 void snmp_set_snmpenableauthentraps(u8_t *value)
1203 snmpenableauthentraps_ptr = value;
1208 noleafs_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od)
1212 od->instance = MIB_OBJECT_NONE;
1216 noleafs_get_value(struct obj_def *od, u16_t len, void *value)
1227 * Returns systems object definitions.
1229 * @param ident_len the address length (2)
1230 * @param ident points to objectname.0 (object id trailer)
1231 * @param od points to object definition.
1234 system_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od)
1238 if ((ident_len == 2) && (ident[1] == 0))
1240 od->id_inst_len = ident_len;
1241 od->id_inst_ptr = ident;
1244 LWIP_DEBUGF(SNMP_MIB_DEBUG,("get_object_def system.%"U16_F".0",(u16_t)id));
1247 case 1: /* sysDescr */
1248 od->instance = MIB_OBJECT_SCALAR;
1249 od->access = MIB_OBJECT_READ_ONLY;
1250 od->asn_type = (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_OC_STR);
1251 od->v_len = *sysdescr_len_ptr;
1253 case 2: /* sysObjectID */
1254 od->instance = MIB_OBJECT_SCALAR;
1255 od->access = MIB_OBJECT_READ_ONLY;
1256 od->asn_type = (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_OBJ_ID);
1257 od->v_len = SNMP_SYSOBJID_LEN * sizeof(s32_t);
1259 case 3: /* sysUpTime */
1260 od->instance = MIB_OBJECT_SCALAR;
1261 od->access = MIB_OBJECT_READ_ONLY;
1262 od->asn_type = (SNMP_ASN1_APPLIC | SNMP_ASN1_PRIMIT | SNMP_ASN1_TIMETICKS);
1263 od->v_len = sizeof(u32_t);
1265 case 4: /* sysContact */
1266 od->instance = MIB_OBJECT_SCALAR;
1267 od->access = MIB_OBJECT_READ_WRITE;
1268 od->asn_type = (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_OC_STR);
1269 od->v_len = *syscontact_len_ptr;
1271 case 5: /* sysName */
1272 od->instance = MIB_OBJECT_SCALAR;
1273 od->access = MIB_OBJECT_READ_WRITE;
1274 od->asn_type = (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_OC_STR);
1275 od->v_len = *sysname_len_ptr;
1277 case 6: /* sysLocation */
1278 od->instance = MIB_OBJECT_SCALAR;
1279 od->access = MIB_OBJECT_READ_WRITE;
1280 od->asn_type = (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_OC_STR);
1281 od->v_len = *syslocation_len_ptr;
1283 case 7: /* sysServices */
1284 od->instance = MIB_OBJECT_SCALAR;
1285 od->access = MIB_OBJECT_READ_ONLY;
1286 od->asn_type = (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_INTEG);
1287 od->v_len = sizeof(s32_t);
1290 LWIP_DEBUGF(SNMP_MIB_DEBUG,("system_get_object_def: no such object"));
1291 od->instance = MIB_OBJECT_NONE;
1297 LWIP_DEBUGF(SNMP_MIB_DEBUG,("system_get_object_def: no scalar"));
1298 od->instance = MIB_OBJECT_NONE;
1303 * Returns system object value.
1305 * @param ident_len the address length (2)
1306 * @param ident points to objectname.0 (object id trailer)
1307 * @param len return value space (in bytes)
1308 * @param value points to (varbind) space to copy value into.
1311 system_get_value(struct obj_def *od, u16_t len, void *value)
1315 id = od->id_inst_ptr[0];
1318 case 1: /* sysDescr */
1319 ocstrncpy(value,sysdescr_ptr,len);
1321 case 2: /* sysObjectID */
1322 objectidncpy((s32_t*)value,(s32_t*)sysobjid.id,len / sizeof(s32_t));
1324 case 3: /* sysUpTime */
1326 u32_t *uint_ptr = value;
1327 *uint_ptr = sysuptime;
1330 case 4: /* sysContact */
1331 ocstrncpy(value,syscontact_ptr,len);
1333 case 5: /* sysName */
1334 ocstrncpy(value,sysname_ptr,len);
1336 case 6: /* sysLocation */
1337 ocstrncpy(value,syslocation_ptr,len);
1339 case 7: /* sysServices */
1341 s32_t *sint_ptr = value;
1342 *sint_ptr = sysservices;
1349 * Returns interfaces.ifnumber object definition.
1351 * @param ident_len the address length (2)
1352 * @param ident points to objectname.index
1353 * @param od points to object definition.
1356 interfaces_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od)
1358 if ((ident_len == 2) && (ident[0] == 1) && (ident[1] == 0))
1360 od->id_inst_len = ident_len;
1361 od->id_inst_ptr = ident;
1363 od->instance = MIB_OBJECT_SCALAR;
1364 od->access = MIB_OBJECT_READ_ONLY;
1365 od->asn_type = (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_INTEG);
1366 od->v_len = sizeof(s32_t);
1370 LWIP_DEBUGF(SNMP_MIB_DEBUG,("interfaces_get_object_def: no scalar"));
1371 od->instance = MIB_OBJECT_NONE;
1376 * Returns interfaces.ifnumber object value.
1378 * @param ident_len the address length (2)
1379 * @param ident points to objectname.0 (object id trailer)
1380 * @param len return value space (in bytes)
1381 * @param value points to (varbind) space to copy value into.
1384 interfaces_get_value(struct obj_def *od, u16_t len, void *value)
1387 if (od->id_inst_ptr[0] == 1)
1389 s32_t *sint_ptr = value;
1390 *sint_ptr = netif_cnt;
1395 * Returns ifentry object definitions.
1397 * @param ident_len the address length (2)
1398 * @param ident points to objectname.index
1399 * @param od points to object definition.
1402 ifentry_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od)
1406 if ((ident_len == 2) && (ident[1] > 0) && (ident[1] <= netif_cnt))
1408 od->id_inst_len = ident_len;
1409 od->id_inst_ptr = ident;
1412 LWIP_DEBUGF(SNMP_MIB_DEBUG,("get_object_def ifentry.%"U16_F".",(u16_t)id));
1415 case 1: /* ifIndex */
1416 od->instance = MIB_OBJECT_TAB;
1417 od->access = MIB_OBJECT_READ_ONLY;
1418 od->asn_type = (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_INTEG);
1419 od->v_len = sizeof(s32_t);
1421 case 2: /* ifDescr */
1422 od->instance = MIB_OBJECT_TAB;
1423 od->access = MIB_OBJECT_READ_ONLY;
1424 od->asn_type = (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_OC_STR);
1425 /** @todo this should be some sort of sizeof(struct netif.name) */
1428 case 3: /* ifType */
1430 case 8: /* ifOperStatus */
1431 od->instance = MIB_OBJECT_TAB;
1432 od->access = MIB_OBJECT_READ_ONLY;
1433 od->asn_type = (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_INTEG);
1434 od->v_len = sizeof(s32_t);
1436 case 5: /* ifSpeed */
1437 case 21: /* ifOutQLen */
1438 od->instance = MIB_OBJECT_TAB;
1439 od->access = MIB_OBJECT_READ_ONLY;
1440 od->asn_type = (SNMP_ASN1_APPLIC | SNMP_ASN1_PRIMIT | SNMP_ASN1_GAUGE);
1441 od->v_len = sizeof(u32_t);
1443 case 6: /* ifPhysAddress */
1445 struct netif *netif = netif_list;
1448 ifidx = ident[1] - 1;
1450 while ((netif != NULL) && (i < ifidx))
1452 netif = netif->next;
1455 od->instance = MIB_OBJECT_TAB;
1456 od->access = MIB_OBJECT_READ_ONLY;
1457 od->asn_type = (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_OC_STR);
1458 od->v_len = netif->hwaddr_len;
1461 case 7: /* ifAdminStatus */
1462 od->instance = MIB_OBJECT_TAB;
1463 od->access = MIB_OBJECT_READ_WRITE;
1464 od->asn_type = (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_INTEG);
1465 od->v_len = sizeof(s32_t);
1467 case 9: /* ifLastChange */
1468 od->instance = MIB_OBJECT_TAB;
1469 od->access = MIB_OBJECT_READ_ONLY;
1470 od->asn_type = (SNMP_ASN1_APPLIC | SNMP_ASN1_PRIMIT | SNMP_ASN1_TIMETICKS);
1471 od->v_len = sizeof(u32_t);
1473 case 10: /* ifInOctets */
1474 case 11: /* ifInUcastPkts */
1475 case 12: /* ifInNUcastPkts */
1476 case 13: /* ifInDiscarts */
1477 case 14: /* ifInErrors */
1478 case 15: /* ifInUnkownProtos */
1479 case 16: /* ifOutOctets */
1480 case 17: /* ifOutUcastPkts */
1481 case 18: /* ifOutNUcastPkts */
1482 case 19: /* ifOutDiscarts */
1483 case 20: /* ifOutErrors */
1484 od->instance = MIB_OBJECT_TAB;
1485 od->access = MIB_OBJECT_READ_ONLY;
1486 od->asn_type = (SNMP_ASN1_APPLIC | SNMP_ASN1_PRIMIT | SNMP_ASN1_COUNTER);
1487 od->v_len = sizeof(u32_t);
1489 case 22: /* ifSpecific */
1490 /** @note returning zeroDotZero (0.0) no media specific MIB support */
1491 od->instance = MIB_OBJECT_TAB;
1492 od->access = MIB_OBJECT_READ_ONLY;
1493 od->asn_type = (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_OBJ_ID);
1494 od->v_len = ifspecific.len * sizeof(s32_t);
1497 LWIP_DEBUGF(SNMP_MIB_DEBUG,("ifentry_get_object_def: no such object"));
1498 od->instance = MIB_OBJECT_NONE;
1504 LWIP_DEBUGF(SNMP_MIB_DEBUG,("ifentry_get_object_def: no scalar"));
1505 od->instance = MIB_OBJECT_NONE;
1510 * Returns ifentry object value.
1512 * @param ident_len the address length (2)
1513 * @param ident points to objectname.0 (object id trailer)
1514 * @param len return value space (in bytes)
1515 * @param value points to (varbind) space to copy value into.
1518 ifentry_get_value(struct obj_def *od, u16_t len, void *value)
1520 struct netif *netif = netif_list;
1524 ifidx = od->id_inst_ptr[1] - 1;
1526 while ((netif != NULL) && (i < ifidx))
1528 netif = netif->next;
1531 id = od->id_inst_ptr[0];
1534 case 1: /* ifIndex */
1536 s32_t *sint_ptr = value;
1537 *sint_ptr = od->id_inst_ptr[1];
1540 case 2: /* ifDescr */
1541 ocstrncpy(value,(u8_t*)netif->name,len);
1543 case 3: /* ifType */
1545 s32_t *sint_ptr = value;
1546 *sint_ptr = netif->link_type;
1551 s32_t *sint_ptr = value;
1552 *sint_ptr = netif->mtu;
1555 case 5: /* ifSpeed */
1557 u32_t *uint_ptr = value;
1558 *uint_ptr = netif->link_speed;
1561 case 6: /* ifPhysAddress */
1562 ocstrncpy(value,netif->hwaddr,len);
1564 case 7: /* ifAdminStatus */
1565 case 8: /* ifOperStatus */
1567 s32_t *sint_ptr = value;
1568 if (netif_is_up(netif))
1578 case 9: /* ifLastChange */
1580 u32_t *uint_ptr = value;
1581 *uint_ptr = netif->ts;
1584 case 10: /* ifInOctets */
1586 u32_t *uint_ptr = value;
1587 *uint_ptr = netif->ifinoctets;
1590 case 11: /* ifInUcastPkts */
1592 u32_t *uint_ptr = value;
1593 *uint_ptr = netif->ifinucastpkts;
1596 case 12: /* ifInNUcastPkts */
1598 u32_t *uint_ptr = value;
1599 *uint_ptr = netif->ifinnucastpkts;
1602 case 13: /* ifInDiscarts */
1604 u32_t *uint_ptr = value;
1605 *uint_ptr = netif->ifindiscards;
1608 case 14: /* ifInErrors */
1609 case 15: /* ifInUnkownProtos */
1610 /** @todo add these counters! */
1612 u32_t *uint_ptr = value;
1616 case 16: /* ifOutOctets */
1618 u32_t *uint_ptr = value;
1619 *uint_ptr = netif->ifoutoctets;
1622 case 17: /* ifOutUcastPkts */
1624 u32_t *uint_ptr = value;
1625 *uint_ptr = netif->ifoutucastpkts;
1628 case 18: /* ifOutNUcastPkts */
1630 u32_t *uint_ptr = value;
1631 *uint_ptr = netif->ifoutnucastpkts;
1634 case 19: /* ifOutDiscarts */
1636 u32_t *uint_ptr = value;
1637 *uint_ptr = netif->ifoutdiscards;
1640 case 20: /* ifOutErrors */
1641 /** @todo add this counter! */
1643 u32_t *uint_ptr = value;
1647 case 21: /* ifOutQLen */
1648 /** @todo figure out if this must be 0 (no queue) or 1? */
1650 u32_t *uint_ptr = value;
1654 case 22: /* ifSpecific */
1655 objectidncpy((s32_t*)value,(s32_t*)ifspecific.id,len / sizeof(s32_t));
1661 * Returns atentry object definitions.
1663 * @param ident_len the address length (6)
1664 * @param ident points to objectname.atifindex.atnetaddress
1665 * @param od points to object definition.
1667 * @todo std says objects are writeable, can we ignore it?
1670 atentry_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od)
1672 if ((ident_len == 6) &&
1673 (ident[1] > 0) && (ident[1] <= netif_cnt))
1675 struct eth_addr* ethaddr_ret;
1676 struct ip_addr* ipaddr_ret;
1678 struct netif *netif = netif_list;
1681 ifidx = ident[1] - 1;
1683 while ((netif != NULL) && (i < ifidx))
1685 netif = netif->next;
1690 ip.addr |= ident[3];
1692 ip.addr |= ident[4];
1694 ip.addr |= ident[5];
1695 ip.addr = htonl(ip.addr);
1697 if (etharp_find_addr(netif, &ip, ðaddr_ret, &ipaddr_ret) > -1)
1699 od->id_inst_len = ident_len;
1700 od->id_inst_ptr = ident;
1704 case 1: /* atIfIndex */
1705 od->instance = MIB_OBJECT_TAB;
1706 od->access = MIB_OBJECT_READ_WRITE;
1707 od->asn_type = (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_INTEG);
1708 od->v_len = sizeof(s32_t);
1711 case 2: /* atPhysAddress */
1712 od->instance = MIB_OBJECT_TAB;
1713 od->access = MIB_OBJECT_READ_WRITE;
1714 od->asn_type = (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_OC_STR);
1715 od->v_len = sizeof(struct eth_addr);
1716 od->addr = ethaddr_ret;
1718 case 3: /* atNetAddress */
1719 od->instance = MIB_OBJECT_TAB;
1720 od->access = MIB_OBJECT_READ_WRITE;
1721 od->asn_type = (SNMP_ASN1_APPLIC | SNMP_ASN1_PRIMIT | SNMP_ASN1_IPADDR);
1723 od->addr = ipaddr_ret;
1726 LWIP_DEBUGF(SNMP_MIB_DEBUG,("atentry_get_object_def: no such object"));
1727 od->instance = MIB_OBJECT_NONE;
1733 LWIP_DEBUGF(SNMP_MIB_DEBUG,("atentry_get_object_def: no scalar"));
1734 od->instance = MIB_OBJECT_NONE;
1739 LWIP_DEBUGF(SNMP_MIB_DEBUG,("atentry_get_object_def: no scalar"));
1740 od->instance = MIB_OBJECT_NONE;
1745 atentry_get_value(struct obj_def *od, u16_t len, void *value)
1750 id = od->id_inst_ptr[0];
1753 case 1: /* atIfIndex */
1755 s32_t *sint_ptr = value;
1756 *sint_ptr = od->id_inst_ptr[1];
1759 case 2: /* atPhysAddress */
1761 struct eth_addr *dst = value;
1762 struct eth_addr *src = od->addr;
1767 case 3: /* atNetAddress */
1769 struct ip_addr *dst = value;
1770 struct ip_addr *src = od->addr;
1780 ip_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od)
1784 if ((ident_len == 2) && (ident[1] == 0))
1786 od->id_inst_len = ident_len;
1787 od->id_inst_ptr = ident;
1790 LWIP_DEBUGF(SNMP_MIB_DEBUG,("get_object_def ip.%"U16_F".0",(u16_t)id));
1793 case 1: /* ipForwarding */
1794 case 2: /* ipDefaultTTL */
1795 od->instance = MIB_OBJECT_SCALAR;
1796 od->access = MIB_OBJECT_READ_WRITE;
1797 od->asn_type = (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_INTEG);
1798 od->v_len = sizeof(s32_t);
1800 case 3: /* ipInReceives */
1801 case 4: /* ipInHdrErrors */
1802 case 5: /* ipInAddrErrors */
1803 case 6: /* ipForwDatagrams */
1804 case 7: /* ipInUnknownProtos */
1805 case 8: /* ipInDiscards */
1806 case 9: /* ipInDelivers */
1807 case 10: /* ipOutRequests */
1808 case 11: /* ipOutDiscards */
1809 case 12: /* ipOutNoRoutes */
1810 case 14: /* ipReasmReqds */
1811 case 15: /* ipReasmOKs */
1812 case 16: /* ipReasmFails */
1813 case 17: /* ipFragOKs */
1814 case 18: /* ipFragFails */
1815 case 19: /* ipFragCreates */
1816 case 23: /* ipRoutingDiscards */
1817 od->instance = MIB_OBJECT_SCALAR;
1818 od->access = MIB_OBJECT_READ_ONLY;
1819 od->asn_type = (SNMP_ASN1_APPLIC | SNMP_ASN1_PRIMIT | SNMP_ASN1_COUNTER);
1820 od->v_len = sizeof(u32_t);
1822 case 13: /* ipReasmTimeout */
1823 od->instance = MIB_OBJECT_SCALAR;
1824 od->access = MIB_OBJECT_READ_ONLY;
1825 od->asn_type = (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_INTEG);
1826 od->v_len = sizeof(s32_t);
1829 LWIP_DEBUGF(SNMP_MIB_DEBUG,("ip_get_object_def: no such object"));
1830 od->instance = MIB_OBJECT_NONE;
1836 LWIP_DEBUGF(SNMP_MIB_DEBUG,("ip_get_object_def: no scalar"));
1837 od->instance = MIB_OBJECT_NONE;
1841 /** @todo ipForwarding is writeable, but we may return badValue,
1842 in lwIP this is a compile-time switch
1843 we will also return a badvalue for wring a default TTL
1844 which differs from our compile time default */
1846 ip_get_value(struct obj_def *od, u16_t len, void *value)
1851 id = od->id_inst_ptr[0];
1854 case 1: /* ipForwarding */
1856 s32_t *sint_ptr = value;
1861 /* not-forwarding */
1866 case 2: /* ipDefaultTTL */
1868 s32_t *sint_ptr = value;
1869 *sint_ptr = IP_DEFAULT_TTL;
1872 case 3: /* ipInReceives */
1874 u32_t *uint_ptr = value;
1875 *uint_ptr = ipinreceives;
1878 case 4: /* ipInHdrErrors */
1880 u32_t *uint_ptr = value;
1881 *uint_ptr = ipinhdrerrors;
1884 case 5: /* ipInAddrErrors */
1886 u32_t *uint_ptr = value;
1887 *uint_ptr = ipinaddrerrors;
1890 case 6: /* ipForwDatagrams */
1892 u32_t *uint_ptr = value;
1893 *uint_ptr = ipforwdatagrams;
1896 case 7: /* ipInUnknownProtos */
1898 u32_t *uint_ptr = value;
1899 *uint_ptr = ipinunknownprotos;
1902 case 8: /* ipInDiscards */
1904 u32_t *uint_ptr = value;
1905 *uint_ptr = ipindiscards;
1908 case 9: /* ipInDelivers */
1910 u32_t *uint_ptr = value;
1911 *uint_ptr = ipindelivers;
1914 case 10: /* ipOutRequests */
1916 u32_t *uint_ptr = value;
1917 *uint_ptr = ipoutrequests;
1920 case 11: /* ipOutDiscards */
1922 u32_t *uint_ptr = value;
1923 *uint_ptr = ipoutdiscards;
1926 case 12: /* ipOutNoRoutes */
1928 u32_t *uint_ptr = value;
1929 *uint_ptr = ipoutnoroutes;
1932 case 13: /* ipReasmTimeout */
1934 s32_t *sint_ptr = value;
1936 *sint_ptr = IP_REASS_MAXAGE;
1942 case 14: /* ipReasmReqds */
1944 u32_t *uint_ptr = value;
1945 *uint_ptr = ipreasmreqds;
1948 case 15: /* ipReasmOKs */
1950 u32_t *uint_ptr = value;
1951 *uint_ptr = ipreasmoks;
1954 case 16: /* ipReasmFails */
1956 u32_t *uint_ptr = value;
1957 *uint_ptr = ipreasmfails;
1960 case 17: /* ipFragOKs */
1962 u32_t *uint_ptr = value;
1963 *uint_ptr = ipfragoks;
1966 case 18: /* ipFragFails */
1968 u32_t *uint_ptr = value;
1969 *uint_ptr = ipfragfails;
1972 case 19: /* ipFragCreates */
1974 u32_t *uint_ptr = value;
1975 *uint_ptr = ipfragcreates;
1978 case 23: /* ipRoutingDiscards */
1979 /** @todo can lwIP discard routes at all?? hardwire this to 0?? */
1981 u32_t *uint_ptr = value;
1982 *uint_ptr = iproutingdiscards;
1989 ip_addrentry_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od)
1994 struct netif *netif = netif_list;
1998 ip.addr |= ident[2];
2000 ip.addr |= ident[3];
2002 ip.addr |= ident[4];
2003 ip.addr = htonl(ip.addr);
2005 while ((netif != NULL) && !ip_addr_cmp(&ip, &netif->ip_addr))
2007 netif = netif->next;
2014 od->id_inst_len = ident_len;
2015 od->id_inst_ptr = ident;
2021 case 1: /* ipAdEntAddr */
2022 case 3: /* ipAdEntNetMask */
2023 od->instance = MIB_OBJECT_TAB;
2024 od->access = MIB_OBJECT_READ_ONLY;
2025 od->asn_type = (SNMP_ASN1_APPLIC | SNMP_ASN1_PRIMIT | SNMP_ASN1_IPADDR);
2028 case 2: /* ipAdEntIfIndex */
2029 case 4: /* ipAdEntBcastAddr */
2030 case 5: /* ipAdEntReasmMaxSize */
2031 od->instance = MIB_OBJECT_TAB;
2032 od->access = MIB_OBJECT_READ_ONLY;
2033 od->asn_type = (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_INTEG);
2034 od->v_len = sizeof(s32_t);
2037 LWIP_DEBUGF(SNMP_MIB_DEBUG,("ip_addrentry_get_object_def: no such object"));
2038 od->instance = MIB_OBJECT_NONE;
2044 LWIP_DEBUGF(SNMP_MIB_DEBUG,("ip_addrentry_get_object_def: no scalar"));
2045 od->instance = MIB_OBJECT_NONE;
2050 LWIP_DEBUGF(SNMP_MIB_DEBUG,("ip_addrentry_get_object_def: no scalar"));
2051 od->instance = MIB_OBJECT_NONE;
2056 ip_addrentry_get_value(struct obj_def *od, u16_t len, void *value)
2061 id = od->id_inst_ptr[0];
2064 case 1: /* ipAdEntAddr */
2066 struct ip_addr *dst = value;
2067 struct netif *netif;
2068 struct ip_addr *src;
2071 src = &netif->ip_addr;
2075 case 2: /* ipAdEntIfIndex */
2077 s32_t *sint_ptr = value;
2078 struct netif *netif = netif_list;
2082 while ((netif != NULL) && (netif != od->addr))
2084 netif = netif->next;
2090 case 3: /* ipAdEntNetMask */
2092 struct ip_addr *dst = value;
2093 struct netif *netif;
2094 struct ip_addr *src;
2097 src = &netif->netmask;
2101 case 4: /* ipAdEntBcastAddr */
2103 s32_t *sint_ptr = value;
2105 /* lwIP oddity, there's no broadcast
2106 address in the netif we can rely on */
2107 *sint_ptr = ip_addr_broadcast.addr & 1;
2110 case 5: /* ipAdEntReasmMaxSize */
2112 s32_t *sint_ptr = value;
2114 *sint_ptr = (IP_HLEN + IP_REASS_BUFSIZE);
2116 /** @todo returning MTU would be a bad thing and
2117 returning a wild guess like '576' isn't good either */
2127 * lwIP IP routing is currently using the network addresses in netif_list.
2128 * if no suitable network IP is found in netif_list, the default_netif is used.
2131 ip_rteentry_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od)
2137 struct ip_addr dest;
2138 struct netif *netif;
2140 dest.addr = ident[1];
2142 dest.addr |= ident[2];
2144 dest.addr |= ident[3];
2146 dest.addr |= ident[4];
2147 dest.addr = htonl(dest.addr);
2151 /* ip_route() uses default netif for default route */
2152 netif = netif_default;
2156 /* not using ip_route(), need exact match! */
2158 while ((netif != NULL) &&
2159 !ip_addr_netcmp(&dest, &(netif->ip_addr), &(netif->netmask)) )
2161 netif = netif->next;
2166 od->id_inst_len = ident_len;
2167 od->id_inst_ptr = ident;
2173 case 1: /* ipRouteDest */
2174 case 7: /* ipRouteNextHop */
2175 case 11: /* ipRouteMask */
2176 od->instance = MIB_OBJECT_TAB;
2177 od->access = MIB_OBJECT_READ_WRITE;
2178 od->asn_type = (SNMP_ASN1_APPLIC | SNMP_ASN1_PRIMIT | SNMP_ASN1_IPADDR);
2181 case 2: /* ipRouteIfIndex */
2182 case 3: /* ipRouteMetric1 */
2183 case 4: /* ipRouteMetric2 */
2184 case 5: /* ipRouteMetric3 */
2185 case 6: /* ipRouteMetric4 */
2186 case 8: /* ipRouteType */
2187 case 10: /* ipRouteAge */
2188 case 12: /* ipRouteMetric5 */
2189 od->instance = MIB_OBJECT_TAB;
2190 od->access = MIB_OBJECT_READ_WRITE;
2191 od->asn_type = (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_INTEG);
2192 od->v_len = sizeof(s32_t);
2194 case 9: /* ipRouteProto */
2195 od->instance = MIB_OBJECT_TAB;
2196 od->access = MIB_OBJECT_READ_ONLY;
2197 od->asn_type = (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_INTEG);
2198 od->v_len = sizeof(s32_t);
2200 case 13: /* ipRouteInfo */
2201 /** @note returning zeroDotZero (0.0) no routing protocol specific MIB */
2202 od->instance = MIB_OBJECT_TAB;
2203 od->access = MIB_OBJECT_READ_ONLY;
2204 od->asn_type = (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_OBJ_ID);
2205 od->v_len = iprouteinfo.len * sizeof(s32_t);
2208 LWIP_DEBUGF(SNMP_MIB_DEBUG,("ip_rteentry_get_object_def: no such object"));
2209 od->instance = MIB_OBJECT_NONE;
2215 LWIP_DEBUGF(SNMP_MIB_DEBUG,("ip_rteentry_get_object_def: no scalar"));
2216 od->instance = MIB_OBJECT_NONE;
2221 LWIP_DEBUGF(SNMP_MIB_DEBUG,("ip_rteentry_get_object_def: no scalar"));
2222 od->instance = MIB_OBJECT_NONE;
2227 ip_rteentry_get_value(struct obj_def *od, u16_t len, void *value)
2229 struct netif *netif;
2230 struct ip_addr dest;
2235 ident = od->id_inst_ptr;
2236 dest.addr = ident[1];
2238 dest.addr |= ident[2];
2240 dest.addr |= ident[3];
2242 dest.addr |= ident[4];
2243 dest.addr = htonl(dest.addr);
2248 case 1: /* ipRouteDest */
2250 struct ip_addr *dst = value;
2254 /* default rte has 0.0.0.0 dest */
2259 /* netifs have netaddress dest */
2260 dst->addr = netif->ip_addr.addr & netif->netmask.addr;
2264 case 2: /* ipRouteIfIndex */
2266 struct netif *ni = netif_list;
2267 s32_t *sint_ptr = value;
2271 while ((ni != NULL) && (ni != netif))
2279 case 3: /* ipRouteMetric1 */
2281 s32_t *sint_ptr = value;
2285 /* default rte has metric 1 */
2290 /* other rtes have metric 0 */
2295 case 4: /* ipRouteMetric2 */
2296 case 5: /* ipRouteMetric3 */
2297 case 6: /* ipRouteMetric4 */
2298 case 12: /* ipRouteMetric5 */
2300 s32_t *sint_ptr = value;
2305 case 7: /* ipRouteNextHop */
2307 struct ip_addr *dst = value;
2311 /* default rte: gateway */
2316 /* other rtes: netif ip_addr */
2317 *dst = netif->ip_addr;
2321 case 8: /* ipRouteType */
2323 s32_t *sint_ptr = value;
2327 /* default rte is indirect */
2332 /* other rtes are direct */
2337 case 9: /* ipRouteProto */
2339 s32_t *sint_ptr = value;
2340 /* locally defined routes */
2344 case 10: /* ipRouteAge */
2346 s32_t *sint_ptr = value;
2347 /** @todo (sysuptime - timestamp last change) / 100 */
2351 case 11: /* ipRouteMask */
2353 struct ip_addr *dst = value;
2357 /* default rte use 0.0.0.0 mask */
2362 /* other rtes use netmask */
2363 *dst = netif->netmask;
2367 case 13: /* ipRouteInfo */
2368 objectidncpy((s32_t*)value,(s32_t*)iprouteinfo.id,len / sizeof(s32_t));
2374 ip_ntomentry_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od)
2376 if ((ident_len == 6) &&
2377 (ident[1] > 0) && (ident[1] <= netif_cnt))
2379 struct eth_addr* ethaddr_ret;
2380 struct ip_addr* ipaddr_ret;
2382 struct netif *netif = netif_list;
2385 ifidx = ident[1] - 1;
2387 while ((netif != NULL) && (i < ifidx))
2389 netif = netif->next;
2394 ip.addr |= ident[3];
2396 ip.addr |= ident[4];
2398 ip.addr |= ident[5];
2399 ip.addr = htonl(ip.addr);
2401 if (etharp_find_addr(netif, &ip, ðaddr_ret, &ipaddr_ret) > -1)
2405 od->id_inst_len = ident_len;
2406 od->id_inst_ptr = ident;
2411 case 1: /* ipNetToMediaIfIndex */
2412 case 4: /* ipNetToMediaType */
2413 od->instance = MIB_OBJECT_TAB;
2414 od->access = MIB_OBJECT_READ_WRITE;
2415 od->asn_type = (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_INTEG);
2416 od->v_len = sizeof(s32_t);
2419 case 2: /* ipNetToMediaPhysAddress */
2420 od->instance = MIB_OBJECT_TAB;
2421 od->access = MIB_OBJECT_READ_WRITE;
2422 od->asn_type = (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_OC_STR);
2423 od->v_len = sizeof(struct eth_addr);
2424 od->addr = ethaddr_ret;
2426 case 3: /* ipNetToMediaNetAddress */
2427 od->instance = MIB_OBJECT_TAB;
2428 od->access = MIB_OBJECT_READ_WRITE;
2429 od->asn_type = (SNMP_ASN1_APPLIC | SNMP_ASN1_PRIMIT | SNMP_ASN1_IPADDR);
2431 od->addr = ipaddr_ret;
2434 LWIP_DEBUGF(SNMP_MIB_DEBUG,("ip_ntomentry_get_object_def: no such object"));
2435 od->instance = MIB_OBJECT_NONE;
2441 LWIP_DEBUGF(SNMP_MIB_DEBUG,("ip_ntomentry_get_object_def: no scalar"));
2442 od->instance = MIB_OBJECT_NONE;
2447 LWIP_DEBUGF(SNMP_MIB_DEBUG,("ip_ntomentry_get_object_def: no scalar"));
2448 od->instance = MIB_OBJECT_NONE;
2453 ip_ntomentry_get_value(struct obj_def *od, u16_t len, void *value)
2458 id = od->id_inst_ptr[0];
2461 case 1: /* ipNetToMediaIfIndex */
2463 s32_t *sint_ptr = value;
2464 *sint_ptr = od->id_inst_ptr[1];
2467 case 2: /* ipNetToMediaPhysAddress */
2469 struct eth_addr *dst = value;
2470 struct eth_addr *src = od->addr;
2475 case 3: /* ipNetToMediaNetAddress */
2477 struct ip_addr *dst = value;
2478 struct ip_addr *src = od->addr;
2483 case 4: /* ipNetToMediaType */
2485 s32_t *sint_ptr = value;
2494 icmp_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od)
2496 if ((ident_len == 2) && (ident[1] == 0) &&
2497 (ident[0] > 0) && (ident[0] < 27))
2499 od->id_inst_len = ident_len;
2500 od->id_inst_ptr = ident;
2502 od->instance = MIB_OBJECT_SCALAR;
2503 od->access = MIB_OBJECT_READ_ONLY;
2504 od->asn_type = (SNMP_ASN1_APPLIC | SNMP_ASN1_PRIMIT | SNMP_ASN1_COUNTER);
2505 od->v_len = sizeof(u32_t);
2509 LWIP_DEBUGF(SNMP_MIB_DEBUG,("icmp_get_object_def: no scalar"));
2510 od->instance = MIB_OBJECT_NONE;
2515 icmp_get_value(struct obj_def *od, u16_t len, void *value)
2517 u32_t *uint_ptr = value;
2521 id = od->id_inst_ptr[0];
2524 case 1: /* icmpInMsgs */
2525 *uint_ptr = icmpinmsgs;
2527 case 2: /* icmpInErrors */
2528 *uint_ptr = icmpinerrors;
2530 case 3: /* icmpInDestUnreachs */
2531 *uint_ptr = icmpindestunreachs;
2533 case 4: /* icmpInTimeExcds */
2534 *uint_ptr = icmpintimeexcds;
2536 case 5: /* icmpInParmProbs */
2537 *uint_ptr = icmpinparmprobs;
2539 case 6: /* icmpInSrcQuenchs */
2540 *uint_ptr = icmpinsrcquenchs;
2542 case 7: /* icmpInRedirects */
2543 *uint_ptr = icmpinredirects;
2545 case 8: /* icmpInEchos */
2546 *uint_ptr = icmpinechos;
2548 case 9: /* icmpInEchoReps */
2549 *uint_ptr = icmpinechoreps;
2551 case 10: /* icmpInTimestamps */
2552 *uint_ptr = icmpintimestamps;
2554 case 11: /* icmpInTimestampReps */
2555 *uint_ptr = icmpintimestampreps;
2557 case 12: /* icmpInAddrMasks */
2558 *uint_ptr = icmpinaddrmasks;
2560 case 13: /* icmpInAddrMaskReps */
2561 *uint_ptr = icmpinaddrmaskreps;
2563 case 14: /* icmpOutMsgs */
2564 *uint_ptr = icmpoutmsgs;
2566 case 15: /* icmpOutErrors */
2567 *uint_ptr = icmpouterrors;
2569 case 16: /* icmpOutDestUnreachs */
2570 *uint_ptr = icmpoutdestunreachs;
2572 case 17: /* icmpOutTimeExcds */
2573 *uint_ptr = icmpouttimeexcds;
2575 case 18: /* icmpOutParmProbs */
2576 *uint_ptr = icmpoutparmprobs;
2578 case 19: /* icmpOutSrcQuenchs */
2579 *uint_ptr = icmpoutsrcquenchs;
2581 case 20: /* icmpOutRedirects */
2582 *uint_ptr = icmpoutredirects;
2584 case 21: /* icmpOutEchos */
2585 *uint_ptr = icmpoutechos;
2587 case 22: /* icmpOutEchoReps */
2588 *uint_ptr = icmpoutechoreps;
2590 case 23: /* icmpOutTimestamps */
2591 *uint_ptr = icmpouttimestamps;
2593 case 24: /* icmpOutTimestampReps */
2594 *uint_ptr = icmpouttimestampreps;
2596 case 25: /* icmpOutAddrMasks */
2597 *uint_ptr = icmpoutaddrmasks;
2599 case 26: /* icmpOutAddrMaskReps */
2600 *uint_ptr = icmpoutaddrmaskreps;
2606 /** @todo tcp grp */
2608 tcp_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od)
2613 tcp_get_value(struct obj_def *od, u16_t len, void *value)
2618 tcpconnentry_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od)
2623 tcpconnentry_get_value(struct obj_def *od, u16_t len, void *value)
2629 udp_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od)
2631 if ((ident_len == 2) && (ident[1] == 0) &&
2632 (ident[0] > 0) && (ident[0] < 6))
2634 od->id_inst_len = ident_len;
2635 od->id_inst_ptr = ident;
2637 od->instance = MIB_OBJECT_SCALAR;
2638 od->access = MIB_OBJECT_READ_ONLY;
2639 od->asn_type = (SNMP_ASN1_APPLIC | SNMP_ASN1_PRIMIT | SNMP_ASN1_COUNTER);
2640 od->v_len = sizeof(u32_t);
2644 LWIP_DEBUGF(SNMP_MIB_DEBUG,("udp_get_object_def: no scalar"));
2645 od->instance = MIB_OBJECT_NONE;
2650 udp_get_value(struct obj_def *od, u16_t len, void *value)
2652 u32_t *uint_ptr = value;
2656 id = od->id_inst_ptr[0];
2659 case 1: /* udpInDatagrams */
2660 *uint_ptr = udpindatagrams;
2662 case 2: /* udpNoPorts */
2663 *uint_ptr = udpnoports;
2665 case 3: /* udpInErrors */
2666 *uint_ptr = udpinerrors;
2668 case 4: /* udpOutDatagrams */
2669 *uint_ptr = udpoutdatagrams;
2675 udpentry_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od)
2679 struct udp_pcb *pcb;
2685 ip.addr |= ident[2];
2687 ip.addr |= ident[3];
2689 ip.addr |= ident[4];
2690 ip.addr = htonl(ip.addr);
2695 while ((pcb != NULL) &&
2696 (pcb->local_ip.addr != ip.addr) &&
2697 (pcb->local_port != port))
2704 od->id_inst_len = ident_len;
2705 od->id_inst_ptr = ident;
2710 case 1: /* udpLocalAddress */
2711 od->instance = MIB_OBJECT_TAB;
2712 od->access = MIB_OBJECT_READ_WRITE;
2713 od->asn_type = (SNMP_ASN1_APPLIC | SNMP_ASN1_PRIMIT | SNMP_ASN1_IPADDR);
2716 case 2: /* udpLocalPort */
2717 od->instance = MIB_OBJECT_TAB;
2718 od->access = MIB_OBJECT_READ_WRITE;
2719 od->asn_type = (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_INTEG);
2720 od->v_len = sizeof(s32_t);
2723 LWIP_DEBUGF(SNMP_MIB_DEBUG,("udpentry_get_object_def: no such object"));
2724 od->instance = MIB_OBJECT_NONE;
2730 LWIP_DEBUGF(SNMP_MIB_DEBUG,("udpentry_get_object_def: no scalar"));
2731 od->instance = MIB_OBJECT_NONE;
2736 LWIP_DEBUGF(SNMP_MIB_DEBUG,("udpentry_get_object_def: no scalar"));
2737 od->instance = MIB_OBJECT_NONE;
2742 udpentry_get_value(struct obj_def *od, u16_t len, void *value)
2744 struct udp_pcb *pcb;
2749 id = od->id_inst_ptr[0];
2752 case 1: /* udpLocalAddress */
2754 struct ip_addr *dst = value;
2755 struct ip_addr *src = &pcb->local_ip;
2759 case 2: /* udpLocalPort */
2761 s32_t *sint_ptr = value;
2762 *sint_ptr = pcb->local_port;
2769 snmp_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od)
2771 if ((ident_len == 2) && (ident[1] == 0))
2775 od->id_inst_len = ident_len;
2776 od->id_inst_ptr = ident;
2781 case 1: /* snmpInPkts */
2782 case 2: /* snmpOutPkts */
2783 case 3: /* snmpInBadVersions */
2784 case 4: /* snmpInBadCommunityNames */
2785 case 5: /* snmpInBadCommunityUses */
2786 case 6: /* snmpInASNParseErrs */
2787 case 8: /* snmpInTooBigs */
2788 case 9: /* snmpInNoSuchNames */
2789 case 10: /* snmpInBadValues */
2790 case 11: /* snmpInReadOnlys */
2791 case 12: /* snmpInGenErrs */
2792 case 13: /* snmpInTotalReqVars */
2793 case 14: /* snmpInTotalSetVars */
2794 case 15: /* snmpInGetRequests */
2795 case 16: /* snmpInGetNexts */
2796 case 17: /* snmpInSetRequests */
2797 case 18: /* snmpInGetResponses */
2798 case 19: /* snmpInTraps */
2799 case 20: /* snmpOutTooBigs */
2800 case 21: /* snmpOutNoSuchNames */
2801 case 22: /* snmpOutBadValues */
2802 case 24: /* snmpOutGenErrs */
2803 case 25: /* snmpOutGetRequests */
2804 case 26: /* snmpOutGetNexts */
2805 case 27: /* snmpOutSetRequests */
2806 case 28: /* snmpOutGetResponses */
2807 case 29: /* snmpOutTraps */
2808 od->instance = MIB_OBJECT_SCALAR;
2809 od->access = MIB_OBJECT_READ_ONLY;
2810 od->asn_type = (SNMP_ASN1_APPLIC | SNMP_ASN1_PRIMIT | SNMP_ASN1_COUNTER);
2811 od->v_len = sizeof(u32_t);
2813 case 30: /* snmpEnableAuthenTraps */
2814 od->instance = MIB_OBJECT_SCALAR;
2815 od->access = MIB_OBJECT_READ_WRITE;
2816 od->asn_type = (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_INTEG);
2817 od->v_len = sizeof(s32_t);
2820 LWIP_DEBUGF(SNMP_MIB_DEBUG,("snmp_get_object_def: no such object"));
2821 od->instance = MIB_OBJECT_NONE;
2827 LWIP_DEBUGF(SNMP_MIB_DEBUG,("snmp_get_object_def: no scalar"));
2828 od->instance = MIB_OBJECT_NONE;
2833 snmp_get_value(struct obj_def *od, u16_t len, void *value)
2835 u32_t *uint_ptr = value;
2839 id = od->id_inst_ptr[0];
2842 case 1: /* snmpInPkts */
2843 *uint_ptr = snmpinpkts;
2845 case 2: /* snmpOutPkts */
2846 *uint_ptr = snmpoutpkts;
2848 case 3: /* snmpInBadVersions */
2849 *uint_ptr = snmpinbadversions;
2851 case 4: /* snmpInBadCommunityNames */
2852 *uint_ptr = snmpinbadcommunitynames;
2854 case 5: /* snmpInBadCommunityUses */
2855 *uint_ptr = snmpinbadcommunityuses;
2857 case 6: /* snmpInASNParseErrs */
2858 *uint_ptr = snmpinasnparseerrs;
2860 case 8: /* snmpInTooBigs */
2861 *uint_ptr = snmpintoobigs;
2863 case 9: /* snmpInNoSuchNames */
2864 *uint_ptr = snmpinnosuchnames;
2866 case 10: /* snmpInBadValues */
2867 *uint_ptr = snmpinbadvalues;
2869 case 11: /* snmpInReadOnlys */
2870 *uint_ptr = snmpinreadonlys;
2872 case 12: /* snmpInGenErrs */
2873 *uint_ptr = snmpingenerrs;
2875 case 13: /* snmpInTotalReqVars */
2876 *uint_ptr = snmpintotalreqvars;
2878 case 14: /* snmpInTotalSetVars */
2879 *uint_ptr = snmpintotalsetvars;
2881 case 15: /* snmpInGetRequests */
2882 *uint_ptr = snmpingetrequests;
2884 case 16: /* snmpInGetNexts */
2885 *uint_ptr = snmpingetnexts;
2887 case 17: /* snmpInSetRequests */
2888 *uint_ptr = snmpinsetrequests;
2890 case 18: /* snmpInGetResponses */
2891 *uint_ptr = snmpingetresponses;
2893 case 19: /* snmpInTraps */
2894 *uint_ptr = snmpintraps;
2896 case 20: /* snmpOutTooBigs */
2897 *uint_ptr = snmpouttoobigs;
2899 case 21: /* snmpOutNoSuchNames */
2900 *uint_ptr = snmpoutnosuchnames;
2902 case 22: /* snmpOutBadValues */
2903 *uint_ptr = snmpoutbadvalues;
2905 case 24: /* snmpOutGenErrs */
2906 *uint_ptr = snmpoutgenerrs;
2908 case 25: /* snmpOutGetRequests */
2909 *uint_ptr = snmpoutgetrequests;
2911 case 26: /* snmpOutGetNexts */
2912 *uint_ptr = snmpoutgetnexts;
2914 case 27: /* snmpOutSetRequests */
2915 *uint_ptr = snmpoutsetrequests;
2917 case 28: /* snmpOutGetResponses */
2918 *uint_ptr = snmpoutgetresponses;
2920 case 29: /* snmpOutTraps */
2921 *uint_ptr = snmpouttraps;
2923 case 30: /* snmpEnableAuthenTraps */
2924 *uint_ptr = *snmpenableauthentraps_ptr;
2929 #endif /* LWIP_SNMP */