ln.snmp/types/ScopedPDU.cs

53 lines
1.5 KiB
C#

// /**
// * File: ScopedPDU.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 System.Runtime.Remoting.Messaging;
using ln.snmp.asn1;
using System.Linq;
namespace ln.snmp.types
{
public class ScopedPDU : AbstractSequence
{
public OctetString contextEngineID { get; set; }
public OctetString contextName { get; set; }
public PDU PDU { get; set; }
public ScopedPDU()
:base(new Identifier(IdentifierClass.UNIVERSAL,true,0x10))
{
contextEngineID = new OctetString();
contextName = new OctetString();
PDU = new GetRequest();
}
public ScopedPDU(ASN1Value asn)
:this()
{
Items = asn.Items.Select((x) => (Variable)x).ToArray();
}
public override Variable[] Items
{
get => new Variable[] { contextEngineID, contextName, PDU };
set
{
contextEngineID = value[0] as OctetString;
contextName = value[1] as OctetString;
PDU = value[2] as PDU;
}
}
public override void Add(Variable item) => throw new NotImplementedException();
public override void Remove(Variable item) => throw new NotImplementedException();
}
}