SNMP version 3 packet implementation class.
Namespace: SnmpSharpNetAssembly: SnmpSharpNet (in SnmpSharpNet.dll) Version: 0.9.1.0 (0.9.1)
Syntax
| C# |
|---|
public class SnmpV3Packet : SnmpPacket |
| Visual Basic |
|---|
Public Class SnmpV3Packet _ Inherits SnmpPacket |
| Visual C++ |
|---|
public ref class SnmpV3Packet : public SnmpPacket |
Remarks
Available packet classes are:
CopyC#
Example, SNMP version 3 noAuthNoPriv encoding:
CopyC#
Example, SNMP version 3 authNoPriv using MD5 authentication packet encoding:
CopyC#
Example, SNMP version 3 authPriv using MD5 authentication and DES encryption packet encoding:
CopyC#
When decoding SNMP version 3 packets, SnmpV3Packet class needs to be initialized with the same values
security values as a request does. This includes, authoritative engine id, engine boots and engine time,
if authentication is used, authentication digest and password and for encryption, password and privacy
protocol used. Without these parameters packet class will not be able to verify the incoming packet and
responses will be discarded even if they are valid.
- SnmpV1Packet
- SnmpV1TrapPacket
- SnmpV2Packet
- SnmpV3Packet
SnmpV1Packet packetv1 = new SnmpV1Packet(); packetv1.Community.Set("public"); packetv1.Pdu.Set(mypdu); byte[] berpacket = packetv1.encode();
SnmpV3Packet packetv3 = new SnmpV3Packet(); packetv3.noAuthNoPriv("myusername"); packetv3.SetEngineTime(engineTime, engineBoots); // See SNMPv3 discovery process for details packetv3.SetEngineId(engineId); // See SNMPv3 discovery process for details packetv3.IsReportable = true; packetv3.Pdu.Set(mypdu); byte[] berpacket = packetv3.encode();
SnmpV3Packet packetv3 = new SnmpV3Packet(); packetv3.authNoPriv("myusername", "myAuthenticationPassword", AuthenticationDigests.MD5); packetv3.SetEngineTime(engineTime, engineBoots); // See SNMPv3 discovery process for details packetv3.SetEngineId(engineId); // See SNMPv3 discovery process for details packetv3.IsReportable = true; packetv3.Pdu.Set(mypdu); byte[] berpacket = packetv3.encode();
SnmpV3Packet packetv3 = new SnmpV3Packet(); packetv3.authPriv("myusername", "myAuthenticationPassword", AuthenticationDigests.MD5, "myPrivacyPassword", PrivacyProtocols.DES); packetv3.SetEngineTime(engineTime, engineBoots); // See SNMPv3 discovery process for details packetv3.SetEngineId(engineId); // See SNMPv3 discovery process for details packetv3.IsReportable = true; packetv3.Pdu.Set(mypdu); byte[] berpacket = packetv3.encode();