snmp_agent_misc.h File Reference

Helper functions for SNMP agent. More...

#include "core/net.h"
#include "snmp/snmp_agent.h"

Go to the source code of this file.

Functions

void snmpLockMib (SnmpAgentContext *context)
 Lock MIB bases. More...
 
void snmpUnlockMib (SnmpAgentContext *context)
 Unlock MIB bases. More...
 
SnmpUserEntrysnmpCreateCommunityEntry (SnmpAgentContext *context)
 Create a new community entry. More...
 
SnmpUserEntrysnmpFindCommunityEntry (SnmpAgentContext *context, const char_t *community, size_t length)
 Search the community table for a given community string. More...
 
error_t snmpParseVarBinding (const uint8_t *p, size_t length, SnmpVarBind *var, size_t *consumed)
 Parse variable binding. More...
 
error_t snmpWriteVarBinding (SnmpAgentContext *context, const SnmpVarBind *var)
 Write variable binding. More...
 
error_t snmpCopyVarBindingList (SnmpAgentContext *context)
 Copy the list of variable bindings. More...
 
error_t snmpWriteTrapVarBindingList (SnmpAgentContext *context, uint_t genericTrapType, uint_t specificTrapCode, const SnmpTrapObject *objectList, uint_t objectListSize)
 Format the variable binding list for Trap-PDU or SNMPv2-Trap-PDU. More...
 
error_t snmpTranslateStatusCode (SnmpMessage *message, error_t status, uint_t index)
 Translate status code. More...
 

Detailed Description

Helper functions for SNMP agent.

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_misc.h.

Function Documentation

◆ snmpCopyVarBindingList()

error_t snmpCopyVarBindingList ( SnmpAgentContext context)

Copy the list of variable bindings.

Parameters
[in]contextPointer to the SNMP agent context
Returns
Error code

Definition at line 449 of file snmp_agent_misc.c.

◆ snmpCreateCommunityEntry()

SnmpUserEntry* snmpCreateCommunityEntry ( SnmpAgentContext context)

Create a new community entry.

Parameters
[in]contextPointer to the SNMP agent context
Returns
Pointer to the newly created entry

Definition at line 147 of file snmp_agent_misc.c.

◆ snmpFindCommunityEntry()

SnmpUserEntry* snmpFindCommunityEntry ( SnmpAgentContext context,
const char_t community,
size_t  length 
)

Search the community table for a given community string.

Parameters
[in]contextPointer to the SNMP agent context
[in]communityPointer to the community string
[in]lengthLength of the community string
Returns
Pointer to the matching entry

Definition at line 205 of file snmp_agent_misc.c.

◆ snmpLockMib()

void snmpLockMib ( SnmpAgentContext context)

Lock MIB bases.

Parameters
[in]contextPointer to the SNMP agent context

Definition at line 62 of file snmp_agent_misc.c.

◆ snmpParseVarBinding()

error_t snmpParseVarBinding ( const uint8_t *  p,
size_t  length,
SnmpVarBind var,
size_t *  consumed 
)

Parse variable binding.

Parameters
[in]pInput stream where to read the variable binding
[in]lengthNumber of bytes available in the input stream
[out]varVariable binding
[out]consumedTotal number of bytes that have been consumed
Returns
Error code

Definition at line 256 of file snmp_agent_misc.c.

◆ snmpTranslateStatusCode()

error_t snmpTranslateStatusCode ( SnmpMessage message,
error_t  status,
uint_t  index 
)

Translate status code.

Parameters
[in,out]messagePointer to the outgoing SNMP message
[in]statusStatus code
[in]indexIndex of the variable binding in the list that caused an exception
Returns
error code

Definition at line 616 of file snmp_agent_misc.c.

◆ snmpUnlockMib()

void snmpUnlockMib ( SnmpAgentContext context)

Unlock MIB bases.

Parameters
[in]contextPointer to the SNMP agent context

Definition at line 104 of file snmp_agent_misc.c.

◆ snmpWriteTrapVarBindingList()

error_t snmpWriteTrapVarBindingList ( SnmpAgentContext context,
uint_t  genericTrapType,
uint_t  specificTrapCode,
const SnmpTrapObject objectList,
uint_t  objectListSize 
)

Format the variable binding list for Trap-PDU or SNMPv2-Trap-PDU.

Parameters
[in]contextPointer to the SNMP agent context
[in]genericTrapTypeGeneric trap type
[in]specificTrapCodeSpecific code
[in]objectListList of object names
[in]objectListSizeNumber of entries in the list
Returns
Error code

Definition at line 477 of file snmp_agent_misc.c.

◆ snmpWriteVarBinding()

error_t snmpWriteVarBinding ( SnmpAgentContext context,
const SnmpVarBind var 
)

Write variable binding.

Parameters
[in]contextPointer to the SNMP agent context
[in]varVariable binding
Returns
Error code

Definition at line 331 of file snmp_agent_misc.c.