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) (sysuptime = (sys_now() / 10))
79static void system_get_object_def(
u8_t ident_len,
s32_t *ident,
struct obj_def *od);
80static void system_get_value(
struct obj_def *od,
u16_t len,
void *value);
81static u8_t system_set_test(
struct obj_def *od,
u16_t len,
void *value);
82static void system_set_value(
struct obj_def *od,
u16_t len,
void *value);
83static void interfaces_get_object_def(
u8_t ident_len,
s32_t *ident,
struct obj_def *od);
84static void interfaces_get_value(
struct obj_def *od,
u16_t len,
void *value);
85static void ifentry_get_object_def(
u8_t ident_len,
s32_t *ident,
struct obj_def *od);
86static void ifentry_get_value(
struct obj_def *od,
u16_t len,
void *value);
87#if !SNMP_SAFE_REQUESTS
88static u8_t ifentry_set_test (
struct obj_def *od,
u16_t len,
void *value);
89static void ifentry_set_value (
struct obj_def *od,
u16_t len,
void *value);
91static void atentry_get_object_def(
u8_t ident_len,
s32_t *ident,
struct obj_def *od);
92static void atentry_get_value(
struct obj_def *od,
u16_t len,
void *value);
93static void ip_get_object_def(
u8_t ident_len,
s32_t *ident,
struct obj_def *od);
94static void ip_get_value(
struct obj_def *od,
u16_t len,
void *value);
95static u8_t ip_set_test(
struct obj_def *od,
u16_t len,
void *value);
96static void ip_addrentry_get_object_def(
u8_t ident_len,
s32_t *ident,
struct obj_def *od);
97static void ip_addrentry_get_value(
struct obj_def *od,
u16_t len,
void *value);
98static void ip_rteentry_get_object_def(
u8_t ident_len,
s32_t *ident,
struct obj_def *od);
99static void ip_rteentry_get_value(
struct obj_def *od,
u16_t len,
void *value);
100static void ip_ntomentry_get_object_def(
u8_t ident_len,
s32_t *ident,
struct obj_def *od);
101static void ip_ntomentry_get_value(
struct obj_def *od,
u16_t len,
void *value);
102static void icmp_get_object_def(
u8_t ident_len,
s32_t *ident,
struct obj_def *od);
103static void icmp_get_value(
struct obj_def *od,
u16_t len,
void *value);
105static void tcp_get_object_def(
u8_t ident_len,
s32_t *ident,
struct obj_def *od);
106static void tcp_get_value(
struct obj_def *od,
u16_t len,
void *value);
107#ifdef THIS_SEEMS_UNUSED
108static void tcpconnentry_get_object_def(
u8_t ident_len,
s32_t *ident,
struct obj_def *od);
109static void tcpconnentry_get_value(
struct obj_def *od,
u16_t len,
void *value);
112static void udp_get_object_def(
u8_t ident_len,
s32_t *ident,
struct obj_def *od);
113static void udp_get_value(
struct obj_def *od,
u16_t len,
void *value);
114static void udpentry_get_object_def(
u8_t ident_len,
s32_t *ident,
struct obj_def *od);
115static void udpentry_get_value(
struct obj_def *od,
u16_t len,
void *value);
116static void snmp_get_object_def(
u8_t ident_len,
s32_t *ident,
struct obj_def *od);
117static void snmp_get_value(
struct obj_def *od,
u16_t len,
void *value);
118static u8_t snmp_set_test(
struct obj_def *od,
u16_t len,
void *value);
119static void snmp_set_value(
struct obj_def *od,
u16_t len,
void *value);
123const mib_scalar_node snmp_scalar = {
124 &snmp_get_object_def,
131const 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
135struct 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
151const struct mib_array_node snmp = {
152 &noleafs_get_object_def,
168struct mib_list_rootnode udp_root = {
169 &noleafs_get_object_def,
179const s32_t udpentry_ids[2] = { 1, 2 };
180struct mib_node*
const udpentry_nodes[2] = {
181 (
struct mib_node*)&udp_root, (
struct mib_node*)&udp_root,
183const struct mib_array_node udpentry = {
184 &noleafs_get_object_def,
194s32_t udptable_id = 1;
195struct mib_node* udptable_node = (
struct mib_node*)&udpentry;
196struct mib_ram_array_node udptable = {
197 &noleafs_get_object_def,
207const mib_scalar_node udp_scalar = {
215const s32_t udp_ids[5] = { 1, 2, 3, 4, 5 };
216struct 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
221const struct mib_array_node udp = {
222 &noleafs_get_object_def,
236struct mib_list_rootnode tcpconntree_root = {
237 &noleafs_get_object_def,
247const s32_t tcpconnentry_ids[5] = { 1, 2, 3, 4, 5 };
248struct 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
253const struct mib_array_node tcpconnentry = {
254 &noleafs_get_object_def,
264s32_t tcpconntable_id = 1;
265struct mib_node* tcpconntable_node = (
struct mib_node*)&tcpconnentry;
266struct mib_ram_array_node tcpconntable = {
267 &noleafs_get_object_def,
279const mib_scalar_node tcp_scalar = {
287const s32_t tcp_ids[15] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
288struct 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
298const struct mib_array_node tcp = {
299 &noleafs_get_object_def,
311const mib_scalar_node icmp_scalar = {
312 &icmp_get_object_def,
319const 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 };
320struct 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
335const struct mib_array_node icmp = {
336 &noleafs_get_object_def,
347struct mib_list_rootnode ipntomtree_root = {
348 &noleafs_get_object_def,
358const s32_t ipntomentry_ids[4] = { 1, 2, 3, 4 };
359struct 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
363const struct mib_array_node ipntomentry = {
364 &noleafs_get_object_def,
374s32_t ipntomtable_id = 1;
375struct mib_node* ipntomtable_node = (
struct mib_node*)&ipntomentry;
376struct mib_ram_array_node ipntomtable = {
377 &noleafs_get_object_def,
388struct mib_list_rootnode iprtetree_root = {
389 &noleafs_get_object_def,
399const s32_t iprteentry_ids[13] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 };
400struct 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
409const struct mib_array_node iprteentry = {
410 &noleafs_get_object_def,
420s32_t iprtetable_id = 1;
421struct mib_node* iprtetable_node = (
struct mib_node*)&iprteentry;
422struct mib_ram_array_node iprtetable = {
423 &noleafs_get_object_def,
434struct mib_list_rootnode ipaddrtree_root = {
435 &noleafs_get_object_def,
445const s32_t ipaddrentry_ids[5] = { 1, 2, 3, 4, 5 };
446struct 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
453const struct mib_array_node ipaddrentry = {
454 &noleafs_get_object_def,
464s32_t ipaddrtable_id = 1;
465struct mib_node* ipaddrtable_node = (
struct mib_node*)&ipaddrentry;
466struct mib_ram_array_node ipaddrtable = {
467 &noleafs_get_object_def,
478const mib_scalar_node ip_scalar = {
486const 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 };
487struct 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
501const struct mib_array_node mib2_ip = {
502 &noleafs_get_object_def,
513struct mib_list_rootnode arptree_root = {
514 &noleafs_get_object_def,
524const s32_t atentry_ids[3] = { 1, 2, 3 };
525struct mib_node*
const atentry_nodes[3] = {
526 (
struct mib_node*)&arptree_root,
527 (
struct mib_node*)&arptree_root,
528 (
struct mib_node*)&arptree_root
530const struct mib_array_node atentry = {
531 &noleafs_get_object_def,
541const s32_t attable_id = 1;
542struct mib_node*
const attable_node = (
struct mib_node*)&atentry;
543const struct mib_array_node attable = {
544 &noleafs_get_object_def,
556struct mib_node* mib2_at_node = (
struct mib_node*)&attable;
557struct mib_ram_array_node at = {
558 &noleafs_get_object_def,
569struct mib_list_rootnode iflist_root = {
570 &ifentry_get_object_def,
572#if SNMP_SAFE_REQUESTS
585const 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 };
586struct 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
599const struct mib_array_node ifentry = {
600 &noleafs_get_object_def,
611struct mib_node* iftable_node = (
struct mib_node*)&ifentry;
612struct mib_ram_array_node iftable = {
613 &noleafs_get_object_def,
624const mib_scalar_node interfaces_scalar = {
625 &interfaces_get_object_def,
626 &interfaces_get_value,
632const s32_t interfaces_ids[2] = { 1, 2 };
633struct mib_node*
const interfaces_nodes[2] = {
634 (
struct mib_node*)&interfaces_scalar, (
struct mib_node*)&iftable
636const struct mib_array_node interfaces = {
637 &noleafs_get_object_def,
650const mib_scalar_node sys_tem_scalar = {
651 &system_get_object_def,
658const s32_t sys_tem_ids[7] = { 1, 2, 3, 4, 5, 6, 7 };
659struct 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
666const struct mib_array_node sys_tem = {
667 &noleafs_get_object_def,
683const s32_t mib2_ids[MIB2_GROUPS] =
696struct 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
709const struct mib_array_node mib2 = {
710 &noleafs_get_object_def,
721const s32_t mgmt_ids[1] = { 1 };
722struct mib_node*
const mgmt_nodes[1] = { (
struct mib_node*)&mib2 };
723const struct mib_array_node mgmt = {
724 &noleafs_get_object_def,
738s32_t internet_ids[2] = { 2, 4 };
739struct mib_node*
const internet_nodes[2] = { (
struct mib_node*)&mgmt, (
struct mib_node*)&mib_private };
740const struct mib_array_node internet = {
741 &noleafs_get_object_def,
751const s32_t internet_ids[1] = { 2 };
752struct mib_node*
const internet_nodes[1] = { (
struct mib_node*)&mgmt };
753const struct mib_array_node internet = {
754 &noleafs_get_object_def,
766static struct snmp_obj_id sysobjid = {SNMP_SYSOBJID_LEN, SNMP_SYSOBJID};
768static struct snmp_obj_id snmpgrp_id = {7,{1,3,6,1,2,1,11}};
770static const s32_t sysservices = SNMP_SYSSERVICES;
773static const u8_t sysdescr_len_default = 4;
774static const u8_t sysdescr_default[] =
"lwIP";
775static u8_t* sysdescr_len_ptr = (
u8_t*)&sysdescr_len_default;
776static u8_t* sysdescr_ptr = (
u8_t*)&sysdescr_default[0];
778static const u8_t syscontact_len_default = 0;
779static const u8_t syscontact_default[] =
"";
780static u8_t* syscontact_len_ptr = (
u8_t*)&syscontact_len_default;
781static u8_t* syscontact_ptr = (
u8_t*)&syscontact_default[0];
783static const u8_t sysname_len_default = 8;
784static const u8_t sysname_default[] =
"FQDN-unk";
785static u8_t* sysname_len_ptr = (
u8_t*)&sysname_len_default;
786static u8_t* sysname_ptr = (
u8_t*)&sysname_default[0];
788static const u8_t syslocation_len_default = 0;
789static const u8_t syslocation_default[] =
"";
790static u8_t* syslocation_len_ptr = (
u8_t*)&syslocation_len_default;
791static u8_t* syslocation_ptr = (
u8_t*)&syslocation_default[0];
793static const u8_t snmpenableauthentraps_default = 2;
794static u8_t* snmpenableauthentraps_ptr = (
u8_t*)&snmpenableauthentraps_default;
797static const struct snmp_obj_id ifspecific = {2, {0, 0}};
799static const struct snmp_obj_id iprouteinfo = {2, {0, 0}};
804static u32_t sysuptime = 0;
807static u32_t ipinreceives = 0,
811 ipinunknownprotos = 0,
823 iproutingdiscards = 0;
825static 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;
852static u32_t tcpactiveopens = 0,
862static u32_t udpindatagrams = 0,
867static 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;
2075noleafs_get_object_def(
u8_t ident_len,
s32_t *ident,
struct obj_def *od)
2079 od->instance = MIB_OBJECT_NONE;
2083noleafs_get_value(
struct obj_def *od,
u16_t len,
void *value)
2091noleafs_set_test(
struct obj_def *od,
u16_t len,
void *value)
2101noleafs_set_value(
struct obj_def *od,
u16_t len,
void *value)
2117system_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;
2198system_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;
2236system_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) &&
2272system_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;
2304interfaces_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;
2335interfaces_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;
2353ifentry_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;
2461ifentry_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;
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
2618ifentry_set_test(
struct obj_def *od,
u16_t len,
void *value)
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)
2641ifentry_set_value(
struct obj_def *od,
u16_t len,
void *value)
2647 snmp_ifindextonetif(od->id_inst_ptr[1], &
netif);
2648 id = (
u8_t)od->id_inst_ptr[0];
2658 else if (*sint_ptr == 2)
2676atentry_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;
2721atentry_get_value(
struct obj_def *od,
u16_t len,
void *value)
2725 struct eth_addr* ethaddr_ret;
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;
2770ip_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;
2836ip_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;
2990ip_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];
3024ip_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;
3070ip_addrentry_get_value(
struct obj_def *od,
u16_t len,
void *value)
3078 snmp_oidtoip(&od->id_inst_ptr[1], &
ip);
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;
3146ip_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;
3211ip_rteentry_get_value(
struct obj_def *od,
u16_t len,
void *value)
3218 ident = od->id_inst_ptr;
3219 snmp_oidtoip(&ident[1], &dest);
3238 LWIP_ASSERT(
"invalid id", (ident[0] >= 0) && (ident[0] <= 0xff));
3239 id = (
u8_t)ident[0];
3262 snmp_netiftoifindex(
netif, sint_ptr);
3362ip_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;
3412ip_ntomentry_get_value(
struct obj_def *od,
u16_t len,
void *value)
3416 struct eth_addr* ethaddr_ret;
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;
3468icmp_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;
3492icmp_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;
3586tcp_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;
3647tcp_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
3721tcpconnentry_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;
3773tcpconnentry_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);
3791udp_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;
3815udp_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;
3841udpentry_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;
3880udpentry_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;
3923snmp_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;
3991snmp_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;
4096snmp_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)
4130snmp_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;
#define LWIP_UNUSED_ARG(x)
#define LWIP_DEBUGF(debug, message)
#define LWIP_ASSERT(message, assertion)
#define ip_addr_cmp(addr1, addr2)
#define ip_addr_isany(addr1)
#define ip_addr_netcmp(addr1, addr2, mask)
typedefPACK_STRUCT_END struct ip_addr ip_addr_t
#define ip_addr_set_any(ipaddr)
#define ip_addr_set_zero(ipaddr)
#define ip_addr_get_network(target, host, netmask)
struct netif * netif_list
struct netif * netif_default
void netif_set_down(struct netif *netif)
void netif_set_up(struct netif *netif)
#define netif_is_link_up(netif)
#define netif_is_up(netif)
#define IP_REASS_MAX_PBUFS
#define PBUF_POOL_BUFSIZE
#define snmp_inc_snmpouttoobigs()
#define snmp_inc_snmpinbadcommunitynames()
#define snmp_inc_tcppassiveopens()
#define snmp_inc_icmpoutechoreps()
#define snmp_inc_snmpoutpkts()
#define snmp_inc_iflist()
#define snmp_inc_ipfragcreates()
#define snmp_inc_snmpinbadcommunityuses()
#define snmp_inc_snmpinnosuchnames()
#define snmp_inc_snmpingetnexts()
#define snmp_inc_icmpinsrcquenchs()
#define snmp_inc_icmpoutdestunreachs()
#define snmp_insert_udpidx_tree(pcb)
#define snmp_inc_ipinhdrerrors()
#define snmp_get_sysuptime(value)
#define snmp_inc_ipoutnoroutes()
#define snmp_inc_snmpoutgetnexts()
#define snmp_delete_arpidx_tree(ni, ip)
#define snmp_inc_icmpinerrors()
#define snmp_inc_ipreasmreqds()
#define snmp_inc_ipindelivers()
#define snmp_inc_icmpouterrors()
#define snmp_inc_tcpattemptfails()
#define snmp_inc_ifoutucastpkts(ni)
#define snmp_get_snmpenableauthentraps(value)
#define snmp_set_sysobjid(oid)
#define snmp_inc_udpnoports()
#define snmp_inc_ipfragoks()
#define snmp_set_sysdesr(str, len)
#define snmp_inc_icmpintimeexcds()
#define snmp_inc_snmpinasnparseerrs()
#define snmp_inc_iproutingdiscards()
#define snmp_inc_ipindiscards()
#define snmp_inc_ipoutrequests()
#define snmp_inc_snmpouttraps()
#define snmp_inc_snmpingetrequests()
#define snmp_inc_snmpinbadvalues()
#define snmp_inc_snmpintraps()
#define snmp_inc_snmpoutgetrequests()
#define snmp_add_sysuptime(value)
#define snmp_inc_sysuptime()
#define snmp_dec_iflist()
#define snmp_inc_icmpinparmprobs()
#define snmp_inc_icmpoutsrcquenchs()
#define snmp_inc_icmpoutparmprobs()
#define snmp_insert_arpidx_tree(ni, ip)
#define snmp_inc_ifinnucastpkts(ni)
#define snmp_inc_ipinaddrerrors()
#define snmp_inc_udpindatagrams()
#define snmp_inc_ipforwdatagrams()
#define snmp_inc_icmpinmsgs()
#define snmp_insert_ipaddridx_tree(ni)
#define snmp_inc_icmpinechoreps()
#define snmp_delete_iprteidx_tree(dflt, ni)
#define snmp_inc_tcpinerrs()
#define snmp_delete_udpidx_tree(pcb)
#define snmp_set_syslocation(ocstr, ocstrlen)
#define snmp_inc_ipinunknownprotos()
#define snmp_inc_ifindiscards(ni)
#define snmp_inc_snmpoutbadvalues()
#define snmp_set_snmpenableauthentraps(value)
#define snmp_inc_snmpintoobigs()
#define snmp_inc_icmpoutredirects()
#define snmp_inc_tcpoutsegs()
#define snmp_inc_tcpestabresets()
#define snmp_inc_snmpinbadversions()
#define snmp_inc_icmpouttimestamps()
#define snmp_inc_snmpoutgetresponses()
#define snmp_inc_udpinerrors()
#define snmp_inc_snmpoutgenerrs()
#define snmp_inc_udpoutdatagrams()
#define snmp_inc_ifinucastpkts(ni)
#define snmp_get_sysobjid_ptr(oid)
#define snmp_inc_snmpinreadonlys()
#define snmp_inc_snmpinpkts()
#define snmp_inc_ifoutnucastpkts(ni)
#define snmp_add_snmpintotalreqvars(value)
#define snmp_inc_icmpouttimestampreps()
#define snmp_inc_icmpouttimeexcds()
#define snmp_inc_icmpinredirects()
#define snmp_get_snmpgrpid_ptr(oid)
#define snmp_inc_icmpoutaddrmasks()
#define snmp_inc_tcpactiveopens()
#define snmp_inc_icmpinaddrmaskreps()
#define snmp_inc_icmpoutaddrmaskreps()
#define snmp_inc_snmpoutnosuchnames()
#define snmp_inc_snmpoutsetrequests()
#define snmp_inc_icmpinaddrmasks()
#define snmp_inc_snmpingetresponses()
#define snmp_inc_ipoutdiscards()
#define snmp_inc_tcpoutrsts()
#define snmp_inc_snmpingenerrs()
#define snmp_add_ifinoctets(ni, value)
#define snmp_inc_icmpintimestamps()
#define snmp_inc_ipreasmfails()
#define snmp_add_ifoutoctets(ni, value)
#define snmp_inc_ipinreceives()
#define snmp_inc_icmpoutechos()
#define snmp_inc_icmpinechos()
#define snmp_delete_ipaddridx_tree(ni)
#define snmp_insert_iprteidx_tree(dflt, ni)
#define snmp_inc_snmpinsetrequests()
#define snmp_inc_tcpinsegs()
#define snmp_set_sysname(ocstr, ocstrlen)
#define snmp_inc_tcpretranssegs()
#define snmp_inc_icmpoutmsgs()
#define snmp_set_syscontact(ocstr, ocstrlen)
#define snmp_inc_ipreasmoks()
#define snmp_inc_icmpindestunreachs()
#define snmp_inc_icmpintimestampreps()
#define snmp_inc_ifoutdiscards(ni)
#define snmp_add_snmpintotalsetvars(value)
#define snmp_inc_ipfragfails()
u8_t hwaddr[NETIF_MAX_HWADDR_LEN]