// /** // * File: SnmpV1Message.cs // * Author: haraldwolff // * // * This file and it's content is copyrighted by the Author and / or copyright holder. // * Any use wihtout proper permission is illegal and may lead to legal actions. // * // * // **/ using System; using ln.snmp.asn1; using ln.logging; namespace ln.snmp.types { public class SnmpV2Message : SnmpMessage { public OctetString snmpCommunity { get; set; } public PDU snmpPDU { get; set; } public SnmpV2Message() :base(SnmpVersion.V2c) { } public SnmpV2Message(ASN1Value value) :this() { snmpCommunity = (OctetString)value.Items[1]; Logging.Log(LogLevel.DEBUG, "ASN1Value->PDU: {0}", value.Items[2]); snmpPDU = (PDU)value.Items[2]; Logging.Log(LogLevel.DEBUG, "PDU: {0}", snmpPDU); } public override Variable[] Items { get => new Variable[] { new Integer((int)SnmpVersion), snmpCommunity, snmpPDU }; set { snmpCommunity = value[1] as OctetString; snmpPDU = value[2] as PDU; } } public override int MessageID { get => (int)snmpPDU.RequestID.LongValue; set => snmpPDU.RequestID.LongValue = value; } } }