snmp_agent_vacm.h File Reference

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...
 
SnmpGroupEntrysnmpCreateGroupEntry (SnmpAgentContext *context)
 Create a new group entry. More...
 
SnmpGroupEntrysnmpFindGroupEntry (SnmpAgentContext *context, uint_t securityModel, const char_t *securityName, size_t securityNameLen)
 Search the group table. More...
 
SnmpAccessEntrysnmpCreateAccessEntry (SnmpAgentContext *context)
 Create a new access entry. More...
 
SnmpAccessEntrysnmpFindAccessEntry (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...
 
SnmpAccessEntrysnmpSelectAccessEntry (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...
 
SnmpViewEntrysnmpCreateViewEntry (SnmpAgentContext *context)
 Create a new view entry. More...
 
SnmpViewEntrysnmpFindViewEntry (SnmpAgentContext *context, const char_t *viewName, const uint8_t *subtree, size_t subtreeLen)
 Search the view table for a given entry. More...
 
SnmpViewEntrysnmpSelectViewEntry (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.

Author
Oryx Embedded SARL (www.oryx-embedded.com)
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

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

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]contextPointer 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]contextPointer 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]contextPointer 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]contextPointer to the SNMP agent context
[in]groupNameGroup name
[in]contextPrefixContext name prefix
[in]securityModelSecurity model
[in]securityLevelSecurity 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]contextPointer to the SNMP agent context
[in]securityModelSecurity model
[in]securityNamePointer to the security name
[in]securityNameLenLength 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]contextPointer to the SNMP agent context
[in]viewNameView name
[in]subtreePointer to the MIB subtree
[in]subtreeLenLength 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]contextPointer to the SNMP agent context
[in]messagePointer to the received SNMP message
[in]oidOID for the managed object
[in]oidLenLength 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]contextPointer to the SNMP agent context
[in]groupNameNULL-terminated string that contains the group name
[in]contextNamePointer to the context name
[in]contextNameLenLength of the context name
[in]securityModelSecurity model
[in]securityLevelSecurity 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]contextPointer to the SNMP agent context
[in]viewNameNULL-terminated string that contains the view name
[in]oidOID for the managed object
[in]oidLenLength of the OID, in bytes
Returns
Pointer to the matching entry

Definition at line 653 of file snmp_agent_vacm.c.