Commit 404b6321 authored by Brickner_cp's avatar Brickner_cp

617 warnings left.

parent 1c38d4e7
......@@ -12,26 +12,50 @@ namespace PcapDotNet.Packets.IpV6
/// </summary>
public abstract class IpV6ExtensionHeader : IEquatable<IpV6ExtensionHeader>
{
/// <summary>
/// Identifies the type of this extension header.
/// </summary>
public abstract IpV4Protocol Protocol { get; }
/// <summary>
/// Identifies the type of header immediately following this extension header.
/// </summary>
public IpV4Protocol? NextHeader { get; private set; }
/// <summary>
/// The number of bytes this extension header takes.
/// </summary>
public abstract int Length { get; }
/// <summary>
/// List of all extension header protocols.
/// </summary>
public static ReadOnlyCollection<IpV4Protocol> ExtensionHeaders
{
get { return _extensionHeaders; }
}
/// <summary>
/// True iff the extension header parsing didn't encounter an issue.
/// </summary>
public abstract bool IsValid { get; }
/// <summary>
/// True iff the given extension header is equal to this extension header.
/// </summary>
public sealed override bool Equals(object obj)
{
return Equals(obj as IpV6ExtensionHeader);
}
/// <summary>
/// True iff the given extension header is equal to this extension header.
/// </summary>
public abstract bool Equals(IpV6ExtensionHeader other);
/// <summary>
/// Returns a hash code of the extension header.
/// </summary>
public abstract override int GetHashCode();
internal static bool IsExtensionHeader(IpV4Protocol nextHeader)
......
......@@ -14,34 +14,48 @@ namespace PcapDotNet.Packets.IpV6
/// </summary>
public IpV6AccessNetworkIdentifierSubOptionType OptionType { get; private set; }
internal abstract IpV6AccessNetworkIdentifierSubOption CreateInstance(DataSegment data);
protected IpV6AccessNetworkIdentifierSubOption(IpV6AccessNetworkIdentifierSubOptionType type)
{
OptionType = type;
}
/// <summary>
/// The number of bytes this option takes.
/// </summary>
public sealed override int Length
{
get { return sizeof(byte) + sizeof(byte) + DataLength; }
}
/// <summary>
/// True iff the two options are equal.
/// Two options are equal iff their type, length and data are equal.
/// </summary>
public bool Equals(IpV6AccessNetworkIdentifierSubOption other)
{
return other != null &&
OptionType == other.OptionType && Length == other.Length && EqualsData(other);
}
/// <summary>
/// True iff the two options are equal.
/// Two options are equal iff their type, length and data are equal.
/// </summary>
public sealed override bool Equals(Option other)
{
return Equals(other as IpV6AccessNetworkIdentifierSubOption);
}
/// <summary>
/// Returns the option hash code.
/// </summary>
public sealed override int GetHashCode()
{
return Sequence.GetHashCode(OptionType, GetDataHashCode());
}
internal IpV6AccessNetworkIdentifierSubOption(IpV6AccessNetworkIdentifierSubOptionType type)
{
OptionType = type;
}
internal abstract IpV6AccessNetworkIdentifierSubOption CreateInstance(DataSegment data);
internal abstract int DataLength { get; }
internal abstract bool EqualsData(IpV6AccessNetworkIdentifierSubOption other);
......
......@@ -14,34 +14,46 @@ namespace PcapDotNet.Packets.IpV6
/// </summary>
public IpV6FlowIdentificationSubOptionType OptionType { get; private set; }
/// <summary>
/// The number of bytes this option takes.
/// </summary>
public override int Length
{
get { return sizeof(byte); }
}
internal abstract IpV6FlowIdentificationSubOption CreateInstance(DataSegment data);
protected IpV6FlowIdentificationSubOption(IpV6FlowIdentificationSubOptionType type)
{
OptionType = type;
}
/// <summary>
/// True iff the two options are equal.
/// </summary>
public sealed override bool Equals(Option other)
{
return Equals(other as IpV6FlowIdentificationSubOption);
}
/// <summary>
/// True iff the two options are equal.
/// </summary>
public bool Equals(IpV6FlowIdentificationSubOption other)
{
return other != null &&
OptionType == other.OptionType && Length == other.Length && EqualsData(other);
}
/// <summary>
/// Returns a hash code of the option.
/// </summary>
public sealed override int GetHashCode()
{
return Sequence.GetHashCode(OptionType, GetDataHashCode());
}
internal abstract IpV6FlowIdentificationSubOption CreateInstance(DataSegment data);
internal IpV6FlowIdentificationSubOption(IpV6FlowIdentificationSubOptionType type)
{
OptionType = type;
}
internal abstract bool EqualsData(IpV6FlowIdentificationSubOption other);
internal abstract object GetDataHashCode();
......
......@@ -15,14 +15,17 @@ namespace PcapDotNet.Packets.IpV6
/// </summary>
public abstract class IpV6FlowIdentificationSubOptionComplex : IpV6FlowIdentificationSubOption
{
protected IpV6FlowIdentificationSubOptionComplex(IpV6FlowIdentificationSubOptionType type)
: base(type)
/// <summary>
/// The number of bytes this option takes.
/// </summary>
public sealed override int Length
{
get { return base.Length + sizeof(byte) + DataLength; }
}
public sealed override int Length
internal IpV6FlowIdentificationSubOptionComplex(IpV6FlowIdentificationSubOptionType type)
: base(type)
{
get { return base.Length + sizeof(byte) + DataLength; }
}
internal abstract int DataLength { get; }
......
......@@ -14,14 +14,17 @@ namespace PcapDotNet.Packets.IpV6
/// </summary>
public abstract class IpV6FlowIdentificationSubOptionSimple : IpV6FlowIdentificationSubOption
{
protected IpV6FlowIdentificationSubOptionSimple(IpV6FlowIdentificationSubOptionType type)
: base(type)
/// <summary>
/// The number of bytes this option takes.
/// </summary>
public sealed override int Length
{
get { return base.Length; }
}
public sealed override int Length
internal IpV6FlowIdentificationSubOptionSimple(IpV6FlowIdentificationSubOptionType type)
: base(type)
{
get { return base.Length; }
}
internal sealed override bool EqualsData(IpV6FlowIdentificationSubOption other)
......
......@@ -15,6 +15,10 @@ namespace PcapDotNet.Packets.IpV6
[IpV6MobilityOptionTypeRegistration(IpV6MobilityOptionType.AccessTechnologyType)]
public sealed class IpV6MobilityOptionAccessTechnologyType : IpV6MobilityOptionReservedByteValueByte
{
/// <summary>
/// Creates an option according to the given access technology type.
/// </summary>
/// <param name="accessTechnologyType">Specifies the access technology through which the mobile node is connected to the access link on the mobile access gateway.</param>
public IpV6MobilityOptionAccessTechnologyType(IpV6AccessTechnologyType accessTechnologyType)
: base(IpV6MobilityOptionType.AccessTechnologyType, (byte)accessTechnologyType)
{
......
......@@ -16,6 +16,13 @@ namespace PcapDotNet.Packets.IpV6
[IpV6MobilityOptionTypeRegistration(IpV6MobilityOptionType.BindingAuthorizationData)]
public sealed class IpV6MobilityOptionBindingAuthorizationData : IpV6MobilityOptionSingleDataSegmentField
{
/// <summary>
/// Creates an option from the given authenticator.
/// </summary>
/// <param name="authenticator">
/// Contains a cryptographic value that can be used to determine that the message in question comes from the right authority.
/// Rules for calculating this value depends on the used authorization procedure.
/// </param>
public IpV6MobilityOptionBindingAuthorizationData(DataSegment authenticator)
: base(IpV6MobilityOptionType.BindingAuthorizationData, authenticator)
{
......
......@@ -15,8 +15,18 @@ namespace PcapDotNet.Packets.IpV6
[IpV6MobilityOptionTypeRegistration(IpV6MobilityOptionType.BindingRefreshAdvice)]
public sealed class IpV6MobilityOptionBindingRefreshAdvice : IpV6MobilityOptionComplex
{
/// <summary>
/// The number of bytes the option data takes.
/// </summary>
public const int OptionDataLength = sizeof(ushort);
/// <summary>
/// Creates an option from the given refresh interval.
/// </summary>
/// <param name="refreshInterval">
/// Measured in units of four seconds, and indicates remaining time until the mobile node should send a new home registration to the home agent.
/// The Refresh Interval must be set to indicate a smaller time interval than the Lifetime value of the Binding Acknowledgement.
/// </param>
public IpV6MobilityOptionBindingRefreshAdvice(ushort refreshInterval)
: base(IpV6MobilityOptionType.BindingRefreshAdvice)
{
......
......@@ -13,6 +13,9 @@ namespace PcapDotNet.Packets.IpV6
[IpV6MobilityOptionTypeRegistration(IpV6MobilityOptionType.CareOfTestInit)]
public sealed class IpV6MobilityOptionCareOfTestInit : IpV6MobilityOptionEmpty
{
/// <summary>
/// Creates an instance.
/// </summary>
public IpV6MobilityOptionCareOfTestInit()
: base(IpV6MobilityOptionType.CareOfTestInit)
{
......
......@@ -13,6 +13,9 @@ namespace PcapDotNet.Packets.IpV6
[IpV6MobilityOptionTypeRegistration(IpV6MobilityOptionType.CgaParametersRequest)]
public sealed class IpV6MobilityOptionCgaParametersRequest : IpV6MobilityOptionEmpty
{
/// <summary>
/// Creates an instance.
/// </summary>
public IpV6MobilityOptionCgaParametersRequest()
: base(IpV6MobilityOptionType.CgaParametersRequest)
{
......
......@@ -17,6 +17,11 @@ namespace PcapDotNet.Packets.IpV6
/// </summary>
public sealed class IpV6MobilityOptionContextRequestEntry : IEquatable<IpV6MobilityOptionContextRequestEntry>
{
/// <summary>
/// Creates a context request entry according to the given request type and option.
/// </summary>
/// <param name="requestType">The type value for the requested option.</param>
/// <param name="option">The optional data to uniquely identify the requested context for the requested option.</param>
public IpV6MobilityOptionContextRequestEntry(byte requestType, DataSegment option)
{
if (option.Length > byte.MaxValue)
......
......@@ -16,6 +16,10 @@ namespace PcapDotNet.Packets.IpV6
[IpV6MobilityOptionTypeRegistration(IpV6MobilityOptionType.Experimental)]
public sealed class IpV6MobilityOptionExperimental : IpV6MobilityOptionSingleDataSegmentField
{
/// <summary>
/// Creates an option from the given data.
/// </summary>
/// <param name="data">Data related to the experimental protocol extension.</param>
public IpV6MobilityOptionExperimental(DataSegment data)
: base(IpV6MobilityOptionType.Experimental, data)
{
......
......@@ -15,16 +15,15 @@ namespace PcapDotNet.Packets.IpV6
[IpV6MobilityOptionTypeRegistration(IpV6MobilityOptionType.HandoffIndicator)]
public sealed class IpV6MobilityOptionHandoffIndicator : IpV6MobilityOptionReservedByteValueByte
{
/// <summary>
/// Creates an instance from the given handoff indicator.
/// </summary>
/// <param name="handoffIndicator">Specifies the type of handoff.</param>
public IpV6MobilityOptionHandoffIndicator(IpV6HandoffIndicator handoffIndicator)
: base(IpV6MobilityOptionType.HandoffIndicator, (byte)handoffIndicator)
{
}
private IpV6MobilityOptionHandoffIndicator()
: this(IpV6HandoffIndicator.AttachmentOverNewInterface)
{
}
/// <summary>
/// Specifies the type of handoff.
/// </summary>
......@@ -41,5 +40,10 @@ namespace PcapDotNet.Packets.IpV6
return new IpV6MobilityOptionHandoffIndicator((IpV6HandoffIndicator)value);
}
private IpV6MobilityOptionHandoffIndicator()
: this(IpV6HandoffIndicator.AttachmentOverNewInterface)
{
}
}
}
\ No newline at end of file
......@@ -12,8 +12,14 @@ namespace PcapDotNet.Packets.IpV6
/// </summary>
public sealed class IpV6MobilityOptionPad1 : IpV6MobilityOption
{
/// <summary>
/// The number of bytes the option takes.
/// </summary>
public const int OptionLength = sizeof(byte);
/// <summary>
/// Constructs an instance.
/// </summary>
public IpV6MobilityOptionPad1()
: base(IpV6MobilityOptionType.Pad1)
{
......
......@@ -16,6 +16,15 @@ namespace PcapDotNet.Packets.IpV6
[IpV6MobilityOptionTypeRegistration(IpV6MobilityOptionType.PermanentHomeKeygenToken)]
public sealed class IpV6MobilityOptionPermanentHomeKeygenToken : IpV6MobilityOptionSingleDataSegmentField
{
/// <summary>
/// Creates an option from the given permanent home keygen token.
/// </summary>
/// <param name="permanentHomeKeygenToken">
/// Contains the permanent home keygen token generated by the correspondent node.
/// The content of this field must be encrypted with the mobile node's public key.
/// The length of the permanent home keygen token is 8 octets before encryption, though the ciphertext and, hence,
/// the Permanent Home Keygen Token field may be longer.
/// </param>
public IpV6MobilityOptionPermanentHomeKeygenToken(DataSegment permanentHomeKeygenToken)
: base(IpV6MobilityOptionType.PermanentHomeKeygenToken, permanentHomeKeygenToken)
{
......
......@@ -15,8 +15,14 @@ namespace PcapDotNet.Packets.IpV6
[IpV6MobilityOptionTypeRegistration(IpV6MobilityOptionType.RedirectCapability)]
public sealed class IpV6MobilityOptionRedirectCapability : IpV6MobilityOptionComplex
{
/// <summary>
/// The number of bytes this option data takes.
/// </summary>
public const int OptionDataLength = sizeof(ushort);
/// <summary>
/// Creates an instance.
/// </summary>
public IpV6MobilityOptionRedirectCapability()
: base(IpV6MobilityOptionType.RedirectCapability)
{
......
......@@ -16,8 +16,15 @@ namespace PcapDotNet.Packets.IpV6
[IpV6MobilityOptionTypeRegistration(IpV6MobilityOptionType.RestartCounter)]
public sealed class IpV6MobilityOptionRestartCounter : IpV6MobilityOptionComplex
{
/// <summary>
/// The number of bytes the option data takes.
/// </summary>
public const int OptionDataLength = sizeof(uint);
/// <summary>
/// Creates an option from the given restart counter.
/// </summary>
/// <param name="restartCounter">Indicates the current Restart Counter value.</param>
public IpV6MobilityOptionRestartCounter(uint restartCounter)
: base(IpV6MobilityOptionType.RestartCounter)
{
......
......@@ -16,6 +16,10 @@ namespace PcapDotNet.Packets.IpV6
[IpV6MobilityOptionTypeRegistration(IpV6MobilityOptionType.Signature)]
public sealed class IpV6MobilityOptionSignature : IpV6MobilityOptionSingleDataSegmentField
{
/// <summary>
/// Creates an option from the given signature.
/// </summary>
/// <param name="signature">Contains the mobile or correspondent node's signature, generated with the mobile or correspondent node's private key.</param>
public IpV6MobilityOptionSignature(DataSegment signature)
: base(IpV6MobilityOptionType.Signature, signature)
{
......
......@@ -14,7 +14,7 @@ namespace PcapDotNet.Packets.IpV6
/// </summary>
public abstract class IpV6MobilityOptionSingleDataSegmentField : IpV6MobilityOptionComplex
{
public IpV6MobilityOptionSingleDataSegmentField(IpV6MobilityOptionType type, DataSegment value)
internal IpV6MobilityOptionSingleDataSegmentField(IpV6MobilityOptionType type, DataSegment value)
: base(type)
{
Value = value;
......
......@@ -16,9 +16,12 @@ namespace PcapDotNet.Packets.IpV6
/// </summary>
public abstract class IpV6MobilityOptionULong : IpV6MobilityOptionComplex
{
/// <summary>
/// The number of bytes the option data takes.
/// </summary>
public const int OptionDataLength = sizeof(ulong);
public IpV6MobilityOptionULong(IpV6MobilityOptionType type, ulong value)
internal IpV6MobilityOptionULong(IpV6MobilityOptionType type, ulong value)
: base(type)
{
Value = value;
......
......@@ -16,8 +16,18 @@ namespace PcapDotNet.Packets.IpV6
[IpV6OptionTypeRegistration(IpV6OptionType.JumboPayload)]
public sealed class IpV6OptionJumboPayload : IpV6OptionComplex, IIpV6OptionComplexFactory
{
/// <summary>
/// The number of bytes the option data takes.
/// </summary>
public const int OptionDataLength = sizeof(uint);
/// <summary>
/// Creates an option from the given jumbo payload length.
/// </summary>
/// <param name="jumboPayloadLength">
/// Length of the IPv6 packet in octets, excluding the IPv6 header but including the Hop-by-Hop Options header and any other extension headers present.
/// Must be greater than 65,535.
/// </param>
public IpV6OptionJumboPayload(uint jumboPayloadLength) : base(IpV6OptionType.JumboPayload)
{
JumboPayloadLength = jumboPayloadLength;
......
......@@ -9,8 +9,14 @@ namespace PcapDotNet.Packets.IpV6
/// </summary>
public class IpV6OptionPad1 : IpV6OptionSimple
{
/// <summary>
/// The number of bytes the option takes.
/// </summary>
public const int OptionLength = sizeof(byte);
/// <summary>
/// Constructs an instance.
/// </summary>
public IpV6OptionPad1()
: base(IpV6OptionType.Pad1)
{
......
......@@ -15,8 +15,15 @@ namespace PcapDotNet.Packets.IpV6
[IpV6OptionTypeRegistration(IpV6OptionType.RouterAlert)]
public sealed class IpV6OptionRouterAlert : IpV6OptionComplex, IIpV6OptionComplexFactory
{
/// <summary>
/// The number of bytes the option data takes.
/// </summary>
public const int OptionDataLength = sizeof(ushort);
/// <summary>
/// Creates an instance according to the given router alert type.
/// </summary>
/// <param name="routerAlertType">Type of router alert.</param>
public IpV6OptionRouterAlert(IpV6RouterAlertType routerAlertType)
: base(IpV6OptionType.RouterAlert)
{
......@@ -28,6 +35,11 @@ namespace PcapDotNet.Packets.IpV6
/// </summary>
public IpV6RouterAlertType RouterAlertType { get; private set; }
/// <summary>
/// Parses the given data to create a router alert IPv6 option.
/// </summary>
/// <param name="data">The data to parse to create the option.</param>
/// <returns>Router alert IPv6 option according to the data parsed.</returns>
public IpV6Option CreateInstance(DataSegment data)
{
if (data.Length != OptionDataLength)
......
......@@ -14,13 +14,17 @@ namespace PcapDotNet.Packets.IpV6
/// </summary>
public abstract class IpV6OptionSimple : IpV6Option
{
protected IpV6OptionSimple(IpV6OptionType type) : base(type)
/// <summary>
/// The number of bytes this option takes.
/// </summary>
public sealed override int Length
{
get { return sizeof(byte); }
}
public sealed override int Length
internal IpV6OptionSimple(IpV6OptionType type)
: base(type)
{
get { return sizeof(byte); }
}
internal sealed override bool EqualsData(IpV6Option other)
......
......@@ -15,8 +15,15 @@ namespace PcapDotNet.Packets.IpV6
[IpV6OptionTypeRegistration(IpV6OptionType.TunnelEncapsulationLimit)]
public sealed class IpV6OptionTunnelEncapsulationLimit : IpV6OptionComplex, IIpV6OptionComplexFactory
{
/// <summary>
/// The number of bytes the option data takes.
/// </summary>
public const int OptionDataLength = sizeof(byte);
/// <summary>
/// Creates an option from the given tunnel encapsulation limit.
/// </summary>
/// <param name="tunnelEncapsulationLimit">How many further levels of encapsulation are permitted for the packet.</param>
public IpV6OptionTunnelEncapsulationLimit(byte tunnelEncapsulationLimit)
: base(IpV6OptionType.TunnelEncapsulationLimit)
{
......
......@@ -15,12 +15,20 @@ namespace PcapDotNet.Packets.IpV6
/// </summary>
public sealed class IpV6OptionUnknown : IpV6OptionComplex
{
/// <summary>
/// Creates an unknown option according to the given type and data.
/// </summary>
/// <param name="type">The type of the IP option.</param>
/// <param name="data">The data of the IP option.</param>
public IpV6OptionUnknown(IpV6OptionType type, DataSegment data)
: base(type)
{
Data = data;
}
/// <summary>
/// The data of the option.
/// </summary>
public DataSegment Data { get; private set; }
internal override int DataLength
......
......@@ -15,6 +15,9 @@ namespace PcapDotNet.Packets
/// </summary>
public sealed class Packet : IList<byte>, IEquatable<Packet>
{
/// <summary>
/// Creates a packet from a string that represents bytes in a hexadecimal format.
/// <returns></returns>
public static Packet FromHexadecimalString(string value, DateTime timestamp, DataLinkKind 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