Commit 65a24f13 authored by Brickner_cp's avatar Brickner_cp

DNS

parent 64ffbb1d
...@@ -117,6 +117,20 @@ namespace PcapDotNet.Packets.TestUtils ...@@ -117,6 +117,20 @@ namespace PcapDotNet.Packets.TestUtils
case DnsType.AfsDb: case DnsType.AfsDb:
return new DnsResourceDataAfsDb(random.NextUShort(), random.NextDnsDomainName()); return new DnsResourceDataAfsDb(random.NextUShort(), random.NextDnsDomainName());
case DnsType.X25:
return new DnsResourceDataString(random.NextDataSegment(random.Next(10)));
case DnsType.Isdn:
return random.NextBool()
? new DnsResourceDataIsdn(random.NextDataSegment(random.Next(10)))
: new DnsResourceDataIsdn(random.NextDataSegment(random.Next(10)), random.NextDataSegment(random.Next(10)));
case DnsType.Rt:
return new DnsResourceDataRouteThrough(random.NextUShort(), random.NextDnsDomainName());
case DnsType.Nsap:
return new DnsResourceDataNetworkServiceAccessPoint(random.NextDataSegment(1 + random.Next(10)), random.NextUInt48(), random.NextByte());
default: default:
return new DnsResourceDataAnything(random.NextDataSegment(random.Next(100))); return new DnsResourceDataAnything(random.NextDataSegment(random.Next(100)));
} }
......
...@@ -218,6 +218,17 @@ namespace PcapDotNet.Packets ...@@ -218,6 +218,17 @@ namespace PcapDotNet.Packets
return Buffer.ReadUInt(StartOffset + offset, endianity); return Buffer.ReadUInt(StartOffset + offset, endianity);
} }
/// <summary>
/// Reads 6 bytes from a specific offset in the segment as a UInt48 with a given endianity.
/// </summary>
/// <param name="offset">The offset in the segment to start reading.</param>
/// <param name="endianity">The endianity to use to translate the bytes to the value.</param>
/// <returns>The value converted from the read bytes according to the endianity.</returns>
internal UInt48 ReadUInt48(int offset, Endianity endianity)
{
return Buffer.ReadUInt48(StartOffset + offset, endianity);
}
/// <summary> /// <summary>
/// Reads 6 bytes from a specific offset in the segment as a MacAddress with a given endianity. /// Reads 6 bytes from a specific offset in the segment as a MacAddress with a given endianity.
/// </summary> /// </summary>
......
...@@ -136,6 +136,7 @@ ...@@ -136,6 +136,7 @@
/// <summary> /// <summary>
/// RFC 1706. /// RFC 1706.
/// Network Service Access Point.
/// For NSAP address, NSAP style A record. /// For NSAP address, NSAP style A record.
/// </summary> /// </summary>
Nsap = 22, Nsap = 22,
......
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