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);
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);
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,
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,
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,
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,
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,
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,
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,
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,
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,
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,
556 struct mib_node* mib2_at_node = (
struct mib_node*)&attable;
557 struct mib_ram_array_node at = {
558 &noleafs_get_object_def,
569 struct mib_list_rootnode iflist_root = {
570 &ifentry_get_object_def,
572 #if 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,
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,
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
666 const struct mib_array_node sys_tem = {
667 &noleafs_get_object_def,
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,
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,
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,
766 static struct snmp_obj_id sysobjid = {SNMP_SYSOBJID_LEN, SNMP_SYSOBJID};
768 static struct snmp_obj_id snmpgrp_id = {7,{1,3,6,1,2,1,11}};
770 static const s32_t sysservices = SNMP_SYSSERVICES;
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];
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];
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];
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];
793 static const u8_t snmpenableauthentraps_default = 2;
794 static u8_t* snmpenableauthentraps_ptr = (
u8_t*)&snmpenableauthentraps_default;
797 static const struct snmp_obj_id ifspecific = {2, {0, 0}};
799 static const struct snmp_obj_id iprouteinfo = {2, {0, 0}};
804 static u32_t sysuptime = 0;
807 static u32_t ipinreceives = 0,
811 ipinunknownprotos = 0,
823 iproutingdiscards = 0;
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;
852 static u32_t tcpactiveopens = 0,
862 static u32_t udpindatagrams = 0,
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,
941 sysdescr_len_ptr = len;
976 SNMP_GET_SYSUPTIME(sysuptime);
991 syscontact_ptr = ocstr;
992 syscontact_len_ptr = ocstrlen;
1007 sysname_ptr = ocstr;
1008 sysname_len_ptr = ocstrlen;
1023 syslocation_ptr = ocstr;
1024 syslocation_len_ptr = ocstrlen;
1031 ni->ifinoctets += value;
1036 (ni->ifinucastpkts)++;
1041 (ni->ifinnucastpkts)++;
1046 (ni->ifindiscards)++;
1051 ni->ifoutoctets += value;
1056 (ni->ifoutucastpkts)++;
1061 (ni->ifoutnucastpkts)++;
1066 (ni->ifoutdiscards)++;
1071 struct mib_list_node *if_node =
NULL;
1073 snmp_mib_node_insert(&iflist_root, iflist_root.count + 1, &if_node);
1075 iftable.maxlength = 1;
1080 snmp_mib_node_delete(&iflist_root, iflist_root.tail);
1082 if(iflist_root.count == 0) iftable.maxlength = 0;
1091 struct mib_list_rootnode *at_rn;
1092 struct mib_list_node *at_node;
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;
1147 at_rn = (
struct mib_list_rootnode*)at_node->nptr;
1154 ipntomtable.maxlength = 1;
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++)
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);
1195 del_rn[del_cnt] = at_rn;
1196 del_n[del_cnt] = at_n;
1198 at_rn = (
struct mib_list_rootnode*)(at_n->nptr);
1204 at_rn = (
struct mib_list_rootnode*)(at_n->nptr);
1213 at_rn = del_rn[del_cnt];
1214 at_n = del_n[del_cnt];
1216 next = snmp_mib_node_delete(at_rn, at_n);
1220 snmp_mib_lrn_free(next);
1225 if(arptree_root.count == 0) at.maxlength = 0;
1226 if(ipntomtree_root.count == 0) ipntomtable.maxlength = 0;
1251 ipinunknownprotos++;
1311 iproutingdiscards++;
1320 struct mib_list_rootnode *ipa_rn;
1321 struct mib_list_node *ipa_node;
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;
1359 ipa_rn = (
struct mib_list_rootnode*)ipa_node->nptr;
1365 ipaddrtable.maxlength = 1;
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;
1380 snmp_iptooid(&ni->
ip_addr, &ipaddridx[0]);
1385 ipa_rn = &ipaddrtree_root;
1386 while ((level < 4) && (ipa_rn !=
NULL))
1388 fc = snmp_mib_node_find(ipa_rn, ipaddridx[level], &ipa_n);
1397 del_rn[del_cnt] = ipa_rn;
1398 del_n[del_cnt] = ipa_n;
1400 ipa_rn = (
struct mib_list_rootnode*)(ipa_n->nptr);
1406 ipa_rn = (
struct mib_list_rootnode*)(ipa_n->nptr);
1415 ipa_rn = del_rn[del_cnt];
1416 ipa_n = del_n[del_cnt];
1418 next = snmp_mib_node_delete(ipa_rn, ipa_n);
1422 snmp_mib_lrn_free(next);
1426 if (ipaddrtree_root.count == 0) ipaddrtable.maxlength = 0;
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;
1498 iprte_rn = (
struct mib_list_rootnode*)iprte_node->nptr;
1505 iprtetable.maxlength = 1;
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]);
1547 iprte_rn = &iprtetree_root;
1548 while ((level < 4) && (iprte_rn !=
NULL))
1550 fc = snmp_mib_node_find(iprte_rn, iprteidx[level], &iprte_n);
1559 del_rn[del_cnt] = iprte_rn;
1560 del_n[del_cnt] = iprte_n;
1562 iprte_rn = (
struct mib_list_rootnode*)(iprte_n->nptr);
1568 iprte_rn = (
struct mib_list_rootnode*)(iprte_n->nptr);
1577 iprte_rn = del_rn[del_cnt];
1578 iprte_n = del_n[del_cnt];
1580 next = snmp_mib_node_delete(iprte_rn, iprte_n);
1584 snmp_mib_lrn_free(next);
1589 if (iprtetree_root.count == 0) iprtetable.maxlength = 0;
1605 icmpindestunreachs++;
1645 icmpintimestampreps++;
1655 icmpinaddrmaskreps++;
1670 icmpoutdestunreachs++;
1685 icmpoutsrcquenchs++;
1705 icmpouttimestamps++;
1710 icmpouttimestampreps++;
1720 icmpoutaddrmaskreps++;
1794 struct mib_list_rootnode *udp_rn;
1795 struct mib_list_node *udp_node;
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;
1833 udp_rn = (
struct mib_list_rootnode*)udp_node->nptr;
1837 udptable.maxlength = 1;
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;
1853 snmp_iptooid(&pcb->local_ip, &udpidx[0]);
1854 udpidx[4] = pcb->local_port;
1860 while ((npcb !=
NULL))
1862 if (
ip_addr_cmp(&npcb->local_ip, &pcb->local_ip) &&
1863 (npcb->local_port == udpidx[4]))
1876 while ((level < 5) && (udp_rn !=
NULL))
1878 fc = snmp_mib_node_find(udp_rn, udpidx[level], &udp_n);
1887 del_rn[del_cnt] = udp_rn;
1888 del_n[del_cnt] = udp_n;
1890 udp_rn = (
struct mib_list_rootnode*)(udp_n->nptr);
1896 udp_rn = (
struct mib_list_rootnode*)(udp_n->nptr);
1905 udp_rn = del_rn[del_cnt];
1906 udp_n = del_n[del_cnt];
1908 next = snmp_mib_node_delete(udp_rn, udp_n);
1912 snmp_mib_lrn_free(next);
1917 if (udp_root.count == 0) udptable.maxlength = 0;
1933 snmpinbadversions++;
1938 snmpinbadcommunitynames++;
1943 snmpinbadcommunityuses++;
1948 snmpinasnparseerrs++;
1958 snmpinnosuchnames++;
1978 snmpintotalreqvars += value;
1983 snmpintotalsetvars += value;
1988 snmpingetrequests++;
1998 snmpinsetrequests++;
2003 snmpingetresponses++;
2018 snmpoutnosuchnames++;
2033 snmpoutgetrequests++;
2043 snmpoutsetrequests++;
2048 snmpoutgetresponses++;
2065 snmpenableauthentraps_ptr = value;
2071 *value = *snmpenableauthentraps_ptr;
2075 noleafs_get_object_def(
u8_t ident_len,
s32_t *ident,
struct obj_def *od)
2079 od->instance = MIB_OBJECT_NONE;
2083 noleafs_get_value(
struct obj_def *od,
u16_t len,
void *value)
2091 noleafs_set_test(
struct obj_def *od,
u16_t len,
void *value)
2101 noleafs_set_value(
struct obj_def *od,
u16_t len,
void *value)
2117 system_get_object_def(
u8_t ident_len,
s32_t *ident,
struct obj_def *od)
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];
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;
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);
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);
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;
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;
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;
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);
2178 od->instance = MIB_OBJECT_NONE;
2185 od->instance = MIB_OBJECT_NONE;
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];
2207 ocstrncpy((
u8_t*)value, sysdescr_ptr, len);
2218 ocstrncpy((
u8_t*)value, syscontact_ptr, len);
2221 ocstrncpy((
u8_t*)value, sysname_ptr, len);
2224 ocstrncpy((
u8_t*)value, syslocation_ptr, len);
2229 *sint_ptr = sysservices;
2236 system_set_test(
struct obj_def *od,
u16_t len,
void *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];
2247 if ((syscontact_ptr != syscontact_default) &&
2254 if ((sysname_ptr != sysname_default) &&
2261 if ((syslocation_ptr != syslocation_default) &&
2272 system_set_value(
struct obj_def *od,
u16_t len,
void *value)
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];
2282 ocstrncpy(syscontact_ptr, (
u8_t*)value, len);
2283 *syscontact_len_ptr = (
u8_t)len;
2286 ocstrncpy(sysname_ptr, (
u8_t*)value, len);
2287 *sysname_len_ptr = (
u8_t)len;
2290 ocstrncpy(syslocation_ptr, (
u8_t*)value, len);
2291 *syslocation_len_ptr = (
u8_t)len;
2304 interfaces_get_object_def(
u8_t ident_len,
s32_t *ident,
struct obj_def *od)
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);
2322 od->instance = MIB_OBJECT_NONE;
2335 interfaces_get_value(
struct obj_def *od,
u16_t len,
void *value)
2338 if (od->id_inst_ptr[0] == 1)
2341 *sint_ptr = iflist_root.count;
2353 ifentry_get_object_def(
u8_t ident_len,
s32_t *ident,
struct obj_def *od)
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];
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);
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);
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);
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);
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);
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);
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);
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);
2441 od->instance = MIB_OBJECT_NONE;
2448 od->instance = MIB_OBJECT_NONE;
2461 ifentry_get_value(
struct obj_def *od,
u16_t len,
void *value)
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];
2474 *sint_ptr = od->id_inst_ptr[1];
2483 *sint_ptr = netif->link_type;
2489 *sint_ptr = netif->
mtu;
2495 *uint_ptr = netif->link_speed;
2537 *uint_ptr = netif->ts;
2543 *uint_ptr = netif->ifinoctets;
2549 *uint_ptr = netif->ifinucastpkts;
2555 *uint_ptr = netif->ifinnucastpkts;
2561 *uint_ptr = netif->ifindiscards;
2575 *uint_ptr = netif->ifoutoctets;
2581 *uint_ptr = netif->ifoutucastpkts;
2587 *uint_ptr = netif->ifoutnucastpkts;
2593 *uint_ptr = netif->ifoutdiscards;
2616 #if !SNMP_SAFE_REQUESTS
2618 ifentry_set_test(
struct obj_def *od,
u16_t len,
void *value)
2620 struct netif *netif;
2625 snmp_ifindextonetif(od->id_inst_ptr[1], &netif);
2626 id = (
u8_t)od->id_inst_ptr[0];
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;
2647 snmp_ifindextonetif(od->id_inst_ptr[1], &netif);
2648 id = (
u8_t)od->id_inst_ptr[0];
2658 else if (*sint_ptr == 2)
2676 atentry_get_object_def(
u8_t ident_len,
s32_t *ident,
struct obj_def *od)
2684 od->id_inst_len = ident_len;
2685 od->id_inst_ptr = ident;
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);
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);
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);
2709 od->instance = MIB_OBJECT_NONE;
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;
2729 struct netif *netif;
2734 snmp_ifindextonetif(od->id_inst_ptr[1], &netif);
2735 snmp_oidtoip(&od->id_inst_ptr[2], &ip);
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];
2747 *sint_ptr = od->id_inst_ptr[1];
2752 struct eth_addr *dst = (
struct eth_addr*)value;
2754 *dst = *ethaddr_ret;
2770 ip_get_object_def(
u8_t ident_len,
s32_t *ident,
struct obj_def *od)
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];
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);
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);
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);
2824 od->instance = MIB_OBJECT_NONE;
2831 od->instance = MIB_OBJECT_NONE;
2836 ip_get_value(
struct obj_def *od,
u16_t len,
void *value)
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];
2866 *uint_ptr = ipinreceives;
2872 *uint_ptr = ipinhdrerrors;
2878 *uint_ptr = ipinaddrerrors;
2884 *uint_ptr = ipforwdatagrams;
2890 *uint_ptr = ipinunknownprotos;
2896 *uint_ptr = ipindiscards;
2902 *uint_ptr = ipindelivers;
2908 *uint_ptr = ipoutrequests;
2914 *uint_ptr = ipoutdiscards;
2920 *uint_ptr = ipoutnoroutes;
2936 *uint_ptr = ipreasmreqds;
2942 *uint_ptr = ipreasmoks;
2948 *uint_ptr = ipreasmfails;
2954 *uint_ptr = ipfragoks;
2960 *uint_ptr = ipfragfails;
2966 *uint_ptr = ipfragcreates;
2973 *uint_ptr = iproutingdiscards;
2990 ip_set_test(
struct obj_def *od,
u16_t len,
void *value)
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];
3024 ip_addrentry_get_object_def(
u8_t ident_len,
s32_t *ident,
struct obj_def *od)
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];
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);
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);
3058 od->instance = MIB_OBJECT_NONE;
3065 od->instance = MIB_OBJECT_NONE;
3070 ip_addrentry_get_value(
struct obj_def *od,
u16_t len,
void *value)
3078 snmp_oidtoip(&od->id_inst_ptr[1], &ip);
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];
3101 *sint_ptr = ifidx + 1;
3146 ip_rteentry_get_object_def(
u8_t ident_len,
s32_t *ident,
struct obj_def *od)
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];
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);
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);
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);
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);
3199 od->instance = MIB_OBJECT_NONE;
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);
3230 while ((netif !=
NULL) &&
3233 netif = netif->
next;
3238 LWIP_ASSERT(
"invalid id", (ident[0] >= 0) && (ident[0] <= 0xff));
3239 id = (
u8_t)ident[0];
3262 snmp_netiftoifindex(netif, sint_ptr);
3362 ip_ntomentry_get_object_def(
u8_t ident_len,
s32_t *ident,
struct obj_def *od)
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];
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);
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);
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);
3400 od->instance = MIB_OBJECT_NONE;
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;
3420 struct netif *netif;
3425 snmp_ifindextonetif(od->id_inst_ptr[1], &netif);
3426 snmp_oidtoip(&od->id_inst_ptr[2], &ip);
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];
3438 *sint_ptr = od->id_inst_ptr[1];
3443 struct eth_addr *dst = (
struct eth_addr*)value;
3445 *dst = *ethaddr_ret;
3468 icmp_get_object_def(
u8_t ident_len,
s32_t *ident,
struct obj_def *od)
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);
3487 od->instance = MIB_OBJECT_NONE;
3492 icmp_get_value(
struct obj_def *od,
u16_t len,
void *value)
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];
3503 *uint_ptr = icmpinmsgs;
3506 *uint_ptr = icmpinerrors;
3509 *uint_ptr = icmpindestunreachs;
3512 *uint_ptr = icmpintimeexcds;
3515 *uint_ptr = icmpinparmprobs;
3518 *uint_ptr = icmpinsrcquenchs;
3521 *uint_ptr = icmpinredirects;
3524 *uint_ptr = icmpinechos;
3527 *uint_ptr = icmpinechoreps;
3530 *uint_ptr = icmpintimestamps;
3533 *uint_ptr = icmpintimestampreps;
3536 *uint_ptr = icmpinaddrmasks;
3539 *uint_ptr = icmpinaddrmaskreps;
3542 *uint_ptr = icmpoutmsgs;
3545 *uint_ptr = icmpouterrors;
3548 *uint_ptr = icmpoutdestunreachs;
3551 *uint_ptr = icmpouttimeexcds;
3554 *uint_ptr = icmpoutparmprobs;
3557 *uint_ptr = icmpoutsrcquenchs;
3560 *uint_ptr = icmpoutredirects;
3563 *uint_ptr = icmpoutechos;
3566 *uint_ptr = icmpoutechoreps;
3569 *uint_ptr = icmpouttimestamps;
3572 *uint_ptr = icmpouttimestampreps;
3575 *uint_ptr = icmpoutaddrmasks;
3578 *uint_ptr = icmpoutaddrmaskreps;
3586 tcp_get_object_def(
u8_t ident_len,
s32_t *ident,
struct obj_def *od)
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];
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);
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);
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);
3635 od->instance = MIB_OBJECT_NONE;
3642 od->instance = MIB_OBJECT_NONE;
3647 tcp_get_value(
struct obj_def *od,
u16_t len,
void *value)
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];
3675 *uint_ptr = tcpactiveopens;
3678 *uint_ptr = tcppassiveopens;
3681 *uint_ptr = tcpattemptfails;
3684 *uint_ptr = tcpestabresets;
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;
3703 *uint_ptr = tcpinsegs;
3706 *uint_ptr = tcpoutsegs;
3709 *uint_ptr = tcpretranssegs;
3712 *uint_ptr = tcpinerrs;
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)
3727 if (ident_len == 11)
3731 od->id_inst_len = ident_len;
3732 od->id_inst_ptr = ident;
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);
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);
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);
3761 od->instance = MIB_OBJECT_NONE;
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);
3791 udp_get_object_def(
u8_t ident_len,
s32_t *ident,
struct obj_def *od)
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);
3810 od->instance = MIB_OBJECT_NONE;
3815 udp_get_value(
struct obj_def *od,
u16_t len,
void *value)
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];
3826 *uint_ptr = udpindatagrams;
3829 *uint_ptr = udpnoports;
3832 *uint_ptr = udpinerrors;
3835 *uint_ptr = udpoutdatagrams;
3841 udpentry_get_object_def(
u8_t ident_len,
s32_t *ident,
struct obj_def *od)
3849 od->id_inst_len = ident_len;
3850 od->id_inst_ptr = ident;
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);
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);
3868 od->instance = MIB_OBJECT_NONE;
3875 od->instance = MIB_OBJECT_NONE;
3880 udpentry_get_value(
struct obj_def *od,
u16_t len,
void *value)
3883 struct udp_pcb *pcb;
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) &&
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];
3909 *dst = pcb->local_ip;
3915 *sint_ptr = pcb->local_port;
3923 snmp_get_object_def(
u8_t ident_len,
s32_t *ident,
struct obj_def *od)
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];
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);
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);
3979 od->instance = MIB_OBJECT_NONE;
3986 od->instance = MIB_OBJECT_NONE;
3991 snmp_get_value(
struct obj_def *od,
u16_t len,
void *value)
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];
4002 *uint_ptr = snmpinpkts;
4005 *uint_ptr = snmpoutpkts;
4008 *uint_ptr = snmpinbadversions;
4011 *uint_ptr = snmpinbadcommunitynames;
4014 *uint_ptr = snmpinbadcommunityuses;
4017 *uint_ptr = snmpinasnparseerrs;
4020 *uint_ptr = snmpintoobigs;
4023 *uint_ptr = snmpinnosuchnames;
4026 *uint_ptr = snmpinbadvalues;
4029 *uint_ptr = snmpinreadonlys;
4032 *uint_ptr = snmpingenerrs;
4035 *uint_ptr = snmpintotalreqvars;
4038 *uint_ptr = snmpintotalsetvars;
4041 *uint_ptr = snmpingetrequests;
4044 *uint_ptr = snmpingetnexts;
4047 *uint_ptr = snmpinsetrequests;
4050 *uint_ptr = snmpingetresponses;
4053 *uint_ptr = snmpintraps;
4056 *uint_ptr = snmpouttoobigs;
4059 *uint_ptr = snmpoutnosuchnames;
4062 *uint_ptr = snmpoutbadvalues;
4065 *uint_ptr = snmpoutgenerrs;
4068 *uint_ptr = snmpoutgetrequests;
4071 *uint_ptr = snmpoutgetnexts;
4074 *uint_ptr = snmpoutsetrequests;
4077 *uint_ptr = snmpoutgetresponses;
4080 *uint_ptr = snmpouttraps;
4083 *uint_ptr = *snmpenableauthentraps_ptr;
4096 snmp_set_test(
struct obj_def *od,
u16_t len,
void *value)
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];
4109 if (snmpenableauthentraps_ptr != &snmpenableauthentraps_default)
4112 if ((*sint_ptr == 1) || (*sint_ptr == 2))
4120 if (*sint_ptr == snmpenableauthentraps_default)
4130 snmp_set_value(
struct obj_def *od,
u16_t len,
void *value)
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];
4142 *snmpenableauthentraps_ptr = *ptr;