1 /* 2 Generated by LwipMibCompiler 3 */ 4 5 #include "lwip/apps/snmp_opts.h" 6 7 #if LWIP_SNMP && LWIP_SNMP_V3 /* don't build if not configured for use in lwipopts.h */ 8 9 #include "lwip/apps/snmp_snmpv2_framework.h" 10 #include "lwip/apps/snmp.h" 11 #include "lwip/apps/snmp_core.h" 12 #include "lwip/apps/snmp_scalar.h" 13 #include "lwip/apps/snmp_table.h" 14 #include "lwip/apps/snmpv3.h" 15 #include "snmpv3_priv.h" 16 17 #include "lwip/sys.h" 18 19 #include <string.h> 20 21 const struct snmp_obj_id usmNoAuthProtocol = { 10, { 1, 3, 6, 1, 6, 3, 10, 1, 1, 1 } }; 22 const struct snmp_obj_id usmHMACMD5AuthProtocol = { 10, { 1, 3, 6, 1, 6, 3, 10, 1, 1, 2 } }; 23 const struct snmp_obj_id usmHMACSHAAuthProtocol = { 10, { 1, 3, 6, 1, 6, 3, 10, 1, 1, 3 } }; 24 /* .4 sha-224 25 * .5 sha-256 26 * .6 sha-384 27 * .7 sha-512 28 */ 29 30 const struct snmp_obj_id usmNoPrivProtocol = { 10, { 1, 3, 6, 1, 6, 3, 10, 1, 2, 1 } }; 31 const struct snmp_obj_id usmDESPrivProtocol = { 10, { 1, 3, 6, 1, 6, 3, 10, 1, 2, 2 } }; 32 /* .3 3des-ede */ 33 const struct snmp_obj_id usmAESPrivProtocol = { 10, { 1, 3, 6, 1, 6, 3, 10, 1, 2, 4 } }; 34 /* .5 unknown 35 * .6 unknown 36 * .7 unknown 37 */ 38 39 /* TODO: where should this value come from? */ 40 #define SNMP_FRAMEWORKMIB_SNMPENGINEMAXMESSAGESIZE 1500 41 42 /* --- snmpFrameworkMIBObjects 1.3.6.1.6.3.10.2 ----------------------------------------------------- */ 43 static s16_t snmpengine_scalars_get_value(const struct snmp_scalar_array_node_def *node, void *value) 44 { 45 const char *engineid; 46 u8_t engineid_len; 47 48 switch (node->oid) { 49 case 1: /* snmpEngineID */ 50 snmpv3_get_engine_id(&engineid, &engineid_len); 51 MEMCPY(value, engineid, engineid_len); 52 return engineid_len; 53 case 2: /* snmpEngineBoots */ 54 *(s32_t *)value = snmpv3_get_engine_boots_internal(); 55 return sizeof(s32_t); 56 case 3: /* snmpEngineTime */ 57 *(s32_t *)value = snmpv3_get_engine_time_internal(); 58 return sizeof(s32_t); 59 case 4: /* snmpEngineMaxMessageSize */ 60 *(s32_t *)value = SNMP_FRAMEWORKMIB_SNMPENGINEMAXMESSAGESIZE; 61 return sizeof(s32_t); 62 default: 63 LWIP_DEBUGF(SNMP_MIB_DEBUG,("snmpengine_scalars_get_value(): unknown id: %"S32_F"\n", node->oid)); 64 return 0; 65 } 66 } 67 68 static const struct snmp_scalar_array_node_def snmpengine_scalars_nodes[] = { 69 {1, SNMP_ASN1_TYPE_OCTET_STRING, SNMP_NODE_INSTANCE_READ_ONLY}, /* snmpEngineID */ 70 {2, SNMP_ASN1_TYPE_INTEGER, SNMP_NODE_INSTANCE_READ_ONLY}, /* snmpEngineBoots */ 71 {3, SNMP_ASN1_TYPE_INTEGER, SNMP_NODE_INSTANCE_READ_ONLY}, /* snmpEngineTime */ 72 {4, SNMP_ASN1_TYPE_INTEGER, SNMP_NODE_INSTANCE_READ_ONLY}, /* snmpEngineMaxMessageSize */ 73 }; 74 static const struct snmp_scalar_array_node snmpengine_scalars = SNMP_SCALAR_CREATE_ARRAY_NODE(1, snmpengine_scalars_nodes, snmpengine_scalars_get_value, NULL, NULL); 75 76 static const struct snmp_node *const snmpframeworkmibobjects_subnodes[] = { 77 &snmpengine_scalars.node.node 78 }; 79 static const struct snmp_tree_node snmpframeworkmibobjects_treenode = SNMP_CREATE_TREE_NODE(2, snmpframeworkmibobjects_subnodes); 80 81 /* --- snmpFrameworkMIB ----------------------------------------------------- */ 82 static const struct snmp_node *const snmpframeworkmib_subnodes[] = { 83 &snmpframeworkmibobjects_treenode.node 84 }; 85 static const struct snmp_tree_node snmpframeworkmib_root = SNMP_CREATE_TREE_NODE(10, snmpframeworkmib_subnodes); 86 static const u32_t snmpframeworkmib_base_oid[] = {1,3,6,1,6,3,10}; 87 const struct snmp_mib snmpframeworkmib = {snmpframeworkmib_base_oid, LWIP_ARRAYSIZE(snmpframeworkmib_base_oid), &snmpframeworkmib_root.node}; 88 89 /* --- snmpFrameworkMIB ----------------------------------------------------- */ 90 #endif /* LWIP_SNMP */ 91