1195972f6Sopenharmony_ci/*
2195972f6Sopenharmony_ciGenerated by LwipMibCompiler
3195972f6Sopenharmony_ci*/
4195972f6Sopenharmony_ci
5195972f6Sopenharmony_ci#include "lwip/apps/snmp_opts.h"
6195972f6Sopenharmony_ci
7195972f6Sopenharmony_ci#if LWIP_SNMP && LWIP_SNMP_V3 /* don't build if not configured for use in lwipopts.h */
8195972f6Sopenharmony_ci
9195972f6Sopenharmony_ci#include "lwip/apps/snmp_snmpv2_framework.h"
10195972f6Sopenharmony_ci#include "lwip/apps/snmp.h"
11195972f6Sopenharmony_ci#include "lwip/apps/snmp_core.h"
12195972f6Sopenharmony_ci#include "lwip/apps/snmp_scalar.h"
13195972f6Sopenharmony_ci#include "lwip/apps/snmp_table.h"
14195972f6Sopenharmony_ci#include "lwip/apps/snmpv3.h"
15195972f6Sopenharmony_ci#include "snmpv3_priv.h"
16195972f6Sopenharmony_ci
17195972f6Sopenharmony_ci#include "lwip/sys.h"
18195972f6Sopenharmony_ci
19195972f6Sopenharmony_ci#include <string.h>
20195972f6Sopenharmony_ci
21195972f6Sopenharmony_ciconst struct snmp_obj_id usmNoAuthProtocol      = { 10, { 1, 3, 6, 1, 6, 3, 10, 1, 1, 1 } };
22195972f6Sopenharmony_ciconst struct snmp_obj_id usmHMACMD5AuthProtocol = { 10, { 1, 3, 6, 1, 6, 3, 10, 1, 1, 2 } };
23195972f6Sopenharmony_ciconst struct snmp_obj_id usmHMACSHAAuthProtocol = { 10, { 1, 3, 6, 1, 6, 3, 10, 1, 1, 3 } };
24195972f6Sopenharmony_ci/* .4 sha-224
25195972f6Sopenharmony_ci * .5 sha-256
26195972f6Sopenharmony_ci * .6 sha-384
27195972f6Sopenharmony_ci * .7 sha-512
28195972f6Sopenharmony_ci */
29195972f6Sopenharmony_ci
30195972f6Sopenharmony_ciconst struct snmp_obj_id usmNoPrivProtocol  = { 10, { 1, 3, 6, 1, 6, 3, 10, 1, 2, 1 } };
31195972f6Sopenharmony_ciconst struct snmp_obj_id usmDESPrivProtocol = { 10, { 1, 3, 6, 1, 6, 3, 10, 1, 2, 2 } };
32195972f6Sopenharmony_ci/* .3 3des-ede */
33195972f6Sopenharmony_ciconst struct snmp_obj_id usmAESPrivProtocol = { 10, { 1, 3, 6, 1, 6, 3, 10, 1, 2, 4 } };
34195972f6Sopenharmony_ci/* .5 unknown
35195972f6Sopenharmony_ci * .6 unknown
36195972f6Sopenharmony_ci * .7 unknown
37195972f6Sopenharmony_ci */
38195972f6Sopenharmony_ci
39195972f6Sopenharmony_ci/* TODO: where should this value come from? */
40195972f6Sopenharmony_ci#define SNMP_FRAMEWORKMIB_SNMPENGINEMAXMESSAGESIZE 1500
41195972f6Sopenharmony_ci
42195972f6Sopenharmony_ci/* --- snmpFrameworkMIBObjects 1.3.6.1.6.3.10.2 ----------------------------------------------------- */
43195972f6Sopenharmony_cistatic s16_t snmpengine_scalars_get_value(const struct snmp_scalar_array_node_def *node, void *value)
44195972f6Sopenharmony_ci{
45195972f6Sopenharmony_ci  const char *engineid;
46195972f6Sopenharmony_ci  u8_t engineid_len;
47195972f6Sopenharmony_ci
48195972f6Sopenharmony_ci  switch (node->oid) {
49195972f6Sopenharmony_ci    case 1: /* snmpEngineID */
50195972f6Sopenharmony_ci      snmpv3_get_engine_id(&engineid, &engineid_len);
51195972f6Sopenharmony_ci      MEMCPY(value, engineid, engineid_len);
52195972f6Sopenharmony_ci      return engineid_len;
53195972f6Sopenharmony_ci    case 2: /* snmpEngineBoots */
54195972f6Sopenharmony_ci      *(s32_t *)value = snmpv3_get_engine_boots_internal();
55195972f6Sopenharmony_ci      return sizeof(s32_t);
56195972f6Sopenharmony_ci    case 3: /* snmpEngineTime */
57195972f6Sopenharmony_ci      *(s32_t *)value = snmpv3_get_engine_time_internal();
58195972f6Sopenharmony_ci      return sizeof(s32_t);
59195972f6Sopenharmony_ci    case 4: /* snmpEngineMaxMessageSize */
60195972f6Sopenharmony_ci      *(s32_t *)value = SNMP_FRAMEWORKMIB_SNMPENGINEMAXMESSAGESIZE;
61195972f6Sopenharmony_ci      return sizeof(s32_t);
62195972f6Sopenharmony_ci    default:
63195972f6Sopenharmony_ci      LWIP_DEBUGF(SNMP_MIB_DEBUG, ("snmpengine_scalars_get_value(): unknown id: %"S32_F"\n", node->oid));
64195972f6Sopenharmony_ci      return 0;
65195972f6Sopenharmony_ci  }
66195972f6Sopenharmony_ci}
67195972f6Sopenharmony_ci
68195972f6Sopenharmony_cistatic const struct snmp_scalar_array_node_def snmpengine_scalars_nodes[] = {
69195972f6Sopenharmony_ci  {1, SNMP_ASN1_TYPE_OCTET_STRING, SNMP_NODE_INSTANCE_READ_ONLY}, /* snmpEngineID */
70195972f6Sopenharmony_ci  {2, SNMP_ASN1_TYPE_INTEGER,      SNMP_NODE_INSTANCE_READ_ONLY}, /* snmpEngineBoots */
71195972f6Sopenharmony_ci  {3, SNMP_ASN1_TYPE_INTEGER,      SNMP_NODE_INSTANCE_READ_ONLY}, /* snmpEngineTime */
72195972f6Sopenharmony_ci  {4, SNMP_ASN1_TYPE_INTEGER,      SNMP_NODE_INSTANCE_READ_ONLY}, /* snmpEngineMaxMessageSize */
73195972f6Sopenharmony_ci};
74195972f6Sopenharmony_cistatic const struct snmp_scalar_array_node snmpengine_scalars = SNMP_SCALAR_CREATE_ARRAY_NODE(1, snmpengine_scalars_nodes, snmpengine_scalars_get_value, NULL, NULL);
75195972f6Sopenharmony_ci
76195972f6Sopenharmony_cistatic const struct snmp_node *const snmpframeworkmibobjects_subnodes[] = {
77195972f6Sopenharmony_ci  &snmpengine_scalars.node.node
78195972f6Sopenharmony_ci};
79195972f6Sopenharmony_cistatic const struct snmp_tree_node snmpframeworkmibobjects_treenode = SNMP_CREATE_TREE_NODE(2, snmpframeworkmibobjects_subnodes);
80195972f6Sopenharmony_ci
81195972f6Sopenharmony_ci/* --- snmpFrameworkMIB  ----------------------------------------------------- */
82195972f6Sopenharmony_cistatic const struct snmp_node *const snmpframeworkmib_subnodes[] = {
83195972f6Sopenharmony_ci  &snmpframeworkmibobjects_treenode.node
84195972f6Sopenharmony_ci};
85195972f6Sopenharmony_cistatic const struct snmp_tree_node snmpframeworkmib_root = SNMP_CREATE_TREE_NODE(10, snmpframeworkmib_subnodes);
86195972f6Sopenharmony_cistatic const u32_t snmpframeworkmib_base_oid[] = {1, 3, 6, 1, 6, 3, 10};
87195972f6Sopenharmony_ciconst struct snmp_mib snmpframeworkmib = {snmpframeworkmib_base_oid, LWIP_ARRAYSIZE(snmpframeworkmib_base_oid), &snmpframeworkmib_root.node};
88195972f6Sopenharmony_ci
89195972f6Sopenharmony_ci/* --- snmpFrameworkMIB  ----------------------------------------------------- */
90195972f6Sopenharmony_ci#endif /* LWIP_SNMP */
91