in Source/Tx.Network/Snmp/SnmpEncodeDecoder.cs [200:229]
private static int NextValueLength(this byte[] bytes, int offset, int classValidations, int constructValidations, int typeValidations, out int length)
{
var type = bytes[offset++].DecodeToClassConstructType();
if (classValidations != -1 && type.Asn1ClassType != (Asn1Class)classValidations)
{
throw new DataMisalignedException("Data Malformated/Expected Asn1 Class tag is: " + ((Asn1Class)classValidations).ToString());
}
if (constructValidations != -1 && type.Asn1ConstructType != (ConstructType)constructValidations)
{
throw new DataMisalignedException("Data Malformated/Expected ConstructType tag is: " + ((ConstructType)constructValidations).ToString());
}
if (type.Asn1TagType != Asn1Tag.NotAsn1Data)
{
if (typeValidations != -1 && type.Asn1TagType != (Asn1Tag)typeValidations)
{
throw new DataMisalignedException("Data Malformated/Expected Asn1 tag is: " + ((Asn1Tag)typeValidations).ToString());
}
}
else
{
if (typeValidations != -1 && type.Asn1SnmpTagType != (Asn1SnmpTag)typeValidations)
{
throw new DataMisalignedException("Data Malformated/Expected Asn1Snmp tag is: " + ((Asn1SnmpTag)typeValidations).ToString());
}
}
return bytes.ReadLength(offset, out length);
}