Commit 2d605154 authored by Brickner_cp's avatar Brickner_cp

DNS

parent 3bfe71e1
...@@ -137,6 +137,11 @@ namespace PcapDotNet.Packets.TestUtils ...@@ -137,6 +137,11 @@ namespace PcapDotNet.Packets.TestUtils
random.NextUInt(), random.NextUInt(), random.NextUShort(), random.NextDnsDomainName(), random.NextUInt(), random.NextUInt(), random.NextUShort(), random.NextDnsDomainName(),
random.NextDataSegment(random.Next(100))); 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: default:
return new DnsResourceDataAnything(random.NextDataSegment(random.Next(100))); return new DnsResourceDataAnything(random.NextDataSegment(random.Next(100)));
} }
......
...@@ -180,6 +180,7 @@ ...@@ -180,6 +180,7 @@
/// <summary> /// <summary>
/// RFCs 2535, 3755, 4034. /// RFCs 2535, 3755, 4034.
/// For security key. /// For security key.
/// Payload type: DnsResourceDataKey.
/// </summary> /// </summary>
Key = 25, Key = 25,
......
...@@ -156,7 +156,9 @@ namespace PcapDotNet.TestUtils ...@@ -156,7 +156,9 @@ namespace PcapDotNet.TestUtils
List<object> enumValuesAsUnderlyingType = new List<object>(enumValues.Select(value => Convert.ChangeType(value, underlyingType))); List<object> enumValuesAsUnderlyingType = new List<object>(enumValues.Select(value => Convert.ChangeType(value, underlyingType)));
List<ulong> enumValuesAsULong; 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)); enumValuesAsULong = new List<ulong>(enumValuesAsUnderlyingType.Cast<ushort>().Select(value => (ulong)value));
else else
throw new ArgumentException("Type " + underlyingType + " is not supported"); 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