snmp_usm_mib_module.c
Go to the documentation of this file.
1 /**
2  * @file snmp_usm_mib_module.c
3  * @brief SNMP USM MIB module
4  *
5  * @section License
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  *
9  * Copyright (C) 2010-2020 Oryx Embedded SARL. All rights reserved.
10  *
11  * This file is part of CycloneTCP Open.
12  *
13  * This program is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU General Public License
15  * as published by the Free Software Foundation; either version 2
16  * of the License, or (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, write to the Free Software Foundation,
25  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26  *
27  * @section Description
28  *
29  * The SNMP-USM-MIB describes managed objects for remotely monitoring and
30  * managing the configuration parameters for the User-Based Security Model.
31  * Refer to RFC 3414 for more details
32  *
33  * @author Oryx Embedded SARL (www.oryx-embedded.com)
34  * @version 1.9.8
35  **/
36 
37 //Switch to the appropriate trace level
38 #define TRACE_LEVEL SNMP_TRACE_LEVEL
39 
40 //Dependencies
41 #include "core/net.h"
42 #include "mibs/mib_common.h"
44 #include "mibs/snmp_usm_mib_impl.h"
45 #include "core/crypto.h"
46 #include "encoding/asn1.h"
47 #include "encoding/oid.h"
48 #include "debug.h"
49 
50 //Check TCP/IP stack configuration
51 #if (SNMP_USM_MIB_SUPPORT == ENABLED)
52 
53 
54 /**
55  * @brief SNMP USM MIB base
56  **/
57 
59 
60 
61 /**
62  * @brief SNMP USM MIB objects
63  **/
64 
66 {
67  //usmStatsUnsupportedSecLevels object (1.3.6.1.6.3.15.1.1.1)
68  {
69  "usmStatsUnsupportedSecLevels",
70  {43, 6, 1, 6, 3, 15, 1, 1, 1},
71  9,
76  NULL,
77  sizeof(uint32_t),
78  NULL,
79  NULL,
80  NULL
81  },
82  //usmStatsNotInTimeWindows object (1.3.6.1.6.3.15.1.1.2)
83  {
84  "usmStatsNotInTimeWindows",
85  {43, 6, 1, 6, 3, 15, 1, 1, 2},
86  9,
91  NULL,
92  sizeof(uint32_t),
93  NULL,
94  NULL,
95  NULL
96  },
97  //usmStatsUnknownUserNames object (1.3.6.1.6.3.15.1.1.3)
98  {
99  "usmStatsUnknownUserNames",
100  {43, 6, 1, 6, 3, 15, 1, 1, 3},
101  9,
106  NULL,
107  sizeof(uint32_t),
108  NULL,
109  NULL,
110  NULL
111  },
112  //usmStatsUnknownEngineIDs object (1.3.6.1.6.3.15.1.1.4)
113  {
114  "usmStatsUnknownEngineIDs",
115  {43, 6, 1, 6, 3, 15, 1, 1, 4},
116  9,
121  NULL,
122  sizeof(uint32_t),
123  NULL,
124  NULL,
125  NULL
126  },
127  //usmStatsWrongDigests object (1.3.6.1.6.3.15.1.1.5)
128  {
129  "usmStatsWrongDigests",
130  {43, 6, 1, 6, 3, 15, 1, 1, 5},
131  9,
136  NULL,
137  sizeof(uint32_t),
138  NULL,
139  NULL,
140  NULL
141  },
142  //usmStatsDecryptionErrors object (1.3.6.1.6.3.15.1.1.6)
143  {
144  "usmStatsDecryptionErrors",
145  {43, 6, 1, 6, 3, 15, 1, 1, 6},
146  9,
151  NULL,
152  sizeof(uint32_t),
153  NULL,
154  NULL,
155  NULL
156  },
157  //usmUserSpinLock object (1.3.6.1.6.3.15.1.2.1)
158  {
159  "usmUserSpinLock",
160  {43, 6, 1, 6, 3, 15, 1, 2, 1},
161  9,
165  NULL,
166  NULL,
167  sizeof(int32_t),
170  NULL
171  },
172  //usmUserSecurityName object (1.3.6.1.6.3.15.1.2.2.1.3)
173  {
174  "usmUserSecurityName",
175  {43, 6, 1, 6, 3, 15, 1, 2, 2, 1, 3},
176  11,
180  NULL,
181  NULL,
182  0,
183  NULL,
186  },
187  //usmUserCloneFrom object (1.3.6.1.6.3.15.1.2.2.1.4)
188  {
189  "usmUserCloneFrom",
190  {43, 6, 1, 6, 3, 15, 1, 2, 2, 1, 4},
191  11,
195  NULL,
196  NULL,
197  0,
201  },
202  //usmUserAuthProtocol object (1.3.6.1.6.3.15.1.2.2.1.5)
203  {
204  "usmUserAuthProtocol",
205  {43, 6, 1, 6, 3, 15, 1, 2, 2, 1, 5},
206  11,
210  NULL,
211  NULL,
212  0,
216  },
217  //usmUserAuthKeyChange object (1.3.6.1.6.3.15.1.2.2.1.6)
218  {
219  "usmUserAuthKeyChange",
220  {43, 6, 1, 6, 3, 15, 1, 2, 2, 1, 6},
221  11,
225  NULL,
226  NULL,
227  0,
231  },
232  //usmUserOwnAuthKeyChange object (1.3.6.1.6.3.15.1.2.2.1.7)
233  {
234  "usmUserOwnAuthKeyChange",
235  {43, 6, 1, 6, 3, 15, 1, 2, 2, 1, 7},
236  11,
240  NULL,
241  NULL,
242  0,
246  },
247  //usmUserPrivProtocol object (1.3.6.1.6.3.15.1.2.2.1.8)
248  {
249  "usmUserPrivProtocol",
250  {43, 6, 1, 6, 3, 15, 1, 2, 2, 1, 8},
251  11,
255  NULL,
256  NULL,
257  0,
261  },
262  //usmUserPrivKeyChange object (1.3.6.1.6.3.15.1.2.2.1.9)
263  {
264  "usmUserPrivKeyChange",
265  {43, 6, 1, 6, 3, 15, 1, 2, 2, 1, 9},
266  11,
270  NULL,
271  NULL,
272  0,
276  },
277  //usmUserOwnPrivKeyChange object (1.3.6.1.6.3.15.1.2.2.1.10)
278  {
279  "usmUserOwnPrivKeyChange",
280  {43, 6, 1, 6, 3, 15, 1, 2, 2, 1, 10},
281  11,
285  NULL,
286  NULL,
287  0,
291  },
292  //usmUserPublic object (1.3.6.1.6.3.15.1.2.2.1.11)
293  {
294  "usmUserPublic",
295  {43, 6, 1, 6, 3, 15, 1, 2, 2, 1, 11},
296  11,
300  NULL,
301  NULL,
302  0,
306  },
307  //usmUserStorageType object (1.3.6.1.6.3.15.1.2.2.1.12)
308  {
309  "usmUserStorageType",
310  {43, 6, 1, 6, 3, 15, 1, 2, 2, 1, 12},
311  11,
315  NULL,
316  NULL,
317  sizeof(int32_t),
321  },
322  //usmUserStatus object (1.3.6.1.6.3.15.1.2.2.1.13)
323  {
324  "usmUserStatus",
325  {43, 6, 1, 6, 3, 15, 1, 2, 2, 1, 13},
326  11,
330  NULL,
331  NULL,
332  sizeof(int32_t),
336  }
337 };
338 
339 
340 /**
341  * @brief SNMP USM MIB module
342  **/
343 
345 {
346  "SNMP-USM-MIB",
347  {43, 6, 1, 6, 3, 15},
348  6,
356 };
357 
358 #endif
OID (Object Identifier)
uint32_t usmStatsNotInTimeWindows
uint32_t usmStatsWrongDigests
error_t snmpUsmMibLoad(void *context)
Load SNMP USM MIB module.
error_t snmpUsmMibGetUserSpinLock(const MibObject *object, const uint8_t *oid, size_t oidLen, MibVariant *value, size_t *valueLen)
Get usmUserSpinLock object value.
error_t snmpUsmMibSetUserEntry(const MibObject *object, const uint8_t *oid, size_t oidLen, const MibVariant *value, size_t valueLen, bool_t commit)
Set usmUserEntry object value.
SnmpUsmMibBase snmpUsmMibBase
SNMP USM MIB base.
const MibModule snmpUsmMibModule
SNMP USM MIB module.
#define ASN1_CLASS_UNIVERSAL
Definition: asn1.h:48
void snmpUsmMibUnlock(void)
Unlock SNMP USM MIB base.
General definitions for cryptographic algorithms.
SNMP USM MIB base.
void snmpUsmMibUnload(void *context)
Unload SNMP USM MIB module.
MIB module.
Definition: mib_common.h:287
error_t snmpUsmMibGetNextUserEntry(const MibObject *object, const uint8_t *oid, size_t oidLen, uint8_t *nextOid, size_t *nextOidLen)
Get next usmUserEntry object.
error_t snmpUsmMibGetUserEntry(const MibObject *object, const uint8_t *oid, size_t oidLen, MibVariant *value, size_t *valueLen)
Get usmUserEntry object value.
uint32_t usmStatsUnsupportedSecLevels
uint32_t usmStatsDecryptionErrors
uint32_t usmStatsUnknownUserNames
Common definitions for MIB modules.
SNMP USM MIB module implementation.
error_t snmpUsmMibInit(void)
SNMP USM MIB module initialization.
#define MibObject
Definition: mib_common.h:46
error_t snmpUsmMibSetUserSpinLock(const MibObject *object, const uint8_t *oid, size_t oidLen, const MibVariant *value, size_t valueLen, bool_t commit)
Set usmUserSpinLock object value.
uint32_t usmStatsUnknownEngineIDs
SNMP USM MIB module.
TCP/IP stack core.
#define ASN1_CLASS_APPLICATION
Definition: asn1.h:49
const MibObject snmpUsmMibObjects[]
SNMP USM MIB objects.
void snmpUsmMibLock(void)
Lock SNMP USM MIB base.
Debugging facilities.
ASN.1 (Abstract Syntax Notation One)
#define arraysize(a)
Definition: os_port.h:70