Kenji Arai / mbed-os_TYBLE16

Dependents:   TYBLE16_simple_data_logger TYBLE16_MP3_Air

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers lwip_snmp_snmpv2_framework.c Source File

lwip_snmp_snmpv2_framework.c

00001 /*
00002 Generated by LwipMibCompiler
00003 */
00004 
00005 #include "lwip/apps/snmp_opts.h"
00006 
00007 #if LWIP_SNMP && LWIP_SNMP_V3 /* don't build if not configured for use in lwipopts.h */
00008 
00009 #include "lwip/apps/snmp_snmpv2_framework.h"
00010 #include "lwip/apps/snmp.h"
00011 #include "lwip/apps/snmp_core.h"
00012 #include "lwip/apps/snmp_scalar.h"
00013 #include "lwip/apps/snmp_table.h"
00014 #include "lwip/apps/snmpv3.h"
00015 #include "snmpv3_priv.h"
00016 
00017 #include "lwip/sys.h"
00018 
00019 #include <string.h>
00020 
00021 const struct snmp_obj_id usmNoAuthProtocol      = { 10, { 1, 3, 6, 1, 6, 3, 10, 1, 1, 1 } };
00022 const struct snmp_obj_id usmHMACMD5AuthProtocol = { 10, { 1, 3, 6, 1, 6, 3, 10, 1, 1, 2 } };
00023 const struct snmp_obj_id usmHMACSHAAuthProtocol = { 10, { 1, 3, 6, 1, 6, 3, 10, 1, 1, 3 } };
00024 /* .4 sha-224
00025  * .5 sha-256
00026  * .6 sha-384
00027  * .7 sha-512
00028  */
00029 
00030 const struct snmp_obj_id usmNoPrivProtocol  = { 10, { 1, 3, 6, 1, 6, 3, 10, 1, 2, 1 } };
00031 const struct snmp_obj_id usmDESPrivProtocol = { 10, { 1, 3, 6, 1, 6, 3, 10, 1, 2, 2 } };
00032 /* .3 3des-ede */
00033 const struct snmp_obj_id usmAESPrivProtocol = { 10, { 1, 3, 6, 1, 6, 3, 10, 1, 2, 4 } };
00034 /* .5 unknown
00035  * .6 unknown
00036  * .7 unknown
00037  */
00038 
00039 /* TODO: where should this value come from? */
00040 #define SNMP_FRAMEWORKMIB_SNMPENGINEMAXMESSAGESIZE 1500
00041 
00042 /* --- snmpFrameworkMIBObjects 1.3.6.1.6.3.10.2 ----------------------------------------------------- */
00043 static s16_t snmpengine_scalars_get_value(const struct snmp_scalar_array_node_def *node, void *value)
00044 {
00045   const char *engineid;
00046   u8_t engineid_len;
00047 
00048   switch (node->oid) {
00049     case 1: /* snmpEngineID */
00050       snmpv3_get_engine_id(&engineid, &engineid_len);
00051       MEMCPY(value, engineid, engineid_len);
00052       return engineid_len;
00053     case 2: /* snmpEngineBoots */
00054       *(s32_t *)value = snmpv3_get_engine_boots_internal();
00055       return sizeof(s32_t);
00056     case 3: /* snmpEngineTime */
00057       *(s32_t *)value = snmpv3_get_engine_time_internal();
00058       return sizeof(s32_t);
00059     case 4: /* snmpEngineMaxMessageSize */
00060       *(s32_t *)value = SNMP_FRAMEWORKMIB_SNMPENGINEMAXMESSAGESIZE;
00061       return sizeof(s32_t);
00062     default:
00063       LWIP_DEBUGF(SNMP_MIB_DEBUG, ("snmpengine_scalars_get_value(): unknown id: %"S32_F"\n", node->oid));
00064       return 0;
00065   }
00066 }
00067 
00068 static const struct snmp_scalar_array_node_def snmpengine_scalars_nodes[] = {
00069   {1, SNMP_ASN1_TYPE_OCTET_STRING, SNMP_NODE_INSTANCE_READ_ONLY}, /* snmpEngineID */
00070   {2, SNMP_ASN1_TYPE_INTEGER,      SNMP_NODE_INSTANCE_READ_ONLY}, /* snmpEngineBoots */
00071   {3, SNMP_ASN1_TYPE_INTEGER,      SNMP_NODE_INSTANCE_READ_ONLY}, /* snmpEngineTime */
00072   {4, SNMP_ASN1_TYPE_INTEGER,      SNMP_NODE_INSTANCE_READ_ONLY}, /* snmpEngineMaxMessageSize */
00073 };
00074 static const struct snmp_scalar_array_node snmpengine_scalars = SNMP_SCALAR_CREATE_ARRAY_NODE(1, snmpengine_scalars_nodes, snmpengine_scalars_get_value, NULL, NULL);
00075 
00076 static const struct snmp_node *const snmpframeworkmibobjects_subnodes[] = {
00077   &snmpengine_scalars.node.node
00078 };
00079 static const struct snmp_tree_node snmpframeworkmibobjects_treenode = SNMP_CREATE_TREE_NODE(2, snmpframeworkmibobjects_subnodes);
00080 
00081 /* --- snmpFrameworkMIB  ----------------------------------------------------- */
00082 static const struct snmp_node *const snmpframeworkmib_subnodes[] = {
00083   &snmpframeworkmibobjects_treenode.node
00084 };
00085 static const struct snmp_tree_node snmpframeworkmib_root = SNMP_CREATE_TREE_NODE(10, snmpframeworkmib_subnodes);
00086 static const u32_t snmpframeworkmib_base_oid[] = {1, 3, 6, 1, 6, 3, 10};
00087 const struct snmp_mib snmpframeworkmib = {snmpframeworkmib_base_oid, LWIP_ARRAYSIZE(snmpframeworkmib_base_oid), &snmpframeworkmib_root.node};
00088 
00089 /* --- snmpFrameworkMIB  ----------------------------------------------------- */
00090 #endif /* LWIP_SNMP */