snmp_agent_vacm.c
Go to the documentation of this file.
1 /**
2  * @file snmp_agent_vacm.c
3  * @brief View-based Access Control Model (VACM) for SNMP
4  *
5  * @section License
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  *
9  * Copyright (C) 2010-2024 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  * This module implements the View-based Access Control Model (VACM) for Simple
30  * Network Management Protocol (SNMP). Refer to RFC 3415 for complete details
31  *
32  * @author Oryx Embedded SARL (www.oryx-embedded.com)
33  * @version 2.4.0
34  **/
35 
36 //Switch to the appropriate trace level
37 #define TRACE_LEVEL SNMP_TRACE_LEVEL
38 
39 //Dependencies
40 #include "core/net.h"
41 #include "snmp/snmp_agent.h"
42 #include "snmp/snmp_agent_vacm.h"
43 #include "core/crypto.h"
44 #include "encoding/asn1.h"
45 #include "encoding/oid.h"
46 #include "debug.h"
47 
48 //Check TCP/IP stack configuration
49 #if (SNMP_AGENT_SUPPORT == ENABLED && SNMP_AGENT_VACM_SUPPORT == ENABLED)
50 
51 
52 /**
53  * @brief Access control verification
54  * @param[in] context Pointer to the SNMP agent context
55  * @param[in] message Pointer to the received SNMP message
56  * @param[in] oid OID for the managed object
57  * @param[in] oidLen Length of the OID, in bytes
58  * @return Error code
59  **/
60 
62  const SnmpMessage *message, const uint8_t *oid, size_t oidLen)
63 {
64  SnmpSecurityModel securityModel;
65  SnmpSecurityLevel securityLevel;
66  const char_t *securityName;
67  size_t securityNameLen;
68  const char_t *contextName;
69  size_t contextNameLen;
70  const char_t *viewName;
71  const SnmpGroupEntry *groupEntry;
72  const SnmpAccessEntry *accessEntry;
73  const SnmpViewEntry *viewEntry;
74 
75 #if (SNMP_V1_SUPPORT == ENABLED)
76  //SNMPv1 version?
77  if(message->version == SNMP_VERSION_1)
78  {
79  //Set security parameters
80  securityModel = SNMP_SECURITY_MODEL_V1;
82  securityName = message->community;
83  securityNameLen = message->communityLen;
84  contextName = context->contextName;
85  contextNameLen = osStrlen(context->contextName);
86  }
87  else
88 #endif
89 #if (SNMP_V2C_SUPPORT == ENABLED)
90  //SNMPv2c version?
91  if(message->version == SNMP_VERSION_2C)
92  {
93  //Set security parameters
94  securityModel = SNMP_SECURITY_MODEL_V2C;
96  securityName = message->community;
97  securityNameLen = message->communityLen;
98  contextName = context->contextName;
99  contextNameLen = osStrlen(context->contextName);
100  }
101  else
102 #endif
103 #if (SNMP_V3_SUPPORT == ENABLED)
104  //SNMPv3 version?
105  if(message->version == SNMP_VERSION_3)
106  {
107  //Set security parameters
108  securityModel = (SnmpSecurityModel) message->msgSecurityModel;
109  securityLevel = SNMP_SECURITY_LEVEL_NO_AUTH_NO_PRIV;
110  securityName = message->msgUserName;
111  securityNameLen = message->msgUserNameLen;
112  contextName = message->contextName;
113  contextNameLen = message->contextNameLen;
114 
115  //Check whether the authFlag is set
116  if((message->msgFlags & SNMP_MSG_FLAG_AUTH) != 0)
117  {
118  //Check whether the privFlag is set
119  if((message->msgFlags & SNMP_MSG_FLAG_PRIV) != 0)
120  {
121  securityLevel = SNMP_SECURITY_LEVEL_AUTH_PRIV;
122  }
123  else
124  {
125  securityLevel = SNMP_SECURITY_LEVEL_AUTH_NO_PRIV;
126  }
127  }
128  }
129  else
130 #endif
131  //Invalid SNMP version?
132  {
133  //Report an error
134  return ERROR_INVALID_VERSION;
135  }
136 
137  //The vacmContextTable is consulted for information about the SNMP
138  //context identified by the contextName. If information about this
139  //SNMP context is absent from the table, then an errorIndication
140  //(noSuchContext) is returned to the calling module
141  if(contextNameLen != osStrlen(context->contextName))
142  return ERROR_UNKNOWN_CONTEXT;
143 
144  //Check context name
145  if(osStrncmp(contextName, context->contextName, contextNameLen))
146  return ERROR_UNKNOWN_CONTEXT;
147 
148  //The vacmSecurityToGroupTable is consulted for mapping the securityModel
149  //and securityName to a groupName
150  groupEntry = snmpFindGroupEntry(context, securityModel,
151  securityName, securityNameLen);
152 
153  //If the information about this combination is absent from the table, then
154  //an errorIndication (noGroupName) is returned to the calling module
155  if(groupEntry == NULL)
157 
158  //The vacmAccessTable is consulted for information about the groupName,
159  //contextName, securityModel and securityLevel
160  accessEntry = snmpSelectAccessEntry(context, groupEntry->groupName,
161  contextName, contextNameLen, securityModel, securityLevel);
162 
163  //If information about this combination is absent from the table, then
164  //an errorIndication (noAccessEntry) is returned to the calling module
165  if(accessEntry == NULL)
167 
168  //Select the proper MIB view
169  if(message->pduType == SNMP_PDU_GET_REQUEST ||
170  message->pduType == SNMP_PDU_GET_NEXT_REQUEST ||
172  {
173  //The read view is used for checking access rights
174  viewName = accessEntry->readViewName;
175  }
176  else if(message->pduType == SNMP_PDU_SET_REQUEST)
177  {
178  //The write view is used for checking access rights
179  viewName = accessEntry->writeViewName;
180  }
181  else if(message->pduType == SNMP_PDU_TRAP ||
182  message->pduType == SNMP_PDU_TRAP_V2 ||
183  message->pduType == SNMP_PDU_INFORM_REQUEST)
184  {
185  //The notify view is used for checking access rights
186  viewName = accessEntry->notifyViewName;
187  }
188  else
189  {
190  //Report an error
192  }
193 
194  //If the view to be used is the empty view (zero length viewName) then
195  //an errorIndication (noSuchView) is returned to the calling module
196  if(viewName[0] == '\0')
198 
199  //Check whether the specified variableName is in the MIB view
200  viewEntry = snmpSelectViewEntry(context, viewName, oid, oidLen);
201 
202  //If there is no view configured for the specified viewType, then an
203  //errorIndication (noSuchView) is returned to the calling module
204  if(viewEntry == NULL)
206 
207  //If the specified variableName (object instance) is not in the MIB view,
208  //then an errorIndication (notInView) is returned to the calling module
209  if(viewEntry->type != SNMP_VIEW_TYPE_INCLUDED)
211 
212  //Otherwise, the specified variableName is in the MIB view
213  return NO_ERROR;
214 }
215 
216 
217 /**
218  * @brief Create a new group entry
219  * @param[in] context Pointer to the SNMP agent context
220  * @return Pointer to the newly created entry
221  **/
222 
224 {
225  uint_t i;
226  SnmpGroupEntry *entry;
227 
228  //Initialize pointer
229  entry = NULL;
230 
231  //Loop through the list of groups
232  for(i = 0; i < SNMP_AGENT_GROUP_TABLE_SIZE; i++)
233  {
234  //Check current status
235  if(context->groupTable[i].status == MIB_ROW_STATUS_UNUSED)
236  {
237  //An unused entry has been found
238  entry = &context->groupTable[i];
239  //We are done
240  break;
241  }
242  }
243 
244  //Check whether the group table runs out of space
245  if(entry == NULL)
246  {
247  //Loop through the list of groups
248  for(i = 0; i < SNMP_AGENT_GROUP_TABLE_SIZE; i++)
249  {
250  //Check current status
251  if(context->groupTable[i].status == MIB_ROW_STATUS_NOT_READY)
252  {
253  //Reuse the current entry
254  entry = &context->groupTable[i];
255  //We are done
256  break;
257  }
258  }
259  }
260 
261  //Return a pointer to the newly created entry
262  return entry;
263 }
264 
265 
266 /**
267  * @brief Search the group table
268  * @param[in] context Pointer to the SNMP agent context
269  * @param[in] securityModel Security model
270  * @param[in] securityName Pointer to the security name
271  * @param[in] securityNameLen Length of the security name
272  * @return Pointer to the matching entry
273  **/
274 
276  uint_t securityModel, const char_t *securityName, size_t securityNameLen)
277 {
278  uint_t i;
279  SnmpGroupEntry *entry;
280 
281  //Loop through the list of groups
282  for(i = 0; i < SNMP_AGENT_GROUP_TABLE_SIZE; i++)
283  {
284  //Point to the current entry
285  entry = &context->groupTable[i];
286 
287  //Check current status
288  if(entry->status != MIB_ROW_STATUS_UNUSED)
289  {
290  //Compare security model
291  if(entry->securityModel == securityModel)
292  {
293  //Check the length of the security name
294  if(osStrlen(entry->securityName) == securityNameLen)
295  {
296  //Compare security name
297  if(!osStrncmp(entry->securityName, securityName, securityNameLen))
298  {
299  //A matching entry has been found
300  break;
301  }
302  }
303  }
304  }
305  }
306 
307  //Any matching entry found?
309  {
310  return entry;
311  }
312  else
313  {
314  return NULL;
315  }
316 }
317 
318 
319 /**
320  * @brief Create a new access entry
321  * @param[in] context Pointer to the SNMP agent context
322  * @return Pointer to the newly created entry
323  **/
324 
326 {
327  uint_t i;
328  SnmpAccessEntry *entry;
329 
330  //Initialize pointer
331  entry = NULL;
332 
333  //Loop through the list of access rights
334  for(i = 0; i < SNMP_AGENT_ACCESS_TABLE_SIZE; i++)
335  {
336  //Check current status
337  if(context->accessTable[i].status == MIB_ROW_STATUS_UNUSED)
338  {
339  //An unused entry has been found
340  entry = &context->accessTable[i];
341  //We are done
342  break;
343  }
344  }
345 
346  //Check whether the group table runs out of space
347  if(entry == NULL)
348  {
349  //Loop through the list of access rights
350  for(i = 0; i < SNMP_AGENT_ACCESS_TABLE_SIZE; i++)
351  {
352  //Check current status
353  if(context->accessTable[i].status == MIB_ROW_STATUS_NOT_READY)
354  {
355  //Reuse the current entry
356  entry = &context->accessTable[i];
357  //We are done
358  break;
359  }
360  }
361  }
362 
363  //Return a pointer to the newly created entry
364  return entry;
365 }
366 
367 
368 /**
369  * @brief Search the access table for a given entry
370  * @param[in] context Pointer to the SNMP agent context
371  * @param[in] groupName Group name
372  * @param[in] contextPrefix Context name prefix
373  * @param[in] securityModel Security model
374  * @param[in] securityLevel Security level
375  * @return Pointer to the matching entry
376  **/
377 
379  const char_t *groupName, const char_t *contextPrefix,
380  uint_t securityModel, uint_t securityLevel)
381 {
382  uint_t i;
383  SnmpAccessEntry *entry;
384 
385  //Loop through the list of access rights
386  for(i = 0; i < SNMP_AGENT_ACCESS_TABLE_SIZE; i++)
387  {
388  //Point to the current entry
389  entry = &context->accessTable[i];
390 
391  //Check current status
392  if(entry->status != MIB_ROW_STATUS_UNUSED)
393  {
394  //Compare group name
395  if(!osStrcmp(entry->groupName, groupName))
396  {
397  //Compare context name prefix
398  if(!osStrcmp(entry->contextPrefix, contextPrefix))
399  {
400  //Compare security model and security level
401  if(entry->securityModel == securityModel &&
402  entry->securityLevel == securityLevel)
403  {
404  //A matching entry has been found
405  break;
406  }
407  }
408  }
409  }
410  }
411 
412  //Return a pointer to the matching entry
414  {
415  return entry;
416  }
417  else
418  {
419  return NULL;
420  }
421 }
422 
423 
424 /**
425  * @brief Find an access entry that matches the selection criteria
426  * @param[in] context Pointer to the SNMP agent context
427  * @param[in] groupName NULL-terminated string that contains the group name
428  * @param[in] contextName Pointer to the context name
429  * @param[in] contextNameLen Length of the context name
430  * @param[in] securityModel Security model
431  * @param[in] securityLevel Security level
432  * @return Pointer to the matching entry
433  **/
434 
436  const char_t *groupName, const char_t *contextName, size_t contextNameLen,
437  SnmpSecurityModel securityModel, SnmpSecurityLevel securityLevel)
438 {
439  uint_t i;
440  size_t n;
441  bool_t acceptable;
442  SnmpAccessEntry *entry;
443  SnmpAccessEntry *selectedEntry;
444 
445  //Initialize pointer
446  selectedEntry = NULL;
447 
448  //Loop through the list of access rights
449  for(i = 0; i < SNMP_AGENT_ACCESS_TABLE_SIZE; i++)
450  {
451  //Point to the current entry
452  entry = &context->accessTable[i];
453 
454  //Check current status
455  if(entry->status == MIB_ROW_STATUS_UNUSED)
456  continue;
457 
458  //Compare group name
459  if(osStrcmp(entry->groupName, groupName))
460  continue;
461 
462  //Compare security model
464  {
465  if(entry->securityModel != securityModel)
466  continue;
467  }
468 
469  //Compare security level
470  if(entry->securityLevel > securityLevel)
471  continue;
472 
473  //Retrieve the length of the context name prefix
474  n = osStrlen(entry->contextPrefix);
475 
476  //Check the length of the context name prefix
477  if(n > contextNameLen)
478  continue;
479 
480  //Compare context name prefix
481  if(osStrncmp(entry->contextPrefix, contextName, n))
482  continue;
483 
484  //Exact match?
486  {
487  //The contextName must match exactly
488  if(n != contextNameLen)
489  continue;
490  }
491 
492  //If this set has only one member, we're done otherwise, it comes down
493  //to deciding how to weight the preferences between ContextPrefixes,
494  //SecurityModels, and SecurityLevels (refer to RFC 3415, section 4)
495  if(selectedEntry == NULL)
496  {
497  acceptable = TRUE;
498  }
499  else if(entry->securityModel == SNMP_SECURITY_MODEL_ANY)
500  {
501  acceptable = FALSE;
502  }
503  else if(selectedEntry->securityModel == SNMP_SECURITY_MODEL_ANY)
504  {
505  acceptable = TRUE;
506  }
507  else if(osStrlen(selectedEntry->contextPrefix) == contextNameLen)
508  {
509  acceptable = FALSE;
510  }
511  else if(osStrlen(entry->contextPrefix) == contextNameLen)
512  {
513  acceptable = TRUE;
514  }
515  else if(osStrlen(selectedEntry->contextPrefix) > osStrlen(entry->contextPrefix))
516  {
517  acceptable = FALSE;
518  }
519  else if(osStrlen(entry->contextPrefix) > osStrlen(selectedEntry->contextPrefix))
520  {
521  acceptable = TRUE;
522  }
523  else if(selectedEntry->securityLevel >= entry->securityLevel)
524  {
525  acceptable = FALSE;
526  }
527  else
528  {
529  acceptable = TRUE;
530  }
531 
532  //Select the proper entry
533  if(acceptable)
534  selectedEntry = entry;
535  }
536 
537  //Return a pointer to the matching entry
538  return selectedEntry;
539 }
540 
541 
542 /**
543  * @brief Create a new view entry
544  * @param[in] context Pointer to the SNMP agent context
545  * @return Pointer to the newly created entry
546  **/
547 
549 {
550  uint_t i;
551  SnmpViewEntry *entry;
552 
553  //Initialize pointer
554  entry = NULL;
555 
556  //Loop through the list of MIB views
557  for(i = 0; i < SNMP_AGENT_VIEW_TABLE_SIZE; i++)
558  {
559  //Check current status
560  if(context->viewTable[i].status == MIB_ROW_STATUS_UNUSED)
561  {
562  //An unused entry has been found
563  entry = &context->viewTable[i];
564  //We are done
565  break;
566  }
567  }
568 
569  //Check whether the group table runs out of space
570  if(entry == NULL)
571  {
572  //Loop through the list of MIB views
573  for(i = 0; i < SNMP_AGENT_VIEW_TABLE_SIZE; i++)
574  {
575  //Check current status
576  if(context->viewTable[i].status == MIB_ROW_STATUS_NOT_READY)
577  {
578  //Reuse the current entry
579  entry = &context->viewTable[i];
580  //We are done
581  break;
582  }
583  }
584  }
585 
586  //Return a pointer to the newly created entry
587  return entry;
588 }
589 
590 
591 /**
592  * @brief Search the view table for a given entry
593  * @param[in] context Pointer to the SNMP agent context
594  * @param[in] viewName View name
595  * @param[in] subtree Pointer to the MIB subtree
596  * @param[in] subtreeLen Length of the MIB subtree
597  * @return Pointer to the matching entry
598  **/
599 
601  const char_t *viewName, const uint8_t *subtree, size_t subtreeLen)
602 {
603  uint_t i;
604  SnmpViewEntry *entry;
605 
606  //Loop through the list of MIB views
607  for(i = 0; i < SNMP_AGENT_VIEW_TABLE_SIZE; i++)
608  {
609  //Point to the current entry
610  entry = &context->viewTable[i];
611 
612  //Check current status
613  if(entry->status != MIB_ROW_STATUS_UNUSED)
614  {
615  //Compare view name
616  if(!osStrcmp(entry->viewName, viewName))
617  {
618  //Check the length of the subtree
619  if(entry->subtreeLen == subtreeLen)
620  {
621  //Compare subtree
622  if(!osMemcmp(entry->subtree, subtree, subtreeLen))
623  {
624  //A matching entry has been found
625  break;
626  }
627  }
628  }
629  }
630  }
631 
632  //Return a pointer to the matching entry
634  {
635  return entry;
636  }
637  else
638  {
639  return NULL;
640  }
641 }
642 
643 
644 /**
645  * @brief Find a view entry that matches the selection criteria
646  * @param[in] context Pointer to the SNMP agent context
647  * @param[in] viewName NULL-terminated string that contains the view name
648  * @param[in] oid OID for the managed object
649  * @param[in] oidLen Length of the OID, in bytes
650  * @return Pointer to the matching entry
651  **/
652 
654  const char_t *viewName, const uint8_t *oid, size_t oidLen)
655 {
656  uint_t i;
657  uint_t subtreeLen;
658  uint_t selectedSubtreeLen;
659  bool_t acceptable;
660  SnmpViewEntry *entry;
661  SnmpViewEntry *selectedEntry;
662 
663  //Initialize pointer
664  selectedEntry = NULL;
665 
666  //Loop through the list of MIB views
667  for(i = 0; i < SNMP_AGENT_VIEW_TABLE_SIZE; i++)
668  {
669  //Point to the current entry
670  entry = &context->viewTable[i];
671 
672  //Check current status
673  if(entry->status == MIB_ROW_STATUS_UNUSED)
674  continue;
675 
676  //Compare view name
677  if(osStrcmp(entry->viewName, viewName))
678  continue;
679 
680  //Check whether the OID matches the subtree (the mask allows for a
681  //simple form of wildcarding)
682  if(!oidMatch(oid, oidLen, entry->subtree, entry->subtreeLen,
683  entry->mask, entry->maskLen))
684  {
685  continue;
686  }
687 
688  //First matching entry?
689  if(selectedEntry == NULL)
690  {
691  acceptable = TRUE;
692  }
693  else
694  {
695  //Calculate the number of sub-identifiers of the subtree
696  subtreeLen = oidCountSubIdentifiers(entry->subtree,
697  entry->subtreeLen);
698 
699  //Calculate the number of sub-identifiers of the currently selected
700  //subtree
701  selectedSubtreeLen = oidCountSubIdentifiers(selectedEntry->subtree,
702  selectedEntry->subtreeLen);
703 
704  //If multiple entries match, then select the entry whose value of
705  //vacmViewTreeFamilySubtree has the most sub-identifiers. If multiple
706  //entries match and have the same number of sub-identifiers, then the
707  //lexicographically greatest instance of vacmViewTreeFamilyType is
708  //selected
709  if(selectedSubtreeLen > subtreeLen)
710  {
711  acceptable = FALSE;
712  }
713  else if(subtreeLen > selectedSubtreeLen)
714  {
715  acceptable = TRUE;
716  }
717  else if(oidComp(selectedEntry->subtree, selectedEntry->subtreeLen,
718  entry->subtree, entry->subtreeLen) > 0)
719  {
720  acceptable = FALSE;
721  }
722  else if(oidComp(entry->subtree, entry->subtreeLen,
723  selectedEntry->subtree, selectedEntry->subtreeLen) > 0)
724  {
725  acceptable = TRUE;
726  }
727  else if(selectedEntry->type >= entry->type)
728  {
729  acceptable = FALSE;
730  }
731  else
732  {
733  acceptable = TRUE;
734  }
735  }
736 
737  //Select the proper entry
738  if(acceptable)
739  selectedEntry = entry;
740  }
741 
742  //Return a pointer to the matching entry
743  return selectedEntry;
744 }
745 
746 #endif
ASN.1 (Abstract Syntax Notation One)
uint8_t message[]
Definition: chap.h:154
unsigned int uint_t
Definition: compiler_port.h:50
char char_t
Definition: compiler_port.h:48
int bool_t
Definition: compiler_port.h:53
General definitions for cryptographic algorithms.
Debugging facilities.
uint8_t n
error_t
Error codes.
Definition: error.h:43
@ ERROR_UNKNOWN_CONTEXT
Definition: error.h:262
@ ERROR_AUTHORIZATION_FAILED
Definition: error.h:266
@ NO_ERROR
Success.
Definition: error.h:44
@ ERROR_INVALID_VERSION
Definition: error.h:118
uint8_t oid[]
Definition: lldp_tlv.h:300
uint8_t oidLen
Definition: lldp_tlv.h:299
@ MIB_ROW_STATUS_UNUSED
Definition: mib_common.h:102
@ MIB_ROW_STATUS_NOT_READY
Definition: mib_common.h:105
Ipv6Addr contextPrefix
Definition: ndp.h:519
TCP/IP stack core.
uint_t oidCountSubIdentifiers(const uint8_t *oid, size_t oidLen)
Calculate the number of sub-identifiers.
Definition: oid.c:386
int_t oidComp(const uint8_t *oid1, size_t oidLen1, const uint8_t *oid2, size_t oidLen2)
Compare object identifiers.
Definition: oid.c:103
bool_t oidMatch(const uint8_t *oid, size_t oidLen, const uint8_t *subtree, size_t subtreeLen, const uint8_t *mask, size_t maskLen)
Check whether an OID matches the specified subtree.
Definition: oid.c:245
OID (Object Identifier)
#define osStrcmp(s1, s2)
Definition: os_port.h:171
#define osMemcmp(p1, p2, length)
Definition: os_port.h:153
#define osStrlen(s)
Definition: os_port.h:165
#define osStrncmp(s1, s2, length)
Definition: os_port.h:177
#define TRUE
Definition: os_port.h:50
#define FALSE
Definition: os_port.h:46
SNMP agent (Simple Network Management Protocol)
#define SNMP_AGENT_VIEW_TABLE_SIZE
Definition: snmp_agent.h:104
#define SnmpAgentContext
Definition: snmp_agent.h:36
#define SNMP_AGENT_GROUP_TABLE_SIZE
Definition: snmp_agent.h:90
#define SNMP_AGENT_ACCESS_TABLE_SIZE
Definition: snmp_agent.h:97
SnmpSecurityLevel
Security levels.
@ SNMP_SECURITY_LEVEL_AUTH_PRIV
@ SNMP_SECURITY_LEVEL_AUTH_NO_PRIV
@ SNMP_SECURITY_LEVEL_NO_AUTH_NO_PRIV
SnmpSecurityModel
Security models.
@ SNMP_SECURITY_MODEL_ANY
Any.
@ SNMP_SECURITY_MODEL_V2C
SNMPv2c.
@ SNMP_SECURITY_MODEL_V1
SNMPv1.
@ SNMP_MSG_FLAG_PRIV
@ SNMP_MSG_FLAG_AUTH
SnmpViewEntry * snmpCreateViewEntry(SnmpAgentContext *context)
Create a new view entry.
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.
SnmpGroupEntry * snmpCreateGroupEntry(SnmpAgentContext *context)
Create a new group entry.
SnmpAccessEntry * snmpCreateAccessEntry(SnmpAgentContext *context)
Create a new access entry.
error_t snmpIsAccessAllowed(SnmpAgentContext *context, const SnmpMessage *message, const uint8_t *oid, size_t oidLen)
Access control verification.
SnmpViewEntry * snmpSelectViewEntry(SnmpAgentContext *context, const char_t *viewName, const uint8_t *oid, size_t oidLen)
Find a view entry that matches the selection criteria.
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.
SnmpGroupEntry * snmpFindGroupEntry(SnmpAgentContext *context, uint_t securityModel, const char_t *securityName, size_t securityNameLen)
Search the group table.
SnmpViewEntry * snmpFindViewEntry(SnmpAgentContext *context, const char_t *viewName, const uint8_t *subtree, size_t subtreeLen)
Search the view table for a given entry.
View-based Access Control Model (VACM) for SNMP.
@ SNMP_CONTEXT_MATCH_EXACT
@ SNMP_VIEW_TYPE_INCLUDED
@ SNMP_PDU_TRAP_V2
Definition: snmp_common.h:157
@ SNMP_PDU_GET_REQUEST
Definition: snmp_common.h:150
@ SNMP_PDU_INFORM_REQUEST
Definition: snmp_common.h:156
@ SNMP_PDU_TRAP
Definition: snmp_common.h:154
@ SNMP_PDU_GET_NEXT_REQUEST
Definition: snmp_common.h:151
@ SNMP_PDU_GET_BULK_REQUEST
Definition: snmp_common.h:155
@ SNMP_PDU_SET_REQUEST
Definition: snmp_common.h:153
@ SNMP_VERSION_1
Definition: snmp_common.h:138
@ SNMP_VERSION_3
Definition: snmp_common.h:140
@ SNMP_VERSION_2C
Definition: snmp_common.h:139
Access table entry.
MibRowStatus status
char_t readViewName[SNMP_MAX_VIEW_NAME_LEN+1]
SnmpSecurityModel securityModel
char_t notifyViewName[SNMP_MAX_VIEW_NAME_LEN+1]
char_t groupName[SNMP_MAX_GROUP_NAME_LEN+1]
SnmpSecurityLevel securityLevel
SnmpContextMatch contextMatch
char_t writeViewName[SNMP_MAX_VIEW_NAME_LEN+1]
char_t contextPrefix[SNMP_MAX_CONTEXT_NAME_LEN+1]
Group table entry.
MibRowStatus status
char_t securityName[SNMP_MAX_GROUP_NAME_LEN+1]
SnmpSecurityModel securityModel
char_t groupName[SNMP_MAX_GROUP_NAME_LEN+1]
SNMP message.
View table entry.
uint8_t subtree[SNMP_MAX_OID_SIZE]
size_t subtreeLen
MibRowStatus status
SnmpViewType type
char_t viewName[SNMP_MAX_VIEW_NAME_LEN+1]
uint8_t mask[SNMP_MAX_BIT_MASK_SIZE]
size_t maskLen