View-based Access Control Model (VACM) for SNMP. More...
#include "core/net.h"
#include "snmp/snmp_agent.h"
#include "mibs/mib_common.h"
#include "core/crypto.h"
Go to the source code of this file.
Data Structures | |
struct | SnmpGroupEntry |
Group table entry. More... | |
struct | SnmpAccessEntry |
Access table entry. More... | |
struct | SnmpViewEntry |
View table entry. More... | |
Macros | |
#define | SNMP_AGENT_VACM_SUPPORT DISABLED |
Enumerations | |
enum | SnmpContextMatch { SNMP_CONTEXT_MATCH_INVALID = 0, SNMP_CONTEXT_MATCH_EXACT = 1, SNMP_CONTEXT_MATCH_PREFIX = 2 } |
Context match. More... | |
enum | SnmpViewType { SNMP_VIEW_TYPE_INVALID = 0, SNMP_VIEW_TYPE_INCLUDED = 1, SNMP_VIEW_TYPE_EXCLUDED = 2 } |
View type. More... | |
Functions | |
error_t | snmpIsAccessAllowed (SnmpAgentContext *context, const SnmpMessage *message, const uint8_t *oid, size_t oidLen) |
Access control verification. More... | |
SnmpGroupEntry * | snmpCreateGroupEntry (SnmpAgentContext *context) |
Create a new group entry. More... | |
SnmpGroupEntry * | snmpFindGroupEntry (SnmpAgentContext *context, uint_t securityModel, const char_t *securityName, size_t securityNameLen) |
Search the group table. More... | |
SnmpAccessEntry * | snmpCreateAccessEntry (SnmpAgentContext *context) |
Create a new access entry. More... | |
SnmpAccessEntry * | snmpFindAccessEntry (SnmpAgentContext *context, const char_t *groupName, const char_t *contextPrefix, uint_t securityModel, uint_t securityLevel) |
Search the access table for a given entry. More... | |
SnmpAccessEntry * | snmpSelectAccessEntry (SnmpAgentContext *context, const char_t *groupName, const char_t *contextName, size_t contextNameLen, SnmpSecurityModel securityModel, SnmpSecurityLevel securityLevel) |
Find an access entry that matches the selection criteria. More... | |
SnmpViewEntry * | snmpCreateViewEntry (SnmpAgentContext *context) |
Create a new view entry. More... | |
SnmpViewEntry * | snmpFindViewEntry (SnmpAgentContext *context, const char_t *viewName, const uint8_t *subtree, size_t subtreeLen) |
Search the view table for a given entry. More... | |
SnmpViewEntry * | snmpSelectViewEntry (SnmpAgentContext *context, const char_t *viewName, const uint8_t *oid, size_t oidLen) |
Find a view entry that matches the selection criteria. More... | |
Detailed Description
View-based Access Control Model (VACM) for SNMP.
License
SPDX-License-Identifier: GPL-2.0-or-later
Copyright (C) 2010-2024 Oryx Embedded SARL. All rights reserved.
This file is part of CycloneTCP Open.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- Version
- 2.4.4
Definition in file snmp_agent_vacm.h.
Macro Definition Documentation
◆ SNMP_AGENT_VACM_SUPPORT
#define SNMP_AGENT_VACM_SUPPORT DISABLED |
Definition at line 42 of file snmp_agent_vacm.h.
Enumeration Type Documentation
◆ SnmpContextMatch
enum SnmpContextMatch |
Context match.
Enumerator | |
---|---|
SNMP_CONTEXT_MATCH_INVALID | |
SNMP_CONTEXT_MATCH_EXACT | |
SNMP_CONTEXT_MATCH_PREFIX |
Definition at line 57 of file snmp_agent_vacm.h.
◆ SnmpViewType
enum SnmpViewType |
View type.
Enumerator | |
---|---|
SNMP_VIEW_TYPE_INVALID | |
SNMP_VIEW_TYPE_INCLUDED | |
SNMP_VIEW_TYPE_EXCLUDED |
Definition at line 69 of file snmp_agent_vacm.h.
Function Documentation
◆ snmpCreateAccessEntry()
SnmpAccessEntry* snmpCreateAccessEntry | ( | SnmpAgentContext * | context | ) |
Create a new access entry.
- Parameters
-
[in] context Pointer to the SNMP agent context
- Returns
- Pointer to the newly created entry
Definition at line 325 of file snmp_agent_vacm.c.
◆ snmpCreateGroupEntry()
SnmpGroupEntry* snmpCreateGroupEntry | ( | SnmpAgentContext * | context | ) |
Create a new group entry.
- Parameters
-
[in] context Pointer to the SNMP agent context
- Returns
- Pointer to the newly created entry
Definition at line 223 of file snmp_agent_vacm.c.
◆ snmpCreateViewEntry()
SnmpViewEntry* snmpCreateViewEntry | ( | SnmpAgentContext * | context | ) |
Create a new view entry.
- Parameters
-
[in] context Pointer to the SNMP agent context
- Returns
- Pointer to the newly created entry
Definition at line 548 of file snmp_agent_vacm.c.
◆ snmpFindAccessEntry()
SnmpAccessEntry* snmpFindAccessEntry | ( | SnmpAgentContext * | context, |
const char_t * | groupName, | ||
const char_t * | contextPrefix, | ||
uint_t | securityModel, | ||
uint_t | securityLevel | ||
) |
Search the access table for a given entry.
- Parameters
-
[in] context Pointer to the SNMP agent context [in] groupName Group name [in] contextPrefix Context name prefix [in] securityModel Security model [in] securityLevel Security level
- Returns
- Pointer to the matching entry
Definition at line 378 of file snmp_agent_vacm.c.
◆ snmpFindGroupEntry()
SnmpGroupEntry* snmpFindGroupEntry | ( | SnmpAgentContext * | context, |
uint_t | securityModel, | ||
const char_t * | securityName, | ||
size_t | securityNameLen | ||
) |
Search the group table.
- Parameters
-
[in] context Pointer to the SNMP agent context [in] securityModel Security model [in] securityName Pointer to the security name [in] securityNameLen Length of the security name
- Returns
- Pointer to the matching entry
Definition at line 275 of file snmp_agent_vacm.c.
◆ snmpFindViewEntry()
SnmpViewEntry* snmpFindViewEntry | ( | SnmpAgentContext * | context, |
const char_t * | viewName, | ||
const uint8_t * | subtree, | ||
size_t | subtreeLen | ||
) |
Search the view table for a given entry.
- Parameters
-
[in] context Pointer to the SNMP agent context [in] viewName View name [in] subtree Pointer to the MIB subtree [in] subtreeLen Length of the MIB subtree
- Returns
- Pointer to the matching entry
Definition at line 600 of file snmp_agent_vacm.c.
◆ snmpIsAccessAllowed()
error_t snmpIsAccessAllowed | ( | SnmpAgentContext * | context, |
const SnmpMessage * | message, | ||
const uint8_t * | oid, | ||
size_t | oidLen | ||
) |
Access control verification.
- Parameters
-
[in] context Pointer to the SNMP agent context [in] message Pointer to the received SNMP message [in] oid OID for the managed object [in] oidLen Length of the OID, in bytes
- Returns
- Error code
Definition at line 61 of file snmp_agent_vacm.c.
◆ snmpSelectAccessEntry()
SnmpAccessEntry* snmpSelectAccessEntry | ( | SnmpAgentContext * | context, |
const char_t * | groupName, | ||
const char_t * | contextName, | ||
size_t | contextNameLen, | ||
SnmpSecurityModel | securityModel, | ||
SnmpSecurityLevel | securityLevel | ||
) |
Find an access entry that matches the selection criteria.
- Parameters
-
[in] context Pointer to the SNMP agent context [in] groupName NULL-terminated string that contains the group name [in] contextName Pointer to the context name [in] contextNameLen Length of the context name [in] securityModel Security model [in] securityLevel Security level
- Returns
- Pointer to the matching entry
Definition at line 435 of file snmp_agent_vacm.c.
◆ snmpSelectViewEntry()
SnmpViewEntry* snmpSelectViewEntry | ( | SnmpAgentContext * | context, |
const char_t * | viewName, | ||
const uint8_t * | oid, | ||
size_t | oidLen | ||
) |
Find a view entry that matches the selection criteria.
- Parameters
-
[in] context Pointer to the SNMP agent context [in] viewName NULL-terminated string that contains the view name [in] oid OID for the managed object [in] oidLen Length of the OID, in bytes
- Returns
- Pointer to the matching entry
Definition at line 653 of file snmp_agent_vacm.c.