Commit 19eb654f authored by Brickner_cp's avatar Brickner_cp

Warnings, Code Analysis and Documentation. 48 warnings left.

parent d4f798e6
...@@ -35,8 +35,16 @@ namespace PcapDotNet.Packets.Dns ...@@ -35,8 +35,16 @@ namespace PcapDotNet.Packets.Dns
public const int LeaseLife = Id + sizeof(ulong); public const int LeaseLife = Id + sizeof(ulong);
} }
public const int ConstDataLength = Offset.LeaseLife + sizeof(uint); private const int ConstDataLength = Offset.LeaseLife + sizeof(uint);
/// <summary>
/// Constructs an instance out of the version, opcode, error code, id and lease life fields.
/// </summary>
/// <param name="version">Version of LLQ protocol implemented.</param>
/// <param name="opCode">Identifies LLQ operation.</param>
/// <param name="errorCode">Identifies LLQ errors.</param>
/// <param name="id">Identifier for an LLQ.</param>
/// <param name="leaseLife">Requested or granted life of LLQ, in seconds.</param>
public DnsOptionLongLivedQuery(ushort version, DnsLongLivedQueryOpCode opCode, DnsLongLivedQueryErrorCode errorCode, ulong id, uint leaseLife) public DnsOptionLongLivedQuery(ushort version, DnsLongLivedQueryOpCode opCode, DnsLongLivedQueryErrorCode errorCode, ulong id, uint leaseLife)
: base(DnsOptionCode.LongLivedQuery) : base(DnsOptionCode.LongLivedQuery)
{ {
...@@ -47,12 +55,34 @@ namespace PcapDotNet.Packets.Dns ...@@ -47,12 +55,34 @@ namespace PcapDotNet.Packets.Dns
LeaseLife = leaseLife; LeaseLife = leaseLife;
} }
/// <summary>
/// Version of LLQ protocol implemented.
/// </summary>
public ushort Version { get; private set; } public ushort Version { get; private set; }
/// <summary>
/// Identifies LLQ operation.
/// </summary>
public DnsLongLivedQueryOpCode OpCode { get; private set; } public DnsLongLivedQueryOpCode OpCode { get; private set; }
/// <summary>
/// Identifies LLQ errors.
/// </summary>
public DnsLongLivedQueryErrorCode ErrorCode { get; private set; } public DnsLongLivedQueryErrorCode ErrorCode { get; private set; }
/// <summary>
/// Identifier for an LLQ.
/// </summary>
public ulong Id { get; private set; } public ulong Id { get; private set; }
/// <summary>
/// Requested or granted life of LLQ, in seconds.
/// </summary>
public uint LeaseLife { get; private set; } public uint LeaseLife { get; private set; }
/// <summary>
/// The number of bytes the option data takes.
/// </summary>
public override int DataLength public override int DataLength
{ {
get { return ConstDataLength; } get { return ConstDataLength; }
......
...@@ -34,8 +34,22 @@ namespace PcapDotNet.Packets.Dns ...@@ -34,8 +34,22 @@ namespace PcapDotNet.Packets.Dns
public const int Gateway = Algorithm + sizeof(byte); public const int Gateway = Algorithm + sizeof(byte);
} }
public const int ConstPartLength = Offset.Gateway; private const int ConstPartLength = Offset.Gateway;
/// <summary>
/// Constructs an instance out of the precedence, gateway, algorithm and public key fields.
/// </summary>
/// <param name="precedence">
/// Precedence for this record.
/// Gateways listed in IPSECKEY records with lower precedence are to be attempted first.
/// Where there is a tie in precedence, the order should be non-deterministic.
/// </param>
/// <param name="gateway">
/// Indicates a gateway to which an IPsec tunnel may be created in order to reach the entity named by this
/// resource record.
/// </param>
/// <param name="algorithm">Identifies the public key's cryptographic algorithm and determines the format of the public key field.</param>
/// <param name="publicKey">Contains the algorithm-specific portion of the KEY RR RDATA.</param>
public DnsResourceDataIpSecKey(byte precedence, DnsGateway gateway, DnsPublicKeyAlgorithm algorithm, DataSegment publicKey) public DnsResourceDataIpSecKey(byte precedence, DnsGateway gateway, DnsPublicKeyAlgorithm algorithm, DataSegment publicKey)
{ {
Precedence = precedence; Precedence = precedence;
...@@ -71,6 +85,9 @@ namespace PcapDotNet.Packets.Dns ...@@ -71,6 +85,9 @@ namespace PcapDotNet.Packets.Dns
/// </summary> /// </summary>
public DataSegment PublicKey { get; private set; } public DataSegment PublicKey { get; private set; }
/// <summary>
/// Two DnsResourceDataIpSecKey are equal iff their precedence, gateway, algorithm and public key fields are equal.
/// </summary>
public bool Equals(DnsResourceDataIpSecKey other) public bool Equals(DnsResourceDataIpSecKey other)
{ {
return other != null && return other != null &&
...@@ -80,11 +97,17 @@ namespace PcapDotNet.Packets.Dns ...@@ -80,11 +97,17 @@ namespace PcapDotNet.Packets.Dns
PublicKey.Equals(other.PublicKey); PublicKey.Equals(other.PublicKey);
} }
/// <summary>
/// Two DnsResourceDataIpSecKey are equal iff their precedence, gateway, algorithm and public key fields are equal.
/// </summary>
public override bool Equals(object obj) public override bool Equals(object obj)
{ {
return Equals(obj as DnsResourceDataIpSecKey); return Equals(obj as DnsResourceDataIpSecKey);
} }
/// <summary>
/// A hash code of the combination of the precedence, gateway, algorithm and public key fields.
/// </summary>
public override int GetHashCode() public override int GetHashCode()
{ {
return Sequence.GetHashCode(BitSequence.Merge(Precedence, (byte)Algorithm), Gateway, PublicKey); return Sequence.GetHashCode(BitSequence.Merge(Precedence, (byte)Algorithm), Gateway, PublicKey);
......
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