Commit 541b67a5 authored by Brickner_cp's avatar Brickner_cp

589 warnings left

parent 404b6321
...@@ -18,11 +18,19 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -18,11 +18,19 @@ namespace PcapDotNet.Packets.IpV6
/// </summary> /// </summary>
public sealed class IpV6ExtensionHeaderDestinationOptions : IpV6ExtensionHeaderOptions public sealed class IpV6ExtensionHeaderDestinationOptions : IpV6ExtensionHeaderOptions
{ {
/// <summary>
/// Creates an instance from next header and options.
/// </summary>
/// <param name="nextHeader">Identifies the type of header immediately following this extension header.</param>
/// <param name="options">Extension header options.</param>
public IpV6ExtensionHeaderDestinationOptions(IpV4Protocol nextHeader, IpV6Options options) public IpV6ExtensionHeaderDestinationOptions(IpV4Protocol nextHeader, IpV6Options options)
: base(nextHeader, options) : base(nextHeader, options)
{ {
} }
/// <summary>
/// Identifies the type of this extension header.
/// </summary>
public override IpV4Protocol Protocol public override IpV4Protocol Protocol
{ {
get { return IpV4Protocol.IpV6Opts; } get { return IpV4Protocol.IpV6Opts; }
......
...@@ -15,13 +15,21 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -15,13 +15,21 @@ namespace PcapDotNet.Packets.IpV6
/// +-----+---------------------------------------+ /// +-----+---------------------------------------+
/// </pre> /// </pre>
/// </summary> /// </summary>
public class IpV6ExtensionHeaderHopByHopOptions : IpV6ExtensionHeaderOptions public sealed class IpV6ExtensionHeaderHopByHopOptions : IpV6ExtensionHeaderOptions
{ {
/// <summary>
/// Creates an instance from next header and options.
/// </summary>
/// <param name="nextHeader">Identifies the type of header immediately following this extension header.</param>
/// <param name="options">Options for the extension header.</param>
public IpV6ExtensionHeaderHopByHopOptions(IpV4Protocol nextHeader, IpV6Options options) public IpV6ExtensionHeaderHopByHopOptions(IpV4Protocol nextHeader, IpV6Options options)
: base(nextHeader, options) : base(nextHeader, options)
{ {
} }
/// <summary>
/// Identifies the type of this extension header.
/// </summary>
public override IpV4Protocol Protocol public override IpV4Protocol Protocol
{ {
get { return IpV4Protocol.IpV6HopByHopOption; } get { return IpV4Protocol.IpV6HopByHopOption; }
......
...@@ -18,6 +18,9 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -18,6 +18,9 @@ namespace PcapDotNet.Packets.IpV6
/// </summary> /// </summary>
public abstract class IpV6ExtensionHeaderOptions : IpV6ExtensionHeaderStandard public abstract class IpV6ExtensionHeaderOptions : IpV6ExtensionHeaderStandard
{ {
/// <summary>
/// Extension header options.
/// </summary>
public IpV6Options Options { get; private set; } public IpV6Options Options { get; private set; }
public sealed override bool IsValid public sealed override bool IsValid
......
...@@ -2,6 +2,11 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -2,6 +2,11 @@ namespace PcapDotNet.Packets.IpV6
{ {
internal interface IIpV6OptionComplexFactory internal interface IIpV6OptionComplexFactory
{ {
/// <summary>
/// Parses an option from the given data.
/// </summary>
/// <param name="data">The data to parse.</param>
/// <returns>The option if parsing was successful, null otherwise.</returns>
IpV6Option CreateInstance(DataSegment data); IpV6Option CreateInstance(DataSegment data);
} }
} }
\ No newline at end of file
...@@ -17,12 +17,20 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -17,12 +17,20 @@ namespace PcapDotNet.Packets.IpV6
/// </summary> /// </summary>
public sealed class IpV6AccessNetworkIdentifierSubOptionUnknown : IpV6AccessNetworkIdentifierSubOption public sealed class IpV6AccessNetworkIdentifierSubOptionUnknown : IpV6AccessNetworkIdentifierSubOption
{ {
/// <summary>
/// Creates an instance from type and data.
/// </summary>
/// <param name="type">The type of the option.</param>
/// <param name="data">The data of the option.</param>
public IpV6AccessNetworkIdentifierSubOptionUnknown(IpV6AccessNetworkIdentifierSubOptionType type, DataSegment data) public IpV6AccessNetworkIdentifierSubOptionUnknown(IpV6AccessNetworkIdentifierSubOptionType type, DataSegment data)
: base(type) : base(type)
{ {
Data = data; Data = data;
} }
/// <summary>
/// The data of the option.
/// </summary>
public DataSegment Data { get; private set; } public DataSegment Data { get; private set; }
internal override IpV6AccessNetworkIdentifierSubOption CreateInstance(DataSegment data) internal override IpV6AccessNetworkIdentifierSubOption CreateInstance(DataSegment data)
......
...@@ -18,12 +18,19 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -18,12 +18,19 @@ namespace PcapDotNet.Packets.IpV6
[IpV6FlowIdentificationSubOptionTypeRegistration(IpV6FlowIdentificationSubOptionType.PadN)] [IpV6FlowIdentificationSubOptionTypeRegistration(IpV6FlowIdentificationSubOptionType.PadN)]
public sealed class IpV6FlowIdentificationSubOptionPadN : IpV6FlowIdentificationSubOptionComplex public sealed class IpV6FlowIdentificationSubOptionPadN : IpV6FlowIdentificationSubOptionComplex
{ {
/// <summary>
/// Creates an instance from padding data length.
/// </summary>
/// <param name="paddingDataLength">The size of the padding in bytes.</param>
public IpV6FlowIdentificationSubOptionPadN(int paddingDataLength) public IpV6FlowIdentificationSubOptionPadN(int paddingDataLength)
: base(IpV6FlowIdentificationSubOptionType.PadN) : base(IpV6FlowIdentificationSubOptionType.PadN)
{ {
PaddingDataLength = paddingDataLength; PaddingDataLength = paddingDataLength;
} }
/// <summary>
/// The size of the padding in bytes.
/// </summary>
public int PaddingDataLength { get; private set; } public int PaddingDataLength { get; private set; }
internal override IpV6FlowIdentificationSubOption CreateInstance(DataSegment data) internal override IpV6FlowIdentificationSubOption CreateInstance(DataSegment data)
......
...@@ -17,12 +17,20 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -17,12 +17,20 @@ namespace PcapDotNet.Packets.IpV6
/// </summary> /// </summary>
public sealed class IpV6FlowIdentificationSubOptionUnknown : IpV6FlowIdentificationSubOptionComplex public sealed class IpV6FlowIdentificationSubOptionUnknown : IpV6FlowIdentificationSubOptionComplex
{ {
/// <summary>
/// Creates an instance from type and data.
/// </summary>
/// <param name="type">The type of the option.</param>
/// <param name="data">The data of the option.</param>
public IpV6FlowIdentificationSubOptionUnknown(IpV6FlowIdentificationSubOptionType type, DataSegment data) public IpV6FlowIdentificationSubOptionUnknown(IpV6FlowIdentificationSubOptionType type, DataSegment data)
: base(type) : base(type)
{ {
Data = data; Data = data;
} }
/// <summary>
/// The data of the option.
/// </summary>
public DataSegment Data { get; private set; } public DataSegment Data { get; private set; }
internal override IpV6FlowIdentificationSubOption CreateInstance(DataSegment data) internal override IpV6FlowIdentificationSubOption CreateInstance(DataSegment data)
......
...@@ -24,11 +24,6 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -24,11 +24,6 @@ namespace PcapDotNet.Packets.IpV6
/// </summary> /// </summary>
public IpV6MobilityOptionType OptionType { get; private set; } public IpV6MobilityOptionType OptionType { get; private set; }
public override int Length
{
get { return sizeof(byte); }
}
public sealed override bool Equals(Option option) public sealed override bool Equals(Option option)
{ {
return Equals(option as IpV6MobilityOption); return Equals(option as IpV6MobilityOption);
......
...@@ -18,6 +18,10 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -18,6 +18,10 @@ namespace PcapDotNet.Packets.IpV6
[IpV6MobilityOptionTypeRegistration(IpV6MobilityOptionType.AccessNetworkIdentifier)] [IpV6MobilityOptionTypeRegistration(IpV6MobilityOptionType.AccessNetworkIdentifier)]
public sealed class IpV6MobilityOptionAccessNetworkIdentifier : IpV6MobilityOptionComplex public sealed class IpV6MobilityOptionAccessNetworkIdentifier : IpV6MobilityOptionComplex
{ {
/// <summary>
/// Creates an instance from sub options.
/// </summary>
/// <param name="subOptions">Sub options.</param>
public IpV6MobilityOptionAccessNetworkIdentifier(IpV6AccessNetworkIdentifierSubOptions subOptions) public IpV6MobilityOptionAccessNetworkIdentifier(IpV6AccessNetworkIdentifierSubOptions subOptions)
: base(IpV6MobilityOptionType.AccessNetworkIdentifier) : base(IpV6MobilityOptionType.AccessNetworkIdentifier)
{ {
......
...@@ -18,6 +18,10 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -18,6 +18,10 @@ namespace PcapDotNet.Packets.IpV6
[IpV6MobilityOptionTypeRegistration(IpV6MobilityOptionType.CareOfTest)] [IpV6MobilityOptionTypeRegistration(IpV6MobilityOptionType.CareOfTest)]
public sealed class IpV6MobilityOptionCareOfTest : IpV6MobilityOptionULong public sealed class IpV6MobilityOptionCareOfTest : IpV6MobilityOptionULong
{ {
/// <summary>
/// Creates an instance from care of keygen token.
/// </summary>
/// <param name="careOfKeygenToken">Contains the care-of keygen token generated by the correspondent node.</param>
public IpV6MobilityOptionCareOfTest(ulong careOfKeygenToken) public IpV6MobilityOptionCareOfTest(ulong careOfKeygenToken)
: base(IpV6MobilityOptionType.CareOfTest, careOfKeygenToken) : base(IpV6MobilityOptionType.CareOfTest, careOfKeygenToken)
{ {
......
...@@ -17,14 +17,17 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -17,14 +17,17 @@ namespace PcapDotNet.Packets.IpV6
/// </summary> /// </summary>
public abstract class IpV6MobilityOptionComplex : IpV6MobilityOption public abstract class IpV6MobilityOptionComplex : IpV6MobilityOption
{ {
protected IpV6MobilityOptionComplex(IpV6MobilityOptionType type) /// <summary>
: base(type) /// The number of bytes the option takes.
/// </summary>
public sealed override int Length
{ {
get { return sizeof(byte) + sizeof(byte) + DataLength; }
} }
public sealed override int Length internal IpV6MobilityOptionComplex(IpV6MobilityOptionType type)
: base(type)
{ {
get { return base.Length + sizeof(byte) + DataLength; }
} }
internal const int MaxDataLength = byte.MaxValue - sizeof(byte) - sizeof(byte); internal const int MaxDataLength = byte.MaxValue - sizeof(byte) - sizeof(byte);
......
using System; using System;
using PcapDotNet.Base;
namespace PcapDotNet.Packets.IpV6 namespace PcapDotNet.Packets.IpV6
{ {
...@@ -63,14 +64,19 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -63,14 +64,19 @@ namespace PcapDotNet.Packets.IpV6
Option.Write(buffer, ref offset); Option.Write(buffer, ref offset);
} }
public override bool Equals(object obj)
{
return Equals(obj as IpV6MobilityOptionContextRequestEntry);
}
public bool Equals(IpV6MobilityOptionContextRequestEntry other) public bool Equals(IpV6MobilityOptionContextRequestEntry other)
{ {
return (other != null && RequestType.Equals(other.RequestType) && Option.Equals(other.Option)); return (other != null && RequestType.Equals(other.RequestType) && Option.Equals(other.Option));
} }
public override bool Equals(object obj) public override int GetHashCode()
{ {
return Equals(obj as IpV6MobilityOptionContextRequestEntry); return Sequence.GetHashCode(RequestType, Option);
} }
} }
} }
\ No newline at end of file
...@@ -25,6 +25,11 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -25,6 +25,11 @@ namespace PcapDotNet.Packets.IpV6
{ {
} }
public override int Length
{
get { return sizeof(byte); }
}
internal override bool EqualsData(IpV6MobilityOption other) internal override bool EqualsData(IpV6MobilityOption other)
{ {
return true; return true;
......
...@@ -18,6 +18,10 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -18,6 +18,10 @@ namespace PcapDotNet.Packets.IpV6
[IpV6MobilityOptionTypeRegistration(IpV6MobilityOptionType.ReplayProtection)] [IpV6MobilityOptionTypeRegistration(IpV6MobilityOptionType.ReplayProtection)]
public sealed class IpV6MobilityOptionReplayProtection : IpV6MobilityOptionULong public sealed class IpV6MobilityOptionReplayProtection : IpV6MobilityOptionULong
{ {
/// <summary>
/// Creates an instance from timestamp.
/// </summary>
/// <param name="timestamp">64 bit timestamp.</param>
public IpV6MobilityOptionReplayProtection(ulong timestamp) public IpV6MobilityOptionReplayProtection(ulong timestamp)
: base(IpV6MobilityOptionType.ReplayProtection, timestamp) : base(IpV6MobilityOptionType.ReplayProtection, timestamp)
{ {
......
...@@ -17,11 +17,19 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -17,11 +17,19 @@ namespace PcapDotNet.Packets.IpV6
/// </summary> /// </summary>
public sealed class IpV6MobilityOptionUnknown : IpV6MobilityOptionSingleDataSegmentField public sealed class IpV6MobilityOptionUnknown : IpV6MobilityOptionSingleDataSegmentField
{ {
/// <summary>
/// Creates an instance from type and data.
/// </summary>
/// <param name="type">The type of the option.</param>
/// <param name="data">The data of the option.</param>
public IpV6MobilityOptionUnknown(IpV6MobilityOptionType type, DataSegment data) public IpV6MobilityOptionUnknown(IpV6MobilityOptionType type, DataSegment data)
: base(type, data) : base(type, data)
{ {
} }
/// <summary>
/// The data of the option.
/// </summary>
public DataSegment Data public DataSegment Data
{ {
get { return Value; } get { return Value; }
......
...@@ -17,14 +17,17 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -17,14 +17,17 @@ namespace PcapDotNet.Packets.IpV6
/// </summary> /// </summary>
public abstract class IpV6OptionComplex : IpV6Option public abstract class IpV6OptionComplex : IpV6Option
{ {
protected IpV6OptionComplex(IpV6OptionType type) /// <summary>
: base(type) /// The number of bytes the option takes.
/// </summary>
public sealed override int Length
{ {
get { return sizeof(byte) + sizeof (byte) + DataLength; }
} }
public sealed override int Length internal IpV6OptionComplex(IpV6OptionType type)
: base(type)
{ {
get { return sizeof(byte) + sizeof (byte) + DataLength; }
} }
internal abstract int DataLength { get; } internal abstract int DataLength { get; }
......
...@@ -18,6 +18,10 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -18,6 +18,10 @@ namespace PcapDotNet.Packets.IpV6
[IpV6OptionTypeRegistration(IpV6OptionType.IlnpNonce)] [IpV6OptionTypeRegistration(IpV6OptionType.IlnpNonce)]
public sealed class IpV6OptionIlnpNonce : IpV6OptionComplex, IIpV6OptionComplexFactory public sealed class IpV6OptionIlnpNonce : IpV6OptionComplex, IIpV6OptionComplexFactory
{ {
/// <summary>
/// Creates an instance from nonce.
/// </summary>
/// <param name="nonce">An unpredictable cryptographically random value used to prevent off-path attacks on an ILNP session.</param>
public IpV6OptionIlnpNonce(DataSegment nonce) public IpV6OptionIlnpNonce(DataSegment nonce)
: base(IpV6OptionType.IlnpNonce) : base(IpV6OptionType.IlnpNonce)
{ {
...@@ -29,6 +33,11 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -29,6 +33,11 @@ namespace PcapDotNet.Packets.IpV6
/// </summary> /// </summary>
public DataSegment Nonce { get; private set; } public DataSegment Nonce { get; private set; }
/// <summary>
/// Parses an option from the given data.
/// </summary>
/// <param name="data">The data to parse.</param>
/// <returns>The option if parsing was successful, null otherwise.</returns>
public IpV6Option CreateInstance(DataSegment data) public IpV6Option CreateInstance(DataSegment data)
{ {
return new IpV6OptionIlnpNonce(data); return new IpV6OptionIlnpNonce(data);
......
...@@ -18,13 +18,25 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -18,13 +18,25 @@ namespace PcapDotNet.Packets.IpV6
[IpV6OptionTypeRegistration(IpV6OptionType.PadN)] [IpV6OptionTypeRegistration(IpV6OptionType.PadN)]
public sealed class IpV6OptionPadN : IpV6OptionComplex, IIpV6OptionComplexFactory public sealed class IpV6OptionPadN : IpV6OptionComplex, IIpV6OptionComplexFactory
{ {
/// <summary>
/// Creates an option from padding data length.
/// </summary>
/// <param name="paddingDataLength">The size of the padding in bytes.</param>
public IpV6OptionPadN(int paddingDataLength) : base(IpV6OptionType.PadN) public IpV6OptionPadN(int paddingDataLength) : base(IpV6OptionType.PadN)
{ {
PaddingDataLength = paddingDataLength; PaddingDataLength = paddingDataLength;
} }
/// <summary>
/// The size of the padding in bytes.
/// </summary>
public int PaddingDataLength { get; private set; } public int PaddingDataLength { get; private set; }
/// <summary>
/// Parses an option from the given data.
/// </summary>
/// <param name="data">The data to parse.</param>
/// <returns>The option if parsing was successful, null otherwise.</returns>
public IpV6Option CreateInstance(DataSegment data) public IpV6Option CreateInstance(DataSegment data)
{ {
return new IpV6OptionPadN(data.Length); return new IpV6OptionPadN(data.Length);
......
...@@ -10,13 +10,16 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -10,13 +10,16 @@ namespace PcapDotNet.Packets.IpV6
private const ushort InitialValue = 0xffff; private const ushort InitialValue = 0xffff;
/// <summary> /// <summary>
/// Calculate FCS16. /// Calculates FCS16.
/// </summary> /// </summary>
public static ushort CalculateFcs16(IEnumerable<byte> values) public static ushort CalculateFcs16(IEnumerable<byte> values)
{ {
return CalculateFcs16(InitialValue, values); return CalculateFcs16(InitialValue, values);
} }
/// <summary>
/// Calculates FCS16.
/// </summary>
public static ushort CalculateFcs16(ushort fcs, IEnumerable<byte> values) public static ushort CalculateFcs16(ushort fcs, IEnumerable<byte> values)
{ {
foreach (byte value in values) foreach (byte value in values)
......
...@@ -17,7 +17,7 @@ namespace PcapDotNet.Packets ...@@ -17,7 +17,7 @@ namespace PcapDotNet.Packets
{ {
/// <summary> /// <summary>
/// Creates a packet from a string that represents bytes in a hexadecimal format. /// Creates a packet from a string that represents bytes in a hexadecimal format.
/// <returns></returns> /// </summary>
public static Packet FromHexadecimalString(string value, DateTime timestamp, DataLinkKind dataLink) public static Packet FromHexadecimalString(string value, DateTime timestamp, DataLinkKind dataLink)
{ {
return FromHexadecimalString(value, timestamp, new DataLink(dataLink)); return FromHexadecimalString(value, timestamp, new DataLink(dataLink));
......
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