ln.snmp/types/Unsigned32.cs

65 lines
1.6 KiB
C#

// /**
// * File: Integer.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;
namespace ln.snmp.types
{
public class Unsigned32 : Variable
{
public uint UIntValue { get; set; }
public Unsigned32()
:base(new Identifier(IdentifierClass.APPLICATION, false, 0x02))
{
}
public Unsigned32(uint value)
:this()
{
UIntValue = value;
}
protected Unsigned32(Identifier identifier)
: base(identifier)
{
}
protected Unsigned32(Identifier identifier,uint value)
: base(identifier)
{
UIntValue = value;
}
public override byte[] Bytes
{
get => BasicEncodingRules.EncodeInteger(UIntValue);
set => UIntValue = (uint)BasicEncodingRules.DecodeInteger(value);
}
public override object Value { get => UIntValue; set => UIntValue = (uint)value; }
public override string ToString()
{
return String.Format("[Unsigned32 UIntValue={0}]", UIntValue);
}
}
public class Counter32 : Unsigned32
{
public Counter32()
: base(new Identifier(IdentifierClass.APPLICATION, false, 0x01))
{
}
public Counter32(uint value)
: base(new Identifier(IdentifierClass.APPLICATION, false, 0x01),value)
{
}
}
}