ln.snmp/types/SnmpV1Message.cs

47 lines
1.2 KiB
C#

// /**
// * 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;
namespace ln.snmp.types
{
public class SnmpV1Message : SnmpMessage
{
public OctetString snmpCommunity { get; set; }
public PDU snmpPDU { get; set; }
public SnmpV1Message()
:base(SnmpVersion.V1)
{
}
public SnmpV1Message(ASN1Value value)
:this()
{
snmpCommunity = (OctetString)value.Items[1];
snmpPDU = (PDU)value.Items[2];
}
public override int MessageID
{
get => (int)snmpPDU.RequestID.LongValue;
set => snmpPDU.RequestID.LongValue = value;
}
public override Variable[] Items
{
get => new Variable[] { new Integer((int)SnmpVersion), snmpCommunity, snmpPDU };
set
{
snmpCommunity = value[1] as OctetString;
snmpPDU = value[2] as PDU;
}
}
}
}