mikroSDK Reference Manual
snmp_agent_vacm.h
Go to the documentation of this file.
1
31#ifndef _SNMP_AGENT_VACM_H
32#define _SNMP_AGENT_VACM_H
33
34//Dependencies
35#include "core/net.h"
36#include "snmp/snmp_agent.h"
37#include "mibs/mib_common.h"
38#include "core/crypto.h"
39
40//VACM support
41#ifndef SNMP_AGENT_VACM_SUPPORT
42 #define SNMP_AGENT_VACM_SUPPORT DISABLED
43#elif (SNMP_AGENT_VACM_SUPPORT != ENABLED && SNMP_AGENT_VACM_SUPPORT != DISABLED)
44 #error SNMP_AGENT_VACM_SUPPORT parameter is not valid
45#endif
46
47//C++ guard
48#ifdef __cplusplus
49extern "C" {
50#endif
51
52
57typedef enum
58{
59 SNMP_CONTEXT_MATCH_INVALID = 0,
60 SNMP_CONTEXT_MATCH_EXACT = 1,
61 SNMP_CONTEXT_MATCH_PREFIX = 2
63
64
69typedef enum
70{
71 SNMP_VIEW_TYPE_INVALID = 0,
72 SNMP_VIEW_TYPE_INCLUDED = 1,
73 SNMP_VIEW_TYPE_EXCLUDED = 2
75
76
81typedef struct
82{
83 MibRowStatus status;
84 SnmpSecurityModel securityModel;
85 char_t securityName[SNMP_MAX_GROUP_NAME_LEN + 1];
86 char_t groupName[SNMP_MAX_GROUP_NAME_LEN + 1];
88
89
94typedef struct
95{
96 MibRowStatus status;
97 char_t groupName[SNMP_MAX_GROUP_NAME_LEN + 1];
98 char_t contextPrefix[SNMP_MAX_CONTEXT_NAME_LEN + 1];
99 SnmpSecurityModel securityModel;
100 SnmpSecurityLevel securityLevel;
101 SnmpContextMatch contextMatch;
102 char_t readViewName[SNMP_MAX_VIEW_NAME_LEN + 1];
103 char_t writeViewName[SNMP_MAX_VIEW_NAME_LEN + 1];
104 char_t notifyViewName[SNMP_MAX_VIEW_NAME_LEN + 1];
106
107
112typedef struct
113{
114 MibRowStatus status;
115 char_t viewName[SNMP_MAX_VIEW_NAME_LEN + 1];
116 uint8_t subtree[SNMP_MAX_OID_SIZE];
117 size_t subtreeLen;
118 uint8_t mask[SNMP_MAX_BIT_MASK_SIZE];
119 size_t maskLen;
120 SnmpViewType type;
122
123
124//VACM related functions
125error_t snmpIsAccessAllowed(SnmpAgentContext *context,
126 const SnmpMessage *message, const uint8_t *oid, size_t oidLen);
127
128SnmpGroupEntry *snmpCreateGroupEntry(SnmpAgentContext *context);
129
130SnmpGroupEntry *snmpFindGroupEntry(SnmpAgentContext *context,
131 uint_t securityModel, const char_t *securityName, size_t securityNameLen);
132
133SnmpAccessEntry *snmpCreateAccessEntry(SnmpAgentContext *context);
134
135SnmpAccessEntry *snmpFindAccessEntry(SnmpAgentContext *context,
136 const char_t *groupName, const char_t *contextPrefix,
137 uint_t securityModel, uint_t securityLevel);
138
139SnmpAccessEntry *snmpSelectAccessEntry(SnmpAgentContext *context,
140 const char_t *groupName, const char_t *contextName, size_t contextNameLen,
141 SnmpSecurityModel securityModel, SnmpSecurityLevel securityLevel);
142
143SnmpViewEntry *snmpCreateViewEntry(SnmpAgentContext *context);
144
145SnmpViewEntry *snmpFindViewEntry(SnmpAgentContext *context,
146 const char_t *viewName, const uint8_t *subtree, size_t subtreeLen);
147
148SnmpViewEntry *snmpSelectViewEntry(SnmpAgentContext *context,
149 const char_t *viewName, const uint8_t *oid, size_t oidLen);
150
151//C++ guard
152#ifdef __cplusplus
153}
154#endif
155
156#endif
error_t
Error codes.
Definition error.h:43
Common definitions for MIB modules.
MibRowStatus
Row status.
Definition mib_common.h:101
TCP/IP stack core.
SNMP agent (Simple Network Management Protocol)
SnmpSecurityLevel
Security levels.
Definition snmp_agent_usm.h:219
SnmpSecurityModel
Security models.
Definition snmp_agent_usm.h:205
SnmpContextMatch
Context match.
Definition snmp_agent_vacm.h:58
SnmpViewType
View type.
Definition snmp_agent_vacm.h:70
Access table entry.
Definition snmp_agent_vacm.h:95
Group table entry.
Definition snmp_agent_vacm.h:82
SNMP message.
Definition snmp_agent_message.h:56
View table entry.
Definition snmp_agent_vacm.h:113