Commit 888c8784 authored by Brickner_cp's avatar Brickner_cp

Warnings, Code Analysis and Documentation. 91 warnings left.

parent 59688054
......@@ -28,8 +28,30 @@ namespace PcapDotNet.Packets.Dns
/// </summary>
public sealed class DnsOptResourceRecord : DnsDataResourceRecord
{
/// <summary>
/// Constructs an instance out of the domain name, senders UDP payload size, extended return code, version, flags and data fields.
/// </summary>
/// <param name="domainName">An owner name, i.e., the name of the node to which this resource record pertains.</param>
/// <param name="sendersUdpPayloadSize">
/// The number of octets of the largest UDP payload that can be reassembled and delivered in the sender's network stack.
/// Note that path MTU, with or without fragmentation, may be smaller than this.
/// </param>
/// <param name="extendedReturnCode">
/// Forms upper 8 bits of extended 12-bit RCODE.
/// Note that EXTENDED-RCODE value "0" indicates that an unextended RCODE is in use (values "0" through "15").
/// </param>
/// <param name="version">
/// Indicates the implementation level of whoever sets it.
/// Full conformance with this specification is indicated by version "0".
/// Requestors are encouraged to set this to the lowest implemented level capable of expressing a transaction,
/// to minimize the responder and network load of discovering the greatest common implementation level between requestor and responder.
/// A requestor's version numbering strategy should ideally be a run time configuration option.
/// </param>
/// <param name="flags">OPT flags.</param>
/// <param name="data">An OPT resource record data</param>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms", MessageId = "flags")]
public DnsOptResourceRecord(DnsDomainName domainName, ushort sendersUdpPayloadSize, byte extendedReturnCode, DnsOptVersion version, DnsOptFlags flags, DnsResourceDataOptions data)
public DnsOptResourceRecord(DnsDomainName domainName, ushort sendersUdpPayloadSize, byte extendedReturnCode, DnsOptVersion version, DnsOptFlags flags,
DnsResourceDataOptions data)
: this(domainName, (DnsClass)sendersUdpPayloadSize, (int)BitSequence.Merge(extendedReturnCode, (byte)version, (ushort)flags), data)
{
}
......
......@@ -23,6 +23,9 @@ namespace PcapDotNet.Packets.Dns
/// </summary>
public DataSegment Data { get; private set; }
/// <summary>
/// The number of bytes the option data takes.
/// </summary>
public override int DataLength
{
get { return Data.Length; }
......
......@@ -29,7 +29,7 @@ namespace PcapDotNet.Packets.Dns
public const int AddressFamilyDependentPart = AddressFamilyDependentPartLength + sizeof(byte);
}
public const int MinimumLength = Offset.AddressFamilyDependentPart;
private const int MinimumLength = Offset.AddressFamilyDependentPart;
private static class Mask
{
......@@ -37,9 +37,39 @@ namespace PcapDotNet.Packets.Dns
public const byte AddressFamilyDependentPartLength = 0x7F;
}
public const int AddressFamilyDependentPartMaxLength = (1 << 7) - 1;
private const int AddressFamilyDependentPartMaxLength = (1 << 7) - 1;
/// <summary>
/// Constructs an instance out of the address family, prefix length, negation and address family dependent part fields.
/// </summary>
/// <param name="addressFamily">The address family value.</param>
/// <param name="prefixLength">
/// Prefix length.
/// Upper and lower bounds and interpretation of this value are address family specific.
///
/// For IPv4, specifies the number of bits of the IPv4 address starting at the most significant bit.
/// Legal values range from 0 to 32.
///
/// For IPv6, specifies the number of bits of the IPv6 address starting at the most significant bit.
/// Legal values range from 0 to 128.
/// </param>
/// <param name="negation">Negation flag, indicates the presence of the "!" character in the textual format.</param>
/// <param name="addressFamilyDependentPart">
/// For IPv4, the encoding follows the encoding specified for the A RR by RFC 1035.
/// Trailing zero octets do not bear any information (e.g., there is no semantic difference between 10.0.0.0/16 and 10/16) in an address prefix,
/// so the shortest possible AddressFamilyDependentPart can be used to encode it.
/// However, for DNSSEC (RFC 2535) a single wire encoding must be used by all.
/// Therefore the sender must not include trailing zero octets in the AddressFamilyDependentPart regardless of the value of PrefixLength.
/// This includes cases in which AddressFamilyDependentPart length times 8 results in a value less than PrefixLength.
/// The AddressFamilyDependentPart is padded with zero bits to match a full octet boundary.
/// An IPv4 AddressFamilyDependentPart has a variable length of 0 to 4 octets.
///
/// For IPv6, the 128 bit IPv6 address is encoded in network byte order (high-order byte first).
/// The sender must not include trailing zero octets in the AddressFamilyDependentPart regardless of the value of PrefixLength.
/// This includes cases in which AddressFamilyDependentPart length times 8 results in a value less than PrefixLength.
/// The AddressFamilyDependentPart is padded with zero bits to match a full octet boundary.
/// An IPv6 AddressFamilyDependentPart has a variable length of 0 to 16 octets.
/// </param>
public DnsAddressPrefix(AddressFamily addressFamily, byte prefixLength, bool negation, DataSegment addressFamilyDependentPart)
{
if (addressFamilyDependentPart == null)
......@@ -54,6 +84,9 @@ namespace PcapDotNet.Packets.Dns
AddressFamilyDependentPart = addressFamilyDependentPart;
}
/// <summary>
/// The address family value.
/// </summary>
public AddressFamily AddressFamily { get; private set; }
/// <summary>
......@@ -91,11 +124,17 @@ namespace PcapDotNet.Packets.Dns
/// </summary>
public DataSegment AddressFamilyDependentPart { get; private set; }
/// <summary>
/// The number of bytes this resource data takes.
/// </summary>
public int Length
{
get { return MinimumLength + AddressFamilyDependentPart.Length; }
}
/// <summary>
/// Two DnsAddressPrefix are equal iff their address family, prefix length, negation and address family dependent part are equal.
/// </summary>
public bool Equals(DnsAddressPrefix other)
{
return other != null &&
......@@ -105,18 +144,24 @@ namespace PcapDotNet.Packets.Dns
AddressFamilyDependentPart.Equals(other.AddressFamilyDependentPart);
}
/// <summary>
/// Two DnsAddressPrefix are equal iff their address family, prefix length, negation and address family dependent part fields are equal.
/// </summary>
public override bool Equals(object obj)
{
return Equals(obj as DnsAddressPrefix);
}
/// <summary>
/// A hash code based on the address family, prefix length, negation and address family dependent part fields.
/// </summary>
public override int GetHashCode()
{
return BitSequence.Merge((ushort)AddressFamily, PrefixLength, (byte)(((Negation ? 1 : 0) << 7) | AddressFamilyDependentPart.Length)).GetHashCode() ^
AddressFamilyDependentPart.BytesSequenceGetHashCode();
}
public static DnsAddressPrefix Read(DataSegment data)
internal static DnsAddressPrefix Read(DataSegment data)
{
if (data == null)
throw new ArgumentNullException("data");
......@@ -135,7 +180,7 @@ namespace PcapDotNet.Packets.Dns
return new DnsAddressPrefix(addressFamily, prefixLength, negation, addressFamilyDependentPart);
}
public void Write(byte[] buffer, ref int offset)
internal void Write(byte[] buffer, ref int offset)
{
buffer.Write(offset + Offset.AddressFamily, (ushort)AddressFamily, Endianity.Big);
buffer.Write(offset + Offset.PrefixLength, PrefixLength);
......
......@@ -17,6 +17,9 @@ namespace PcapDotNet.Packets.Dns
[DnsTypeRegistration(Type = DnsType.A6)]
public sealed class DnsResourceDataA6 : DnsResourceDataNoCompression, IEquatable<DnsResourceDataA6>
{
/// <summary>
/// The maximum value for the prefix length.
/// </summary>
public const byte MaxPrefixLength = 8 * IpV6Address.SizeOf;
private static class Offset
......@@ -25,19 +28,20 @@ namespace PcapDotNet.Packets.Dns
public const int AddressSuffix = PrefixLength + sizeof(byte);
}
public const int ConstantPartLength = Offset.AddressSuffix;
public const int MinimumLength = ConstantPartLength + DnsDomainName.RootLength;
private static bool IsAddressSuffixTooBig(byte prefixLength, IpV6Address addressSuffix)
{
return (prefixLength < 128 && (addressSuffix.ToValue() < (UInt128.One << (127 - prefixLength))));
}
private static bool IsAddressSuffixTooSmall(byte prefixLength, IpV6Address addressSuffix)
{
return (prefixLength > 0 && (addressSuffix.ToValue() >= (UInt128.One << (128 - prefixLength))));
}
private const int ConstantPartLength = Offset.AddressSuffix;
private const int MinimumLength = ConstantPartLength + DnsDomainName.RootLength;
/// <summary>
/// Constructs the resource data from the prefix length, address suffix and prefix name fields.
/// </summary>
/// <param name="prefixLength">Encoded as an eight-bit unsigned integer with value between 0 and 128 inclusive.</param>
/// <param name="addressSuffix">
/// An IPv6 address suffix, encoded in network order (high-order octet first).
/// There must be exactly enough octets in this field to contain a number of bits equal to 128 minus prefix length,
/// with 0 to 7 leading pad bits to make this field an integral number of octets.
/// Pad bits, if present, must be set to zero when loading a zone file and ignored (other than for SIG verification) on reception.
/// </param>
/// <param name="prefixName">The name of the prefix, encoded as a domain name. This name must not be compressed. </param>
public DnsResourceDataA6(byte prefixLength, IpV6Address addressSuffix, DnsDomainName prefixName)
{
if (IsAddressSuffixTooBig(prefixLength, addressSuffix))
......@@ -59,7 +63,8 @@ namespace PcapDotNet.Packets.Dns
/// <summary>
/// An IPv6 address suffix, encoded in network order (high-order octet first).
/// There must be exactly enough octets in this field to contain a number of bits equal to 128 minus prefix length, with 0 to 7 leading pad bits to make this field an integral number of octets.
/// There must be exactly enough octets in this field to contain a number of bits equal to 128 minus prefix length,
/// with 0 to 7 leading pad bits to make this field an integral number of octets.
/// Pad bits, if present, must be set to zero when loading a zone file and ignored (other than for SIG verification) on reception.
/// </summary>
public IpV6Address AddressSuffix { get; private set; }
......@@ -75,6 +80,9 @@ namespace PcapDotNet.Packets.Dns
/// </summary>
public DnsDomainName PrefixName { get; private set; }
/// <summary>
/// Two A6 resource datas are equal iff their prefix length, address suffix and prefix name fields are equal.
/// </summary>
public bool Equals(DnsResourceDataA6 other)
{
return other != null &&
......@@ -83,11 +91,17 @@ namespace PcapDotNet.Packets.Dns
PrefixName.Equals(other.PrefixName);
}
/// <summary>
/// Two A6 resource datas are equal iff their prefix length, address suffix and prefix name fields are equal.
/// </summary>
public override bool Equals(object obj)
{
return Equals(obj as DnsResourceDataA6);
}
/// <summary>
/// The combined hash code of the prefix length, address suffix and prefix name fields.
/// </summary>
public override int GetHashCode()
{
return Sequence.GetHashCode(PrefixLength, AddressSuffix, PrefixName);
......@@ -143,6 +157,16 @@ namespace PcapDotNet.Packets.Dns
return new DnsResourceDataA6(prefixLength, addressSuffix, prefixName);
}
private static bool IsAddressSuffixTooBig(byte prefixLength, IpV6Address addressSuffix)
{
return (prefixLength < 128 && (addressSuffix.ToValue() < (UInt128.One << (127 - prefixLength))));
}
private static bool IsAddressSuffixTooSmall(byte prefixLength, IpV6Address addressSuffix)
{
return (prefixLength > 0 && (addressSuffix.ToValue() >= (UInt128.One << (128 - prefixLength))));
}
private static int CalculateAddressSuffixLength(byte prefixLength)
{
return (MaxPrefixLength - prefixLength + 7) / 8;
......
......@@ -25,31 +25,53 @@ namespace PcapDotNet.Packets.Dns
[DnsTypeRegistration(Type = DnsType.Apl)]
public sealed class DnsResourceDataAddressPrefixList: DnsResourceDataSimple, IEquatable<DnsResourceDataAddressPrefixList>
{
/// <summary>
/// Constructs an instance from a sequence of DnsAddressPrefix.
/// </summary>
public DnsResourceDataAddressPrefixList(IList<DnsAddressPrefix> items)
{
Items = items.AsReadOnly();
}
/// <summary>
/// Constructs an instance from a sequence of DnsAddressPrefix.
/// </summary>
public DnsResourceDataAddressPrefixList(params DnsAddressPrefix[] items)
: this((IList<DnsAddressPrefix>)items)
{
Length = items.Sum(item => item.Length);
}
/// <summary>
/// The DnsAddressPrefix items in the list.
/// </summary>
public ReadOnlyCollection<DnsAddressPrefix> Items { get; private set; }
/// <summary>
/// The number of bytes the resource data takes.
/// </summary>
public int Length { get; private set; }
/// <summary>
/// Two DnsResourceDataAddressPrefixList are equal iff their items are equal and in the same order.
/// </summary>
public bool Equals(DnsResourceDataAddressPrefixList other)
{
return other != null &&
Items.SequenceEqual(other.Items);
}
/// <summary>
/// Two DnsResourceDataAddressPrefixList are equal iff their items are equal and in the same order.
/// </summary>
public override bool Equals(object obj)
{
return Equals(obj as DnsResourceDataAddressPrefixList);
}
/// <summary>
/// A hash code based on the items.
/// </summary>
public override int GetHashCode()
{
return Items.SequenceGetHashCode();
......
......@@ -24,8 +24,20 @@ namespace PcapDotNet.Packets.Dns
public const int Address = Format + sizeof(byte);
}
public const int ConstantPartLength = Offset.Address;
private const int ConstantPartLength = Offset.Address;
/// <summary>
/// Constructs an instance from the format and address fields.
/// </summary>
/// <param name="format">The format of Address.</param>
/// <param name="address">
/// Variable length string of octets containing the ATM address of the node to which this RR pertains.
/// When the format is AESA, the address is coded as described in ISO 8348/AD 2 using the preferred binary encoding of the ISO NSAP format.
/// When the format value is E.164, the Address/Number Digits appear in the order in which they would be entered on a numeric keypad.
/// Digits are coded in IA5 characters with the leftmost bit of each digit set to 0.
/// This ATM address appears in ATM End System Address Octets field (AESA format) or the Address/Number Digits field (E.164 format) of the Called party number information element [ATMUNI3.1].
/// Subaddress information is intentionally not included because E.164 subaddress information is used for routing.
/// </param>
public DnsResourceDataAtmAddress(DnsAtmAddressFormat format, DataSegment address)
{
Format = format;
......@@ -47,6 +59,9 @@ namespace PcapDotNet.Packets.Dns
/// </summary>
public DataSegment Address { get; private set; }
/// <summary>
/// Two DnsResourceDataAtmAddress are equal iff their format and address fields are equal.
/// </summary>
public bool Equals(DnsResourceDataAtmAddress other)
{
return other != null &&
......@@ -54,11 +69,17 @@ namespace PcapDotNet.Packets.Dns
Address.Equals(other.Address);
}
/// <summary>
/// Two DnsResourceDataAtmAddress are equal iff their format and address fields are equal.
/// </summary>
public override bool Equals(object obj)
{
return Equals(obj as DnsResourceDataAtmAddress);
}
/// <summary>
/// A hash code based on the format and address fields.
/// </summary>
public override int GetHashCode()
{
return Sequence.GetHashCode(Format, Address);
......
......@@ -4,7 +4,7 @@ using PcapDotNet.Base;
namespace PcapDotNet.Packets.Dns
{
/// <summary>
/// RFC 4034, 5011.
/// RFCs 3757, 4034, 5011.
/// <pre>
/// +-----+----------+----------+--------+----------+--------------------+
/// | bit | 0-6 | 7 | 8 | 9-14 | 15 |
......@@ -21,6 +21,9 @@ namespace PcapDotNet.Packets.Dns
[DnsTypeRegistration(Type = DnsType.DnsKey)]
public sealed class DnsResourceDataDnsKey : DnsResourceDataSimple, IEquatable<DnsResourceDataDnsKey>
{
/// <summary>
/// The expected value for the protocol field.
/// </summary>
public const byte ProtocolValue = 3;
private static class Offset
......@@ -42,6 +45,30 @@ namespace PcapDotNet.Packets.Dns
private const int ConstantPartLength = Offset.PublicKey;
/// <summary>
/// Constructs an instance from the zone key, revoke, secure entry point, protocol, algorithm and public key fields.
/// </summary>
/// <param name="zoneKey">
/// If true, the DNSKEY record holds a DNS zone key, and the DNSKEY RR's owner name must be the name of a zone.
/// If false, then the DNSKEY record holds some other type of DNS public key and must not be used to verify RRSIGs that cover RRsets.
/// </param>
/// <param name="revoke">
/// If true, and the resolver sees an RRSIG(DNSKEY) signed by the associated key,
/// then the resolver must consider this key permanently invalid for all purposes except for validating the revocation.
/// </param>
/// <param name="secureEntryPoint">
/// RFC 3757.
/// If true, then the DNSKEY record holds a key intended for use as a secure entry point.
/// This flag is only intended to be a hint to zone signing or debugging software as to the intended use of this DNSKEY record;
/// validators must not alter their behavior during the signature validation process in any way based on the setting of this bit.
/// This also means that a DNSKEY RR with the SEP bit set would also need the Zone Key flag set in order to be able to generate signatures legally.
/// A DNSKEY RR with the SEP set and the Zone Key flag not set MUST NOT be used to verify RRSIGs that cover RRsets.
/// </param>
/// <param name="protocol">
/// Must have value 3, and the DNSKEY RR MUST be treated as invalid during signature verification if it is found to be some value other than 3.
/// </param>
/// <param name="algorithm">Identifies the public key's cryptographic algorithm and determines the format of the Public Key field.</param>
/// <param name="publicKey">The public key material. The format depends on the algorithm of the key being stored.</param>
public DnsResourceDataDnsKey(bool zoneKey, bool revoke, bool secureEntryPoint, byte protocol, DnsAlgorithm algorithm, DataSegment publicKey)
{
ZoneKey = zoneKey;
......@@ -75,7 +102,7 @@ namespace PcapDotNet.Packets.Dns
public bool SecureEntryPoint { get; private set; }
/// <summary>
/// Musthave value 3, and the DNSKEY RR MUST be treated as invalid during signature verification if it is found to be some value other than 3.
/// Must have value 3, and the DNSKEY RR MUST be treated as invalid during signature verification if it is found to be some value other than 3.
/// </summary>
public byte Protocol { get; private set; }
......@@ -90,6 +117,9 @@ namespace PcapDotNet.Packets.Dns
/// </summary>
public DataSegment PublicKey { get; private set; }
/// <summary>
/// Two DnsResourceDataDnsKey are equal iff their zone key, revoke, secure entry point, protocol, algorithm and public key fields are equal.
/// </summary>
public bool Equals(DnsResourceDataDnsKey other)
{
return other != null &&
......@@ -101,11 +131,17 @@ namespace PcapDotNet.Packets.Dns
PublicKey.Equals(other.PublicKey);
}
/// <summary>
/// Two DnsResourceDataDnsKey are equal iff their zone key, revoke, secure entry point, protocol, algorithm and public key fields are equal.
/// </summary>
public override bool Equals(object obj)
{
return Equals(obj as DnsResourceDataDnsKey);
}
/// <summary>
/// The hash code based on the zone key, revoke, secure entry point, protocol, algorithm and public key fields.
/// </summary>
public override int GetHashCode()
{
return BitSequence.Merge(BitSequence.Merge(ZoneKey, Revoke, SecureEntryPoint), Protocol, (byte)Algorithm).GetHashCode();
......
......@@ -22,23 +22,38 @@ namespace PcapDotNet.Packets.Dns
[DnsTypeRegistration(Type = DnsType.DName)]
public sealed class DnsResourceDataDomainName : DnsResourceData, IEquatable<DnsResourceDataDomainName>
{
/// <summary>
/// Constructs an instance from the domain name data.
/// </summary>
public DnsResourceDataDomainName(DnsDomainName data)
{
Data = data;
}
/// <summary>
/// The domain name value.
/// </summary>
public DnsDomainName Data { get; private set; }
/// <summary>
/// Two DnsResourceDataDomainName are equal iff their domain name values are equal.
/// </summary>
public bool Equals(DnsResourceDataDomainName other)
{
return other != null && Data.Equals(other.Data);
}
/// <summary>
/// Two DnsResourceDataDomainName are equal iff their domain name values are equal.
/// </summary>
public override bool Equals(object obj)
{
return Equals(obj as DnsResourceDataDomainName);
}
/// <summary>
/// The hash code of the domain name value.
/// </summary>
public override int GetHashCode()
{
return Data.GetHashCode();
......
......@@ -19,6 +19,24 @@ namespace PcapDotNet.Packets.Dns
[DnsTypeRegistration(Type = DnsType.GPos)]
public sealed class DnsResourceDataGeographicalPosition : DnsResourceDataSimple, IEquatable<DnsResourceDataGeographicalPosition>
{
/// <summary>
/// Constructs an instnace from the longitude, latitude and altitude fields.
/// </summary>
/// <param name="longitude">
/// The real number describing the longitude encoded as a printable string.
/// The precision is limited by 256 charcters within the range -90..90 degrees.
/// Positive numbers indicate locations north of the equator.
/// </param>
/// <param name="latitude">
/// The real number describing the latitude encoded as a printable string.
/// The precision is limited by 256 charcters within the range -180..180 degrees.
/// Positive numbers indicate locations east of the prime meridian.
/// </param>
/// <param name="altitude">
/// The real number describing the altitude (in meters) from mean sea-level encoded as a printable string.
/// The precision is limited by 256 charcters.
/// Positive numbers indicate locations above mean sea-level.
/// </param>
public DnsResourceDataGeographicalPosition(string longitude, string latitude, string altitude)
{
Longitude = longitude;
......@@ -47,20 +65,28 @@ namespace PcapDotNet.Packets.Dns
/// </summary>
public string Altitude { get; private set; }
/// <summary>
/// Two DnsResourceDataGeographicalPosition are equal if their longitude, latitude and altitude fields are equal.
/// </summary>
public bool Equals(DnsResourceDataGeographicalPosition other)
{
return other != null &&
Longitude.Equals(other.Longitude) &&
Latitude.Equals(other.Latitude) &&
Altitude.Equals(other.Altitude);
}
/// <summary>
/// Two DnsResourceDataGeographicalPosition are equal if their longitude, latitude and altitude fields are equal.
/// </summary>
public override bool Equals(object obj)
{
return Equals(obj as DnsResourceDataGeographicalPosition);
}
/// <summary>
/// A hash code of the combined longitude, latitude and altitude fields.
/// </summary>
public override int GetHashCode()
{
return Sequence.GetHashCode(Longitude, Latitude, Altitude);
......
......@@ -17,13 +17,24 @@ namespace PcapDotNet.Packets.Dns
{
private const int NumStrings = 2;
/// <summary>
/// Constructs the resource data from the CPU and OS parameters.
/// </summary>
/// <param name="cpu">A string which specifies the CPU type.</param>
/// <param name="os">A string which specifies the operating system type.</param>
public DnsResourceDataHostInformation(DataSegment cpu, DataSegment os)
: base(cpu, os)
{
}
/// <summary>
/// A string which specifies the CPU type.
/// </summary>
public DataSegment Cpu { get { return Strings[0]; } }
/// <summary>
/// A string which specifies the operating system type.
/// </summary>
public DataSegment Os { get { return Strings[1]; } }
internal DnsResourceDataHostInformation()
......
......@@ -18,12 +18,29 @@ namespace PcapDotNet.Packets.Dns
private const int MinNumStrings = 1;
private const int MaxNumStrings = 2;
/// <summary>
/// Constructs an ISDN resource data without a subaddress from the ISDN address.
/// </summary>
/// <param name="isdnAddress">
/// Identifies the ISDN number of the owner and DDI (Direct Dial In) if any, as defined by E.164 and E.163,
/// the ISDN and PSTN (Public Switched Telephone Network) numbering plan.
/// E.163 defines the country codes, and E.164 the form of the addresses.
/// </param>
public DnsResourceDataIsdn(DataSegment isdnAddress)
: base(isdnAddress)
{
}
/// <summary>
/// Constructs an ISDN resource data from the ISDN address and subaddress.
/// </summary>
/// <param name="isdnAddress">
/// Identifies the ISDN number of the owner and DDI (Direct Dial In) if any, as defined by E.164 and E.163,
/// the ISDN and PSTN (Public Switched Telephone Network) numbering plan.
/// E.163 defines the country codes, and E.164 the form of the addresses.
/// </param>
/// <param name="subaddress">Specifies the subaddress (SA).</param>
public DnsResourceDataIsdn(DataSegment isdnAddress, DataSegment subaddress)
: base(isdnAddress, subaddress)
{
......
......@@ -23,6 +23,9 @@ namespace PcapDotNet.Packets.Dns
[DnsTypeRegistration(Type = DnsType.Loc)]
public sealed class DnsResourceDataLocationInformation : DnsResourceDataSimple, IEquatable<DnsResourceDataLocationInformation>
{
/// <summary>
/// The maximum value for the size field.
/// </summary>
public const ulong MaxSizeValue = 9 * 1000000000L;
private static class Offset
......@@ -36,8 +39,61 @@ namespace PcapDotNet.Packets.Dns
public const int Altitude = Longitude + sizeof(uint);
}
/// <summary>
/// The number of bytes this resource data takes.
/// </summary>
public const int Length = Offset.Altitude + sizeof(uint);
/// <summary>
/// Constructs an instance from the version, size, horizontal precision, vertical precision, latitude, longitude and altitude fields.
/// </summary>
/// <param name="version">
/// Version number of the representation.
/// This must be zero.
/// Implementations are required to check this field and make no assumptions about the format of unrecognized versions.
/// </param>
/// <param name="size">
/// The diameter of a sphere enclosing the described entity, in centimeters.
/// Only numbers of the form decimal digit times 10 in the power of a decimal digit are allowed since it is expressed as a pair of four-bit unsigned integers,
/// each ranging from zero to nine, with the most significant four bits representing the base and the second number representing the power of ten by which to multiply the base.
/// This allows sizes from 0e0 (&lt;1cm) to 9e9(90,000km) to be expressed.
/// This representation was chosen such that the hexadecimal representation can be read by eye; 0x15 = 1e5.
/// Four-bit values greater than 9 are undefined, as are values with a base of zero and a non-zero exponent.
///
/// Since 20000000m (represented by the value 0x29) is greater than the equatorial diameter of the WGS 84 ellipsoid (12756274m),
/// it is therefore suitable for use as a "worldwide" size.
/// </param>
/// <param name="horizontalPrecision">
/// The horizontal precision of the data, in centimeters, expressed using the same representation as Size.
/// This is the diameter of the horizontal "circle of error", rather than a "plus or minus" value.
/// (This was chosen to match the interpretation of Size; to get a "plus or minus" value, divide by 2.)
/// </param>
/// <param name="verticalPrecision">
/// The vertical precision of the data, in centimeters, expressed using the sane representation as for Size.
/// This is the total potential vertical error, rather than a "plus or minus" value.
/// (This was chosen to match the interpretation of SIize; to get a "plus or minus" value, divide by 2.)
/// Note that if altitude above or below sea level is used as an approximation for altitude relative to the ellipsoid, the precision value should be adjusted.
/// </param>
/// <param name="latitude">
/// The latitude of the center of the sphere described by the Size field, expressed as a 32-bit integer,
/// most significant octet first (network standard byte order), in thousandths of a second of arc.
/// 2^31 represents the equator; numbers above that are north latitude.
/// </param>
/// <param name="longitude">
/// The longitude of the center of the sphere described by the Size field, expressed as a 32-bit integer,
/// most significant octet first (network standard byte order), in thousandths of a second of arc, rounded away from the prime meridian.
/// 2^31 represents the prime meridian; numbers above that are east longitude.
/// </param>
/// <param name="altitude">
/// The altitude of the center of the sphere described by the Size field, expressed as a 32-bit integer,
/// most significant octet first (network standard byte order), in centimeters,
/// from a base of 100,000m below the reference spheroid used by GPS (semimajor axis a=6378137.0, reciprocal flattening rf=298.257223563).
/// Altitude above (or below) sea level may be used as an approximation of altitude relative to the the spheroid,
/// though due to the Earth's surface not being a perfect spheroid, there will be differences.
/// (For example, the geoid (which sea level approximates) for the continental US ranges from 10 meters to 50 meters below the spheroid.
/// Adjustments to Altitude and/or VerticalPrecision will be necessary in most cases.
/// The Defense Mapping Agency publishes geoid height values relative to the ellipsoid.
/// </param>
public DnsResourceDataLocationInformation(byte version, ulong size, ulong horizontalPrecision, ulong verticalPrecision, uint latitude, uint longitude,
uint altitude)
{
......@@ -118,6 +174,10 @@ namespace PcapDotNet.Packets.Dns
/// </summary>
public uint Altitude { get; private set; }
/// <summary>
/// Two DnsResourceDataLocationInformation are equal iff their version, size, horizontal precision, vertical precision, latitude,
/// longitude and altitude fields are equal.
/// </summary>
public bool Equals(DnsResourceDataLocationInformation other)
{
return other != null &&
......@@ -130,11 +190,18 @@ namespace PcapDotNet.Packets.Dns
Altitude.Equals(other.Altitude);
}
/// <summary>
/// Two DnsResourceDataLocationInformation are equal iff their version, size, horizontal precision, vertical precision, latitude,
/// longitude and altitude fields are equal.
/// </summary>
public override bool Equals(object obj)
{
return Equals(obj as DnsResourceDataLocationInformation);
}
/// <summary>
/// A hash code based on the version, size, horizontal precision, vertical precision, latitude, longitude and altitude fields
/// </summary>
public override int GetHashCode()
{
return Sequence.GetHashCode(Version, Size, HorizontalPrecision, VerticalPrecision, Latitude, Longitude, Altitude);
......
......@@ -18,6 +18,10 @@ namespace PcapDotNet.Packets.Dns
{
private const int MinNumStrings = 1;
/// <summary>
/// Constructs the resource data from strings.
/// </summary>
/// <param name="strings">A descriptive text in one or more strings.</param>
public DnsResourceDataNInfo(ReadOnlyCollection<DataSegment> strings)
: base(strings)
{
......@@ -28,6 +32,10 @@ namespace PcapDotNet.Packets.Dns
throw new ArgumentOutOfRangeException("strings", strings.Count, "There must be at least one string.");
}
/// <summary>
/// Constructs the resource data from strings.
/// </summary>
/// <param name="strings">A descriptive text in one or more strings.</param>
public DnsResourceDataNInfo(params DataSegment[] strings)
: this(strings.AsReadOnly())
{
......
......@@ -21,9 +21,32 @@ namespace PcapDotNet.Packets.Dns
[DnsTypeRegistration(Type = DnsType.NextDomain)]
public sealed class DnsResourceDataNextDomain : DnsResourceData, IEquatable<DnsResourceDataNextDomain>
{
/// <summary>
/// The maximum length in bytes of the type bitmap.
/// </summary>
public const int MaxTypeBitmapLength = 16;
/// <summary>
/// The maximum DNS type that can be in the type bitmap.
/// </summary>
public const DnsType MaxTypeBitmapDnsType = (DnsType)(8 * MaxTypeBitmapLength);
/// <summary>
/// Constructs an instance from next domain name and type bitmap.
/// </summary>
/// <param name="nextDomainName">The next domain name according to the canonical DNS name order.</param>
/// <param name="typeBitmap">
/// One bit per RR type present for the owner name.
/// A one bit indicates that at least one RR of that type is present for the owner name.
/// A zero indicates that no such RR is present.
/// All bits not specified because they are beyond the end of the bit map are assumed to be zero.
/// Note that bit 30, for NXT, will always be on so the minimum bit map length is actually four octets.
/// Trailing zero octets are prohibited in this format.
/// The first bit represents RR type zero (an illegal type which can not be present) and so will be zero in this format.
/// This format is not used if there exists an RR with a type number greater than 127.
/// If the zero bit of the type bit map is a one, it indicates that a different format is being used which will always be
/// the case if a type number greater than 127 is present.
/// </param>
public DnsResourceDataNextDomain(DnsDomainName nextDomainName, DataSegment typeBitmap)
{
if (typeBitmap == null)
......@@ -53,10 +76,14 @@ namespace PcapDotNet.Packets.Dns
/// Trailing zero octets are prohibited in this format.
/// The first bit represents RR type zero (an illegal type which can not be present) and so will be zero in this format.
/// This format is not used if there exists an RR with a type number greater than 127.
/// If the zero bit of the type bit map is a one, it indicates that a different format is being used which will always be the case if a type number greater than 127 is present.
/// If the zero bit of the type bit map is a one, it indicates that a different format is being used which will always be
/// the case if a type number greater than 127 is present.
/// </summary>
public DataSegment TypeBitmap { get; private set; }
/// <summary>
/// Returns all the types that exist in the type bitmap.
/// </summary>
public IEnumerable<DnsType> TypesExist
{
get
......@@ -76,6 +103,9 @@ namespace PcapDotNet.Packets.Dns
}
}
/// <summary>
/// True iff the given type exists in the bitmap.
/// </summary>
public bool IsTypePresentForOwner(DnsType dnsType)
{
if (dnsType >= MaxTypeBitmapDnsType)
......@@ -91,6 +121,9 @@ namespace PcapDotNet.Packets.Dns
return TypeBitmap.ReadBool(byteOffset, mask);
}
/// <summary>
/// Creates a type bitmap from a given list of DNS types.
/// </summary>
public static DataSegment CreateTypeBitmap(IEnumerable<DnsType> typesPresentForOwner)
{
if (typesPresentForOwner == null)
......@@ -114,6 +147,9 @@ namespace PcapDotNet.Packets.Dns
return new DataSegment(typeBitmapBuffer);
}
/// <summary>
/// Two DnsResourceDataNextDomain are equal iff their next domain name and type bitmap fields are equal.
/// </summary>
public bool Equals(DnsResourceDataNextDomain other)
{
return other != null &&
......@@ -121,11 +157,17 @@ namespace PcapDotNet.Packets.Dns
TypeBitmap.Equals(other.TypeBitmap);
}
/// <summary>
/// Two DnsResourceDataNextDomain are equal iff their next domain name and type bitmap fields are equal.
/// </summary>
public override bool Equals(object obj)
{
return Equals(obj as DnsResourceDataNextDomain);
}
/// <summary>
/// A hash code based on the next domain name and type bitmap fields.
/// </summary>
public override int GetHashCode()
{
return Sequence.GetHashCode(NextDomainName, TypeBitmap);
......
......@@ -20,6 +20,18 @@ namespace PcapDotNet.Packets.Dns
[DnsTypeRegistration(Type = DnsType.NSec)]
public sealed class DnsResourceDataNextDomainSecure : DnsResourceDataNoCompression, IEquatable<DnsResourceDataNextDomainSecure>
{
/// <summary>
/// Constructs an instance from the next domain name and types exist fields.
/// </summary>
/// <param name="nextDomainName">
/// Contains the next owner name (in the canonical ordering of the zone) that has authoritative data or contains a delegation point NS RRset;
/// The value of the Next Domain Name field in the last NSEC record in the zone is the name of the zone apex (the owner name of the zone's SOA RR).
/// This indicates that the owner name of the NSEC RR is the last name in the canonical ordering of the zone.
///
/// Owner names of RRsets for which the given zone is not authoritative (such as glue records) must not be listed in the Next Domain Name
/// unless at least one authoritative RRset exists at the same owner name.
/// </param>
/// <param name="typesExist">Identifies the RRset types that exist at the NSEC RR's owner name.</param>
public DnsResourceDataNextDomainSecure(DnsDomainName nextDomainName, IEnumerable<DnsType> typesExist)
: this(nextDomainName, new DnsTypeBitmaps(typesExist))
{
......@@ -41,11 +53,17 @@ namespace PcapDotNet.Packets.Dns
/// </summary>
public ReadOnlyCollection<DnsType> TypesExist { get { return _typeBitmaps.TypesExist.AsReadOnly(); } }
/// <summary>
/// True iff the given dns type exists.
/// </summary>
public bool IsTypePresentForOwner(DnsType dnsType)
{
return _typeBitmaps.Contains(dnsType);
}
/// <summary>
/// Two DnsResourceDataNextDomainSecure are equal iff their next domain name and types exist fields are equal.
/// </summary>
public bool Equals(DnsResourceDataNextDomainSecure other)
{
return other != null &&
......@@ -53,11 +71,17 @@ namespace PcapDotNet.Packets.Dns
_typeBitmaps.Equals(other._typeBitmaps);
}
/// <summary>
/// Two DnsResourceDataNextDomainSecure are equal iff their next domain name and types exist fields are equal.
/// </summary>
public override bool Equals(object obj)
{
return Equals(obj as DnsResourceDataNextDomainSecure);
}
/// <summary>
/// A hash code of the combined next domain name and types exist fields.
/// </summary>
public override int GetHashCode()
{
return Sequence.GetHashCode(NextDomainName, _typeBitmaps);
......
......@@ -47,7 +47,8 @@ namespace PcapDotNet.Packets.Dns
/// <summary>
/// Defines the number of additional times the hash function has been performed.
/// More iterations result in greater resiliency of the hash value against dictionary attacks, but at a higher computational cost for both the server and resolver.
/// More iterations result in greater resiliency of the hash value against dictionary attacks,
/// but at a higher computational cost for both the server and resolver.
/// </summary>
public ushort Iterations { get; private set; }
......
......@@ -19,22 +19,42 @@ namespace PcapDotNet.Packets.Dns
[DnsTypeRegistration(Type = DnsType.NSec3Parameters)]
public sealed class DnsResourceDataNextDomainSecure3Parameters : DnsResourceDataNextDomainSecure3Base, IEquatable<DnsResourceDataNextDomainSecure3Parameters>
{
/// <summary>
/// Constructs a next domain secure 3 parameters resource data from the hash algorithm, flags, iterations and salt fields.
/// </summary>
/// <param name="hashAlgorithm">Identifies the cryptographic hash algorithm used to construct the hash-value.</param>
/// <param name="flags">Can be used to indicate different processing. All undefined flags must be zero.</param>
/// <param name="iterations">
/// Defines the number of additional times the hash function has been performed.
/// More iterations result in greater resiliency of the hash value against dictionary attacks,
/// but at a higher computational cost for both the server and resolver.
/// </param>
/// <param name="salt">Appended to the original owner name before hashing in order to defend against pre-calculated dictionary attacks.</param>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms", MessageId = "flags")]
public DnsResourceDataNextDomainSecure3Parameters(DnsSecNSec3HashAlgorithm hashAlgorithm, DnsSecNSec3Flags flags, ushort iterations, DataSegment salt)
: base(hashAlgorithm, flags, iterations, salt)
{
}
/// <summary>
/// Two DnsResourceDataNextDomainSecure3Parameters are equal if they have the hash algorithm, flags, iterations and salt fields.
/// </summary>
public bool Equals(DnsResourceDataNextDomainSecure3Parameters other)
{
return EqualsParameters(other);
}
/// <summary>
/// Two DnsResourceDataNextDomainSecure3Parameters are equal if they have the hash algorithm, flags, iterations and salt fields.
/// </summary>
public override bool Equals(object obj)
{
return Equals(obj as DnsResourceDataNextDomainSecure3Parameters);
}
/// <summary>
/// A hash code made up from the combination of the hash algorithm, flags, iterations and salt fields.
/// </summary>
public override int GetHashCode()
{
return GetHashCodeParameters();
......
......@@ -21,24 +21,39 @@ namespace PcapDotNet.Packets.Dns
[DnsTypeRegistration(Type = DnsType.Opt)]
public sealed class DnsResourceDataOptions : DnsResourceDataSimple, IEquatable<DnsResourceDataOptions>
{
/// <summary>
/// Constructs an instance from options.
/// </summary>
public DnsResourceDataOptions(DnsOptions options)
{
Options = options;
}
/// <summary>
/// The list of options.
/// </summary>
public DnsOptions Options { get; private set; }
/// <summary>
/// Two DnsResourceDataOptions are equal if the options are equal.
/// </summary>
public bool Equals(DnsResourceDataOptions other)
{
return other != null &&
Options.Equals(other.Options);
}
/// <summary>
/// Two DnsResourceDataOptions are equal if the options are equal.
/// </summary>
public override bool Equals(object obj)
{
return Equals(obj as DnsResourceDataOptions);
}
/// <summary>
/// The hash code of the options.
/// </summary>
public override int GetHashCode()
{
return Options.GetHashCode();
......
......@@ -29,6 +29,13 @@ namespace PcapDotNet.Packets.Dns
private const int ConstantPartLength = Offset.PublicKey;
/// <summary>
/// Constructs an instance out of the flags, protocol, algorithm and public key fields.
/// </summary>
/// <param name="flags">Reserved and must be zero.</param>
/// <param name="protocol">Must be set to 1.</param>
/// <param name="algorithm">The key algorithm parallel to the same field for the SIG resource.</param>
/// <param name="publicKey">The public key value.</param>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms", MessageId = "flags")]
public DnsResourceDataRKey(ushort flags, byte protocol, DnsAlgorithm algorithm, DataSegment publicKey)
{
......@@ -59,6 +66,9 @@ namespace PcapDotNet.Packets.Dns
/// </summary>
public DataSegment PublicKey { get; private set; }
/// <summary>
/// Two DnsResourceDataRKey are equal iff their flags, protocol, algorithm and public key fields are equal.
/// </summary>
public bool Equals(DnsResourceDataRKey other)
{
return other != null &&
......@@ -68,11 +78,17 @@ namespace PcapDotNet.Packets.Dns
PublicKey.Equals(other.PublicKey);
}
/// <summary>
/// Two DnsResourceDataRKey are equal iff their flags, protocol, algorithm and public key fields are equal.
/// </summary>
public override bool Equals(object obj)
{
return Equals(obj as DnsResourceDataRKey);
}
/// <summary>
/// A hash code based on the flags, protocol, algorithm and public key fields.
/// </summary>
public override int GetHashCode()
{
return BitSequence.Merge(Flags, Protocol, (byte)Algorithm).GetHashCode();
......
......@@ -26,8 +26,16 @@ namespace PcapDotNet.Packets.Dns
public const int Data = Subcoding + sizeof(byte);
}
public const int ConstantPartLength = Offset.Data;
private const int ConstantPartLength = Offset.Data;
/// <summary>
/// Construct an instance out of the coding subcoding and data fields.
/// </summary>
/// <param name="codingSubCoding">
/// A combination of coding and subcoding.
/// Has a valid enum value if the subcoding is defined specifically for the coding.
/// </param>
/// <param name="data">Variable length and could be null in some cases.</param>
public DnsResourceDataSink(DnsSinkCodingSubCoding codingSubCoding, DataSegment data)
: this((DnsSinkCoding)((ushort)codingSubCoding >> 8), (byte)((ushort)codingSubCoding & 0x00FF), data)
{
......@@ -68,6 +76,9 @@ namespace PcapDotNet.Packets.Dns
/// </summary>
public DataSegment Data { get; private set; }
/// <summary>
/// Two are equal iff their coding, subcoding and data fields are equal.
/// </summary>
public bool Equals(DnsResourceDataSink other)
{
return other != null &&
......@@ -76,11 +87,17 @@ namespace PcapDotNet.Packets.Dns
Data.Equals(other.Data);
}
/// <summary>
/// Two are equal iff their coding, subcoding and data fields are equal.
/// </summary>
public override bool Equals(object obj)
{
return Equals(obj as DnsResourceDataSink);
}
/// <summary>
/// A hash code based on the coding, subcoding and data fields.
/// </summary>
public override int GetHashCode()
{
return Sequence.GetHashCode(CodingSubCoding, Data);
......
......@@ -26,8 +26,17 @@ namespace PcapDotNet.Packets.Dns
public const int Fingerprint = FingerprintType + sizeof(byte);
}
public const int ConstPartLength = Offset.Fingerprint;
private const int ConstPartLength = Offset.Fingerprint;
/// <summary>
/// Constructs an instance out of the algorithm, fingerprint type and fingerprint fields.
/// </summary>
/// <param name="algorithm">Describes the algorithm of the public key.</param>
/// <param name="fingerprintType">Describes the message-digest algorithm used to calculate the fingerprint of the public key.</param>
/// <param name="fingerprint">
/// The fingerprint is calculated over the public key blob.
/// The message-digest algorithm is presumed to produce an opaque octet string output, which is placed as-is in the RDATA fingerprint field.
/// </param>
public DnsResourceDataSshFingerprint(DnsFingerprintPublicKeyAlgorithm algorithm, DnsFingerprintType fingerprintType, DataSegment fingerprint)
{
Algorithm = algorithm;
......@@ -51,6 +60,9 @@ namespace PcapDotNet.Packets.Dns
/// </summary>
public DataSegment Fingerprint { get; private set; }
/// <summary>
/// Two DnsResourceDataSshFingerprint are equal iff the algorithm, fingerprint type and fingerprint fields are equal.
/// </summary>
public bool Equals(DnsResourceDataSshFingerprint other)
{
return other != null &&
......@@ -59,11 +71,17 @@ namespace PcapDotNet.Packets.Dns
Fingerprint.Equals(other.Fingerprint);
}
/// <summary>
/// Two DnsResourceDataSshFingerprint are equal iff the algorithm, fingerprint type and fingerprint fields are equal.
/// </summary>
public override bool Equals(object obj)
{
return Equals(obj as DnsResourceDataSshFingerprint);
}
/// <summary>
/// A hash code based on the algorithm, fingerprint type and fingerprint fields.
/// </summary>
public override int GetHashCode()
{
return Sequence.GetHashCode(BitSequence.Merge((byte)Algorithm, (byte)FingerprintType), Fingerprint);
......
......@@ -18,6 +18,11 @@ namespace PcapDotNet.Packets.Dns
{
private const int MinimumLength = 2 * DnsDomainName.RootLength;
/// <summary>
/// Constructs the resource data from the previous and next fields.
/// </summary>
/// <param name="previous">The start, or previous name.</param>
/// <param name="next">End or next name in the list.</param>
public DnsResourceDataTrustAnchorLink(DnsDomainName previous, DnsDomainName next)
{
Previous = previous;
......@@ -34,6 +39,9 @@ namespace PcapDotNet.Packets.Dns
/// </summary>
public DnsDomainName Next { get; private set; }
/// <summary>
/// Two trust anchor link resource datas are equal iff their previous and next fields are equal.
/// </summary>
public bool Equals(DnsResourceDataTrustAnchorLink other)
{
return other != null &&
......@@ -41,11 +49,17 @@ namespace PcapDotNet.Packets.Dns
Next.Equals(other.Next);
}
/// <summary>
/// Two trust anchor link resource datas are equal iff their previous and next fields are equal.
/// </summary>
public override bool Equals(object obj)
{
return Equals(obj as DnsResourceDataTrustAnchorLink);
}
/// <summary>
/// The combined hash code of the previous and next fields.
/// </summary>
public override int GetHashCode()
{
return Sequence.GetHashCode(Previous, Next);
......
......@@ -26,6 +26,9 @@ namespace PcapDotNet.Packets.Dns
private const int ConstantPartLength = Offset.DomainName;
/// <summary>
/// Two DnsResourceDataUShortDomainName are equal iff their of the same type and their ushort values and domain names are equal.
/// </summary>
public bool Equals(DnsResourceDataUShortDomainName other)
{
return other != null &&
......@@ -34,12 +37,18 @@ namespace PcapDotNet.Packets.Dns
DomainName.Equals(other.DomainName);
}
public override bool Equals(object obj)
/// <summary>
/// Two DnsResourceDataUShortDomainName are equal iff their of the same type and their ushort values and domain names are equal.
/// </summary>
public override sealed bool Equals(object obj)
{
return Equals(obj as DnsResourceDataUShortDomainName);
}
public override int GetHashCode()
/// <summary>
/// A hash code based on the type, ushort value and domain name.
/// </summary>
public override sealed int GetHashCode()
{
return Sequence.GetHashCode(GetType(), Value, DomainName);
}
......
......@@ -28,6 +28,12 @@ namespace PcapDotNet.Packets.Dns
private const int ConstantPartLength = Offset.Bitmap;
/// <summary>
/// Constructs an instance from the address, protocol and bitmap fields.
/// </summary>
/// <param name="address">The service address.</param>
/// <param name="protocol">Specifies an IP protocol number.</param>
/// <param name="bitmap">Has one bit per port of the specified protocol.</param>
public DnsResourceDataWellKnownService(IpV4Address address, IpV4Protocol protocol, DataSegment bitmap)
{
Address = address;
......@@ -50,6 +56,9 @@ namespace PcapDotNet.Packets.Dns
/// </summary>
public DataSegment Bitmap { get; private set; }
/// <summary>
/// Two DnsResourceDataWellKnownService are equal iff their address, protocol and bitmap fields are equal.
/// </summary>
public bool Equals(DnsResourceDataWellKnownService other)
{
return other != null &&
......@@ -58,11 +67,17 @@ namespace PcapDotNet.Packets.Dns
Bitmap.Equals(other.Bitmap);
}
/// <summary>
/// Two DnsResourceDataWellKnownService are equal iff their address, protocol and bitmap fields are equal.
/// </summary>
public override bool Equals(object obj)
{
return Equals(obj as DnsResourceDataWellKnownService);
}
/// <summary>
/// A hash code based on the address, protocol and bitmap fields.
/// </summary>
public override int GetHashCode()
{
return Sequence.GetHashCode(Address, Protocol, Bitmap);
......
......@@ -26,6 +26,9 @@ namespace PcapDotNet.Packets.IpV6
get { return _zero; }
}
/// <summary>
/// The maximum address value.
/// </summary>
public static IpV6Address MaxValue
{
get { return _maxValue; }
......
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