Commit d4f798e6 authored by Brickner_cp's avatar Brickner_cp

Warnings, Code Analysis and Documentation. 61 warnings left.

parent 57ac89fd
......@@ -32,6 +32,17 @@ namespace PcapDotNet.Packets.Dns
private const int ConstantPartLength = Offset.Tag;
/// <summary>
/// Constructs an instance out of the flags, tag and value fields.
/// </summary>
/// <param name="flags">Flags of the record.</param>
/// <param name="tag">
/// The property identifier, a sequence of ASCII characters.
/// Tag values may contain ASCII characters a through z and the numbers 0 through 9.
/// Tag values must not contain any other characters.
/// Matching of tag values is case insensitive.
/// </param>
/// <param name="value">Represents the property value. Property values are encoded as binary values and may employ sub-formats.</param>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1726:UsePreferredTerms", MessageId = "flags")]
public DnsResourceDataCertificationAuthorityAuthorization(DnsCertificationAuthorityAuthorizationFlags flags, DataSegment tag, DataSegment value)
{
......@@ -66,6 +77,9 @@ namespace PcapDotNet.Packets.Dns
/// </summary>
public DataSegment Value { get; private set; }
/// <summary>
/// Two DnsResourceDataCertificationAuthorityAuthorization are equal iff their flags, tag and value fields are equal.
/// </summary>
public bool Equals(DnsResourceDataCertificationAuthorityAuthorization other)
{
return other != null &&
......@@ -74,11 +88,17 @@ namespace PcapDotNet.Packets.Dns
Value.SequenceEqual(other.Value);
}
/// <summary>
/// Two DnsResourceDataCertificationAuthorityAuthorization are equal iff their flags, tag and value fields are equal.
/// </summary>
public override bool Equals(object obj)
{
return Equals(obj as DnsResourceDataCertificationAuthorityAuthorization);
}
/// <summary>
/// A hash code of the combination of the flags, tag and value fields.
/// </summary>
public override int GetHashCode()
{
return Sequence.GetHashCode(Flags, Tag, Value);
......
......@@ -31,8 +31,24 @@ namespace PcapDotNet.Packets.Dns
public const int Digest = DigestType + sizeof(byte);
}
public const int ConstPartLength = Offset.Digest;
private const int ConstPartLength = Offset.Digest;
/// <summary>
/// Constructs an instance out of the key tag, algorithm, digest type and digest fields.
/// </summary>
/// <param name="keyTag">
/// Lists the key tag of the DNSKEY RR referred to by the DS record.
/// The Key Tag used by the DS RR is identical to the Key Tag used by RRSIG RRs.
/// Calculated as specified in RFC 2535.
/// </param>
/// <param name="algorithm">Algorithm must be allowed to sign DNS data.</param>
/// <param name="digestType">An identifier for the digest algorithm used.</param>
/// <param name="digest">
/// Calculated over the canonical name of the delegated domain name followed by the whole RDATA of the KEY record (all four fields).
/// digest = hash(canonical FQDN on KEY RR | KEY_RR_rdata)
/// KEY_RR_rdata = Flags | Protocol | Algorithm | Public Key
/// The size of the digest may vary depending on the digest type.
/// </param>
public DnsResourceDataDelegationSigner(ushort keyTag, DnsAlgorithm algorithm, DnsDigestType digestType, DataSegment digest)
{
if (digest == null)
......@@ -90,6 +106,9 @@ namespace PcapDotNet.Packets.Dns
/// </summary>
public DataSegment ExtraDigest { get; private set; }
/// <summary>
/// Two DnsResourceDataDelegationSigner are equal iff their key tag, algorithm, digest type and digest fields are equal.
/// </summary>
public bool Equals(DnsResourceDataDelegationSigner other)
{
return other != null &&
......@@ -99,11 +118,17 @@ namespace PcapDotNet.Packets.Dns
Digest.Equals(other.Digest);
}
/// <summary>
/// Two DnsResourceDataDelegationSigner are equal iff their key tag, algorithm, digest type and digest fields are equal.
/// </summary>
public override bool Equals(object obj)
{
return Equals(obj as DnsResourceDataDelegationSigner);
}
/// <summary>
/// A hash code of the combination of the key tag, algorithm, digest type and digest fields.
/// </summary>
public override int GetHashCode()
{
return Sequence.GetHashCode(BitSequence.Merge(KeyTag, (byte)Algorithm, (byte)DigestType), Digest);
......
......@@ -31,8 +31,43 @@ namespace PcapDotNet.Packets.Dns
public const int Target = Port + sizeof(ushort);
}
public const int ConstantPartLength = Offset.Target;
private const int ConstantPartLength = Offset.Target;
/// <summary>
/// Constructs an instance out of the priority, weight, port and target fields.
/// </summary>
/// <param name="priority">
/// The priority of this target host.
/// A client must attempt to contact the target host with the lowest-numbered priority it can reach;
/// target hosts with the same priority should be tried in an order defined by the weight field.
/// </param>
/// <param name="weight">
/// A server selection mechanism.
/// The weight field specifies a relative weight for entries with the same priority.
/// Larger weights should be given a proportionately higher probability of being selected.
/// Domain administrators should use Weight 0 when there isn't any server selection to do, to make the RR easier to read for humans (less noisy).
/// In the presence of records containing weights greater than 0, records with weight 0 should have a very small chance of being selected.
///
/// In the absence of a protocol whose specification calls for the use of other weighting information, a client arranges the SRV RRs of the same Priority in the order in which target hosts,
/// specified by the SRV RRs, will be contacted.
/// The following algorithm SHOULD be used to order the SRV RRs of the same priority:
/// To select a target to be contacted next, arrange all SRV RRs (that have not been ordered yet) in any order, except that all those with weight 0 are placed at the beginning of the list.
/// Compute the sum of the weights of those RRs, and with each RR associate the running sum in the selected order.
/// Then choose a uniform random number between 0 and the sum computed (inclusive), and select the RR whose running sum value is the first in the selected order which is greater than or equal to the random number selected.
/// The target host specified in the selected SRV RR is the next one to be contacted by the client.
/// Remove this SRV RR from the set of the unordered SRV RRs and apply the described algorithm to the unordered SRV RRs to select the next target host.
/// Continue the ordering process until there are no unordered SRV RRs.
/// This process is repeated for each Priority.
/// </param>
/// <param name="port">The port on this target host of this service. This is often as specified in Assigned Numbers but need not be.</param>
/// <param name="target">
/// The domain name of the target host.
/// There must be one or more address records for this name, the name must not be an alias (in the sense of RFC 1034 or RFC 2181).
/// Implementors are urged, but not required, to return the address record(s) in the Additional Data section.
/// Unless and until permitted by future standards action, name compression is not to be used for this field.
///
/// A Target of "." means that the service is decidedly not available at this domain.
/// </param>
public DnsResourceDataServerSelection(ushort priority, ushort weight, ushort port, DnsDomainName target)
{
Priority = priority;
......@@ -84,6 +119,9 @@ namespace PcapDotNet.Packets.Dns
/// </summary>
public DnsDomainName Target { get; private set; }
/// <summary>
/// Two DnsResourceDataServerSelection are equal iff their priority, weight, port and target fields are equal.
/// </summary>
public bool Equals(DnsResourceDataServerSelection other)
{
return other != null &&
......@@ -93,14 +131,20 @@ namespace PcapDotNet.Packets.Dns
Target.Equals(other.Target);
}
public override int GetHashCode()
/// <summary>
/// Two DnsResourceDataServerSelection are equal iff their priority, weight, port and target fields are equal.
/// </summary>
public override bool Equals(object obj)
{
return Sequence.GetHashCode(BitSequence.Merge(Priority, Weight), Port, Target);
return Equals(obj as DnsResourceDataServerSelection);
}
public override bool Equals(object obj)
/// <summary>
/// A hash code of the combination of the priority, weight, port and target fields.
/// </summary>
public override int GetHashCode()
{
return Equals(obj as DnsResourceDataServerSelection);
return Sequence.GetHashCode(BitSequence.Merge(Priority, Weight), Port, Target);
}
internal DnsResourceDataServerSelection()
......
......@@ -31,6 +31,20 @@ namespace PcapDotNet.Packets.Dns
private const int ConstantPartLength = Offset.Target;
/// <summary>
/// Constructs an instance out of the priority, weight and target fields.
/// </summary>
/// <param name="priority">
/// The priority of the target URI in this RR.
/// A client must attempt to contact the URI with the lowest-numbered priority it can reach;
/// URIs with the same priority should be tried in the order defined by the weight field.
/// </param>
/// <param name="weight">
/// A server selection mechanism.
/// The weight field specifies a relative weight for entries with the same priority.
/// Larger weights should be given a proportionately higher probability of being selected.
/// </param>
/// <param name="target">The URI of the target. Resolution of the URI is according to the definitions for the Scheme of the URI.</param>
public DnsResourceDataUri(ushort priority, ushort weight, IList<DataSegment> target)
{
Priority = priority;
......@@ -58,6 +72,9 @@ namespace PcapDotNet.Packets.Dns
/// </summary>
public ReadOnlyCollection<DataSegment> Target { get; private set; }
/// <summary>
/// Two DnsResourceDataUri are equal iff their priority, weight and target fields are equal.
/// </summary>
public bool Equals(DnsResourceDataUri other)
{
return other != null &&
......@@ -66,11 +83,17 @@ namespace PcapDotNet.Packets.Dns
Target.SequenceEqual(other.Target);
}
/// <summary>
/// Two DnsResourceDataUri are equal iff their priority, weight and target fields are equal.
/// </summary>
public override bool Equals(object obj)
{
return Equals(obj as DnsResourceDataUri);
}
/// <summary>
/// A hash code of the combination of the priority, weight and target fields.
/// </summary>
public override int GetHashCode()
{
return BitSequence.Merge(Priority, Weight).GetHashCode() ^ Target.SequenceGetHashCode();
......
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