SNMPv3.c

Microchip TCP/IP Stack

Microchip TCP/IP Stack Help
SNMPv3.c
  • Simple Network Management Protocol (SNMP) Version 3 Agent

*

  • Module for Microchip TCP/IP Stack
  • -Provides SNMPv3 API for doing stuff

*

  • -Reference: RFCs 3410, 3411, 3412, 3413, 3414
*******************************************************************
  • FileName: SNMPv3.c
  • Dependencies: TCP/IP stack
  • Processor: PIC32
  • Compiler: Microchip C32

*

  • Software License Agreement

*

  • Copyright (C) 2012 Microchip Technology Inc. All rights
  • reserved.

*

  • Microchip licenses to you the right to use, modify, copy, and
  • distribute:
  • (i) the Software when embedded on a Microchip microcontroller or
  • digital signal controller product ("Device") which is
  • integrated into Licensee's product; or
  • (ii) ONLY the Software driver source files ENC28J60.c, ENC28J60.h,
  • ENCX24J600.c and ENCX24J600.h ported to a non-Microchip device
  • used in conjunction with a Microchip ethernet controller for
  • the sole purpose of interfacing with the ethernet controller.

*

  • You should refer to the license agreement accompanying this
  • Software for additional information regarding your rights and
  • obligations.

*

  • THE SOFTWARE AND DOCUMENTATION ARE PROVIDED "AS IS" WITHOUT
  • WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT
  • LIMITATION, ANY WARRANTY OF MERCHANTABILITY, FITNESS FOR A
  • PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL
  • MICROCHIP BE LIABLE FOR ANY INCIDENTAL, SPECIAL, INDIRECT OR
  • CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF
  • PROCUREMENT OF SUBSTITUTE GOODS, TECHNOLOGY OR SERVICES, ANY CLAIMS
  • BY THIRD PARTIES (INCLUDING BUT NOT LIMITED TO ANY DEFENSE
  • THEREOF), ANY CLAIMS FOR INDEMNITY OR CONTRIBUTION, OR OTHER
  • SIMILAR COSTS, WHETHER ASSERTED ON THE BASIS OF CONTRACT, TORT
  • (INCLUDING NEGLIGENCE), BREACH OF WARRANTY, OR OTHERWISE.
Functions
 
Name 
Description 
 
Decode variable length structure. 
 
Finds number of varbinds in the varbind list received in a SNMPv3 pdu. 
 
Verifies the value type as ASN_NULL
 
Populates OID type, length and oid string from the received pdu. 
 
Decode variable length structure. 
 
Allocated dynamic memory freeing is done by this routine. 
 
Decode variable length structure. 
 
Verifies variable datatype as INT and retrieves its value. 
 
Constructs the report pdu infomration for the Report Pdu. 
 
Set snmpv3 error status in the response pdu. 
Macros
 
Name 
Description 
 
This is macro INVALID_INDEX. 
 
Length of SNMPv3 authoratative msg header length = Header length ( 2 + 2 bytes) + engineID ( snmpEngnIDLength bytes)
  • engine boot( 4 bytes)+ engine time(4 bytes)

+security name (securityPrimitivesOfIncomingPdu value) +authentication parameters (snmpOutMsgAuthParamLen value) +privacy parameters (snmpOutMsgAuthParamLen value) 

 
Length of the SNMPv3 msg header(x) = Header length (2 bytes)
  • MSGID size (type(1 byte) + length of value(1 byte)+4 bytes value)
  • msgMAXSIZE(type + length of value +4 bytes value)
  • msg flag(type + length of value +1 byte value)
  • security model type(type + length of value +1 byte value)

 

 
SNMP_ENGINE_MAX_MSG_SIZE is determined as the minimum of the max msg size values supported among all of the transports available to and supported by the engine. 
Variables
 
Name 
Description 
 
Dynamic memory stub and PDU details for Incoming stored PDU 
 
Dynamic memory stub details and constructed outgoing stored PDU details 
 
Response PDU construction offset details 
 
Offset to read scoped PDU data bytes for processing from dynamic memory stub 
 
Stored request scoped pdu details 
 
Processed response scoped pdu details 
 
SNMPv3 global configuration database to be used for trap notification 
 
Dynamic memory stub details and constructed trap PDU details 
 
TRAP scoped PDU construction offset details 
 
This is variable gSNMPV3TrapSecurityLevel. 
 
Global variable to find out how many times SNMPv3 engine id has been validated 
 
Incoming PDU details 
 
Retrived Incoming Msg ID value from PDU 
 
This is variable msgSecrtyParamLenOffset. 
 
Incoming PDU Security primitive details. 
 
The number of times that the SNMP engine has (re-)initialized itself since snmpEngineID was last configured. 
 
Reserving 32 bytes for the snmpEngineID as the octet string length can vary form 5 to 32 
 
The maximum message size the SNMP engine can handle. 
 
Type of Message processing model used. Value Maximum range (2^31-1), RFC3411 
 
Type of security model used. Value Maximum range (2^31-1), RFC3411 
 
The number of seconds since the value of the snmpEngineBoots object last changed 
 
Stores the time value in seconds since SNMP Engine reset 
 
Engine ID length of the SNMP Engine 
 
Incoming SNMPv3 msg privacy parameters string is 8 bytes long. 
 
Offset to read PDU data bytes for processing from dynamic memory stub 
 
Outgoing SNMPv3 msg privacy parameters string is 8 bytes long. 
 
Type of Security for outgoing message in response to the incoming message. 
 
Type of security. noAuthNoPriv(0),AuthNoPriv(1),AuthPriv(3) 
 
Snmp udp buffer tx offset 
Microchip TCP/IP Stack 5.42.08 - June 15, 2013
Copyright © 2012 Microchip Technology, Inc.  All rights reserved.