Commit 0b18658d authored by Brickner_cp's avatar Brickner_cp

DNS

parent 9a460573
...@@ -258,12 +258,39 @@ namespace PcapDotNet.Packets.TestUtils ...@@ -258,12 +258,39 @@ namespace PcapDotNet.Packets.TestUtils
random.NextDataSegment(random.Next(50))); random.NextDataSegment(random.Next(50)));
case DnsType.SshFp: case DnsType.SshFp:
return new DnsResourceDataSshFingerprint(random.NextEnum<DnsAlgorithm>(), random.NextEnum<DnsFingerprintType>(), return new DnsResourceDataSshFingerprint(random.NextEnum<DnsFingerprintPublicKeyAlgorithm>(), random.NextEnum<DnsFingerprintType>(),
random.NextDataSegment(random.Next(20))); random.NextDataSegment(random.Next(20)));
case DnsType.IpSecKey:
return new DnsResourceDataIpSecKey(random.NextByte(), random.NextDnsGateway(), random.NextEnum<DnsGatewayPublicKeyAlgorithm>(),
random.NextDataSegment(random.Next(100)));
default: default:
return new DnsResourceDataAnything(random.NextDataSegment(random.Next(100))); return new DnsResourceDataAnything(random.NextDataSegment(random.Next(100)));
} }
} }
public static DnsGateway NextDnsGateway(this Random random)
{
DnsGatewayType gatewayType = random.NextEnum<DnsGatewayType>();
switch (gatewayType)
{
case DnsGatewayType.None:
return DnsGateway.None;
case DnsGatewayType.IpV4:
return new DnsGatewayIpV4(random.NextIpV4Address());
case DnsGatewayType.IpV6:
return new DnsGatewayIpV6(random.NextIpV6Address());
case DnsGatewayType.DomainName:
return new DnsGatewayDomainName(random.NextDnsDomainName());
default:
throw new InvalidOperationException(string.Format("Invalid gateway type: {0}", gatewayType));
}
}
} }
} }
...@@ -321,6 +321,7 @@ ...@@ -321,6 +321,7 @@
/// <summary> /// <summary>
/// RFC 4025. /// RFC 4025.
/// IPSECKEY. /// IPSECKEY.
/// Payload type: DnsResourceDataIpSecKey.
/// </summary> /// </summary>
IpSecKey = 45, IpSecKey = 45,
......
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