3 * Management Information Base II (RFC1213) objects and functions.
5 * @note the object identifiers for this MIB-2 and private MIB tree
6 * must be kept in sorted ascending order. This to ensure correct getnext operation.
10 * Copyright (c) 2006 Axon Digital Design B.V., The Netherlands.
11 * All rights reserved.
13 * Redistribution and use in source and binary forms, with or without modification,
14 * are permitted provided that the following conditions are met:
16 * 1. Redistributions of source code must retain the above copyright notice,
17 * this list of conditions and the following disclaimer.
18 * 2. Redistributions in binary form must reproduce the above copyright notice,
19 * this list of conditions and the following disclaimer in the documentation
20 * and/or other materials provided with the distribution.
21 * 3. The name of the author may not be used to endorse or promote products
22 * derived from this software without specific prior written permission.
24 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
25 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
26 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
27 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
28 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
29 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
32 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
35 * Author: Christiaan Simons <christiaan.simons@axon.tv>
40 #if LWIP_SNMP /* don't build if not configured for use in lwipopts.h */
42 #include "lwip/snmp.h"
43 #include "lwip/netif.h"
45 #include "lwip/ip_frag.h"
47 #include "lwip/tcp_impl.h"
49 #include "lwip/snmp_asn1.h"
50 #include "lwip/snmp_structs.h"
52 #include "netif/etharp.h"
55 * IANA assigned enterprise ID for lwIP is 26381
56 * @see http://www.iana.org/assignments/enterprise-numbers
58 * @note this enterprise ID is assigned to the lwIP project,
59 * all object identifiers living under this ID are assigned
60 * by the lwIP maintainers (contact Christiaan Simons)!
61 * @note don't change this define, use snmp_set_sysobjid()
63 * If you need to create your own private MIB you'll need
64 * to apply for your own enterprise ID with IANA:
65 * http://www.iana.org/numbers.html
67 #define SNMP_ENTERPRISE_ID 26381
68 #define SNMP_SYSOBJID_LEN 7
69 #define SNMP_SYSOBJID {1, 3, 6, 1, 4, 1, SNMP_ENTERPRISE_ID}
71 #ifndef SNMP_SYSSERVICES
72 #define SNMP_SYSSERVICES ((1 << 6) | (1 << 3) | ((IP_FORWARD) << 2))
75 #ifndef SNMP_GET_SYSUPTIME
76 #define SNMP_GET_SYSUPTIME(sysuptime)
79 static void system_get_object_def(u8_t ident_len
, s32_t
*ident
, struct obj_def
*od
);
80 static void system_get_value(struct obj_def
*od
, u16_t len
, void *value
);
81 static u8_t
system_set_test(struct obj_def
*od
, u16_t len
, void *value
);
82 static void system_set_value(struct obj_def
*od
, u16_t len
, void *value
);
83 static void interfaces_get_object_def(u8_t ident_len
, s32_t
*ident
, struct obj_def
*od
);
84 static void interfaces_get_value(struct obj_def
*od
, u16_t len
, void *value
);
85 static void ifentry_get_object_def(u8_t ident_len
, s32_t
*ident
, struct obj_def
*od
);
86 static void ifentry_get_value(struct obj_def
*od
, u16_t len
, void *value
);
87 #if !SNMP_SAFE_REQUESTS
88 static u8_t
ifentry_set_test (struct obj_def
*od
, u16_t len
, void *value
);
89 static void ifentry_set_value (struct obj_def
*od
, u16_t len
, void *value
);
90 #endif /* SNMP_SAFE_REQUESTS */
91 static void atentry_get_object_def(u8_t ident_len
, s32_t
*ident
, struct obj_def
*od
);
92 static void atentry_get_value(struct obj_def
*od
, u16_t len
, void *value
);
93 static void ip_get_object_def(u8_t ident_len
, s32_t
*ident
, struct obj_def
*od
);
94 static void ip_get_value(struct obj_def
*od
, u16_t len
, void *value
);
95 static u8_t
ip_set_test(struct obj_def
*od
, u16_t len
, void *value
);
96 static void ip_addrentry_get_object_def(u8_t ident_len
, s32_t
*ident
, struct obj_def
*od
);
97 static void ip_addrentry_get_value(struct obj_def
*od
, u16_t len
, void *value
);
98 static void ip_rteentry_get_object_def(u8_t ident_len
, s32_t
*ident
, struct obj_def
*od
);
99 static void ip_rteentry_get_value(struct obj_def
*od
, u16_t len
, void *value
);
100 static void ip_ntomentry_get_object_def(u8_t ident_len
, s32_t
*ident
, struct obj_def
*od
);
101 static void ip_ntomentry_get_value(struct obj_def
*od
, u16_t len
, void *value
);
102 static void icmp_get_object_def(u8_t ident_len
, s32_t
*ident
, struct obj_def
*od
);
103 static void icmp_get_value(struct obj_def
*od
, u16_t len
, void *value
);
105 static void tcp_get_object_def(u8_t ident_len
, s32_t
*ident
, struct obj_def
*od
);
106 static void tcp_get_value(struct obj_def
*od
, u16_t len
, void *value
);
107 #ifdef THIS_SEEMS_UNUSED
108 static void tcpconnentry_get_object_def(u8_t ident_len
, s32_t
*ident
, struct obj_def
*od
);
109 static void tcpconnentry_get_value(struct obj_def
*od
, u16_t len
, void *value
);
112 static void udp_get_object_def(u8_t ident_len
, s32_t
*ident
, struct obj_def
*od
);
113 static void udp_get_value(struct obj_def
*od
, u16_t len
, void *value
);
114 static void udpentry_get_object_def(u8_t ident_len
, s32_t
*ident
, struct obj_def
*od
);
115 static void udpentry_get_value(struct obj_def
*od
, u16_t len
, void *value
);
116 static void snmp_get_object_def(u8_t ident_len
, s32_t
*ident
, struct obj_def
*od
);
117 static void snmp_get_value(struct obj_def
*od
, u16_t len
, void *value
);
118 static u8_t
snmp_set_test(struct obj_def
*od
, u16_t len
, void *value
);
119 static void snmp_set_value(struct obj_def
*od
, u16_t len
, void *value
);
122 /* snmp .1.3.6.1.2.1.11 */
123 const mib_scalar_node snmp_scalar
= {
124 &snmp_get_object_def
,
131 const s32_t snmp_ids
[28] = {
132 1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15, 16,
133 17, 18, 19, 20, 21, 22, 24, 25, 26, 27, 28, 29, 30
135 struct mib_node
* const snmp_nodes
[28] = {
136 (struct mib_node
*)&snmp_scalar
, (struct mib_node
*)&snmp_scalar
,
137 (struct mib_node
*)&snmp_scalar
, (struct mib_node
*)&snmp_scalar
,
138 (struct mib_node
*)&snmp_scalar
, (struct mib_node
*)&snmp_scalar
,
139 (struct mib_node
*)&snmp_scalar
, (struct mib_node
*)&snmp_scalar
,
140 (struct mib_node
*)&snmp_scalar
, (struct mib_node
*)&snmp_scalar
,
141 (struct mib_node
*)&snmp_scalar
, (struct mib_node
*)&snmp_scalar
,
142 (struct mib_node
*)&snmp_scalar
, (struct mib_node
*)&snmp_scalar
,
143 (struct mib_node
*)&snmp_scalar
, (struct mib_node
*)&snmp_scalar
,
144 (struct mib_node
*)&snmp_scalar
, (struct mib_node
*)&snmp_scalar
,
145 (struct mib_node
*)&snmp_scalar
, (struct mib_node
*)&snmp_scalar
,
146 (struct mib_node
*)&snmp_scalar
, (struct mib_node
*)&snmp_scalar
,
147 (struct mib_node
*)&snmp_scalar
, (struct mib_node
*)&snmp_scalar
,
148 (struct mib_node
*)&snmp_scalar
, (struct mib_node
*)&snmp_scalar
,
149 (struct mib_node
*)&snmp_scalar
, (struct mib_node
*)&snmp_scalar
151 const struct mib_array_node snmp
= {
152 &noleafs_get_object_def
,
162 /* dot3 and EtherLike MIB not planned. (transmission .1.3.6.1.2.1.10) */
163 /* historical (some say hysterical). (cmot .1.3.6.1.2.1.9) */
164 /* lwIP has no EGP, thus may not implement it. (egp .1.3.6.1.2.1.8) */
166 /* udp .1.3.6.1.2.1.7 */
167 /** index root node for udpTable */
168 struct mib_list_rootnode udp_root
= {
169 &noleafs_get_object_def
,
179 const s32_t udpentry_ids
[2] = { 1, 2 };
180 struct mib_node
* const udpentry_nodes
[2] = {
181 (struct mib_node
*)&udp_root
, (struct mib_node
*)&udp_root
,
183 const struct mib_array_node udpentry
= {
184 &noleafs_get_object_def
,
194 s32_t udptable_id
= 1;
195 struct mib_node
* udptable_node
= (struct mib_node
*)&udpentry
;
196 struct mib_ram_array_node udptable
= {
197 &noleafs_get_object_def
,
207 const mib_scalar_node udp_scalar
= {
215 const s32_t udp_ids
[5] = { 1, 2, 3, 4, 5 };
216 struct mib_node
* const udp_nodes
[5] = {
217 (struct mib_node
*)&udp_scalar
, (struct mib_node
*)&udp_scalar
,
218 (struct mib_node
*)&udp_scalar
, (struct mib_node
*)&udp_scalar
,
219 (struct mib_node
*)&udptable
221 const struct mib_array_node udp
= {
222 &noleafs_get_object_def
,
232 /* tcp .1.3.6.1.2.1.6 */
234 /* only if the TCP protocol is available may implement this group */
235 /** index root node for tcpConnTable */
236 struct mib_list_rootnode tcpconntree_root
= {
237 &noleafs_get_object_def
,
247 const s32_t tcpconnentry_ids
[5] = { 1, 2, 3, 4, 5 };
248 struct mib_node
* const tcpconnentry_nodes
[5] = {
249 (struct mib_node
*)&tcpconntree_root
, (struct mib_node
*)&tcpconntree_root
,
250 (struct mib_node
*)&tcpconntree_root
, (struct mib_node
*)&tcpconntree_root
,
251 (struct mib_node
*)&tcpconntree_root
253 const struct mib_array_node tcpconnentry
= {
254 &noleafs_get_object_def
,
264 s32_t tcpconntable_id
= 1;
265 struct mib_node
* tcpconntable_node
= (struct mib_node
*)&tcpconnentry
;
266 struct mib_ram_array_node tcpconntable
= {
267 &noleafs_get_object_def
,
272 /** @todo update maxlength when inserting / deleting from table
273 0 when table is empty, 1 when more than one entry */
279 const mib_scalar_node tcp_scalar
= {
287 const s32_t tcp_ids
[15] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
288 struct mib_node
* const tcp_nodes
[15] = {
289 (struct mib_node
*)&tcp_scalar
, (struct mib_node
*)&tcp_scalar
,
290 (struct mib_node
*)&tcp_scalar
, (struct mib_node
*)&tcp_scalar
,
291 (struct mib_node
*)&tcp_scalar
, (struct mib_node
*)&tcp_scalar
,
292 (struct mib_node
*)&tcp_scalar
, (struct mib_node
*)&tcp_scalar
,
293 (struct mib_node
*)&tcp_scalar
, (struct mib_node
*)&tcp_scalar
,
294 (struct mib_node
*)&tcp_scalar
, (struct mib_node
*)&tcp_scalar
,
295 (struct mib_node
*)&tcpconntable
, (struct mib_node
*)&tcp_scalar
,
296 (struct mib_node
*)&tcp_scalar
298 const struct mib_array_node tcp
= {
299 &noleafs_get_object_def
,
310 /* icmp .1.3.6.1.2.1.5 */
311 const mib_scalar_node icmp_scalar
= {
312 &icmp_get_object_def
,
319 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 };
320 struct mib_node
* const icmp_nodes
[26] = {
321 (struct mib_node
*)&icmp_scalar
, (struct mib_node
*)&icmp_scalar
,
322 (struct mib_node
*)&icmp_scalar
, (struct mib_node
*)&icmp_scalar
,
323 (struct mib_node
*)&icmp_scalar
, (struct mib_node
*)&icmp_scalar
,
324 (struct mib_node
*)&icmp_scalar
, (struct mib_node
*)&icmp_scalar
,
325 (struct mib_node
*)&icmp_scalar
, (struct mib_node
*)&icmp_scalar
,
326 (struct mib_node
*)&icmp_scalar
, (struct mib_node
*)&icmp_scalar
,
327 (struct mib_node
*)&icmp_scalar
, (struct mib_node
*)&icmp_scalar
,
328 (struct mib_node
*)&icmp_scalar
, (struct mib_node
*)&icmp_scalar
,
329 (struct mib_node
*)&icmp_scalar
, (struct mib_node
*)&icmp_scalar
,
330 (struct mib_node
*)&icmp_scalar
, (struct mib_node
*)&icmp_scalar
,
331 (struct mib_node
*)&icmp_scalar
, (struct mib_node
*)&icmp_scalar
,
332 (struct mib_node
*)&icmp_scalar
, (struct mib_node
*)&icmp_scalar
,
333 (struct mib_node
*)&icmp_scalar
, (struct mib_node
*)&icmp_scalar
335 const struct mib_array_node icmp
= {
336 &noleafs_get_object_def
,
346 /** index root node for ipNetToMediaTable */
347 struct mib_list_rootnode ipntomtree_root
= {
348 &noleafs_get_object_def
,
358 const s32_t ipntomentry_ids
[4] = { 1, 2, 3, 4 };
359 struct mib_node
* const ipntomentry_nodes
[4] = {
360 (struct mib_node
*)&ipntomtree_root
, (struct mib_node
*)&ipntomtree_root
,
361 (struct mib_node
*)&ipntomtree_root
, (struct mib_node
*)&ipntomtree_root
363 const struct mib_array_node ipntomentry
= {
364 &noleafs_get_object_def
,
374 s32_t ipntomtable_id
= 1;
375 struct mib_node
* ipntomtable_node
= (struct mib_node
*)&ipntomentry
;
376 struct mib_ram_array_node ipntomtable
= {
377 &noleafs_get_object_def
,
387 /** index root node for ipRouteTable */
388 struct mib_list_rootnode iprtetree_root
= {
389 &noleafs_get_object_def
,
399 const s32_t iprteentry_ids
[13] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 };
400 struct mib_node
* const iprteentry_nodes
[13] = {
401 (struct mib_node
*)&iprtetree_root
, (struct mib_node
*)&iprtetree_root
,
402 (struct mib_node
*)&iprtetree_root
, (struct mib_node
*)&iprtetree_root
,
403 (struct mib_node
*)&iprtetree_root
, (struct mib_node
*)&iprtetree_root
,
404 (struct mib_node
*)&iprtetree_root
, (struct mib_node
*)&iprtetree_root
,
405 (struct mib_node
*)&iprtetree_root
, (struct mib_node
*)&iprtetree_root
,
406 (struct mib_node
*)&iprtetree_root
, (struct mib_node
*)&iprtetree_root
,
407 (struct mib_node
*)&iprtetree_root
409 const struct mib_array_node iprteentry
= {
410 &noleafs_get_object_def
,
420 s32_t iprtetable_id
= 1;
421 struct mib_node
* iprtetable_node
= (struct mib_node
*)&iprteentry
;
422 struct mib_ram_array_node iprtetable
= {
423 &noleafs_get_object_def
,
433 /** index root node for ipAddrTable */
434 struct mib_list_rootnode ipaddrtree_root
= {
435 &noleafs_get_object_def
,
445 const s32_t ipaddrentry_ids
[5] = { 1, 2, 3, 4, 5 };
446 struct mib_node
* const ipaddrentry_nodes
[5] = {
447 (struct mib_node
*)&ipaddrtree_root
,
448 (struct mib_node
*)&ipaddrtree_root
,
449 (struct mib_node
*)&ipaddrtree_root
,
450 (struct mib_node
*)&ipaddrtree_root
,
451 (struct mib_node
*)&ipaddrtree_root
453 const struct mib_array_node ipaddrentry
= {
454 &noleafs_get_object_def
,
464 s32_t ipaddrtable_id
= 1;
465 struct mib_node
* ipaddrtable_node
= (struct mib_node
*)&ipaddrentry
;
466 struct mib_ram_array_node ipaddrtable
= {
467 &noleafs_get_object_def
,
477 /* ip .1.3.6.1.2.1.4 */
478 const mib_scalar_node ip_scalar
= {
486 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 };
487 struct mib_node
* const ip_nodes
[23] = {
488 (struct mib_node
*)&ip_scalar
, (struct mib_node
*)&ip_scalar
,
489 (struct mib_node
*)&ip_scalar
, (struct mib_node
*)&ip_scalar
,
490 (struct mib_node
*)&ip_scalar
, (struct mib_node
*)&ip_scalar
,
491 (struct mib_node
*)&ip_scalar
, (struct mib_node
*)&ip_scalar
,
492 (struct mib_node
*)&ip_scalar
, (struct mib_node
*)&ip_scalar
,
493 (struct mib_node
*)&ip_scalar
, (struct mib_node
*)&ip_scalar
,
494 (struct mib_node
*)&ip_scalar
, (struct mib_node
*)&ip_scalar
,
495 (struct mib_node
*)&ip_scalar
, (struct mib_node
*)&ip_scalar
,
496 (struct mib_node
*)&ip_scalar
, (struct mib_node
*)&ip_scalar
,
497 (struct mib_node
*)&ip_scalar
, (struct mib_node
*)&ipaddrtable
,
498 (struct mib_node
*)&iprtetable
, (struct mib_node
*)&ipntomtable
,
499 (struct mib_node
*)&ip_scalar
501 const struct mib_array_node mib2_ip
= {
502 &noleafs_get_object_def
,
512 /** index root node for atTable */
513 struct mib_list_rootnode arptree_root
= {
514 &noleafs_get_object_def
,
524 const s32_t atentry_ids
[3] = { 1, 2, 3 };
525 struct mib_node
* const atentry_nodes
[3] = {
526 (struct mib_node
*)&arptree_root
,
527 (struct mib_node
*)&arptree_root
,
528 (struct mib_node
*)&arptree_root
530 const struct mib_array_node atentry
= {
531 &noleafs_get_object_def
,
541 const s32_t attable_id
= 1;
542 struct mib_node
* const attable_node
= (struct mib_node
*)&atentry
;
543 const struct mib_array_node attable
= {
544 &noleafs_get_object_def
,
554 /* at .1.3.6.1.2.1.3 */
556 struct mib_node
* mib2_at_node
= (struct mib_node
*)&attable
;
557 struct mib_ram_array_node at
= {
558 &noleafs_get_object_def
,
568 /** index root node for ifTable */
569 struct mib_list_rootnode iflist_root
= {
570 &ifentry_get_object_def
,
572 #if SNMP_SAFE_REQUESTS
575 #else /* SNMP_SAFE_REQUESTS */
578 #endif /* SNMP_SAFE_REQUESTS */
585 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 };
586 struct mib_node
* const ifentry_nodes
[22] = {
587 (struct mib_node
*)&iflist_root
, (struct mib_node
*)&iflist_root
,
588 (struct mib_node
*)&iflist_root
, (struct mib_node
*)&iflist_root
,
589 (struct mib_node
*)&iflist_root
, (struct mib_node
*)&iflist_root
,
590 (struct mib_node
*)&iflist_root
, (struct mib_node
*)&iflist_root
,
591 (struct mib_node
*)&iflist_root
, (struct mib_node
*)&iflist_root
,
592 (struct mib_node
*)&iflist_root
, (struct mib_node
*)&iflist_root
,
593 (struct mib_node
*)&iflist_root
, (struct mib_node
*)&iflist_root
,
594 (struct mib_node
*)&iflist_root
, (struct mib_node
*)&iflist_root
,
595 (struct mib_node
*)&iflist_root
, (struct mib_node
*)&iflist_root
,
596 (struct mib_node
*)&iflist_root
, (struct mib_node
*)&iflist_root
,
597 (struct mib_node
*)&iflist_root
, (struct mib_node
*)&iflist_root
599 const struct mib_array_node ifentry
= {
600 &noleafs_get_object_def
,
610 s32_t iftable_id
= 1;
611 struct mib_node
* iftable_node
= (struct mib_node
*)&ifentry
;
612 struct mib_ram_array_node iftable
= {
613 &noleafs_get_object_def
,
623 /* interfaces .1.3.6.1.2.1.2 */
624 const mib_scalar_node interfaces_scalar
= {
625 &interfaces_get_object_def
,
626 &interfaces_get_value
,
632 const s32_t interfaces_ids
[2] = { 1, 2 };
633 struct mib_node
* const interfaces_nodes
[2] = {
634 (struct mib_node
*)&interfaces_scalar
, (struct mib_node
*)&iftable
636 const struct mib_array_node interfaces
= {
637 &noleafs_get_object_def
,
649 /* system .1.3.6.1.2.1.1 */
650 const mib_scalar_node sys_tem_scalar
= {
651 &system_get_object_def
,
658 const s32_t sys_tem_ids
[7] = { 1, 2, 3, 4, 5, 6, 7 };
659 struct mib_node
* const sys_tem_nodes
[7] = {
660 (struct mib_node
*)&sys_tem_scalar
, (struct mib_node
*)&sys_tem_scalar
,
661 (struct mib_node
*)&sys_tem_scalar
, (struct mib_node
*)&sys_tem_scalar
,
662 (struct mib_node
*)&sys_tem_scalar
, (struct mib_node
*)&sys_tem_scalar
,
663 (struct mib_node
*)&sys_tem_scalar
665 /* work around name issue with 'sys_tem', some compiler(s?) seem to reserve 'system' */
666 const struct mib_array_node sys_tem
= {
667 &noleafs_get_object_def
,
677 /* mib-2 .1.3.6.1.2.1 */
679 #define MIB2_GROUPS 8
681 #define MIB2_GROUPS 7
683 const s32_t mib2_ids
[MIB2_GROUPS
] =
696 struct mib_node
* const mib2_nodes
[MIB2_GROUPS
] = {
697 (struct mib_node
*)&sys_tem
,
698 (struct mib_node
*)&interfaces
,
699 (struct mib_node
*)&at
,
700 (struct mib_node
*)&mib2_ip
,
701 (struct mib_node
*)&icmp
,
703 (struct mib_node
*)&tcp
,
705 (struct mib_node
*)&udp
,
706 (struct mib_node
*)&snmp
709 const struct mib_array_node mib2
= {
710 &noleafs_get_object_def
,
720 /* mgmt .1.3.6.1.2 */
721 const s32_t mgmt_ids
[1] = { 1 };
722 struct mib_node
* const mgmt_nodes
[1] = { (struct mib_node
*)&mib2
};
723 const struct mib_array_node mgmt
= {
724 &noleafs_get_object_def
,
734 /* internet .1.3.6.1 */
736 /* When using a private MIB, you have to create a file 'private_mib.h' that contains
737 * a 'struct mib_array_node mib_private' which contains your MIB. */
738 s32_t internet_ids
[2] = { 2, 4 };
739 struct mib_node
* const internet_nodes
[2] = { (struct mib_node
*)&mgmt
, (struct mib_node
*)&mib_private
};
740 const struct mib_array_node internet
= {
741 &noleafs_get_object_def
,
751 const s32_t internet_ids
[1] = { 2 };
752 struct mib_node
* const internet_nodes
[1] = { (struct mib_node
*)&mgmt
};
753 const struct mib_array_node internet
= {
754 &noleafs_get_object_def
,
765 /** mib-2.system.sysObjectID */
766 static struct snmp_obj_id sysobjid
= {SNMP_SYSOBJID_LEN
, SNMP_SYSOBJID
};
767 /** enterprise ID for generic TRAPs, .iso.org.dod.internet.mgmt.mib-2.snmp */
768 static struct snmp_obj_id snmpgrp_id
= {7,{1,3,6,1,2,1,11}};
769 /** mib-2.system.sysServices */
770 static const s32_t sysservices
= SNMP_SYSSERVICES
;
772 /** mib-2.system.sysDescr */
773 static const u8_t sysdescr_len_default
= 4;
774 static const u8_t sysdescr_default
[] = "lwIP";
775 static u8_t
* sysdescr_len_ptr
= (u8_t
*)&sysdescr_len_default
;
776 static u8_t
* sysdescr_ptr
= (u8_t
*)&sysdescr_default
[0];
777 /** mib-2.system.sysContact */
778 static const u8_t syscontact_len_default
= 0;
779 static const u8_t syscontact_default
[] = "";
780 static u8_t
* syscontact_len_ptr
= (u8_t
*)&syscontact_len_default
;
781 static u8_t
* syscontact_ptr
= (u8_t
*)&syscontact_default
[0];
782 /** mib-2.system.sysName */
783 static const u8_t sysname_len_default
= 8;
784 static const u8_t sysname_default
[] = "FQDN-unk";
785 static u8_t
* sysname_len_ptr
= (u8_t
*)&sysname_len_default
;
786 static u8_t
* sysname_ptr
= (u8_t
*)&sysname_default
[0];
787 /** mib-2.system.sysLocation */
788 static const u8_t syslocation_len_default
= 0;
789 static const u8_t syslocation_default
[] = "";
790 static u8_t
* syslocation_len_ptr
= (u8_t
*)&syslocation_len_default
;
791 static u8_t
* syslocation_ptr
= (u8_t
*)&syslocation_default
[0];
792 /** mib-2.snmp.snmpEnableAuthenTraps */
793 static const u8_t snmpenableauthentraps_default
= 2; /* disabled */
794 static u8_t
* snmpenableauthentraps_ptr
= (u8_t
*)&snmpenableauthentraps_default
;
796 /** mib-2.interfaces.ifTable.ifEntry.ifSpecific (zeroDotZero) */
797 static const struct snmp_obj_id ifspecific
= {2, {0, 0}};
798 /** mib-2.ip.ipRouteTable.ipRouteEntry.ipRouteInfo (zeroDotZero) */
799 static const struct snmp_obj_id iprouteinfo
= {2, {0, 0}};
803 /* mib-2.system counter(s) */
804 static u32_t sysuptime
= 0;
806 /* mib-2.ip counter(s) */
807 static u32_t ipinreceives
= 0,
811 ipinunknownprotos
= 0,
823 iproutingdiscards
= 0;
824 /* mib-2.icmp counter(s) */
825 static u32_t icmpinmsgs
= 0,
827 icmpindestunreachs
= 0,
830 icmpinsrcquenchs
= 0,
834 icmpintimestamps
= 0,
835 icmpintimestampreps
= 0,
837 icmpinaddrmaskreps
= 0,
840 icmpoutdestunreachs
= 0,
841 icmpouttimeexcds
= 0,
842 icmpoutparmprobs
= 0,
843 icmpoutsrcquenchs
= 0,
844 icmpoutredirects
= 0,
847 icmpouttimestamps
= 0,
848 icmpouttimestampreps
= 0,
849 icmpoutaddrmasks
= 0,
850 icmpoutaddrmaskreps
= 0;
851 /* mib-2.tcp counter(s) */
852 static u32_t tcpactiveopens
= 0,
861 /* mib-2.udp counter(s) */
862 static u32_t udpindatagrams
= 0,
866 /* mib-2.snmp counter(s) */
867 static u32_t snmpinpkts
= 0,
869 snmpinbadversions
= 0,
870 snmpinbadcommunitynames
= 0,
871 snmpinbadcommunityuses
= 0,
872 snmpinasnparseerrs
= 0,
874 snmpinnosuchnames
= 0,
878 snmpintotalreqvars
= 0,
879 snmpintotalsetvars
= 0,
880 snmpingetrequests
= 0,
882 snmpinsetrequests
= 0,
883 snmpingetresponses
= 0,
886 snmpoutnosuchnames
= 0,
887 snmpoutbadvalues
= 0,
889 snmpoutgetrequests
= 0,
891 snmpoutsetrequests
= 0,
892 snmpoutgetresponses
= 0,
897 /* prototypes of the following functions are in lwip/src/include/lwip/snmp.h */
901 * @param dst points to destination
902 * @param src points to source
903 * @param n number of octets to copy.
905 static void ocstrncpy(u8_t
*dst
, u8_t
*src
, u16_t n
)
915 * Copy object identifier (s32_t) array.
917 * @param dst points to destination
918 * @param src points to source
919 * @param n number of sub identifiers to copy.
921 void objectidncpy(s32_t
*dst
, s32_t
*src
, u8_t n
)
931 * Initializes sysDescr pointers.
933 * @param str if non-NULL then copy str pointer
934 * @param len points to string length, excluding zero terminator
936 void snmp_set_sysdesr(u8_t
*str
, u8_t
*len
)
941 sysdescr_len_ptr
= len
;
945 void snmp_get_sysobjid_ptr(struct snmp_obj_id
**oid
)
951 * Initializes sysObjectID value.
953 * @param oid points to stuct snmp_obj_id to copy
955 void snmp_set_sysobjid(struct snmp_obj_id
*oid
)
961 * Must be called at regular 10 msec interval from a timer interrupt
962 * or signal handler depending on your runtime environment.
964 void snmp_inc_sysuptime(void)
969 void snmp_add_sysuptime(u32_t value
)
974 void snmp_get_sysuptime(u32_t
*value
)
976 SNMP_GET_SYSUPTIME(sysuptime
);
981 * Initializes sysContact pointers,
982 * e.g. ptrs to non-volatile memory external to lwIP.
984 * @param ocstr if non-NULL then copy str pointer
985 * @param ocstrlen points to string length, excluding zero terminator
987 void snmp_set_syscontact(u8_t
*ocstr
, u8_t
*ocstrlen
)
991 syscontact_ptr
= ocstr
;
992 syscontact_len_ptr
= ocstrlen
;
997 * Initializes sysName pointers,
998 * e.g. ptrs to non-volatile memory external to lwIP.
1000 * @param ocstr if non-NULL then copy str pointer
1001 * @param ocstrlen points to string length, excluding zero terminator
1003 void snmp_set_sysname(u8_t
*ocstr
, u8_t
*ocstrlen
)
1007 sysname_ptr
= ocstr
;
1008 sysname_len_ptr
= ocstrlen
;
1013 * Initializes sysLocation pointers,
1014 * e.g. ptrs to non-volatile memory external to lwIP.
1016 * @param ocstr if non-NULL then copy str pointer
1017 * @param ocstrlen points to string length, excluding zero terminator
1019 void snmp_set_syslocation(u8_t
*ocstr
, u8_t
*ocstrlen
)
1023 syslocation_ptr
= ocstr
;
1024 syslocation_len_ptr
= ocstrlen
;
1029 void snmp_add_ifinoctets(struct netif
*ni
, u32_t value
)
1031 ni
->ifinoctets
+= value
;
1034 void snmp_inc_ifinucastpkts(struct netif
*ni
)
1036 (ni
->ifinucastpkts
)++;
1039 void snmp_inc_ifinnucastpkts(struct netif
*ni
)
1041 (ni
->ifinnucastpkts
)++;
1044 void snmp_inc_ifindiscards(struct netif
*ni
)
1046 (ni
->ifindiscards
)++;
1049 void snmp_add_ifoutoctets(struct netif
*ni
, u32_t value
)
1051 ni
->ifoutoctets
+= value
;
1054 void snmp_inc_ifoutucastpkts(struct netif
*ni
)
1056 (ni
->ifoutucastpkts
)++;
1059 void snmp_inc_ifoutnucastpkts(struct netif
*ni
)
1061 (ni
->ifoutnucastpkts
)++;
1064 void snmp_inc_ifoutdiscards(struct netif
*ni
)
1066 (ni
->ifoutdiscards
)++;
1069 void snmp_inc_iflist(void)
1071 struct mib_list_node
*if_node
= NULL
;
1073 snmp_mib_node_insert(&iflist_root
, iflist_root
.count
+ 1, &if_node
);
1074 /* enable getnext traversal on filled table */
1075 iftable
.maxlength
= 1;
1078 void snmp_dec_iflist(void)
1080 snmp_mib_node_delete(&iflist_root
, iflist_root
.tail
);
1081 /* disable getnext traversal on empty table */
1082 if(iflist_root
.count
== 0) iftable
.maxlength
= 0;
1086 * Inserts ARP table indexes (.xIfIndex.xNetAddress)
1087 * into arp table index trees (both atTable and ipNetToMediaTable).
1089 void snmp_insert_arpidx_tree(struct netif
*ni
, ip_addr_t
*ip
)
1091 struct mib_list_rootnode
*at_rn
;
1092 struct mib_list_node
*at_node
;
1096 LWIP_ASSERT("ni != NULL", ni
!= NULL
);
1097 snmp_netiftoifindex(ni
, &arpidx
[0]);
1098 snmp_iptooid(ip
, &arpidx
[1]);
1100 for (tree
= 0; tree
< 2; tree
++)
1104 at_rn
= &arptree_root
;
1108 at_rn
= &ipntomtree_root
;
1110 for (level
= 0; level
< 5; level
++)
1113 snmp_mib_node_insert(at_rn
, arpidx
[level
], &at_node
);
1114 if ((level
!= 4) && (at_node
!= NULL
))
1116 if (at_node
->nptr
== NULL
)
1118 at_rn
= snmp_mib_lrn_alloc();
1119 at_node
->nptr
= (struct mib_node
*)at_rn
;
1126 at_rn
->get_object_def
= atentry_get_object_def
;
1127 at_rn
->get_value
= atentry_get_value
;
1131 at_rn
->get_object_def
= ip_ntomentry_get_object_def
;
1132 at_rn
->get_value
= ip_ntomentry_get_value
;
1134 at_rn
->set_test
= noleafs_set_test
;
1135 at_rn
->set_value
= noleafs_set_value
;
1140 /* at_rn == NULL, malloc failure */
1141 LWIP_DEBUGF(SNMP_MIB_DEBUG
,("snmp_insert_arpidx_tree() insert failed, mem full"));
1147 at_rn
= (struct mib_list_rootnode
*)at_node
->nptr
;
1152 /* enable getnext traversal on filled tables */
1154 ipntomtable
.maxlength
= 1;
1158 * Removes ARP table indexes (.xIfIndex.xNetAddress)
1159 * from arp table index trees.
1161 void snmp_delete_arpidx_tree(struct netif
*ni
, ip_addr_t
*ip
)
1163 struct mib_list_rootnode
*at_rn
, *next
, *del_rn
[5];
1164 struct mib_list_node
*at_n
, *del_n
[5];
1166 u8_t fc
, tree
, level
, del_cnt
;
1168 snmp_netiftoifindex(ni
, &arpidx
[0]);
1169 snmp_iptooid(ip
, &arpidx
[1]);
1171 for (tree
= 0; tree
< 2; tree
++)
1173 /* mark nodes for deletion */
1176 at_rn
= &arptree_root
;
1180 at_rn
= &ipntomtree_root
;
1184 while ((level
< 5) && (at_rn
!= NULL
))
1186 fc
= snmp_mib_node_find(at_rn
, arpidx
[level
], &at_n
);
1189 /* arpidx[level] does not exist */
1195 del_rn
[del_cnt
] = at_rn
;
1196 del_n
[del_cnt
] = at_n
;
1198 at_rn
= (struct mib_list_rootnode
*)(at_n
->nptr
);
1202 /* reset delete (2 or more childs) */
1204 at_rn
= (struct mib_list_rootnode
*)(at_n
->nptr
);
1208 /* delete marked index nodes */
1213 at_rn
= del_rn
[del_cnt
];
1214 at_n
= del_n
[del_cnt
];
1216 next
= snmp_mib_node_delete(at_rn
, at_n
);
1219 LWIP_ASSERT("next_count == 0",next
->count
== 0);
1220 snmp_mib_lrn_free(next
);
1224 /* disable getnext traversal on empty tables */
1225 if(arptree_root
.count
== 0) at
.maxlength
= 0;
1226 if(ipntomtree_root
.count
== 0) ipntomtable
.maxlength
= 0;
1229 void snmp_inc_ipinreceives(void)
1234 void snmp_inc_ipinhdrerrors(void)
1239 void snmp_inc_ipinaddrerrors(void)
1244 void snmp_inc_ipforwdatagrams(void)
1249 void snmp_inc_ipinunknownprotos(void)
1251 ipinunknownprotos
++;
1254 void snmp_inc_ipindiscards(void)
1259 void snmp_inc_ipindelivers(void)
1264 void snmp_inc_ipoutrequests(void)
1269 void snmp_inc_ipoutdiscards(void)
1274 void snmp_inc_ipoutnoroutes(void)
1279 void snmp_inc_ipreasmreqds(void)
1284 void snmp_inc_ipreasmoks(void)
1289 void snmp_inc_ipreasmfails(void)
1294 void snmp_inc_ipfragoks(void)
1299 void snmp_inc_ipfragfails(void)
1304 void snmp_inc_ipfragcreates(void)
1309 void snmp_inc_iproutingdiscards(void)
1311 iproutingdiscards
++;
1315 * Inserts ipAddrTable indexes (.ipAdEntAddr)
1318 void snmp_insert_ipaddridx_tree(struct netif
*ni
)
1320 struct mib_list_rootnode
*ipa_rn
;
1321 struct mib_list_node
*ipa_node
;
1325 LWIP_ASSERT("ni != NULL", ni
!= NULL
);
1326 snmp_iptooid(&ni
->ip_addr
, &ipaddridx
[0]);
1329 ipa_rn
= &ipaddrtree_root
;
1333 snmp_mib_node_insert(ipa_rn
, ipaddridx
[level
], &ipa_node
);
1334 if ((level
!= 3) && (ipa_node
!= NULL
))
1336 if (ipa_node
->nptr
== NULL
)
1338 ipa_rn
= snmp_mib_lrn_alloc();
1339 ipa_node
->nptr
= (struct mib_node
*)ipa_rn
;
1344 ipa_rn
->get_object_def
= ip_addrentry_get_object_def
;
1345 ipa_rn
->get_value
= ip_addrentry_get_value
;
1346 ipa_rn
->set_test
= noleafs_set_test
;
1347 ipa_rn
->set_value
= noleafs_set_value
;
1352 /* ipa_rn == NULL, malloc failure */
1353 LWIP_DEBUGF(SNMP_MIB_DEBUG
,("snmp_insert_ipaddridx_tree() insert failed, mem full"));
1359 ipa_rn
= (struct mib_list_rootnode
*)ipa_node
->nptr
;
1364 /* enable getnext traversal on filled table */
1365 ipaddrtable
.maxlength
= 1;
1369 * Removes ipAddrTable indexes (.ipAdEntAddr)
1372 void snmp_delete_ipaddridx_tree(struct netif
*ni
)
1374 struct mib_list_rootnode
*ipa_rn
, *next
, *del_rn
[4];
1375 struct mib_list_node
*ipa_n
, *del_n
[4];
1377 u8_t fc
, level
, del_cnt
;
1379 LWIP_ASSERT("ni != NULL", ni
!= NULL
);
1380 snmp_iptooid(&ni
->ip_addr
, &ipaddridx
[0]);
1382 /* mark nodes for deletion */
1385 ipa_rn
= &ipaddrtree_root
;
1386 while ((level
< 4) && (ipa_rn
!= NULL
))
1388 fc
= snmp_mib_node_find(ipa_rn
, ipaddridx
[level
], &ipa_n
);
1391 /* ipaddridx[level] does not exist */
1397 del_rn
[del_cnt
] = ipa_rn
;
1398 del_n
[del_cnt
] = ipa_n
;
1400 ipa_rn
= (struct mib_list_rootnode
*)(ipa_n
->nptr
);
1404 /* reset delete (2 or more childs) */
1406 ipa_rn
= (struct mib_list_rootnode
*)(ipa_n
->nptr
);
1410 /* delete marked index nodes */
1415 ipa_rn
= del_rn
[del_cnt
];
1416 ipa_n
= del_n
[del_cnt
];
1418 next
= snmp_mib_node_delete(ipa_rn
, ipa_n
);
1421 LWIP_ASSERT("next_count == 0",next
->count
== 0);
1422 snmp_mib_lrn_free(next
);
1425 /* disable getnext traversal on empty table */
1426 if (ipaddrtree_root
.count
== 0) ipaddrtable
.maxlength
= 0;
1430 * Inserts ipRouteTable indexes (.ipRouteDest)
1433 * @param dflt non-zero for the default rte, zero for network rte
1434 * @param ni points to network interface for this rte
1436 * @todo record sysuptime for _this_ route when it is installed
1437 * (needed for ipRouteAge) in the netif.
1439 void snmp_insert_iprteidx_tree(u8_t dflt
, struct netif
*ni
)
1446 /* the default route 0.0.0.0 */
1447 ip_addr_set_any(&dst
);
1452 /* route to the network address */
1453 ip_addr_get_network(&dst
, &ni
->ip_addr
, &ni
->netmask
);
1454 /* exclude 0.0.0.0 network (reserved for default rte) */
1455 if (!ip_addr_isany(&dst
)) {
1461 struct mib_list_rootnode
*iprte_rn
;
1462 struct mib_list_node
*iprte_node
;
1466 snmp_iptooid(&dst
, &iprteidx
[0]);
1468 iprte_rn
= &iprtetree_root
;
1472 snmp_mib_node_insert(iprte_rn
, iprteidx
[level
], &iprte_node
);
1473 if ((level
!= 3) && (iprte_node
!= NULL
))
1475 if (iprte_node
->nptr
== NULL
)
1477 iprte_rn
= snmp_mib_lrn_alloc();
1478 iprte_node
->nptr
= (struct mib_node
*)iprte_rn
;
1479 if (iprte_rn
!= NULL
)
1483 iprte_rn
->get_object_def
= ip_rteentry_get_object_def
;
1484 iprte_rn
->get_value
= ip_rteentry_get_value
;
1485 iprte_rn
->set_test
= noleafs_set_test
;
1486 iprte_rn
->set_value
= noleafs_set_value
;
1491 /* iprte_rn == NULL, malloc failure */
1492 LWIP_DEBUGF(SNMP_MIB_DEBUG
,("snmp_insert_iprteidx_tree() insert failed, mem full"));
1498 iprte_rn
= (struct mib_list_rootnode
*)iprte_node
->nptr
;
1504 /* enable getnext traversal on filled table */
1505 iprtetable
.maxlength
= 1;
1509 * Removes ipRouteTable indexes (.ipRouteDest)
1512 * @param dflt non-zero for the default rte, zero for network rte
1513 * @param ni points to network interface for this rte or NULL
1514 * for default route to be removed.
1516 void snmp_delete_iprteidx_tree(u8_t dflt
, struct netif
*ni
)
1523 /* the default route 0.0.0.0 */
1524 ip_addr_set_any(&dst
);
1529 /* route to the network address */
1530 ip_addr_get_network(&dst
, &ni
->ip_addr
, &ni
->netmask
);
1531 /* exclude 0.0.0.0 network (reserved for default rte) */
1532 if (!ip_addr_isany(&dst
)) {
1538 struct mib_list_rootnode
*iprte_rn
, *next
, *del_rn
[4];
1539 struct mib_list_node
*iprte_n
, *del_n
[4];
1541 u8_t fc
, level
, del_cnt
;
1543 snmp_iptooid(&dst
, &iprteidx
[0]);
1544 /* mark nodes for deletion */
1547 iprte_rn
= &iprtetree_root
;
1548 while ((level
< 4) && (iprte_rn
!= NULL
))
1550 fc
= snmp_mib_node_find(iprte_rn
, iprteidx
[level
], &iprte_n
);
1553 /* iprteidx[level] does not exist */
1559 del_rn
[del_cnt
] = iprte_rn
;
1560 del_n
[del_cnt
] = iprte_n
;
1562 iprte_rn
= (struct mib_list_rootnode
*)(iprte_n
->nptr
);
1566 /* reset delete (2 or more childs) */
1568 iprte_rn
= (struct mib_list_rootnode
*)(iprte_n
->nptr
);
1572 /* delete marked index nodes */
1577 iprte_rn
= del_rn
[del_cnt
];
1578 iprte_n
= del_n
[del_cnt
];
1580 next
= snmp_mib_node_delete(iprte_rn
, iprte_n
);
1583 LWIP_ASSERT("next_count == 0",next
->count
== 0);
1584 snmp_mib_lrn_free(next
);
1588 /* disable getnext traversal on empty table */
1589 if (iprtetree_root
.count
== 0) iprtetable
.maxlength
= 0;
1593 void snmp_inc_icmpinmsgs(void)
1598 void snmp_inc_icmpinerrors(void)
1603 void snmp_inc_icmpindestunreachs(void)
1605 icmpindestunreachs
++;
1608 void snmp_inc_icmpintimeexcds(void)
1613 void snmp_inc_icmpinparmprobs(void)
1618 void snmp_inc_icmpinsrcquenchs(void)
1623 void snmp_inc_icmpinredirects(void)
1628 void snmp_inc_icmpinechos(void)
1633 void snmp_inc_icmpinechoreps(void)
1638 void snmp_inc_icmpintimestamps(void)
1643 void snmp_inc_icmpintimestampreps(void)
1645 icmpintimestampreps
++;
1648 void snmp_inc_icmpinaddrmasks(void)
1653 void snmp_inc_icmpinaddrmaskreps(void)
1655 icmpinaddrmaskreps
++;
1658 void snmp_inc_icmpoutmsgs(void)
1663 void snmp_inc_icmpouterrors(void)
1668 void snmp_inc_icmpoutdestunreachs(void)
1670 icmpoutdestunreachs
++;
1673 void snmp_inc_icmpouttimeexcds(void)
1678 void snmp_inc_icmpoutparmprobs(void)
1683 void snmp_inc_icmpoutsrcquenchs(void)
1685 icmpoutsrcquenchs
++;
1688 void snmp_inc_icmpoutredirects(void)
1693 void snmp_inc_icmpoutechos(void)
1698 void snmp_inc_icmpoutechoreps(void)
1703 void snmp_inc_icmpouttimestamps(void)
1705 icmpouttimestamps
++;
1708 void snmp_inc_icmpouttimestampreps(void)
1710 icmpouttimestampreps
++;
1713 void snmp_inc_icmpoutaddrmasks(void)
1718 void snmp_inc_icmpoutaddrmaskreps(void)
1720 icmpoutaddrmaskreps
++;
1723 void snmp_inc_tcpactiveopens(void)
1728 void snmp_inc_tcppassiveopens(void)
1733 void snmp_inc_tcpattemptfails(void)
1738 void snmp_inc_tcpestabresets(void)
1743 void snmp_inc_tcpinsegs(void)
1748 void snmp_inc_tcpoutsegs(void)
1753 void snmp_inc_tcpretranssegs(void)
1758 void snmp_inc_tcpinerrs(void)
1763 void snmp_inc_tcpoutrsts(void)
1768 void snmp_inc_udpindatagrams(void)
1773 void snmp_inc_udpnoports(void)
1778 void snmp_inc_udpinerrors(void)
1783 void snmp_inc_udpoutdatagrams(void)
1789 * Inserts udpTable indexes (.udpLocalAddress.udpLocalPort)
1792 void snmp_insert_udpidx_tree(struct udp_pcb
*pcb
)
1794 struct mib_list_rootnode
*udp_rn
;
1795 struct mib_list_node
*udp_node
;
1799 LWIP_ASSERT("pcb != NULL", pcb
!= NULL
);
1800 snmp_iptooid(&pcb
->local_ip
, &udpidx
[0]);
1801 udpidx
[4] = pcb
->local_port
;
1804 for (level
= 0; level
< 5; level
++)
1807 snmp_mib_node_insert(udp_rn
, udpidx
[level
], &udp_node
);
1808 if ((level
!= 4) && (udp_node
!= NULL
))
1810 if (udp_node
->nptr
== NULL
)
1812 udp_rn
= snmp_mib_lrn_alloc();
1813 udp_node
->nptr
= (struct mib_node
*)udp_rn
;
1818 udp_rn
->get_object_def
= udpentry_get_object_def
;
1819 udp_rn
->get_value
= udpentry_get_value
;
1820 udp_rn
->set_test
= noleafs_set_test
;
1821 udp_rn
->set_value
= noleafs_set_value
;
1826 /* udp_rn == NULL, malloc failure */
1827 LWIP_DEBUGF(SNMP_MIB_DEBUG
,("snmp_insert_udpidx_tree() insert failed, mem full"));
1833 udp_rn
= (struct mib_list_rootnode
*)udp_node
->nptr
;
1837 udptable
.maxlength
= 1;
1841 * Removes udpTable indexes (.udpLocalAddress.udpLocalPort)
1844 void snmp_delete_udpidx_tree(struct udp_pcb
*pcb
)
1846 struct udp_pcb
*npcb
;
1847 struct mib_list_rootnode
*udp_rn
, *next
, *del_rn
[5];
1848 struct mib_list_node
*udp_n
, *del_n
[5];
1850 u8_t bindings
, fc
, level
, del_cnt
;
1852 LWIP_ASSERT("pcb != NULL", pcb
!= NULL
);
1853 snmp_iptooid(&pcb
->local_ip
, &udpidx
[0]);
1854 udpidx
[4] = pcb
->local_port
;
1856 /* count PCBs for a given binding
1857 (e.g. when reusing ports or for temp output PCBs) */
1860 while ((npcb
!= NULL
))
1862 if (ip_addr_cmp(&npcb
->local_ip
, &pcb
->local_ip
) &&
1863 (npcb
->local_port
== udpidx
[4]))
1871 /* selectively remove */
1872 /* mark nodes for deletion */
1876 while ((level
< 5) && (udp_rn
!= NULL
))
1878 fc
= snmp_mib_node_find(udp_rn
, udpidx
[level
], &udp_n
);
1881 /* udpidx[level] does not exist */
1887 del_rn
[del_cnt
] = udp_rn
;
1888 del_n
[del_cnt
] = udp_n
;
1890 udp_rn
= (struct mib_list_rootnode
*)(udp_n
->nptr
);
1894 /* reset delete (2 or more childs) */
1896 udp_rn
= (struct mib_list_rootnode
*)(udp_n
->nptr
);
1900 /* delete marked index nodes */
1905 udp_rn
= del_rn
[del_cnt
];
1906 udp_n
= del_n
[del_cnt
];
1908 next
= snmp_mib_node_delete(udp_rn
, udp_n
);
1911 LWIP_ASSERT("next_count == 0",next
->count
== 0);
1912 snmp_mib_lrn_free(next
);
1916 /* disable getnext traversal on empty table */
1917 if (udp_root
.count
== 0) udptable
.maxlength
= 0;
1921 void snmp_inc_snmpinpkts(void)
1926 void snmp_inc_snmpoutpkts(void)
1931 void snmp_inc_snmpinbadversions(void)
1933 snmpinbadversions
++;
1936 void snmp_inc_snmpinbadcommunitynames(void)
1938 snmpinbadcommunitynames
++;
1941 void snmp_inc_snmpinbadcommunityuses(void)
1943 snmpinbadcommunityuses
++;
1946 void snmp_inc_snmpinasnparseerrs(void)
1948 snmpinasnparseerrs
++;
1951 void snmp_inc_snmpintoobigs(void)
1956 void snmp_inc_snmpinnosuchnames(void)
1958 snmpinnosuchnames
++;
1961 void snmp_inc_snmpinbadvalues(void)
1966 void snmp_inc_snmpinreadonlys(void)
1971 void snmp_inc_snmpingenerrs(void)
1976 void snmp_add_snmpintotalreqvars(u8_t value
)
1978 snmpintotalreqvars
+= value
;
1981 void snmp_add_snmpintotalsetvars(u8_t value
)
1983 snmpintotalsetvars
+= value
;
1986 void snmp_inc_snmpingetrequests(void)
1988 snmpingetrequests
++;
1991 void snmp_inc_snmpingetnexts(void)
1996 void snmp_inc_snmpinsetrequests(void)
1998 snmpinsetrequests
++;
2001 void snmp_inc_snmpingetresponses(void)
2003 snmpingetresponses
++;
2006 void snmp_inc_snmpintraps(void)
2011 void snmp_inc_snmpouttoobigs(void)
2016 void snmp_inc_snmpoutnosuchnames(void)
2018 snmpoutnosuchnames
++;
2021 void snmp_inc_snmpoutbadvalues(void)
2026 void snmp_inc_snmpoutgenerrs(void)
2031 void snmp_inc_snmpoutgetrequests(void)
2033 snmpoutgetrequests
++;
2036 void snmp_inc_snmpoutgetnexts(void)
2041 void snmp_inc_snmpoutsetrequests(void)
2043 snmpoutsetrequests
++;
2046 void snmp_inc_snmpoutgetresponses(void)
2048 snmpoutgetresponses
++;
2051 void snmp_inc_snmpouttraps(void)
2056 void snmp_get_snmpgrpid_ptr(struct snmp_obj_id
**oid
)
2061 void snmp_set_snmpenableauthentraps(u8_t
*value
)
2065 snmpenableauthentraps_ptr
= value
;
2069 void snmp_get_snmpenableauthentraps(u8_t
*value
)
2071 *value
= *snmpenableauthentraps_ptr
;
2075 noleafs_get_object_def(u8_t ident_len
, s32_t
*ident
, struct obj_def
*od
)
2077 LWIP_UNUSED_ARG(ident_len
);
2078 LWIP_UNUSED_ARG(ident
);
2079 od
->instance
= MIB_OBJECT_NONE
;
2083 noleafs_get_value(struct obj_def
*od
, u16_t len
, void *value
)
2085 LWIP_UNUSED_ARG(od
);
2086 LWIP_UNUSED_ARG(len
);
2087 LWIP_UNUSED_ARG(value
);
2091 noleafs_set_test(struct obj_def
*od
, u16_t len
, void *value
)
2093 LWIP_UNUSED_ARG(od
);
2094 LWIP_UNUSED_ARG(len
);
2095 LWIP_UNUSED_ARG(value
);
2101 noleafs_set_value(struct obj_def
*od
, u16_t len
, void *value
)
2103 LWIP_UNUSED_ARG(od
);
2104 LWIP_UNUSED_ARG(len
);
2105 LWIP_UNUSED_ARG(value
);
2110 * Returns systems object definitions.
2112 * @param ident_len the address length (2)
2113 * @param ident points to objectname.0 (object id trailer)
2114 * @param od points to object definition.
2117 system_get_object_def(u8_t ident_len
, s32_t
*ident
, struct obj_def
*od
)
2121 /* return to object name, adding index depth (1) */
2126 od
->id_inst_len
= ident_len
;
2127 od
->id_inst_ptr
= ident
;
2129 LWIP_ASSERT("invalid id", (ident
[0] >= 0) && (ident
[0] <= 0xff));
2130 id
= (u8_t
)ident
[0];
2131 LWIP_DEBUGF(SNMP_MIB_DEBUG
,("get_object_def system.%"U16_F
".0\n",(u16_t
)id
));
2134 case 1: /* sysDescr */
2135 od
->instance
= MIB_OBJECT_SCALAR
;
2136 od
->access
= MIB_OBJECT_READ_ONLY
;
2137 od
->asn_type
= (SNMP_ASN1_UNIV
| SNMP_ASN1_PRIMIT
| SNMP_ASN1_OC_STR
);
2138 od
->v_len
= *sysdescr_len_ptr
;
2140 case 2: /* sysObjectID */
2141 od
->instance
= MIB_OBJECT_SCALAR
;
2142 od
->access
= MIB_OBJECT_READ_ONLY
;
2143 od
->asn_type
= (SNMP_ASN1_UNIV
| SNMP_ASN1_PRIMIT
| SNMP_ASN1_OBJ_ID
);
2144 od
->v_len
= sysobjid
.len
* sizeof(s32_t
);
2146 case 3: /* sysUpTime */
2147 od
->instance
= MIB_OBJECT_SCALAR
;
2148 od
->access
= MIB_OBJECT_READ_ONLY
;
2149 od
->asn_type
= (SNMP_ASN1_APPLIC
| SNMP_ASN1_PRIMIT
| SNMP_ASN1_TIMETICKS
);
2150 od
->v_len
= sizeof(u32_t
);
2152 case 4: /* sysContact */
2153 od
->instance
= MIB_OBJECT_SCALAR
;
2154 od
->access
= MIB_OBJECT_READ_WRITE
;
2155 od
->asn_type
= (SNMP_ASN1_UNIV
| SNMP_ASN1_PRIMIT
| SNMP_ASN1_OC_STR
);
2156 od
->v_len
= *syscontact_len_ptr
;
2158 case 5: /* sysName */
2159 od
->instance
= MIB_OBJECT_SCALAR
;
2160 od
->access
= MIB_OBJECT_READ_WRITE
;
2161 od
->asn_type
= (SNMP_ASN1_UNIV
| SNMP_ASN1_PRIMIT
| SNMP_ASN1_OC_STR
);
2162 od
->v_len
= *sysname_len_ptr
;
2164 case 6: /* sysLocation */
2165 od
->instance
= MIB_OBJECT_SCALAR
;
2166 od
->access
= MIB_OBJECT_READ_WRITE
;
2167 od
->asn_type
= (SNMP_ASN1_UNIV
| SNMP_ASN1_PRIMIT
| SNMP_ASN1_OC_STR
);
2168 od
->v_len
= *syslocation_len_ptr
;
2170 case 7: /* sysServices */
2171 od
->instance
= MIB_OBJECT_SCALAR
;
2172 od
->access
= MIB_OBJECT_READ_ONLY
;
2173 od
->asn_type
= (SNMP_ASN1_UNIV
| SNMP_ASN1_PRIMIT
| SNMP_ASN1_INTEG
);
2174 od
->v_len
= sizeof(s32_t
);
2177 LWIP_DEBUGF(SNMP_MIB_DEBUG
,("system_get_object_def: no such object\n"));
2178 od
->instance
= MIB_OBJECT_NONE
;
2184 LWIP_DEBUGF(SNMP_MIB_DEBUG
,("system_get_object_def: no scalar\n"));
2185 od
->instance
= MIB_OBJECT_NONE
;
2190 * Returns system object value.
2192 * @param ident_len the address length (2)
2193 * @param ident points to objectname.0 (object id trailer)
2194 * @param len return value space (in bytes)
2195 * @param value points to (varbind) space to copy value into.
2198 system_get_value(struct obj_def
*od
, u16_t len
, void *value
)
2202 LWIP_ASSERT("invalid id", (od
->id_inst_ptr
[0] >= 0) && (od
->id_inst_ptr
[0] <= 0xff));
2203 id
= (u8_t
)od
->id_inst_ptr
[0];
2206 case 1: /* sysDescr */
2207 ocstrncpy((u8_t
*)value
, sysdescr_ptr
, len
);
2209 case 2: /* sysObjectID */
2210 objectidncpy((s32_t
*)value
, (s32_t
*)sysobjid
.id
, (u8_t
)(len
/ sizeof(s32_t
)));
2212 case 3: /* sysUpTime */
2214 snmp_get_sysuptime((u32_t
*)value
);
2217 case 4: /* sysContact */
2218 ocstrncpy((u8_t
*)value
, syscontact_ptr
, len
);
2220 case 5: /* sysName */
2221 ocstrncpy((u8_t
*)value
, sysname_ptr
, len
);
2223 case 6: /* sysLocation */
2224 ocstrncpy((u8_t
*)value
, syslocation_ptr
, len
);
2226 case 7: /* sysServices */
2228 s32_t
*sint_ptr
= (s32_t
*)value
;
2229 *sint_ptr
= sysservices
;
2236 system_set_test(struct obj_def
*od
, u16_t len
, void *value
)
2240 LWIP_UNUSED_ARG(value
);
2242 LWIP_ASSERT("invalid id", (od
->id_inst_ptr
[0] >= 0) && (od
->id_inst_ptr
[0] <= 0xff));
2243 id
= (u8_t
)od
->id_inst_ptr
[0];
2246 case 4: /* sysContact */
2247 if ((syscontact_ptr
!= syscontact_default
) &&
2253 case 5: /* sysName */
2254 if ((sysname_ptr
!= sysname_default
) &&
2260 case 6: /* sysLocation */
2261 if ((syslocation_ptr
!= syslocation_default
) &&
2272 system_set_value(struct obj_def
*od
, u16_t len
, void *value
)
2276 LWIP_ASSERT("invalid len", len
<= 0xff);
2277 LWIP_ASSERT("invalid id", (od
->id_inst_ptr
[0] >= 0) && (od
->id_inst_ptr
[0] <= 0xff));
2278 id
= (u8_t
)od
->id_inst_ptr
[0];
2281 case 4: /* sysContact */
2282 ocstrncpy(syscontact_ptr
, (u8_t
*)value
, len
);
2283 *syscontact_len_ptr
= (u8_t
)len
;
2285 case 5: /* sysName */
2286 ocstrncpy(sysname_ptr
, (u8_t
*)value
, len
);
2287 *sysname_len_ptr
= (u8_t
)len
;
2289 case 6: /* sysLocation */
2290 ocstrncpy(syslocation_ptr
, (u8_t
*)value
, len
);
2291 *syslocation_len_ptr
= (u8_t
)len
;
2297 * Returns interfaces.ifnumber object definition.
2299 * @param ident_len the address length (2)
2300 * @param ident points to objectname.index
2301 * @param od points to object definition.
2304 interfaces_get_object_def(u8_t ident_len
, s32_t
*ident
, struct obj_def
*od
)
2306 /* return to object name, adding index depth (1) */
2311 od
->id_inst_len
= ident_len
;
2312 od
->id_inst_ptr
= ident
;
2314 od
->instance
= MIB_OBJECT_SCALAR
;
2315 od
->access
= MIB_OBJECT_READ_ONLY
;
2316 od
->asn_type
= (SNMP_ASN1_UNIV
| SNMP_ASN1_PRIMIT
| SNMP_ASN1_INTEG
);
2317 od
->v_len
= sizeof(s32_t
);
2321 LWIP_DEBUGF(SNMP_MIB_DEBUG
,("interfaces_get_object_def: no scalar\n"));
2322 od
->instance
= MIB_OBJECT_NONE
;
2327 * Returns interfaces.ifnumber object value.
2329 * @param ident_len the address length (2)
2330 * @param ident points to objectname.0 (object id trailer)
2331 * @param len return value space (in bytes)
2332 * @param value points to (varbind) space to copy value into.
2335 interfaces_get_value(struct obj_def
*od
, u16_t len
, void *value
)
2337 LWIP_UNUSED_ARG(len
);
2338 if (od
->id_inst_ptr
[0] == 1)
2340 s32_t
*sint_ptr
= (s32_t
*)value
;
2341 *sint_ptr
= iflist_root
.count
;
2346 * Returns ifentry object definitions.
2348 * @param ident_len the address length (2)
2349 * @param ident points to objectname.index
2350 * @param od points to object definition.
2353 ifentry_get_object_def(u8_t ident_len
, s32_t
*ident
, struct obj_def
*od
)
2357 /* return to object name, adding index depth (1) */
2362 od
->id_inst_len
= ident_len
;
2363 od
->id_inst_ptr
= ident
;
2365 LWIP_ASSERT("invalid id", (ident
[0] >= 0) && (ident
[0] <= 0xff));
2366 id
= (u8_t
)ident
[0];
2367 LWIP_DEBUGF(SNMP_MIB_DEBUG
,("get_object_def ifentry.%"U16_F
"\n",(u16_t
)id
));
2370 case 1: /* ifIndex */
2371 case 3: /* ifType */
2373 case 8: /* ifOperStatus */
2374 od
->instance
= MIB_OBJECT_TAB
;
2375 od
->access
= MIB_OBJECT_READ_ONLY
;
2376 od
->asn_type
= (SNMP_ASN1_UNIV
| SNMP_ASN1_PRIMIT
| SNMP_ASN1_INTEG
);
2377 od
->v_len
= sizeof(s32_t
);
2379 case 2: /* ifDescr */
2380 od
->instance
= MIB_OBJECT_TAB
;
2381 od
->access
= MIB_OBJECT_READ_ONLY
;
2382 od
->asn_type
= (SNMP_ASN1_UNIV
| SNMP_ASN1_PRIMIT
| SNMP_ASN1_OC_STR
);
2383 /** @todo this should be some sort of sizeof(struct netif.name) */
2386 case 5: /* ifSpeed */
2387 case 21: /* ifOutQLen */
2388 od
->instance
= MIB_OBJECT_TAB
;
2389 od
->access
= MIB_OBJECT_READ_ONLY
;
2390 od
->asn_type
= (SNMP_ASN1_APPLIC
| SNMP_ASN1_PRIMIT
| SNMP_ASN1_GAUGE
);
2391 od
->v_len
= sizeof(u32_t
);
2393 case 6: /* ifPhysAddress */
2395 struct netif
*netif
;
2397 snmp_ifindextonetif(ident
[1], &netif
);
2398 od
->instance
= MIB_OBJECT_TAB
;
2399 od
->access
= MIB_OBJECT_READ_ONLY
;
2400 od
->asn_type
= (SNMP_ASN1_UNIV
| SNMP_ASN1_PRIMIT
| SNMP_ASN1_OC_STR
);
2401 od
->v_len
= netif
->hwaddr_len
;
2404 case 7: /* ifAdminStatus */
2405 od
->instance
= MIB_OBJECT_TAB
;
2406 od
->access
= MIB_OBJECT_READ_WRITE
;
2407 od
->asn_type
= (SNMP_ASN1_UNIV
| SNMP_ASN1_PRIMIT
| SNMP_ASN1_INTEG
);
2408 od
->v_len
= sizeof(s32_t
);
2410 case 9: /* ifLastChange */
2411 od
->instance
= MIB_OBJECT_TAB
;
2412 od
->access
= MIB_OBJECT_READ_ONLY
;
2413 od
->asn_type
= (SNMP_ASN1_APPLIC
| SNMP_ASN1_PRIMIT
| SNMP_ASN1_TIMETICKS
);
2414 od
->v_len
= sizeof(u32_t
);
2416 case 10: /* ifInOctets */
2417 case 11: /* ifInUcastPkts */
2418 case 12: /* ifInNUcastPkts */
2419 case 13: /* ifInDiscarts */
2420 case 14: /* ifInErrors */
2421 case 15: /* ifInUnkownProtos */
2422 case 16: /* ifOutOctets */
2423 case 17: /* ifOutUcastPkts */
2424 case 18: /* ifOutNUcastPkts */
2425 case 19: /* ifOutDiscarts */
2426 case 20: /* ifOutErrors */
2427 od
->instance
= MIB_OBJECT_TAB
;
2428 od
->access
= MIB_OBJECT_READ_ONLY
;
2429 od
->asn_type
= (SNMP_ASN1_APPLIC
| SNMP_ASN1_PRIMIT
| SNMP_ASN1_COUNTER
);
2430 od
->v_len
= sizeof(u32_t
);
2432 case 22: /* ifSpecific */
2433 /** @note returning zeroDotZero (0.0) no media specific MIB support */
2434 od
->instance
= MIB_OBJECT_TAB
;
2435 od
->access
= MIB_OBJECT_READ_ONLY
;
2436 od
->asn_type
= (SNMP_ASN1_UNIV
| SNMP_ASN1_PRIMIT
| SNMP_ASN1_OBJ_ID
);
2437 od
->v_len
= ifspecific
.len
* sizeof(s32_t
);
2440 LWIP_DEBUGF(SNMP_MIB_DEBUG
,("ifentry_get_object_def: no such object\n"));
2441 od
->instance
= MIB_OBJECT_NONE
;
2447 LWIP_DEBUGF(SNMP_MIB_DEBUG
,("ifentry_get_object_def: no scalar\n"));
2448 od
->instance
= MIB_OBJECT_NONE
;
2453 * Returns ifentry object value.
2455 * @param ident_len the address length (2)
2456 * @param ident points to objectname.0 (object id trailer)
2457 * @param len return value space (in bytes)
2458 * @param value points to (varbind) space to copy value into.
2461 ifentry_get_value(struct obj_def
*od
, u16_t len
, void *value
)
2463 struct netif
*netif
;
2466 snmp_ifindextonetif(od
->id_inst_ptr
[1], &netif
);
2467 LWIP_ASSERT("invalid id", (od
->id_inst_ptr
[0] >= 0) && (od
->id_inst_ptr
[0] <= 0xff));
2468 id
= (u8_t
)od
->id_inst_ptr
[0];
2471 case 1: /* ifIndex */
2473 s32_t
*sint_ptr
= (s32_t
*)value
;
2474 *sint_ptr
= od
->id_inst_ptr
[1];
2477 case 2: /* ifDescr */
2478 ocstrncpy((u8_t
*)value
, (u8_t
*)netif
->name
, len
);
2480 case 3: /* ifType */
2482 s32_t
*sint_ptr
= (s32_t
*)value
;
2483 *sint_ptr
= netif
->link_type
;
2488 s32_t
*sint_ptr
= (s32_t
*)value
;
2489 *sint_ptr
= netif
->mtu
;
2492 case 5: /* ifSpeed */
2494 u32_t
*uint_ptr
= (u32_t
*)value
;
2495 *uint_ptr
= netif
->link_speed
;
2498 case 6: /* ifPhysAddress */
2499 ocstrncpy((u8_t
*)value
, netif
->hwaddr
, len
);
2501 case 7: /* ifAdminStatus */
2503 s32_t
*sint_ptr
= (s32_t
*)value
;
2504 if (netif_is_up(netif
))
2506 if (netif_is_link_up(netif
))
2508 *sint_ptr
= 1; /* up */
2512 *sint_ptr
= 7; /* lowerLayerDown */
2517 *sint_ptr
= 2; /* down */
2521 case 8: /* ifOperStatus */
2523 s32_t
*sint_ptr
= (s32_t
*)value
;
2524 if (netif_is_up(netif
))
2534 case 9: /* ifLastChange */
2536 u32_t
*uint_ptr
= (u32_t
*)value
;
2537 *uint_ptr
= netif
->ts
;
2540 case 10: /* ifInOctets */
2542 u32_t
*uint_ptr
= (u32_t
*)value
;
2543 *uint_ptr
= netif
->ifinoctets
;
2546 case 11: /* ifInUcastPkts */
2548 u32_t
*uint_ptr
= (u32_t
*)value
;
2549 *uint_ptr
= netif
->ifinucastpkts
;
2552 case 12: /* ifInNUcastPkts */
2554 u32_t
*uint_ptr
= (u32_t
*)value
;
2555 *uint_ptr
= netif
->ifinnucastpkts
;
2558 case 13: /* ifInDiscarts */
2560 u32_t
*uint_ptr
= (u32_t
*)value
;
2561 *uint_ptr
= netif
->ifindiscards
;
2564 case 14: /* ifInErrors */
2565 case 15: /* ifInUnkownProtos */
2566 /** @todo add these counters! */
2568 u32_t
*uint_ptr
= (u32_t
*)value
;
2572 case 16: /* ifOutOctets */
2574 u32_t
*uint_ptr
= (u32_t
*)value
;
2575 *uint_ptr
= netif
->ifoutoctets
;
2578 case 17: /* ifOutUcastPkts */
2580 u32_t
*uint_ptr
= (u32_t
*)value
;
2581 *uint_ptr
= netif
->ifoutucastpkts
;
2584 case 18: /* ifOutNUcastPkts */
2586 u32_t
*uint_ptr
= (u32_t
*)value
;
2587 *uint_ptr
= netif
->ifoutnucastpkts
;
2590 case 19: /* ifOutDiscarts */
2592 u32_t
*uint_ptr
= (u32_t
*)value
;
2593 *uint_ptr
= netif
->ifoutdiscards
;
2596 case 20: /* ifOutErrors */
2597 /** @todo add this counter! */
2599 u32_t
*uint_ptr
= (u32_t
*)value
;
2603 case 21: /* ifOutQLen */
2604 /** @todo figure out if this must be 0 (no queue) or 1? */
2606 u32_t
*uint_ptr
= (u32_t
*)value
;
2610 case 22: /* ifSpecific */
2611 objectidncpy((s32_t
*)value
, (s32_t
*)ifspecific
.id
, (u8_t
)(len
/ sizeof(s32_t
)));
2616 #if !SNMP_SAFE_REQUESTS
2618 ifentry_set_test(struct obj_def
*od
, u16_t len
, void *value
)
2620 struct netif
*netif
;
2622 LWIP_UNUSED_ARG(len
);
2625 snmp_ifindextonetif(od
->id_inst_ptr
[1], &netif
);
2626 id
= (u8_t
)od
->id_inst_ptr
[0];
2629 case 7: /* ifAdminStatus */
2631 s32_t
*sint_ptr
= (s32_t
*)value
;
2632 if (*sint_ptr
== 1 || *sint_ptr
== 2)
2641 ifentry_set_value(struct obj_def
*od
, u16_t len
, void *value
)
2643 struct netif
*netif
;
2645 LWIP_UNUSED_ARG(len
);
2647 snmp_ifindextonetif(od
->id_inst_ptr
[1], &netif
);
2648 id
= (u8_t
)od
->id_inst_ptr
[0];
2651 case 7: /* ifAdminStatus */
2653 s32_t
*sint_ptr
= (s32_t
*)value
;
2656 netif_set_up(netif
);
2658 else if (*sint_ptr
== 2)
2660 netif_set_down(netif
);
2666 #endif /* SNMP_SAFE_REQUESTS */
2669 * Returns atentry object definitions.
2671 * @param ident_len the address length (6)
2672 * @param ident points to objectname.atifindex.atnetaddress
2673 * @param od points to object definition.
2676 atentry_get_object_def(u8_t ident_len
, s32_t
*ident
, struct obj_def
*od
)
2678 /* return to object name, adding index depth (5) */
2684 od
->id_inst_len
= ident_len
;
2685 od
->id_inst_ptr
= ident
;
2689 case 1: /* atIfIndex */
2690 od
->instance
= MIB_OBJECT_TAB
;
2691 od
->access
= MIB_OBJECT_READ_WRITE
;
2692 od
->asn_type
= (SNMP_ASN1_UNIV
| SNMP_ASN1_PRIMIT
| SNMP_ASN1_INTEG
);
2693 od
->v_len
= sizeof(s32_t
);
2695 case 2: /* atPhysAddress */
2696 od
->instance
= MIB_OBJECT_TAB
;
2697 od
->access
= MIB_OBJECT_READ_WRITE
;
2698 od
->asn_type
= (SNMP_ASN1_UNIV
| SNMP_ASN1_PRIMIT
| SNMP_ASN1_OC_STR
);
2699 od
->v_len
= 6; /** @todo try to use netif::hwaddr_len */
2701 case 3: /* atNetAddress */
2702 od
->instance
= MIB_OBJECT_TAB
;
2703 od
->access
= MIB_OBJECT_READ_WRITE
;
2704 od
->asn_type
= (SNMP_ASN1_APPLIC
| SNMP_ASN1_PRIMIT
| SNMP_ASN1_IPADDR
);
2708 LWIP_DEBUGF(SNMP_MIB_DEBUG
,("atentry_get_object_def: no such object\n"));
2709 od
->instance
= MIB_OBJECT_NONE
;
2715 LWIP_DEBUGF(SNMP_MIB_DEBUG
,("atentry_get_object_def: no scalar\n"));
2716 od
->instance
= MIB_OBJECT_NONE
;
2721 atentry_get_value(struct obj_def
*od
, u16_t len
, void *value
)
2725 struct eth_addr
* ethaddr_ret
;
2726 ip_addr_t
* ipaddr_ret
;
2727 #endif /* LWIP_ARP */
2729 struct netif
*netif
;
2731 LWIP_UNUSED_ARG(len
);
2732 LWIP_UNUSED_ARG(value
);/* if !LWIP_ARP */
2734 snmp_ifindextonetif(od
->id_inst_ptr
[1], &netif
);
2735 snmp_oidtoip(&od
->id_inst_ptr
[2], &ip
);
2737 #if LWIP_ARP /** @todo implement a netif_find_addr */
2738 if (etharp_find_addr(netif
, &ip
, ðaddr_ret
, &ipaddr_ret
) > -1)
2740 LWIP_ASSERT("invalid id", (od
->id_inst_ptr
[0] >= 0) && (od
->id_inst_ptr
[0] <= 0xff));
2741 id
= (u8_t
)od
->id_inst_ptr
[0];
2744 case 1: /* atIfIndex */
2746 s32_t
*sint_ptr
= (s32_t
*)value
;
2747 *sint_ptr
= od
->id_inst_ptr
[1];
2750 case 2: /* atPhysAddress */
2752 struct eth_addr
*dst
= (struct eth_addr
*)value
;
2754 *dst
= *ethaddr_ret
;
2757 case 3: /* atNetAddress */
2759 ip_addr_t
*dst
= (ip_addr_t
*)value
;
2766 #endif /* LWIP_ARP */
2770 ip_get_object_def(u8_t ident_len
, s32_t
*ident
, struct obj_def
*od
)
2774 /* return to object name, adding index depth (1) */
2779 od
->id_inst_len
= ident_len
;
2780 od
->id_inst_ptr
= ident
;
2782 LWIP_ASSERT("invalid id", (ident
[0] >= 0) && (ident
[0] <= 0xff));
2783 id
= (u8_t
)ident
[0];
2784 LWIP_DEBUGF(SNMP_MIB_DEBUG
,("get_object_def ip.%"U16_F
".0\n",(u16_t
)id
));
2787 case 1: /* ipForwarding */
2788 case 2: /* ipDefaultTTL */
2789 od
->instance
= MIB_OBJECT_SCALAR
;
2790 od
->access
= MIB_OBJECT_READ_WRITE
;
2791 od
->asn_type
= (SNMP_ASN1_UNIV
| SNMP_ASN1_PRIMIT
| SNMP_ASN1_INTEG
);
2792 od
->v_len
= sizeof(s32_t
);
2794 case 3: /* ipInReceives */
2795 case 4: /* ipInHdrErrors */
2796 case 5: /* ipInAddrErrors */
2797 case 6: /* ipForwDatagrams */
2798 case 7: /* ipInUnknownProtos */
2799 case 8: /* ipInDiscards */
2800 case 9: /* ipInDelivers */
2801 case 10: /* ipOutRequests */
2802 case 11: /* ipOutDiscards */
2803 case 12: /* ipOutNoRoutes */
2804 case 14: /* ipReasmReqds */
2805 case 15: /* ipReasmOKs */
2806 case 16: /* ipReasmFails */
2807 case 17: /* ipFragOKs */
2808 case 18: /* ipFragFails */
2809 case 19: /* ipFragCreates */
2810 case 23: /* ipRoutingDiscards */
2811 od
->instance
= MIB_OBJECT_SCALAR
;
2812 od
->access
= MIB_OBJECT_READ_ONLY
;
2813 od
->asn_type
= (SNMP_ASN1_APPLIC
| SNMP_ASN1_PRIMIT
| SNMP_ASN1_COUNTER
);
2814 od
->v_len
= sizeof(u32_t
);
2816 case 13: /* ipReasmTimeout */
2817 od
->instance
= MIB_OBJECT_SCALAR
;
2818 od
->access
= MIB_OBJECT_READ_ONLY
;
2819 od
->asn_type
= (SNMP_ASN1_UNIV
| SNMP_ASN1_PRIMIT
| SNMP_ASN1_INTEG
);
2820 od
->v_len
= sizeof(s32_t
);
2823 LWIP_DEBUGF(SNMP_MIB_DEBUG
,("ip_get_object_def: no such object\n"));
2824 od
->instance
= MIB_OBJECT_NONE
;
2830 LWIP_DEBUGF(SNMP_MIB_DEBUG
,("ip_get_object_def: no scalar\n"));
2831 od
->instance
= MIB_OBJECT_NONE
;
2836 ip_get_value(struct obj_def
*od
, u16_t len
, void *value
)
2840 LWIP_UNUSED_ARG(len
);
2841 LWIP_ASSERT("invalid id", (od
->id_inst_ptr
[0] >= 0) && (od
->id_inst_ptr
[0] <= 0xff));
2842 id
= (u8_t
)od
->id_inst_ptr
[0];
2845 case 1: /* ipForwarding */
2847 s32_t
*sint_ptr
= (s32_t
*)value
;
2852 /* not-forwarding */
2857 case 2: /* ipDefaultTTL */
2859 s32_t
*sint_ptr
= (s32_t
*)value
;
2860 *sint_ptr
= IP_DEFAULT_TTL
;
2863 case 3: /* ipInReceives */
2865 u32_t
*uint_ptr
= (u32_t
*)value
;
2866 *uint_ptr
= ipinreceives
;
2869 case 4: /* ipInHdrErrors */
2871 u32_t
*uint_ptr
= (u32_t
*)value
;
2872 *uint_ptr
= ipinhdrerrors
;
2875 case 5: /* ipInAddrErrors */
2877 u32_t
*uint_ptr
= (u32_t
*)value
;
2878 *uint_ptr
= ipinaddrerrors
;
2881 case 6: /* ipForwDatagrams */
2883 u32_t
*uint_ptr
= (u32_t
*)value
;
2884 *uint_ptr
= ipforwdatagrams
;
2887 case 7: /* ipInUnknownProtos */
2889 u32_t
*uint_ptr
= (u32_t
*)value
;
2890 *uint_ptr
= ipinunknownprotos
;
2893 case 8: /* ipInDiscards */
2895 u32_t
*uint_ptr
= (u32_t
*)value
;
2896 *uint_ptr
= ipindiscards
;
2899 case 9: /* ipInDelivers */
2901 u32_t
*uint_ptr
= (u32_t
*)value
;
2902 *uint_ptr
= ipindelivers
;
2905 case 10: /* ipOutRequests */
2907 u32_t
*uint_ptr
= (u32_t
*)value
;
2908 *uint_ptr
= ipoutrequests
;
2911 case 11: /* ipOutDiscards */
2913 u32_t
*uint_ptr
= (u32_t
*)value
;
2914 *uint_ptr
= ipoutdiscards
;
2917 case 12: /* ipOutNoRoutes */
2919 u32_t
*uint_ptr
= (u32_t
*)value
;
2920 *uint_ptr
= ipoutnoroutes
;
2923 case 13: /* ipReasmTimeout */
2925 s32_t
*sint_ptr
= (s32_t
*)value
;
2927 *sint_ptr
= IP_REASS_MAXAGE
;
2933 case 14: /* ipReasmReqds */
2935 u32_t
*uint_ptr
= (u32_t
*)value
;
2936 *uint_ptr
= ipreasmreqds
;
2939 case 15: /* ipReasmOKs */
2941 u32_t
*uint_ptr
= (u32_t
*)value
;
2942 *uint_ptr
= ipreasmoks
;
2945 case 16: /* ipReasmFails */
2947 u32_t
*uint_ptr
= (u32_t
*)value
;
2948 *uint_ptr
= ipreasmfails
;
2951 case 17: /* ipFragOKs */
2953 u32_t
*uint_ptr
= (u32_t
*)value
;
2954 *uint_ptr
= ipfragoks
;
2957 case 18: /* ipFragFails */
2959 u32_t
*uint_ptr
= (u32_t
*)value
;
2960 *uint_ptr
= ipfragfails
;
2963 case 19: /* ipFragCreates */
2965 u32_t
*uint_ptr
= (u32_t
*)value
;
2966 *uint_ptr
= ipfragcreates
;
2969 case 23: /* ipRoutingDiscards */
2970 /** @todo can lwIP discard routes at all?? hardwire this to 0?? */
2972 u32_t
*uint_ptr
= (u32_t
*)value
;
2973 *uint_ptr
= iproutingdiscards
;
2980 * Test ip object value before setting.
2982 * @param od is the object definition
2983 * @param len return value space (in bytes)
2984 * @param value points to (varbind) space to copy value from.
2986 * @note we allow set if the value matches the hardwired value,
2987 * otherwise return badvalue.
2990 ip_set_test(struct obj_def
*od
, u16_t len
, void *value
)
2993 s32_t
*sint_ptr
= (s32_t
*)value
;
2995 LWIP_UNUSED_ARG(len
);
2997 LWIP_ASSERT("invalid id", (od
->id_inst_ptr
[0] >= 0) && (od
->id_inst_ptr
[0] <= 0xff));
2998 id
= (u8_t
)od
->id_inst_ptr
[0];
3001 case 1: /* ipForwarding */
3006 /* not-forwarding */
3013 case 2: /* ipDefaultTTL */
3014 if (*sint_ptr
== IP_DEFAULT_TTL
)
3024 ip_addrentry_get_object_def(u8_t ident_len
, s32_t
*ident
, struct obj_def
*od
)
3026 /* return to object name, adding index depth (4) */
3034 od
->id_inst_len
= ident_len
;
3035 od
->id_inst_ptr
= ident
;
3037 LWIP_ASSERT("invalid id", (ident
[0] >= 0) && (ident
[0] <= 0xff));
3038 id
= (u8_t
)ident
[0];
3041 case 1: /* ipAdEntAddr */
3042 case 3: /* ipAdEntNetMask */
3043 od
->instance
= MIB_OBJECT_TAB
;
3044 od
->access
= MIB_OBJECT_READ_ONLY
;
3045 od
->asn_type
= (SNMP_ASN1_APPLIC
| SNMP_ASN1_PRIMIT
| SNMP_ASN1_IPADDR
);
3048 case 2: /* ipAdEntIfIndex */
3049 case 4: /* ipAdEntBcastAddr */
3050 case 5: /* ipAdEntReasmMaxSize */
3051 od
->instance
= MIB_OBJECT_TAB
;
3052 od
->access
= MIB_OBJECT_READ_ONLY
;
3053 od
->asn_type
= (SNMP_ASN1_UNIV
| SNMP_ASN1_PRIMIT
| SNMP_ASN1_INTEG
);
3054 od
->v_len
= sizeof(s32_t
);
3057 LWIP_DEBUGF(SNMP_MIB_DEBUG
,("ip_addrentry_get_object_def: no such object\n"));
3058 od
->instance
= MIB_OBJECT_NONE
;
3064 LWIP_DEBUGF(SNMP_MIB_DEBUG
,("ip_addrentry_get_object_def: no scalar\n"));
3065 od
->instance
= MIB_OBJECT_NONE
;
3070 ip_addrentry_get_value(struct obj_def
*od
, u16_t len
, void *value
)
3075 struct netif
*netif
= netif_list
;
3077 LWIP_UNUSED_ARG(len
);
3078 snmp_oidtoip(&od
->id_inst_ptr
[1], &ip
);
3080 while ((netif
!= NULL
) && !ip_addr_cmp(&ip
, &netif
->ip_addr
))
3082 netif
= netif
->next
;
3088 LWIP_ASSERT("invalid id", (od
->id_inst_ptr
[0] >= 0) && (od
->id_inst_ptr
[0] <= 0xff));
3089 id
= (u8_t
)od
->id_inst_ptr
[0];
3092 case 1: /* ipAdEntAddr */
3094 ip_addr_t
*dst
= (ip_addr_t
*)value
;
3095 *dst
= netif
->ip_addr
;
3098 case 2: /* ipAdEntIfIndex */
3100 s32_t
*sint_ptr
= (s32_t
*)value
;
3101 *sint_ptr
= ifidx
+ 1;
3104 case 3: /* ipAdEntNetMask */
3106 ip_addr_t
*dst
= (ip_addr_t
*)value
;
3107 *dst
= netif
->netmask
;
3110 case 4: /* ipAdEntBcastAddr */
3112 s32_t
*sint_ptr
= (s32_t
*)value
;
3114 /* lwIP oddity, there's no broadcast
3115 address in the netif we can rely on */
3116 *sint_ptr
= IPADDR_BROADCAST
& 1;
3119 case 5: /* ipAdEntReasmMaxSize */
3121 s32_t
*sint_ptr
= (s32_t
*)value
;
3123 /* @todo The theoretical maximum is IP_REASS_MAX_PBUFS * size of the pbufs,
3124 * but only if receiving one fragmented packet at a time.
3125 * The current solution is to calculate for 2 simultaneous packets...
3127 *sint_ptr
= (IP_HLEN
+ ((IP_REASS_MAX_PBUFS
/2) *
3128 (PBUF_POOL_BUFSIZE
- PBUF_LINK_HLEN
- IP_HLEN
)));
3130 /** @todo returning MTU would be a bad thing and
3131 returning a wild guess like '576' isn't good either */
3142 * lwIP IP routing is currently using the network addresses in netif_list.
3143 * if no suitable network IP is found in netif_list, the default_netif is used.
3146 ip_rteentry_get_object_def(u8_t ident_len
, s32_t
*ident
, struct obj_def
*od
)
3150 /* return to object name, adding index depth (4) */
3156 od
->id_inst_len
= ident_len
;
3157 od
->id_inst_ptr
= ident
;
3159 LWIP_ASSERT("invalid id", (ident
[0] >= 0) && (ident
[0] <= 0xff));
3160 id
= (u8_t
)ident
[0];
3163 case 1: /* ipRouteDest */
3164 case 7: /* ipRouteNextHop */
3165 case 11: /* ipRouteMask */
3166 od
->instance
= MIB_OBJECT_TAB
;
3167 od
->access
= MIB_OBJECT_READ_WRITE
;
3168 od
->asn_type
= (SNMP_ASN1_APPLIC
| SNMP_ASN1_PRIMIT
| SNMP_ASN1_IPADDR
);
3171 case 2: /* ipRouteIfIndex */
3172 case 3: /* ipRouteMetric1 */
3173 case 4: /* ipRouteMetric2 */
3174 case 5: /* ipRouteMetric3 */
3175 case 6: /* ipRouteMetric4 */
3176 case 8: /* ipRouteType */
3177 case 10: /* ipRouteAge */
3178 case 12: /* ipRouteMetric5 */
3179 od
->instance
= MIB_OBJECT_TAB
;
3180 od
->access
= MIB_OBJECT_READ_WRITE
;
3181 od
->asn_type
= (SNMP_ASN1_UNIV
| SNMP_ASN1_PRIMIT
| SNMP_ASN1_INTEG
);
3182 od
->v_len
= sizeof(s32_t
);
3184 case 9: /* ipRouteProto */
3185 od
->instance
= MIB_OBJECT_TAB
;
3186 od
->access
= MIB_OBJECT_READ_ONLY
;
3187 od
->asn_type
= (SNMP_ASN1_UNIV
| SNMP_ASN1_PRIMIT
| SNMP_ASN1_INTEG
);
3188 od
->v_len
= sizeof(s32_t
);
3190 case 13: /* ipRouteInfo */
3191 /** @note returning zeroDotZero (0.0) no routing protocol specific MIB */
3192 od
->instance
= MIB_OBJECT_TAB
;
3193 od
->access
= MIB_OBJECT_READ_ONLY
;
3194 od
->asn_type
= (SNMP_ASN1_UNIV
| SNMP_ASN1_PRIMIT
| SNMP_ASN1_OBJ_ID
);
3195 od
->v_len
= iprouteinfo
.len
* sizeof(s32_t
);
3198 LWIP_DEBUGF(SNMP_MIB_DEBUG
,("ip_rteentry_get_object_def: no such object\n"));
3199 od
->instance
= MIB_OBJECT_NONE
;
3205 LWIP_DEBUGF(SNMP_MIB_DEBUG
,("ip_rteentry_get_object_def: no scalar\n"));
3206 od
->instance
= MIB_OBJECT_NONE
;
3211 ip_rteentry_get_value(struct obj_def
*od
, u16_t len
, void *value
)
3213 struct netif
*netif
;
3218 ident
= od
->id_inst_ptr
;
3219 snmp_oidtoip(&ident
[1], &dest
);
3221 if (ip_addr_isany(&dest
))
3223 /* ip_route() uses default netif for default route */
3224 netif
= netif_default
;
3228 /* not using ip_route(), need exact match! */
3230 while ((netif
!= NULL
) &&
3231 !ip_addr_netcmp(&dest
, &(netif
->ip_addr
), &(netif
->netmask
)) )
3233 netif
= netif
->next
;
3238 LWIP_ASSERT("invalid id", (ident
[0] >= 0) && (ident
[0] <= 0xff));
3239 id
= (u8_t
)ident
[0];
3242 case 1: /* ipRouteDest */
3244 ip_addr_t
*dst
= (ip_addr_t
*)value
;
3246 if (ip_addr_isany(&dest
))
3248 /* default rte has 0.0.0.0 dest */
3249 ip_addr_set_zero(dst
);
3253 /* netifs have netaddress dest */
3254 ip_addr_get_network(dst
, &netif
->ip_addr
, &netif
->netmask
);
3258 case 2: /* ipRouteIfIndex */
3260 s32_t
*sint_ptr
= (s32_t
*)value
;
3262 snmp_netiftoifindex(netif
, sint_ptr
);
3265 case 3: /* ipRouteMetric1 */
3267 s32_t
*sint_ptr
= (s32_t
*)value
;
3269 if (ip_addr_isany(&dest
))
3271 /* default rte has metric 1 */
3276 /* other rtes have metric 0 */
3281 case 4: /* ipRouteMetric2 */
3282 case 5: /* ipRouteMetric3 */
3283 case 6: /* ipRouteMetric4 */
3284 case 12: /* ipRouteMetric5 */
3286 s32_t
*sint_ptr
= (s32_t
*)value
;
3291 case 7: /* ipRouteNextHop */
3293 ip_addr_t
*dst
= (ip_addr_t
*)value
;
3295 if (ip_addr_isany(&dest
))
3297 /* default rte: gateway */
3302 /* other rtes: netif ip_addr */
3303 *dst
= netif
->ip_addr
;
3307 case 8: /* ipRouteType */
3309 s32_t
*sint_ptr
= (s32_t
*)value
;
3311 if (ip_addr_isany(&dest
))
3313 /* default rte is indirect */
3318 /* other rtes are direct */
3323 case 9: /* ipRouteProto */
3325 s32_t
*sint_ptr
= (s32_t
*)value
;
3326 /* locally defined routes */
3330 case 10: /* ipRouteAge */
3332 s32_t
*sint_ptr
= (s32_t
*)value
;
3333 /** @todo (sysuptime - timestamp last change) / 100
3334 @see snmp_insert_iprteidx_tree() */
3338 case 11: /* ipRouteMask */
3340 ip_addr_t
*dst
= (ip_addr_t
*)value
;
3342 if (ip_addr_isany(&dest
))
3344 /* default rte use 0.0.0.0 mask */
3345 ip_addr_set_zero(dst
);
3349 /* other rtes use netmask */
3350 *dst
= netif
->netmask
;
3354 case 13: /* ipRouteInfo */
3355 objectidncpy((s32_t
*)value
, (s32_t
*)iprouteinfo
.id
, (u8_t
)(len
/ sizeof(s32_t
)));
3362 ip_ntomentry_get_object_def(u8_t ident_len
, s32_t
*ident
, struct obj_def
*od
)
3364 /* return to object name, adding index depth (5) */
3372 od
->id_inst_len
= ident_len
;
3373 od
->id_inst_ptr
= ident
;
3375 LWIP_ASSERT("invalid id", (ident
[0] >= 0) && (ident
[0] <= 0xff));
3376 id
= (u8_t
)ident
[0];
3379 case 1: /* ipNetToMediaIfIndex */
3380 case 4: /* ipNetToMediaType */
3381 od
->instance
= MIB_OBJECT_TAB
;
3382 od
->access
= MIB_OBJECT_READ_WRITE
;
3383 od
->asn_type
= (SNMP_ASN1_UNIV
| SNMP_ASN1_PRIMIT
| SNMP_ASN1_INTEG
);
3384 od
->v_len
= sizeof(s32_t
);
3386 case 2: /* ipNetToMediaPhysAddress */
3387 od
->instance
= MIB_OBJECT_TAB
;
3388 od
->access
= MIB_OBJECT_READ_WRITE
;
3389 od
->asn_type
= (SNMP_ASN1_UNIV
| SNMP_ASN1_PRIMIT
| SNMP_ASN1_OC_STR
);
3390 od
->v_len
= 6; /** @todo try to use netif::hwaddr_len */
3392 case 3: /* ipNetToMediaNetAddress */
3393 od
->instance
= MIB_OBJECT_TAB
;
3394 od
->access
= MIB_OBJECT_READ_WRITE
;
3395 od
->asn_type
= (SNMP_ASN1_APPLIC
| SNMP_ASN1_PRIMIT
| SNMP_ASN1_IPADDR
);
3399 LWIP_DEBUGF(SNMP_MIB_DEBUG
,("ip_ntomentry_get_object_def: no such object\n"));
3400 od
->instance
= MIB_OBJECT_NONE
;
3406 LWIP_DEBUGF(SNMP_MIB_DEBUG
,("ip_ntomentry_get_object_def: no scalar\n"));
3407 od
->instance
= MIB_OBJECT_NONE
;
3412 ip_ntomentry_get_value(struct obj_def
*od
, u16_t len
, void *value
)
3416 struct eth_addr
* ethaddr_ret
;
3417 ip_addr_t
* ipaddr_ret
;
3418 #endif /* LWIP_ARP */
3420 struct netif
*netif
;
3422 LWIP_UNUSED_ARG(len
);
3423 LWIP_UNUSED_ARG(value
);/* if !LWIP_ARP */
3425 snmp_ifindextonetif(od
->id_inst_ptr
[1], &netif
);
3426 snmp_oidtoip(&od
->id_inst_ptr
[2], &ip
);
3428 #if LWIP_ARP /** @todo implement a netif_find_addr */
3429 if (etharp_find_addr(netif
, &ip
, ðaddr_ret
, &ipaddr_ret
) > -1)
3431 LWIP_ASSERT("invalid id", (od
->id_inst_ptr
[0] >= 0) && (od
->id_inst_ptr
[0] <= 0xff));
3432 id
= (u8_t
)od
->id_inst_ptr
[0];
3435 case 1: /* ipNetToMediaIfIndex */
3437 s32_t
*sint_ptr
= (s32_t
*)value
;
3438 *sint_ptr
= od
->id_inst_ptr
[1];
3441 case 2: /* ipNetToMediaPhysAddress */
3443 struct eth_addr
*dst
= (struct eth_addr
*)value
;
3445 *dst
= *ethaddr_ret
;
3448 case 3: /* ipNetToMediaNetAddress */
3450 ip_addr_t
*dst
= (ip_addr_t
*)value
;
3455 case 4: /* ipNetToMediaType */
3457 s32_t
*sint_ptr
= (s32_t
*)value
;
3464 #endif /* LWIP_ARP */
3468 icmp_get_object_def(u8_t ident_len
, s32_t
*ident
, struct obj_def
*od
)
3470 /* return to object name, adding index depth (1) */
3473 if ((ident_len
== 2) &&
3474 (ident
[0] > 0) && (ident
[0] < 27))
3476 od
->id_inst_len
= ident_len
;
3477 od
->id_inst_ptr
= ident
;
3479 od
->instance
= MIB_OBJECT_SCALAR
;
3480 od
->access
= MIB_OBJECT_READ_ONLY
;
3481 od
->asn_type
= (SNMP_ASN1_APPLIC
| SNMP_ASN1_PRIMIT
| SNMP_ASN1_COUNTER
);
3482 od
->v_len
= sizeof(u32_t
);
3486 LWIP_DEBUGF(SNMP_MIB_DEBUG
,("icmp_get_object_def: no scalar\n"));
3487 od
->instance
= MIB_OBJECT_NONE
;
3492 icmp_get_value(struct obj_def
*od
, u16_t len
, void *value
)
3494 u32_t
*uint_ptr
= (u32_t
*)value
;
3497 LWIP_UNUSED_ARG(len
);
3498 LWIP_ASSERT("invalid id", (od
->id_inst_ptr
[0] >= 0) && (od
->id_inst_ptr
[0] <= 0xff));
3499 id
= (u8_t
)od
->id_inst_ptr
[0];
3502 case 1: /* icmpInMsgs */
3503 *uint_ptr
= icmpinmsgs
;
3505 case 2: /* icmpInErrors */
3506 *uint_ptr
= icmpinerrors
;
3508 case 3: /* icmpInDestUnreachs */
3509 *uint_ptr
= icmpindestunreachs
;
3511 case 4: /* icmpInTimeExcds */
3512 *uint_ptr
= icmpintimeexcds
;
3514 case 5: /* icmpInParmProbs */
3515 *uint_ptr
= icmpinparmprobs
;
3517 case 6: /* icmpInSrcQuenchs */
3518 *uint_ptr
= icmpinsrcquenchs
;
3520 case 7: /* icmpInRedirects */
3521 *uint_ptr
= icmpinredirects
;
3523 case 8: /* icmpInEchos */
3524 *uint_ptr
= icmpinechos
;
3526 case 9: /* icmpInEchoReps */
3527 *uint_ptr
= icmpinechoreps
;
3529 case 10: /* icmpInTimestamps */
3530 *uint_ptr
= icmpintimestamps
;
3532 case 11: /* icmpInTimestampReps */
3533 *uint_ptr
= icmpintimestampreps
;
3535 case 12: /* icmpInAddrMasks */
3536 *uint_ptr
= icmpinaddrmasks
;
3538 case 13: /* icmpInAddrMaskReps */
3539 *uint_ptr
= icmpinaddrmaskreps
;
3541 case 14: /* icmpOutMsgs */
3542 *uint_ptr
= icmpoutmsgs
;
3544 case 15: /* icmpOutErrors */
3545 *uint_ptr
= icmpouterrors
;
3547 case 16: /* icmpOutDestUnreachs */
3548 *uint_ptr
= icmpoutdestunreachs
;
3550 case 17: /* icmpOutTimeExcds */
3551 *uint_ptr
= icmpouttimeexcds
;
3553 case 18: /* icmpOutParmProbs */
3554 *uint_ptr
= icmpoutparmprobs
;
3556 case 19: /* icmpOutSrcQuenchs */
3557 *uint_ptr
= icmpoutsrcquenchs
;
3559 case 20: /* icmpOutRedirects */
3560 *uint_ptr
= icmpoutredirects
;
3562 case 21: /* icmpOutEchos */
3563 *uint_ptr
= icmpoutechos
;
3565 case 22: /* icmpOutEchoReps */
3566 *uint_ptr
= icmpoutechoreps
;
3568 case 23: /* icmpOutTimestamps */
3569 *uint_ptr
= icmpouttimestamps
;
3571 case 24: /* icmpOutTimestampReps */
3572 *uint_ptr
= icmpouttimestampreps
;
3574 case 25: /* icmpOutAddrMasks */
3575 *uint_ptr
= icmpoutaddrmasks
;
3577 case 26: /* icmpOutAddrMaskReps */
3578 *uint_ptr
= icmpoutaddrmaskreps
;
3584 /** @todo tcp grp */
3586 tcp_get_object_def(u8_t ident_len
, s32_t
*ident
, struct obj_def
*od
)
3590 /* return to object name, adding index depth (1) */
3595 od
->id_inst_len
= ident_len
;
3596 od
->id_inst_ptr
= ident
;
3598 LWIP_ASSERT("invalid id", (ident
[0] >= 0) && (ident
[0] <= 0xff));
3599 id
= (u8_t
)ident
[0];
3600 LWIP_DEBUGF(SNMP_MIB_DEBUG
,("get_object_def tcp.%"U16_F
".0\n",(u16_t
)id
));
3604 case 1: /* tcpRtoAlgorithm */
3605 case 2: /* tcpRtoMin */
3606 case 3: /* tcpRtoMax */
3607 case 4: /* tcpMaxConn */
3608 od
->instance
= MIB_OBJECT_SCALAR
;
3609 od
->access
= MIB_OBJECT_READ_ONLY
;
3610 od
->asn_type
= (SNMP_ASN1_UNIV
| SNMP_ASN1_PRIMIT
| SNMP_ASN1_INTEG
);
3611 od
->v_len
= sizeof(s32_t
);
3613 case 5: /* tcpActiveOpens */
3614 case 6: /* tcpPassiveOpens */
3615 case 7: /* tcpAttemptFails */
3616 case 8: /* tcpEstabResets */
3617 case 10: /* tcpInSegs */
3618 case 11: /* tcpOutSegs */
3619 case 12: /* tcpRetransSegs */
3620 case 14: /* tcpInErrs */
3621 case 15: /* tcpOutRsts */
3622 od
->instance
= MIB_OBJECT_SCALAR
;
3623 od
->access
= MIB_OBJECT_READ_ONLY
;
3624 od
->asn_type
= (SNMP_ASN1_APPLIC
| SNMP_ASN1_PRIMIT
| SNMP_ASN1_COUNTER
);
3625 od
->v_len
= sizeof(u32_t
);
3627 case 9: /* tcpCurrEstab */
3628 od
->instance
= MIB_OBJECT_TAB
;
3629 od
->access
= MIB_OBJECT_READ_ONLY
;
3630 od
->asn_type
= (SNMP_ASN1_APPLIC
| SNMP_ASN1_PRIMIT
| SNMP_ASN1_GAUGE
);
3631 od
->v_len
= sizeof(u32_t
);
3634 LWIP_DEBUGF(SNMP_MIB_DEBUG
,("tcp_get_object_def: no such object\n"));
3635 od
->instance
= MIB_OBJECT_NONE
;
3641 LWIP_DEBUGF(SNMP_MIB_DEBUG
,("tcp_get_object_def: no scalar\n"));
3642 od
->instance
= MIB_OBJECT_NONE
;
3647 tcp_get_value(struct obj_def
*od
, u16_t len
, void *value
)
3649 u32_t
*uint_ptr
= (u32_t
*)value
;
3650 s32_t
*sint_ptr
= (s32_t
*)value
;
3653 LWIP_UNUSED_ARG(len
);
3654 LWIP_ASSERT("invalid id", (od
->id_inst_ptr
[0] >= 0) && (od
->id_inst_ptr
[0] <= 0xff));
3655 id
= (u8_t
)od
->id_inst_ptr
[0];
3658 case 1: /* tcpRtoAlgorithm, vanj(4) */
3661 case 2: /* tcpRtoMin */
3662 /* @todo not the actual value, a guess,
3663 needs to be calculated */
3666 case 3: /* tcpRtoMax */
3667 /* @todo not the actual value, a guess,
3668 needs to be calculated */
3671 case 4: /* tcpMaxConn */
3672 *sint_ptr
= MEMP_NUM_TCP_PCB
;
3674 case 5: /* tcpActiveOpens */
3675 *uint_ptr
= tcpactiveopens
;
3677 case 6: /* tcpPassiveOpens */
3678 *uint_ptr
= tcppassiveopens
;
3680 case 7: /* tcpAttemptFails */
3681 *uint_ptr
= tcpattemptfails
;
3683 case 8: /* tcpEstabResets */
3684 *uint_ptr
= tcpestabresets
;
3686 case 9: /* tcpCurrEstab */
3688 u16_t tcpcurrestab
= 0;
3689 struct tcp_pcb
*pcb
= tcp_active_pcbs
;
3692 if ((pcb
->state
== ESTABLISHED
) ||
3693 (pcb
->state
== CLOSE_WAIT
))
3699 *uint_ptr
= tcpcurrestab
;
3702 case 10: /* tcpInSegs */
3703 *uint_ptr
= tcpinsegs
;
3705 case 11: /* tcpOutSegs */
3706 *uint_ptr
= tcpoutsegs
;
3708 case 12: /* tcpRetransSegs */
3709 *uint_ptr
= tcpretranssegs
;
3711 case 14: /* tcpInErrs */
3712 *uint_ptr
= tcpinerrs
;
3714 case 15: /* tcpOutRsts */
3715 *uint_ptr
= tcpoutrsts
;
3719 #ifdef THIS_SEEMS_UNUSED
3721 tcpconnentry_get_object_def(u8_t ident_len
, s32_t
*ident
, struct obj_def
*od
)
3723 /* return to object name, adding index depth (10) */
3727 if (ident_len
== 11)
3731 od
->id_inst_len
= ident_len
;
3732 od
->id_inst_ptr
= ident
;
3735 LWIP_DEBUGF(SNMP_MIB_DEBUG
,("get_object_def tcp.%"U16_F
".0\n",(u16_t
)id
));
3739 case 1: /* tcpConnState */
3740 od
->instance
= MIB_OBJECT_TAB
;
3741 od
->access
= MIB_OBJECT_READ_WRITE
;
3742 od
->asn_type
= (SNMP_ASN1_UNIV
| SNMP_ASN1_PRIMIT
| SNMP_ASN1_INTEG
);
3743 od
->v_len
= sizeof(s32_t
);
3745 case 2: /* tcpConnLocalAddress */
3746 case 4: /* tcpConnRemAddress */
3747 od
->instance
= MIB_OBJECT_TAB
;
3748 od
->access
= MIB_OBJECT_READ_ONLY
;
3749 od
->asn_type
= (SNMP_ASN1_APPLIC
| SNMP_ASN1_PRIMIT
| SNMP_ASN1_IPADDR
);
3752 case 3: /* tcpConnLocalPort */
3753 case 5: /* tcpConnRemPort */
3754 od
->instance
= MIB_OBJECT_TAB
;
3755 od
->access
= MIB_OBJECT_READ_ONLY
;
3756 od
->asn_type
= (SNMP_ASN1_UNIV
| SNMP_ASN1_PRIMIT
| SNMP_ASN1_INTEG
);
3757 od
->v_len
= sizeof(s32_t
);
3760 LWIP_DEBUGF(SNMP_MIB_DEBUG
,("tcpconnentry_get_object_def: no such object\n"));
3761 od
->instance
= MIB_OBJECT_NONE
;
3767 LWIP_DEBUGF(SNMP_MIB_DEBUG
,("tcpconnentry_get_object_def: no such object\n"));
3768 od
->instance
= MIB_OBJECT_NONE
;
3773 tcpconnentry_get_value(struct obj_def
*od
, u16_t len
, void *value
)
3779 ident
= od
->id_inst_ptr
;
3780 snmp_oidtoip(&ident
[1], &lip
);
3782 snmp_oidtoip(&ident
[6], &rip
);
3785 /** @todo find matching PCB */
3791 udp_get_object_def(u8_t ident_len
, s32_t
*ident
, struct obj_def
*od
)
3793 /* return to object name, adding index depth (1) */
3796 if ((ident_len
== 2) &&
3797 (ident
[0] > 0) && (ident
[0] < 6))
3799 od
->id_inst_len
= ident_len
;
3800 od
->id_inst_ptr
= ident
;
3802 od
->instance
= MIB_OBJECT_SCALAR
;
3803 od
->access
= MIB_OBJECT_READ_ONLY
;
3804 od
->asn_type
= (SNMP_ASN1_APPLIC
| SNMP_ASN1_PRIMIT
| SNMP_ASN1_COUNTER
);
3805 od
->v_len
= sizeof(u32_t
);
3809 LWIP_DEBUGF(SNMP_MIB_DEBUG
,("udp_get_object_def: no scalar\n"));
3810 od
->instance
= MIB_OBJECT_NONE
;
3815 udp_get_value(struct obj_def
*od
, u16_t len
, void *value
)
3817 u32_t
*uint_ptr
= (u32_t
*)value
;
3820 LWIP_UNUSED_ARG(len
);
3821 LWIP_ASSERT("invalid id", (od
->id_inst_ptr
[0] >= 0) && (od
->id_inst_ptr
[0] <= 0xff));
3822 id
= (u8_t
)od
->id_inst_ptr
[0];
3825 case 1: /* udpInDatagrams */
3826 *uint_ptr
= udpindatagrams
;
3828 case 2: /* udpNoPorts */
3829 *uint_ptr
= udpnoports
;
3831 case 3: /* udpInErrors */
3832 *uint_ptr
= udpinerrors
;
3834 case 4: /* udpOutDatagrams */
3835 *uint_ptr
= udpoutdatagrams
;
3841 udpentry_get_object_def(u8_t ident_len
, s32_t
*ident
, struct obj_def
*od
)
3843 /* return to object name, adding index depth (5) */
3849 od
->id_inst_len
= ident_len
;
3850 od
->id_inst_ptr
= ident
;
3854 case 1: /* udpLocalAddress */
3855 od
->instance
= MIB_OBJECT_TAB
;
3856 od
->access
= MIB_OBJECT_READ_ONLY
;
3857 od
->asn_type
= (SNMP_ASN1_APPLIC
| SNMP_ASN1_PRIMIT
| SNMP_ASN1_IPADDR
);
3860 case 2: /* udpLocalPort */
3861 od
->instance
= MIB_OBJECT_TAB
;
3862 od
->access
= MIB_OBJECT_READ_ONLY
;
3863 od
->asn_type
= (SNMP_ASN1_UNIV
| SNMP_ASN1_PRIMIT
| SNMP_ASN1_INTEG
);
3864 od
->v_len
= sizeof(s32_t
);
3867 LWIP_DEBUGF(SNMP_MIB_DEBUG
,("udpentry_get_object_def: no such object\n"));
3868 od
->instance
= MIB_OBJECT_NONE
;
3874 LWIP_DEBUGF(SNMP_MIB_DEBUG
,("udpentry_get_object_def: no scalar\n"));
3875 od
->instance
= MIB_OBJECT_NONE
;
3880 udpentry_get_value(struct obj_def
*od
, u16_t len
, void *value
)
3883 struct udp_pcb
*pcb
;
3887 LWIP_UNUSED_ARG(len
);
3888 snmp_oidtoip(&od
->id_inst_ptr
[1], &ip
);
3889 LWIP_ASSERT("invalid port", (od
->id_inst_ptr
[5] >= 0) && (od
->id_inst_ptr
[5] <= 0xffff));
3890 port
= (u16_t
)od
->id_inst_ptr
[5];
3893 while ((pcb
!= NULL
) &&
3894 !(ip_addr_cmp(&pcb
->local_ip
, &ip
) &&
3895 (pcb
->local_port
== port
)))
3902 LWIP_ASSERT("invalid id", (od
->id_inst_ptr
[0] >= 0) && (od
->id_inst_ptr
[0] <= 0xff));
3903 id
= (u8_t
)od
->id_inst_ptr
[0];
3906 case 1: /* udpLocalAddress */
3908 ip_addr_t
*dst
= (ip_addr_t
*)value
;
3909 *dst
= pcb
->local_ip
;
3912 case 2: /* udpLocalPort */
3914 s32_t
*sint_ptr
= (s32_t
*)value
;
3915 *sint_ptr
= pcb
->local_port
;
3923 snmp_get_object_def(u8_t ident_len
, s32_t
*ident
, struct obj_def
*od
)
3925 /* return to object name, adding index depth (1) */
3932 od
->id_inst_len
= ident_len
;
3933 od
->id_inst_ptr
= ident
;
3935 LWIP_ASSERT("invalid id", (ident
[0] >= 0) && (ident
[0] <= 0xff));
3936 id
= (u8_t
)ident
[0];
3939 case 1: /* snmpInPkts */
3940 case 2: /* snmpOutPkts */
3941 case 3: /* snmpInBadVersions */
3942 case 4: /* snmpInBadCommunityNames */
3943 case 5: /* snmpInBadCommunityUses */
3944 case 6: /* snmpInASNParseErrs */
3945 case 8: /* snmpInTooBigs */
3946 case 9: /* snmpInNoSuchNames */
3947 case 10: /* snmpInBadValues */
3948 case 11: /* snmpInReadOnlys */
3949 case 12: /* snmpInGenErrs */
3950 case 13: /* snmpInTotalReqVars */
3951 case 14: /* snmpInTotalSetVars */
3952 case 15: /* snmpInGetRequests */
3953 case 16: /* snmpInGetNexts */
3954 case 17: /* snmpInSetRequests */
3955 case 18: /* snmpInGetResponses */
3956 case 19: /* snmpInTraps */
3957 case 20: /* snmpOutTooBigs */
3958 case 21: /* snmpOutNoSuchNames */
3959 case 22: /* snmpOutBadValues */
3960 case 24: /* snmpOutGenErrs */
3961 case 25: /* snmpOutGetRequests */
3962 case 26: /* snmpOutGetNexts */
3963 case 27: /* snmpOutSetRequests */
3964 case 28: /* snmpOutGetResponses */
3965 case 29: /* snmpOutTraps */
3966 od
->instance
= MIB_OBJECT_SCALAR
;
3967 od
->access
= MIB_OBJECT_READ_ONLY
;
3968 od
->asn_type
= (SNMP_ASN1_APPLIC
| SNMP_ASN1_PRIMIT
| SNMP_ASN1_COUNTER
);
3969 od
->v_len
= sizeof(u32_t
);
3971 case 30: /* snmpEnableAuthenTraps */
3972 od
->instance
= MIB_OBJECT_SCALAR
;
3973 od
->access
= MIB_OBJECT_READ_WRITE
;
3974 od
->asn_type
= (SNMP_ASN1_UNIV
| SNMP_ASN1_PRIMIT
| SNMP_ASN1_INTEG
);
3975 od
->v_len
= sizeof(s32_t
);
3978 LWIP_DEBUGF(SNMP_MIB_DEBUG
,("snmp_get_object_def: no such object\n"));
3979 od
->instance
= MIB_OBJECT_NONE
;
3985 LWIP_DEBUGF(SNMP_MIB_DEBUG
,("snmp_get_object_def: no scalar\n"));
3986 od
->instance
= MIB_OBJECT_NONE
;
3991 snmp_get_value(struct obj_def
*od
, u16_t len
, void *value
)
3993 u32_t
*uint_ptr
= (u32_t
*)value
;
3996 LWIP_UNUSED_ARG(len
);
3997 LWIP_ASSERT("invalid id", (od
->id_inst_ptr
[0] >= 0) && (od
->id_inst_ptr
[0] <= 0xff));
3998 id
= (u8_t
)od
->id_inst_ptr
[0];
4001 case 1: /* snmpInPkts */
4002 *uint_ptr
= snmpinpkts
;
4004 case 2: /* snmpOutPkts */
4005 *uint_ptr
= snmpoutpkts
;
4007 case 3: /* snmpInBadVersions */
4008 *uint_ptr
= snmpinbadversions
;
4010 case 4: /* snmpInBadCommunityNames */
4011 *uint_ptr
= snmpinbadcommunitynames
;
4013 case 5: /* snmpInBadCommunityUses */
4014 *uint_ptr
= snmpinbadcommunityuses
;
4016 case 6: /* snmpInASNParseErrs */
4017 *uint_ptr
= snmpinasnparseerrs
;
4019 case 8: /* snmpInTooBigs */
4020 *uint_ptr
= snmpintoobigs
;
4022 case 9: /* snmpInNoSuchNames */
4023 *uint_ptr
= snmpinnosuchnames
;
4025 case 10: /* snmpInBadValues */
4026 *uint_ptr
= snmpinbadvalues
;
4028 case 11: /* snmpInReadOnlys */
4029 *uint_ptr
= snmpinreadonlys
;
4031 case 12: /* snmpInGenErrs */
4032 *uint_ptr
= snmpingenerrs
;
4034 case 13: /* snmpInTotalReqVars */
4035 *uint_ptr
= snmpintotalreqvars
;
4037 case 14: /* snmpInTotalSetVars */
4038 *uint_ptr
= snmpintotalsetvars
;
4040 case 15: /* snmpInGetRequests */
4041 *uint_ptr
= snmpingetrequests
;
4043 case 16: /* snmpInGetNexts */
4044 *uint_ptr
= snmpingetnexts
;
4046 case 17: /* snmpInSetRequests */
4047 *uint_ptr
= snmpinsetrequests
;
4049 case 18: /* snmpInGetResponses */
4050 *uint_ptr
= snmpingetresponses
;
4052 case 19: /* snmpInTraps */
4053 *uint_ptr
= snmpintraps
;
4055 case 20: /* snmpOutTooBigs */
4056 *uint_ptr
= snmpouttoobigs
;
4058 case 21: /* snmpOutNoSuchNames */
4059 *uint_ptr
= snmpoutnosuchnames
;
4061 case 22: /* snmpOutBadValues */
4062 *uint_ptr
= snmpoutbadvalues
;
4064 case 24: /* snmpOutGenErrs */
4065 *uint_ptr
= snmpoutgenerrs
;
4067 case 25: /* snmpOutGetRequests */
4068 *uint_ptr
= snmpoutgetrequests
;
4070 case 26: /* snmpOutGetNexts */
4071 *uint_ptr
= snmpoutgetnexts
;
4073 case 27: /* snmpOutSetRequests */
4074 *uint_ptr
= snmpoutsetrequests
;
4076 case 28: /* snmpOutGetResponses */
4077 *uint_ptr
= snmpoutgetresponses
;
4079 case 29: /* snmpOutTraps */
4080 *uint_ptr
= snmpouttraps
;
4082 case 30: /* snmpEnableAuthenTraps */
4083 *uint_ptr
= *snmpenableauthentraps_ptr
;
4089 * Test snmp object value before setting.
4091 * @param od is the object definition
4092 * @param len return value space (in bytes)
4093 * @param value points to (varbind) space to copy value from.
4096 snmp_set_test(struct obj_def
*od
, u16_t len
, void *value
)
4100 LWIP_UNUSED_ARG(len
);
4102 LWIP_ASSERT("invalid id", (od
->id_inst_ptr
[0] >= 0) && (od
->id_inst_ptr
[0] <= 0xff));
4103 id
= (u8_t
)od
->id_inst_ptr
[0];
4106 /* snmpEnableAuthenTraps */
4107 s32_t
*sint_ptr
= (s32_t
*)value
;
4109 if (snmpenableauthentraps_ptr
!= &snmpenableauthentraps_default
)
4111 /* we should have writable non-volatile mem here */
4112 if ((*sint_ptr
== 1) || (*sint_ptr
== 2))
4119 /* const or hardwired value */
4120 if (*sint_ptr
== snmpenableauthentraps_default
)
4130 snmp_set_value(struct obj_def
*od
, u16_t len
, void *value
)
4134 LWIP_UNUSED_ARG(len
);
4135 LWIP_ASSERT("invalid id", (od
->id_inst_ptr
[0] >= 0) && (od
->id_inst_ptr
[0] <= 0xff));
4136 id
= (u8_t
)od
->id_inst_ptr
[0];
4139 /* snmpEnableAuthenTraps */
4140 /* @todo @fixme: which kind of pointer is 'value'? s32_t or u8_t??? */
4141 u8_t
*ptr
= (u8_t
*)value
;
4142 *snmpenableauthentraps_ptr
= *ptr
;
4146 #endif /* LWIP_SNMP */