snmp_agent_message.h File Reference
#include "core/net.h"
#include "snmp/snmp_agent.h"

Go to the source code of this file.

Data Structures

struct  SnmpMessage
 SNMP message. More...
 
struct  SnmpVarBind
 Variable binding. More...
 

Macros

#define SNMP_V1_MSG_HEADER_OVERHEAD   48
 
#define SNMP_V2C_MSG_HEADER_OVERHEAD   37
 
#define SNMP_V3_MSG_HEADER_OVERHEAD   105
 

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

◆ SNMP_V1_MSG_HEADER_OVERHEAD

#define SNMP_V1_MSG_HEADER_OVERHEAD   48

Definition at line 39 of file snmp_agent_message.h.

◆ SNMP_V2C_MSG_HEADER_OVERHEAD

#define SNMP_V2C_MSG_HEADER_OVERHEAD   37

Definition at line 41 of file snmp_agent_message.h.

◆ SNMP_V3_MSG_HEADER_OVERHEAD

#define SNMP_V3_MSG_HEADER_OVERHEAD   105

Definition at line 43 of file snmp_agent_message.h.

Function Documentation

◆ snmpComputeMessageOverhead()

error_t snmpComputeMessageOverhead ( SnmpMessage message)

Compute SNMP message overhead.

Parameters
[in]messagePointer to the SNMP message

Definition at line 201 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 1671 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 1707 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 1746 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 1514 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 1565 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 1617 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 52 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 128 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 398 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 480 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 267 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 1204 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 1047 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 694 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 440 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 596 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 320 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 1317 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 1121 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 864 of file snmp_agent_message.c.