[457] | 1 | /*
|
---|
| 2 | * Redistribution and use in source and binary forms, with or without modification,
|
---|
| 3 | * are permitted provided that the following conditions are met:
|
---|
| 4 | *
|
---|
| 5 | * 1. Redistributions of source code must retain the above copyright notice,
|
---|
| 6 | * this list of conditions and the following disclaimer.
|
---|
| 7 | * 2. Redistributions in binary form must reproduce the above copyright notice,
|
---|
| 8 | * this list of conditions and the following disclaimer in the documentation
|
---|
| 9 | * and/or other materials provided with the distribution.
|
---|
| 10 | * 3. The name of the author may not be used to endorse or promote products
|
---|
| 11 | * derived from this software without specific prior written permission.
|
---|
| 12 | *
|
---|
| 13 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
---|
| 14 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
---|
| 15 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
---|
| 16 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
---|
| 17 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
---|
| 18 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
---|
| 19 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
---|
| 20 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
---|
| 21 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
---|
| 22 | * OF SUCH DAMAGE.
|
---|
| 23 | *
|
---|
| 24 | * This file is part of the lwIP TCP/IP stack.
|
---|
| 25 | *
|
---|
| 26 | * Author: Dirk Ziegelmeier <dziegel@gmx.de>
|
---|
| 27 | *
|
---|
| 28 | */
|
---|
| 29 |
|
---|
| 30 | #include "lwip/apps/snmp.h"
|
---|
| 31 | #include "lwip/apps/snmp_mib2.h"
|
---|
| 32 | #include "lwip/apps/snmpv3.h"
|
---|
| 33 | #include "lwip/apps/snmp_snmpv2_framework.h"
|
---|
| 34 | #include "lwip/apps/snmp_snmpv2_usm.h"
|
---|
| 35 | #include "examples/snmp/snmp_v3/snmpv3_dummy.h"
|
---|
| 36 | #include "examples/snmp/snmp_private_mib/private_mib.h"
|
---|
| 37 | #include "snmp_example.h"
|
---|
| 38 |
|
---|
| 39 |
|
---|
| 40 | #if LWIP_SNMP
|
---|
| 41 | static const struct snmp_mib *mibs[] = {
|
---|
| 42 | &mib2,
|
---|
| 43 | &mib_private
|
---|
| 44 | #if LWIP_SNMP_V3
|
---|
| 45 | , &snmpframeworkmib
|
---|
| 46 | , &snmpusmmib
|
---|
| 47 | #endif
|
---|
| 48 | };
|
---|
| 49 | #endif /* LWIP_SNMP */
|
---|
| 50 |
|
---|
| 51 | void
|
---|
| 52 | snmp_example_init(void)
|
---|
| 53 | {
|
---|
| 54 | #if LWIP_SNMP
|
---|
| 55 | lwip_privmib_init();
|
---|
| 56 | #if SNMP_LWIP_MIB2
|
---|
| 57 | #if SNMP_USE_NETCONN
|
---|
| 58 | snmp_threadsync_init(&snmp_mib2_lwip_locks, snmp_mib2_lwip_synchronizer);
|
---|
| 59 | #endif /* SNMP_USE_NETCONN */
|
---|
| 60 | snmp_mib2_set_syscontact_readonly((const u8_t*)"root", NULL);
|
---|
| 61 | snmp_mib2_set_syslocation_readonly((const u8_t*)"lwIP development PC", NULL);
|
---|
| 62 | snmp_mib2_set_sysdescr((const u8_t*)"simhost", NULL);
|
---|
| 63 | #endif /* SNMP_LWIP_MIB2 */
|
---|
| 64 |
|
---|
| 65 | #if LWIP_SNMP_V3
|
---|
| 66 | snmpv3_dummy_init();
|
---|
| 67 | #endif
|
---|
| 68 |
|
---|
| 69 | snmp_set_mibs(mibs, LWIP_ARRAYSIZE(mibs));
|
---|
| 70 | snmp_init();
|
---|
| 71 | #endif /* LWIP_SNMP */
|
---|
| 72 | }
|
---|