snmp_agent_message.c File Reference
#include "core/net.h"
#include "snmp/snmp_agent.h"
#include "snmp/snmp_agent_message.h"
#include "mibs/snmp_mpd_mib_module.h"
#include "core/crypto.h"
#include "encoding/asn1.h"
#include "debug.h"

Go to the source code of this file.

Macros

#define TRACE_LEVEL   SNMP_TRACE_LEVEL
 

Functions

void snmpInitMessage (SnmpMessage *message)
 Initialize a SNMP message. More...
 
error_t snmpInitResponse (SnmpAgentContext *context)
 Initialize a GetResponse-PDU. More...
 
error_t snmpComputeMessageOverhead (SnmpMessage *message)
 Compute SNMP message overhead. More...
 
error_t snmpParseMessageHeader (SnmpMessage *message)
 Parse SNMP message header. More...
 
error_t snmpWriteMessageHeader (SnmpMessage *message)
 Format SNMP message header. More...
 
error_t snmpParseCommunity (SnmpMessage *message)
 Parse community name. More...
 
error_t snmpWriteCommunity (SnmpMessage *message)
 Format community name. More...
 
error_t snmpParseGlobalData (SnmpMessage *message)
 Parse msgGlobalData field. More...
 
error_t snmpWriteGlobalData (SnmpMessage *message)
 Format msgGlobalData field. More...
 
error_t snmpParseSecurityParameters (SnmpMessage *message)
 Parse msgSecurityParameters field. More...
 
error_t snmpWriteSecurityParameters (SnmpMessage *message)
 Format msgSecurityParameters field. More...
 
error_t snmpParseScopedPdu (SnmpMessage *message)
 Parse scopedPDU field. More...
 
error_t snmpWriteScopedPdu (SnmpMessage *message)
 Format scopedPDU. More...
 
error_t snmpParsePduHeader (SnmpMessage *message)
 Parse PDU header. More...
 
error_t snmpWritePduHeader (SnmpMessage *message)
 Format PDU header. More...
 
error_t snmpEncodeInt32 (int32_t value, uint8_t *dest, size_t *length)
 Encode a 32-bit signed integer. More...
 
error_t snmpEncodeUnsignedInt32 (uint32_t value, uint8_t *dest, size_t *length)
 Encode a 32-bit unsigned integer. More...
 
error_t snmpEncodeUnsignedInt64 (uint64_t value, uint8_t *dest, size_t *length)
 Encode a 64-bit unsigned integer. More...
 
error_t snmpDecodeInt32 (const uint8_t *src, size_t length, int32_t *value)
 Decode a 32-bit signed integer. More...
 
error_t snmpDecodeUnsignedInt32 (const uint8_t *src, size_t length, uint32_t *value)
 Decode a 32-bit unsigned integer. More...
 
error_t snmpDecodeUnsignedInt64 (const uint8_t *src, size_t length, uint64_t *value)
 Decode a 64-bit unsigned integer. More...
 

Macro Definition Documentation

◆ TRACE_LEVEL

#define TRACE_LEVEL   SNMP_TRACE_LEVEL

Definition at line 30 of file snmp_agent_message.c.

Function Documentation

◆ snmpComputeMessageOverhead()

error_t snmpComputeMessageOverhead ( SnmpMessage message)

Compute SNMP message overhead.

Parameters
[in]messagePointer to the SNMP message

Definition at line 199 of file snmp_agent_message.c.

◆ snmpDecodeInt32()

error_t snmpDecodeInt32 ( const uint8_t *  src,
size_t  length,
int32_t *  value 
)

Decode a 32-bit signed integer.

Parameters
[in]srcBuffer that contains the encoded value
[in]lengthNumber of bytes to be processed
[out]valueResulting integer value
Returns
Error code

Definition at line 1661 of file snmp_agent_message.c.

◆ snmpDecodeUnsignedInt32()

error_t snmpDecodeUnsignedInt32 ( const uint8_t *  src,
size_t  length,
uint32_t *  value 
)

Decode a 32-bit unsigned integer.

Parameters
[in]srcBuffer that contains the encoded value
[in]lengthNumber of bytes to be processed
[out]valueResulting integer value
Returns
Error code

Definition at line 1697 of file snmp_agent_message.c.

◆ snmpDecodeUnsignedInt64()

error_t snmpDecodeUnsignedInt64 ( const uint8_t *  src,
size_t  length,
uint64_t *  value 
)

Decode a 64-bit unsigned integer.

Parameters
[in]srcBuffer that contains the encoded value
[in]lengthNumber of bytes to be processed
[out]valueResulting integer value
Returns
Error code

Definition at line 1736 of file snmp_agent_message.c.

◆ snmpEncodeInt32()

error_t snmpEncodeInt32 ( int32_t  value,
uint8_t *  dest,
size_t *  length 
)

Encode a 32-bit signed integer.

Parameters
[in]valueInteger value
[out]destBuffer where to encode the integer
[out]lengthTotal number of bytes that have been written
Returns
Error code

Definition at line 1512 of file snmp_agent_message.c.

◆ snmpEncodeUnsignedInt32()

error_t snmpEncodeUnsignedInt32 ( uint32_t  value,
uint8_t *  dest,
size_t *  length 
)

Encode a 32-bit unsigned integer.

Parameters
[in]valueInteger value
[out]destBuffer where to encode the integer
[out]lengthTotal number of bytes that have been written
Returns
Error code

Definition at line 1561 of file snmp_agent_message.c.

◆ snmpEncodeUnsignedInt64()

error_t snmpEncodeUnsignedInt64 ( uint64_t  value,
uint8_t *  dest,
size_t *  length 
)

Encode a 64-bit unsigned integer.

Parameters
[in]valueInteger value
[out]destBuffer where to encode the integer
[out]lengthTotal number of bytes that have been written
Returns
Error code

Definition at line 1611 of file snmp_agent_message.c.

◆ snmpInitMessage()

void snmpInitMessage ( SnmpMessage message)

Initialize a SNMP message.

Parameters
[in]messagePointer to the SNMP message

Definition at line 50 of file snmp_agent_message.c.

◆ snmpInitResponse()

error_t snmpInitResponse ( SnmpAgentContext context)

Initialize a GetResponse-PDU.

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

Definition at line 126 of file snmp_agent_message.c.

◆ snmpParseCommunity()

error_t snmpParseCommunity ( SnmpMessage message)

Parse community name.

Parameters
[in,out]messagePointer to the incoming SNMP message
Returns
Error code

Definition at line 396 of file snmp_agent_message.c.

◆ snmpParseGlobalData()

error_t snmpParseGlobalData ( SnmpMessage message)

Parse msgGlobalData field.

Parameters
[in,out]messagePointer to the incoming SNMP message
Returns
Error code

Definition at line 478 of file snmp_agent_message.c.

◆ snmpParseMessageHeader()

error_t snmpParseMessageHeader ( SnmpMessage message)

Parse SNMP message header.

Parameters
[in,out]messagePointer to the incoming SNMP message
Returns
Error code

Definition at line 265 of file snmp_agent_message.c.

◆ snmpParsePduHeader()

error_t snmpParsePduHeader ( SnmpMessage message)

Parse PDU header.

Parameters
[in,out]messagePointer to the incoming SNMP message
Returns
Error code

Definition at line 1202 of file snmp_agent_message.c.

◆ snmpParseScopedPdu()

error_t snmpParseScopedPdu ( SnmpMessage message)

Parse scopedPDU field.

Parameters
[in,out]messagePointer to the incoming SNMP message
Returns
Error code

Definition at line 1045 of file snmp_agent_message.c.

◆ snmpParseSecurityParameters()

error_t snmpParseSecurityParameters ( SnmpMessage message)

Parse msgSecurityParameters field.

Parameters
[in,out]messagePointer to the incoming SNMP message
Returns
Error code

Definition at line 692 of file snmp_agent_message.c.

◆ snmpWriteCommunity()

error_t snmpWriteCommunity ( SnmpMessage message)

Format community name.

Parameters
[in,out]messagePointer to the outgoing SNMP message
Returns
Error code

Definition at line 438 of file snmp_agent_message.c.

◆ snmpWriteGlobalData()

error_t snmpWriteGlobalData ( SnmpMessage message)

Format msgGlobalData field.

Parameters
[in,out]messagePointer to the outgoing SNMP message
Returns
Error code

Definition at line 594 of file snmp_agent_message.c.

◆ snmpWriteMessageHeader()

error_t snmpWriteMessageHeader ( SnmpMessage message)

Format SNMP message header.

Parameters
[in,out]messagePointer to the outgoing SNMP message
Returns
Error code

Definition at line 318 of file snmp_agent_message.c.

◆ snmpWritePduHeader()

error_t snmpWritePduHeader ( SnmpMessage message)

Format PDU header.

Parameters
[in,out]messagePointer to the outgoing SNMP message
Returns
Error code

Definition at line 1315 of file snmp_agent_message.c.

◆ snmpWriteScopedPdu()

error_t snmpWriteScopedPdu ( SnmpMessage message)

Format scopedPDU.

Parameters
[in,out]messagePointer to the outgoing SNMP message
Returns
Error code

Definition at line 1119 of file snmp_agent_message.c.

◆ snmpWriteSecurityParameters()

error_t snmpWriteSecurityParameters ( SnmpMessage message)

Format msgSecurityParameters field.

Parameters
[in,out]messagePointer to the outgoing SNMP message
Returns
Error code

Definition at line 862 of file snmp_agent_message.c.