SnmpSharpNet.NoSuchInstance.decode C# (CSharp) Method

decode() public method

Decode BER encoded no-such-instance SNMP version 2 MIB value
Invalid ASN.1 type found when parsing value header Invalid data length in ASN.1 header. Only data length 0 is accepted.
public decode ( byte buffer, int offset ) : int
buffer byte The BER encoded buffer
offset int The offset of the first byte of encoded data
return int
        public override int decode(byte[] buffer, int offset)
        {
            int headerLength;
            byte asnType = ParseHeader(buffer, ref offset, out headerLength);
            if (asnType != Type)
                throw new SnmpException("Invalid ASN.1 type");

            if (headerLength != 0)
                throw new SnmpDecodingException("Invalid ASN.1 length");

            return offset;
        }