Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of mbed-os by
lwip_snmp_mib2.c
00001 /** 00002 * @file 00003 * Management Information Base II (RFC1213) objects and functions. 00004 */ 00005 00006 /* 00007 * Copyright (c) 2006 Axon Digital Design B.V., The Netherlands. 00008 * All rights reserved. 00009 * 00010 * Redistribution and use in source and binary forms, with or without modification, 00011 * are permitted provided that the following conditions are met: 00012 * 00013 * 1. Redistributions of source code must retain the above copyright notice, 00014 * this list of conditions and the following disclaimer. 00015 * 2. Redistributions in binary form must reproduce the above copyright notice, 00016 * this list of conditions and the following disclaimer in the documentation 00017 * and/or other materials provided with the distribution. 00018 * 3. The name of the author may not be used to endorse or promote products 00019 * derived from this software without specific prior written permission. 00020 * 00021 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 00022 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 00023 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 00024 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00025 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 00026 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00027 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 00028 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 00029 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 00030 * OF SUCH DAMAGE. 00031 * 00032 * Author: Dirk Ziegelmeier <dziegel@gmx.de> 00033 * Christiaan Simons <christiaan.simons@axon.tv> 00034 */ 00035 00036 /** 00037 * @defgroup snmp_mib2 MIB2 00038 * @ingroup snmp 00039 */ 00040 00041 #include "lwip/apps/snmp_opts.h" 00042 00043 #if LWIP_SNMP && SNMP_LWIP_MIB2 /* don't build if not configured for use in lwipopts.h */ 00044 00045 #if !LWIP_STATS 00046 #error LWIP_SNMP MIB2 needs LWIP_STATS (for MIB2) 00047 #endif 00048 #if !MIB2_STATS 00049 #error LWIP_SNMP MIB2 needs MIB2_STATS (for MIB2) 00050 #endif 00051 00052 #include "lwip/snmp.h" 00053 #include "lwip/apps/snmp.h" 00054 #include "lwip/apps/snmp_core.h" 00055 #include "lwip/apps/snmp_mib2.h" 00056 #include "lwip/apps/snmp_scalar.h" 00057 00058 #if SNMP_USE_NETCONN 00059 #include "lwip/tcpip.h" 00060 #include "lwip/priv/tcpip_priv.h" 00061 void 00062 snmp_mib2_lwip_synchronizer(snmp_threadsync_called_fn fn, void* arg) 00063 { 00064 #if LWIP_TCPIP_CORE_LOCKING 00065 LOCK_TCPIP_CORE(); 00066 fn(arg); 00067 UNLOCK_TCPIP_CORE(); 00068 #else 00069 tcpip_callback(fn, arg); 00070 #endif 00071 } 00072 00073 struct snmp_threadsync_instance snmp_mib2_lwip_locks; 00074 #endif 00075 00076 /* dot3 and EtherLike MIB not planned. (transmission .1.3.6.1.2.1.10) */ 00077 /* historical (some say hysterical). (cmot .1.3.6.1.2.1.9) */ 00078 /* lwIP has no EGP, thus may not implement it. (egp .1.3.6.1.2.1.8) */ 00079 00080 /* --- mib-2 .1.3.6.1.2.1 ----------------------------------------------------- */ 00081 extern const struct snmp_scalar_array_node snmp_mib2_snmp_root; 00082 extern const struct snmp_tree_node snmp_mib2_udp_root; 00083 extern const struct snmp_tree_node snmp_mib2_tcp_root; 00084 extern const struct snmp_scalar_array_node snmp_mib2_icmp_root; 00085 extern const struct snmp_tree_node snmp_mib2_interface_root; 00086 extern const struct snmp_scalar_array_node snmp_mib2_system_node; 00087 extern const struct snmp_tree_node snmp_mib2_at_root; 00088 extern const struct snmp_tree_node snmp_mib2_ip_root; 00089 00090 static const struct snmp_node* const mib2_nodes[] = { 00091 &snmp_mib2_system_node.node.node, 00092 &snmp_mib2_interface_root.node, 00093 #if LWIP_ARP && LWIP_IPV4 00094 &snmp_mib2_at_root.node, 00095 #endif /* LWIP_ARP && LWIP_IPV4 */ 00096 #if LWIP_IPV4 00097 &snmp_mib2_ip_root.node, 00098 #endif /* LWIP_IPV4 */ 00099 #if LWIP_ICMP 00100 &snmp_mib2_icmp_root.node.node, 00101 #endif /* LWIP_ICMP */ 00102 #if LWIP_TCP 00103 &snmp_mib2_tcp_root.node, 00104 #endif /* LWIP_TCP */ 00105 #if LWIP_UDP 00106 &snmp_mib2_udp_root.node, 00107 #endif /* LWIP_UDP */ 00108 &snmp_mib2_snmp_root.node.node 00109 }; 00110 00111 static const struct snmp_tree_node mib2_root = SNMP_CREATE_TREE_NODE(1, mib2_nodes); 00112 00113 static const u32_t mib2_base_oid_arr[] = { 1,3,6,1,2,1 }; 00114 const struct snmp_mib mib2 = SNMP_MIB_CREATE(mib2_base_oid_arr, &mib2_root.node); 00115 00116 #endif /* LWIP_SNMP && SNMP_LWIP_MIB2 */
Generated on Tue Jul 12 2022 13:15:54 by
