Commit 2d605154 authored by Brickner_cp's avatar Brickner_cp

DNS

parent 3bfe71e1
......@@ -137,6 +137,11 @@ namespace PcapDotNet.Packets.TestUtils
random.NextUInt(), random.NextUInt(), random.NextUShort(), random.NextDnsDomainName(),
random.NextDataSegment(random.Next(100)));
case DnsType.Key:
return new DnsResourceDataKey(random.NextBool(), random.NextBool(), random.NextEnum<DnsKeyNameType>(), random.NextFlags<DnsKeySignatory>(),
random.NextEnum<DnsKeyProtocol>(), random.NextEnum<DnsAlgorithm>(),
random.NextBool() ? (ushort?)random.NextUShort() : null, random.NextDataSegment(random.Next(100)));
default:
return new DnsResourceDataAnything(random.NextDataSegment(random.Next(100)));
}
......
......@@ -180,6 +180,7 @@
/// <summary>
/// RFCs 2535, 3755, 4034.
/// For security key.
/// Payload type: DnsResourceDataKey.
/// </summary>
Key = 25,
......
......@@ -156,7 +156,9 @@ namespace PcapDotNet.TestUtils
List<object> enumValuesAsUnderlyingType = new List<object>(enumValues.Select(value => Convert.ChangeType(value, underlyingType)));
List<ulong> enumValuesAsULong;
if (underlyingType == typeof(ushort))
if (underlyingType == typeof(byte))
enumValuesAsULong = new List<ulong>(enumValuesAsUnderlyingType.Cast<byte>().Select(value => (ulong)value));
else if (underlyingType == typeof(ushort))
enumValuesAsULong = new List<ulong>(enumValuesAsUnderlyingType.Cast<ushort>().Select(value => (ulong)value));
else
throw new ArgumentException("Type " + underlyingType + " is not supported");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment