Commit fc7e1c71 authored by Brickner_cp's avatar Brickner_cp

Make classes and methods sealed.

parent d1cd96f5
......@@ -8,7 +8,7 @@ namespace PcapDotNet { namespace Core
/// <summary>
/// Representation of an interface address.
/// </summary>
public ref class DeviceAddress
public ref class DeviceAddress sealed
{
public:
/// <summary>
......
......@@ -8,7 +8,7 @@ namespace PcapDotNet { namespace Core
/// <summary>
/// An internet protocol version 4 address for a device.
/// </summary>
public ref class IpV4SocketAddress : SocketAddress
public ref class IpV4SocketAddress sealed : SocketAddress
{
public:
/// <summary>
......
......@@ -8,7 +8,7 @@ namespace PcapDotNet { namespace Core
/// <summary>
/// An internet protocol version 6 address for a device.
/// </summary>
public ref class IpV6SocketAddress : SocketAddress
public ref class IpV6SocketAddress sealed : SocketAddress
{
public:
/// <summary>
......
......@@ -7,7 +7,7 @@ namespace PcapDotNet { namespace Core
/// <summary>
/// A network device packet communicator.
/// </summary>
public ref class LivePacketCommunicator : PacketCommunicator
public ref class LivePacketCommunicator sealed : PacketCommunicator
{
public:
/// <summary>
......
......@@ -8,7 +8,7 @@ namespace PcapDotNet { namespace Core
/// <summary>
/// A live interface.
/// </summary>
public ref class LivePacketDevice : PacketDevice
public ref class LivePacketDevice sealed : PacketDevice
{
public:
/// <summary>
......
......@@ -6,7 +6,7 @@
namespace PcapDotNet { namespace Core
{
public ref class OfflinePacketCommunicator : PacketCommunicator
public ref class OfflinePacketCommunicator sealed : PacketCommunicator
{
public:
/// <summary>
......
......@@ -7,7 +7,7 @@ namespace PcapDotNet { namespace Core
/// <summary>
/// An offline interface - a pcap file to read packets from.
/// </summary>
public ref class OfflinePacketDevice : PacketDevice
public ref class OfflinePacketDevice sealed : PacketDevice
{
public:
/// <summary>
......
......@@ -7,7 +7,7 @@ namespace PcapDotNet { namespace Core
/// <summary>
/// Represents a statistics value when running in statistics mode.
/// </summary>
public ref class PacketSampleStatistics
public ref class PacketSampleStatistics sealed
{
public:
/// <summary>
......
......@@ -7,7 +7,7 @@ namespace PcapDotNet { namespace Core
/// <summary>
/// Statistics on capture from the start of the run.
/// </summary>
public ref class PacketTotalStatistics : System::IEquatable<PacketTotalStatistics^>
public ref class PacketTotalStatistics sealed : System::IEquatable<PacketTotalStatistics^>
{
public:
/// <summary>
......
......@@ -5,7 +5,7 @@ namespace PcapDotNet { namespace Core
/// <summary>
/// A packet communicator datalink.
/// </summary>
public value class PcapDataLink : Packets::IDataLink, System::IEquatable<PcapDataLink>
public value class PcapDataLink sealed : Packets::IDataLink, System::IEquatable<PcapDataLink>
{
public:
/// <summary>
......
......@@ -8,7 +8,7 @@ namespace PcapDotNet { namespace Core
/// This sampling method defines that we have to return 1 packet every given time-interval.
/// In other words, if the interval is set to 10 milliseconds, the first packet is returned to the caller; the next returned one will be the first packet that arrives when 10ms have elapsed.
/// </summary>
public ref class SamplingMethodFirstAfterInterval : SamplingMethod
public ref class SamplingMethodFirstAfterInterval sealed : SamplingMethod
{
public:
/// <summary>
......
......@@ -8,7 +8,7 @@ namespace PcapDotNet { namespace Core
/// No sampling has to be done on the current capture.
/// In this case, no sampling algorithms are applied to the current capture.
/// </summary>
public ref class SamplingMethodNone : SamplingMethod
public ref class SamplingMethodNone sealed : SamplingMethod
{
internal:
virtual property int Method
......
......@@ -8,7 +8,7 @@ namespace PcapDotNet { namespace Core
/// Defines that only 1 out of count packets must be returned to the user.
/// In other words, if the count is set to 10, the first packet is returned to the caller, while the following 9 are discarded.
/// </summary>
public ref class SamplingMethodOneEveryCount : SamplingMethod
public ref class SamplingMethodOneEveryCount sealed : SamplingMethod
{
public:
/// <summary>
......
......@@ -6,7 +6,7 @@ using PcapDotNet.Base;
namespace PcapDotNet.Packets.TestUtils
{
public class HexEncoding : Encoding
public sealed class HexEncoding : Encoding
{
public static HexEncoding Instance { get { return _instance; } }
......@@ -102,7 +102,7 @@ namespace PcapDotNet.Packets.TestUtils
throw new ArgumentOutOfRangeException("digit", digit, "digit is not a legal hexadecimal character");
}
private char ByteToDigit(byte b)
private static char ByteToDigit(byte b)
{
if (b <= 9)
return (char)('0' + b);
......
......@@ -34,7 +34,7 @@ namespace PcapDotNet.Packets.Arp
/// +-----+-------------------------------------------------------------------------------------------------+
/// </pre>
/// </summary>
public class ArpDatagram : Datagram
public sealed class ArpDatagram : Datagram
{
private static class Offset
{
......
......@@ -8,7 +8,7 @@ namespace PcapDotNet.Packets.Arp
/// <summary>
/// Represents an ARP protocol layer.
/// </summary>
public class ArpLayer : Layer, IEthernetNextLayer
public sealed class ArpLayer : Layer, IEthernetNextLayer
{
/// <summary>
/// Each protocol is assigned a number used in this field.
......@@ -123,7 +123,7 @@ namespace PcapDotNet.Packets.Arp
/// </summary>
/// <param name="other">The ARP layer to compare the layer to.</param>
/// <returns>True iff the two layers are equal.</returns>
public override sealed bool Equals(Layer other)
public override bool Equals(Layer other)
{
return Equals(other as ArpLayer);
}
......
......@@ -95,7 +95,7 @@ namespace PcapDotNet.Packets
/// <summary>
/// Two segments are equal if they have the same data.
/// </summary>
public override bool Equals(object obj)
public sealed override bool Equals(object obj)
{
return Equals(obj as DataSegment);
}
......@@ -103,7 +103,7 @@ namespace PcapDotNet.Packets
/// <summary>
/// The hash code of a segment is the hash code of its length xored with all its bytes (each byte is xored with the next byte in the integer).
/// </summary>
public override int GetHashCode()
public sealed override int GetHashCode()
{
return Length.GetHashCode() ^ this.BytesSequenceGetHashCode();
}
......@@ -112,7 +112,7 @@ namespace PcapDotNet.Packets
/// Converts the segment to a hexadecimal string representing every bytes as two hexadecimal digits.
/// </summary>
/// <returns>A hexadecimal string representing every bytes as two hexadecimal digits.</returns>
public override string ToString()
public sealed override string ToString()
{
return Buffer.Range(StartOffset, Length).BytesSequenceToHexadecimalString();
}
......
......@@ -7,7 +7,7 @@ namespace PcapDotNet.Packets
/// A datagram is part of the packet bytes that can be treated as a specific protocol data (usually header + payload).
/// Never copies the given buffer.
/// </summary>
public class Datagram : DataSegment, IEquatable<Datagram>
public class Datagram : DataSegment
{
/// <summary>
/// Take all the bytes as a datagram.
......@@ -62,22 +62,6 @@ namespace PcapDotNet.Packets
};
}
/// <summary>
/// Two datagrams are equal if they have the same data.
/// </summary>
public bool Equals(Datagram other)
{
return base.Equals(other);
}
/// <summary>
/// Two datagrams are equal if they have the same data.
/// </summary>
public override bool Equals(object obj)
{
return Equals(obj as Datagram);
}
/// <summary>
/// The default validity check always returns true.
/// </summary>
......
......@@ -2,7 +2,7 @@
namespace PcapDotNet.Packets.Dns
{
public class DnsDataResourceRecord : DnsResourceRecord, IEquatable<DnsDataResourceRecord>
public sealed class DnsDataResourceRecord : DnsResourceRecord, IEquatable<DnsDataResourceRecord>
{
private static class OffsetAfterBase
{
......
......@@ -44,7 +44,7 @@ namespace PcapDotNet.Packets.Dns
/// The answer section contains RRs that answer the question; the authority section contains RRs that point toward an authoritative name server;
/// the additional records section contains RRs which relate to the query, but are not strictly answers for the question.
/// </summary>
public class DnsDatagram : Datagram
public sealed class DnsDatagram : Datagram
{
private static class Offset
{
......
......@@ -9,7 +9,7 @@ namespace PcapDotNet.Packets.Dns
/// <summary>
/// A domain name represented as a series of labels, and terminated by a label with zero length.
/// </summary>
public class DnsDomainName : IEquatable<DnsDomainName>
public sealed class DnsDomainName : IEquatable<DnsDomainName>
{
private const byte MaxLabelLength = 63;
private const ushort CompressionMarker = 0xC000;
......
......@@ -10,7 +10,7 @@ namespace PcapDotNet.Packets.Dns
/// Represents a DNS layer.
/// <seealso cref="DnsDatagram"/>
/// </summary>
public class DnsLayer : SimpleLayer, IEquatable<DnsLayer>
public sealed class DnsLayer : SimpleLayer, IEquatable<DnsLayer>
{
public ushort Id { get; set; }
public bool IsResponse { get; set; }
......
......@@ -2,7 +2,7 @@
namespace PcapDotNet.Packets.Dns
{
public class DnsQueryResourceRecord : DnsResourceRecord, IEquatable<DnsQueryResourceRecord>
public sealed class DnsQueryResourceRecord : DnsResourceRecord, IEquatable<DnsQueryResourceRecord>
{
public DnsQueryResourceRecord(DnsDomainName domainName, DnsType type, DnsClass dnsClass)
: base(domainName, type, dnsClass)
......
......@@ -2,7 +2,7 @@
namespace PcapDotNet.Packets.Dns
{
public class DnsResourceDataUnknown : DnsResourceDataSimple, IEquatable<DnsResourceDataUnknown>
public sealed class DnsResourceDataUnknown : DnsResourceDataSimple, IEquatable<DnsResourceDataUnknown>
{
public DnsResourceDataUnknown(DataSegment data)
{
......
......@@ -17,7 +17,7 @@ namespace PcapDotNet.Packets.Ethernet
/// +------+-------------------------------------------------+
/// </pre>
/// </summary>
public class EthernetDatagram : Datagram
public sealed class EthernetDatagram : Datagram
{
private static class Offset
{
......
......@@ -7,7 +7,7 @@ namespace PcapDotNet.Packets.Ethernet
/// Represents an Ethernet layer.
/// <seealso cref="EthernetDatagram"/>
/// </summary>
public class EthernetLayer : Layer, IArpPreviousLayer
public sealed class EthernetLayer : Layer, IArpPreviousLayer
{
/// <summary>
/// Creates an instance with zero values.
......@@ -102,7 +102,7 @@ namespace PcapDotNet.Packets.Ethernet
/// <summary>
/// Two Ethernet layers are equal if they have the same source, destination and ethernet type.
/// </summary>
public override sealed bool Equals(Layer other)
public override bool Equals(Layer other)
{
return Equals(other as EthernetLayer);
}
......
......@@ -28,7 +28,7 @@ namespace PcapDotNet.Packets.Gre
/// +-----+---------------------------------------------------------------------+
/// </pre>
/// </summary>
public class GreDatagram : Datagram
public sealed class GreDatagram : Datagram
{
private static class Offset
{
......
......@@ -10,7 +10,7 @@ namespace PcapDotNet.Packets.Gre
/// Represents a GRE layer.
/// <seealso cref="GreDatagram"/>
/// </summary>
public class GreLayer : Layer, IIpV4NextLayer, IEquatable<GreLayer>
public sealed class GreLayer : Layer, IIpV4NextLayer, IEquatable<GreLayer>
{
/// <summary>
/// The GRE Version Number.
......
......@@ -68,7 +68,7 @@ namespace PcapDotNet.Packets.Gre
/// <summary>
/// Two entries are equal iff they have the same address family, length, payload offset and payload.
/// </summary>
public override bool Equals(object obj)
public sealed override bool Equals(object obj)
{
return Equals(obj as GreSourceRouteEntry);
}
......@@ -76,7 +76,7 @@ namespace PcapDotNet.Packets.Gre
/// <summary>
/// The hash code of an entry is a xor of the hash code of the address family, length, payload offset and payload.
/// </summary>
public override int GetHashCode()
public sealed override int GetHashCode()
{
return AddressFamily.GetHashCode() ^ Length.GetHashCode() ^ PayloadOffset.GetHashCode() ^ PayloadHashCode;
}
......
......@@ -8,7 +8,7 @@ namespace PcapDotNet.Packets.Gre
/// RFC 1702.
/// Represents a source route entry consisting of a list of Autonomous System numbers and indicates an AS source route.
/// </summary>
public class GreSourceRouteEntryAs : GreSourceRouteEntry
public sealed class GreSourceRouteEntryAs : GreSourceRouteEntry
{
/// <summary>
/// Initializes using the given AS numbers and the next as number index.
......
......@@ -9,7 +9,7 @@ namespace PcapDotNet.Packets.Gre
/// RFC 1702.
/// Represents a source route entry consisting of a list of IP addresses and indicates an IP source route.
/// </summary>
public class GreSourceRouteEntryIp : GreSourceRouteEntry
public sealed class GreSourceRouteEntryIp : GreSourceRouteEntry
{
/// <summary>
/// Initializes using the given IP addresses and the next as number index.
......
......@@ -3,7 +3,7 @@ namespace PcapDotNet.Packets.Gre
/// <summary>
/// Represents a source route entry consisting of an unknown data.
/// </summary>
public class GreSourceRouteEntryUnknown : GreSourceRouteEntry
public sealed class GreSourceRouteEntryUnknown : GreSourceRouteEntry
{
/// <summary>
/// Initializes using an address family, data, and offset to the first octet of the active entry in Source Route Entry to be examined.
......
......@@ -21,7 +21,7 @@ namespace PcapDotNet.Packets.Http
/// Content-Type: text/html; charset=ISO-8859-4
/// </pre>
/// </summary>
public class HttpContentTypeField : HttpField, IEquatable<HttpContentTypeField>
public sealed class HttpContentTypeField : HttpField, IEquatable<HttpContentTypeField>
{
/// <summary>
/// The field name.
......
......@@ -112,7 +112,7 @@ namespace PcapDotNet.Packets.Http
/// True iff the two HTTP fields are of equal value.
/// Two fields are equal iff they have the same name (case insensitive) and the same bytes value.
/// </summary>
public override bool Equals(object obj)
public sealed override bool Equals(object obj)
{
return Equals(obj as HttpField);
}
......@@ -120,7 +120,7 @@ namespace PcapDotNet.Packets.Http
/// <summary>
/// Returns a hash code of this field according to the name and value.
/// </summary>
public override int GetHashCode()
public sealed override int GetHashCode()
{
return Name.ToUpperInvariant().GetHashCode() ^ Value.BytesSequenceGetHashCode();
}
......@@ -129,7 +129,7 @@ namespace PcapDotNet.Packets.Http
/// A string representing the field similar to how it would like in the HTTP protocol.
/// </summary>
/// <returns></returns>
public override string ToString()
public sealed override string ToString()
{
return string.Format(CultureInfo.InvariantCulture, "{0}: {1}", Name, ValueString);
}
......
......@@ -13,7 +13,7 @@ namespace PcapDotNet.Packets.Http
/// Used for some of HTTP fields.
/// All parameters must have different names.
/// </summary>
public class HttpFieldParameters : IEnumerable<KeyValuePair<string, string>>, IEquatable<HttpFieldParameters>
public sealed class HttpFieldParameters : IEnumerable<KeyValuePair<string, string>>, IEquatable<HttpFieldParameters>
{
/// <summary>
/// Creates the parameters from an array of parameters. Keys are the parameters names and values are the parameters values.
......
......@@ -11,7 +11,7 @@ namespace PcapDotNet.Packets.Http
/// The header is a container for HTTP fields.
/// Insensitive to the case of HTTP field names.
/// </summary>
public class HttpHeader : IEnumerable<HttpField>, IEquatable<HttpHeader>
public sealed class HttpHeader : IEnumerable<HttpField>, IEquatable<HttpHeader>
{
/// <summary>
/// An empty HTTP header.
......
......@@ -36,7 +36,7 @@ namespace PcapDotNet.Packets.Http
/// <summary>
/// The number of bytes this layer will take.
/// </summary>
public override int Length
public sealed override int Length
{
get
{
......@@ -50,7 +50,7 @@ namespace PcapDotNet.Packets.Http
/// Two HTTP layers are equal iff they have the same version, header and body.
/// Extended by specific HTTP layers types for more checks.
/// </summary>
public override bool Equals(Layer other)
public sealed override bool Equals(Layer other)
{
return Equals(other as HttpLayer);
}
......@@ -72,7 +72,7 @@ namespace PcapDotNet.Packets.Http
/// </summary>
/// <param name="buffer">The buffer to write the layer to.</param>
/// <param name="offset">The offset in the buffer to start writing the layer at.</param>
protected override void Write(byte[] buffer, int offset)
protected sealed override void Write(byte[] buffer, int offset)
{
WriteFirstLine(buffer, ref offset);
if (Header != null)
......
......@@ -6,7 +6,7 @@ namespace PcapDotNet.Packets.Http
/// RFC 2616.
/// Represents an HTTP request.
/// </summary>
public class HttpRequestDatagram : HttpDatagram
public sealed class HttpRequestDatagram : HttpDatagram
{
private class ParseInfo : ParseInfoBase
{
......
......@@ -7,7 +7,7 @@ namespace PcapDotNet.Packets.Http
/// RFC 2616.
/// Represents an HTTP request layer.
/// </summary>
public class HttpRequestLayer : HttpLayer, IEquatable<HttpRequestLayer>
public sealed class HttpRequestLayer : HttpLayer, IEquatable<HttpRequestLayer>
{
/// <summary>
/// True since the message is a request.
......
......@@ -9,7 +9,7 @@ namespace PcapDotNet.Packets.Http
/// HTTP request method.
/// Example: GET
/// </summary>
public class HttpRequestMethod : IEquatable<HttpRequestMethod>
public sealed class HttpRequestMethod : IEquatable<HttpRequestMethod>
{
/// <summary>
/// Creates a method from a method string.
......
......@@ -7,7 +7,7 @@ namespace PcapDotNet.Packets.Http
/// RFC 2616.
/// Represents an HTTP response.
/// </summary>
public class HttpResponseDatagram : HttpDatagram
public sealed class HttpResponseDatagram : HttpDatagram
{
private class ParseInfo : ParseInfoBase
{
......
......@@ -7,7 +7,7 @@ namespace PcapDotNet.Packets.Http
/// RFC 2616.
/// Represents an HTTP response layer.
/// </summary>
public class HttpResponseLayer : HttpLayer, IEquatable<HttpResponseLayer>
public sealed class HttpResponseLayer : HttpLayer, IEquatable<HttpResponseLayer>
{
/// <summary>
/// false since this is a response.
......
......@@ -27,7 +27,7 @@ namespace PcapDotNet.Packets.Http
/// If multiple encodings have been applied to an entity, the transfer-codings MUST be listed in the order in which they were applied.
/// Additional information about the encoding parameters MAY be provided by other entity-header fields not defined by this specification.
/// </summary>
public class HttpTransferEncodingField : HttpField, IEquatable<HttpTransferEncodingField>
public sealed class HttpTransferEncodingField : HttpField, IEquatable<HttpTransferEncodingField>
{
/// <summary>
/// The field name.
......
......@@ -8,7 +8,7 @@ namespace PcapDotNet.Packets.Http
/// <summary>
/// Represents an HTTP version.
/// </summary>
public class HttpVersion : IEquatable<HttpVersion>
public sealed class HttpVersion : IEquatable<HttpVersion>
{
/// <summary>
/// Creates a version from the major and minor version numbers.
......
......@@ -15,7 +15,7 @@ namespace PcapDotNet.Packets.Icmp
/// </pre>
/// </summary>
[IcmpDatagramRegistration(IcmpMessageType.AddressMaskReply)]
public class IcmpAddressMaskReplyDatagram : IcmpAddressMaskRequestDatagram
public sealed class IcmpAddressMaskReplyDatagram : IcmpAddressMaskRequestDatagram
{
/// <summary>
/// Creates a Layer that represents the datagram to be used with PacketBuilder.
......
......@@ -3,7 +3,7 @@ namespace PcapDotNet.Packets.Icmp
/// <summary>
/// RFC 950.
/// </summary>
public class IcmpAddressMaskReplyLayer : IcmpAddressMaskRequestLayer
public sealed class IcmpAddressMaskReplyLayer : IcmpAddressMaskRequestLayer
{
/// <summary>
/// The value of this field determines the format of the remaining data.
......
......@@ -59,7 +59,7 @@ namespace PcapDotNet.Packets.Icmp
/// <summary>
/// ICMP is valid if the datagram's length is OK, the checksum is correct and the code is in the expected range.
/// </summary>
protected override bool CalculateIsValid()
protected sealed override bool CalculateIsValid()
{
return base.CalculateIsValid() && Length == DatagramLength;
}
......
......@@ -25,7 +25,7 @@ namespace PcapDotNet.Packets.Icmp
/// <summary>
/// The number of bytes the ICMP payload takes.
/// </summary>
protected override int PayloadLength
protected sealed override int PayloadLength
{
get { return IcmpAddressMaskRequestDatagram.PayloadLength; }
}
......@@ -36,7 +36,7 @@ namespace PcapDotNet.Packets.Icmp
/// </summary>
/// <param name="buffer">The buffer to write the ICMP payload to.</param>
/// <param name="offset">The offset in the buffer to start writing the payload at.</param>
protected override void WritePayload(byte[] buffer, int offset)
protected sealed override void WritePayload(byte[] buffer, int offset)
{
IcmpAddressMaskRequestDatagram.WriteHeaderAdditional(buffer, offset, AddressMask);
}
......@@ -44,7 +44,7 @@ namespace PcapDotNet.Packets.Icmp
/// <summary>
/// True iff the address mask is equal to the other address mask.
/// </summary>
protected override bool EqualPayload(IcmpLayer other)
protected sealed override bool EqualPayload(IcmpLayer other)
{
return EqualPayload(other as IcmpAddressMaskRequestLayer);
}
......
......@@ -22,7 +22,7 @@ namespace PcapDotNet.Packets.Icmp
/// </pre>
/// </summary>
[IcmpDatagramRegistration(IcmpMessageType.ConversionFailed)]
public class IcmpConversionFailedDatagram : IcmpIpV4PayloadDatagram
public sealed class IcmpConversionFailedDatagram : IcmpIpV4PayloadDatagram
{
/// <summary>
/// The number of bytes that should be taken from the original datagram for an unsupported transport protocol ICMP code.
......
......@@ -5,7 +5,7 @@ namespace PcapDotNet.Packets.Icmp
/// Represents a Conversion Failed ICMP layer.
/// <seealso cref="IcmpConversionFailedDatagram"/>
/// </summary>
public class IcmpConversionFailedLayer : IcmpLayer
public sealed class IcmpConversionFailedLayer : IcmpLayer
{
/// <summary>
/// A sub-type of the message. Specific method of this message type.
......
......@@ -20,7 +20,7 @@ namespace PcapDotNet.Packets.Icmp
/// </pre>
/// </summary>
[IcmpDatagramRegistration(IcmpMessageType.DestinationUnreachable)]
public class IcmpDestinationUnreachableDatagram : IcmpIpV4HeaderPlus64BitsPayloadDatagram
public sealed class IcmpDestinationUnreachableDatagram : IcmpIpV4HeaderPlus64BitsPayloadDatagram
{
/// <summary>
/// The minimum value of the maximum transmission unit for FragmentationNeededAndDoNotFragmentSet code.
......
......@@ -4,7 +4,7 @@ namespace PcapDotNet.Packets.Icmp
/// RFC 792 and RFC 1191.
/// <seealso cref="IcmpDestinationUnreachableDatagram"/>
/// </summary>
public class IcmpDestinationUnreachableLayer : IcmpLayer
public sealed class IcmpDestinationUnreachableLayer : IcmpLayer
{
/// <summary>
/// A sub-type of the message. Specific method of this message type.
......
......@@ -13,7 +13,7 @@ namespace PcapDotNet.Packets.Icmp
/// </pre>
/// </summary>
[IcmpDatagramRegistration(IcmpMessageType.DomainNameRequest)]
public class IcmpDomainNameRequestDatagram : IcmpIdentifiedDatagram
public sealed class IcmpDomainNameRequestDatagram : IcmpIdentifiedDatagram
{
/// <summary>
/// Creates a Layer that represents the datagram to be used with PacketBuilder.
......
......@@ -16,7 +16,7 @@ namespace PcapDotNet.Packets.Icmp
/// </pre>
/// </summary>
[IcmpDatagramRegistration(IcmpMessageType.Echo)]
public class IcmpEchoDatagram : IcmpIdentifiedDatagram
public sealed class IcmpEchoDatagram : IcmpIdentifiedDatagram
{
/// <summary>
/// Creates a Layer that represents the datagram to be used with PacketBuilder.
......
......@@ -3,7 +3,7 @@ namespace PcapDotNet.Packets.Icmp
/// <summary>
/// RFC 792.
/// </summary>
public class IcmpEchoLayer : IcmpIdentifiedLayer
public sealed class IcmpEchoLayer : IcmpIdentifiedLayer
{
/// <summary>
/// The value of this field determines the format of the remaining data.
......
......@@ -16,7 +16,7 @@ namespace PcapDotNet.Packets.Icmp
/// </pre>
/// </summary>
[IcmpDatagramRegistration(IcmpMessageType.EchoReply)]
public class IcmpEchoReplyDatagram : IcmpIdentifiedDatagram
public sealed class IcmpEchoReplyDatagram : IcmpIdentifiedDatagram
{
/// <summary>
/// Creates a Layer that represents the datagram to be used with PacketBuilder.
......
......@@ -3,7 +3,7 @@ namespace PcapDotNet.Packets.Icmp
/// <summary>
/// RFC 792.
/// </summary>
public class IcmpEchoReplyLayer : IcmpIdentifiedLayer
public sealed class IcmpEchoReplyLayer : IcmpIdentifiedLayer
{
/// <summary>
/// The value of this field determines the format of the remaining data.
......
......@@ -18,7 +18,7 @@ namespace PcapDotNet.Packets.Icmp
/// <summary>
/// A value that should be interpreted according to the specific message.
/// </summary>
protected override sealed uint Variable
protected sealed override uint Variable
{
get { return (uint)((Identifier << 16) | SequenceNumber); }
}
......
......@@ -13,7 +13,7 @@ namespace PcapDotNet.Packets.Icmp
/// </pre>
/// </summary>
[IcmpDatagramRegistration(IcmpMessageType.InformationReply)]
public class IcmpInformationReplyDatagram : IcmpIdentifiedDatagram
public sealed class IcmpInformationReplyDatagram : IcmpIdentifiedDatagram
{
/// <summary>
/// Creates a Layer that represents the datagram to be used with PacketBuilder.
......
......@@ -3,7 +3,7 @@ namespace PcapDotNet.Packets.Icmp
/// <summary>
/// RFC 792.
/// </summary>
public class IcmpInformationReplyLayer : IcmpIdentifiedLayer
public sealed class IcmpInformationReplyLayer : IcmpIdentifiedLayer
{
/// <summary>
/// The value of this field determines the format of the remaining data.
......
......@@ -13,7 +13,7 @@ namespace PcapDotNet.Packets.Icmp
/// </pre>
/// </summary>
[IcmpDatagramRegistration(IcmpMessageType.InformationRequest)]
public class IcmpInformationRequestDatagram : IcmpIdentifiedDatagram
public sealed class IcmpInformationRequestDatagram : IcmpIdentifiedDatagram
{
/// <summary>
/// Creates a Layer that represents the datagram to be used with PacketBuilder.
......
......@@ -3,7 +3,7 @@ namespace PcapDotNet.Packets.Icmp
/// <summary>
/// RFC 792.
/// </summary>
public class IcmpInformationRequestLayer : IcmpIdentifiedLayer
public sealed class IcmpInformationRequestLayer : IcmpIdentifiedLayer
{
/// <summary>
/// The value of this field determines the format of the remaining data.
......
......@@ -49,7 +49,7 @@ namespace PcapDotNet.Packets.Icmp
/// <summary>
/// The number of bytes this layer will take.
/// </summary>
public override sealed int Length
public sealed override int Length
{
get { return IcmpDatagram.HeaderLength + PayloadLength; }
}
......@@ -69,7 +69,7 @@ namespace PcapDotNet.Packets.Icmp
/// <param name="buffer">The buffer to write the layer to.</param>
/// <param name="offset">The offset in the buffer to start writing the layer at.</param>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2233:OperationsShouldNotOverflow", MessageId = "offset+8")]
protected override sealed void Write(byte[] buffer, int offset)
protected sealed override void Write(byte[] buffer, int offset)
{
IcmpDatagram.WriteHeader(buffer, offset, MessageType, CodeValue, Variable);
WritePayload(buffer, offset + IcmpDatagram.HeaderLength);
......@@ -93,7 +93,7 @@ namespace PcapDotNet.Packets.Icmp
/// <param name="offset">The offset in the buffer the layer starts.</param>
/// <param name="payloadLength">The length of the layer's payload (the number of bytes after the layer in the packet).</param>
/// <param name="nextLayer">The layer that comes after this layer. null if this is the last layer.</param>
public override sealed void Finalize(byte[] buffer, int offset, int payloadLength, ILayer nextLayer)
public sealed override void Finalize(byte[] buffer, int offset, int payloadLength, ILayer nextLayer)
{
IcmpDatagram.WriteChecksum(buffer, offset, Length + payloadLength, Checksum);
}
......@@ -130,7 +130,7 @@ namespace PcapDotNet.Packets.Icmp
/// Returns a hash code for the layer.
/// The hash code is a XOR of the layer length, data link, message type and code, checksum and variable.
/// </summary>
public override int GetHashCode()
public sealed override int GetHashCode()
{
return base.GetHashCode() ^
MessageTypeAndCode.GetHashCode() ^ Checksum.GetHashCode() ^ Variable.GetHashCode();
......@@ -139,7 +139,7 @@ namespace PcapDotNet.Packets.Icmp
/// <summary>
/// Returns a string containing the message type, code and variable.
/// </summary>
public override string ToString()
public sealed override string ToString()
{
return MessageType + "." + CodeValue + "(" + Variable + ")";
}
......
......@@ -17,7 +17,7 @@ namespace PcapDotNet.Packets.Icmp
/// </pre>
/// </summary>
[IcmpDatagramRegistration(IcmpMessageType.ParameterProblem)]
public class IcmpParameterProblemDatagram : IcmpIpV4HeaderPlus64BitsPayloadDatagram
public sealed class IcmpParameterProblemDatagram : IcmpIpV4HeaderPlus64BitsPayloadDatagram
{
private static class Offset
{
......
......@@ -3,7 +3,7 @@ namespace PcapDotNet.Packets.Icmp
/// <summary>
/// RFC 792.
/// </summary>
public class IcmpParameterProblemLayer : IcmpLayer
public sealed class IcmpParameterProblemLayer : IcmpLayer
{
/// <summary>
/// The pointer identifies the octet of the original datagram's header where the error was detected (it may be in the middle of an option).
......
......@@ -21,7 +21,7 @@ namespace PcapDotNet.Packets.Icmp
/// </pre>
/// </summary>
[IcmpDatagramRegistration(IcmpMessageType.Redirect)]
public class IcmpRedirectDatagram : IcmpIpV4HeaderPlus64BitsPayloadDatagram
public sealed class IcmpRedirectDatagram : IcmpIpV4HeaderPlus64BitsPayloadDatagram
{
private static class Offset
{
......
......@@ -7,7 +7,7 @@ namespace PcapDotNet.Packets.Icmp
/// Represents an ICMP Redirect message layer.
/// <seealso cref="IcmpRedirectDatagram"/>
/// </summary>
public class IcmpRedirectLayer : IcmpLayer
public sealed class IcmpRedirectLayer : IcmpLayer
{
/// <summary>
/// A sub-type of the message. Specific method of this message type.
......
......@@ -30,7 +30,7 @@ namespace PcapDotNet.Packets.Icmp
/// </pre>
/// </summary>
[IcmpDatagramRegistration(IcmpMessageType.RouterAdvertisement)]
public class IcmpRouterAdvertisementDatagram : IcmpDatagram
public sealed class IcmpRouterAdvertisementDatagram : IcmpDatagram
{
/// <summary>
/// The default number of 32-bit words of information per each router address.
......
......@@ -7,7 +7,7 @@ namespace PcapDotNet.Packets.Icmp
/// RFC 1256.
/// Represents an entry in Router Advertisement ICMP message.
/// </summary>
public class IcmpRouterAdvertisementEntry : IEquatable<IcmpRouterAdvertisementEntry>
public sealed class IcmpRouterAdvertisementEntry : IEquatable<IcmpRouterAdvertisementEntry>
{
/// <summary>
/// Creates an instance using the given router address and preference.
......
......@@ -9,7 +9,7 @@ namespace PcapDotNet.Packets.Icmp
/// An ICMP Router Advertisement layer.
/// <seealso cref="IcmpRouterAdvertisementDatagram"/>
/// </summary>
public class IcmpRouterAdvertisementLayer : IcmpLayer
public sealed class IcmpRouterAdvertisementLayer : IcmpLayer
{
/// <summary>
/// The maximum time that the router addresses may be considered valid.
......
......@@ -13,7 +13,7 @@ namespace PcapDotNet.Packets.Icmp
/// </pre>
/// </summary>
[IcmpDatagramRegistration(IcmpMessageType.RouterSolicitation)]
public class IcmpRouterSolicitationDatagram : IcmpDatagram
public sealed class IcmpRouterSolicitationDatagram : IcmpDatagram
{
/// <summary>
/// Creates a Layer that represents the datagram to be used with PacketBuilder.
......
......@@ -20,7 +20,7 @@ namespace PcapDotNet.Packets.Icmp
/// </pre>
/// </summary>
[IcmpDatagramRegistration(IcmpMessageType.SecurityFailures)]
public class IcmpSecurityFailuresDatagram : IcmpIpV4HeaderPlus64BitsPayloadDatagram
public sealed class IcmpSecurityFailuresDatagram : IcmpIpV4HeaderPlus64BitsPayloadDatagram
{
private static class Offset
{
......
......@@ -5,7 +5,7 @@ namespace PcapDotNet.Packets.Icmp
/// Represents an ICMP Security Failures layer.
/// <seealso cref="IcmpSecurityFailuresDatagram"/>
/// </summary>
public class IcmpSecurityFailuresLayer : IcmpLayer
public sealed class IcmpSecurityFailuresLayer : IcmpLayer
{
/// <summary>
/// A sub-type of the message. Specific method of this message type.
......
......@@ -17,7 +17,7 @@ namespace PcapDotNet.Packets.Icmp
/// </pre>
/// </summary>
[IcmpDatagramRegistration(IcmpMessageType.SourceQuench)]
public class IcmpSourceQuenchDatagram : IcmpIpV4HeaderPlus64BitsPayloadDatagram
public sealed class IcmpSourceQuenchDatagram : IcmpIpV4HeaderPlus64BitsPayloadDatagram
{
/// <summary>
/// Creates a Layer that represents the datagram to be used with PacketBuilder.
......
......@@ -3,7 +3,7 @@ namespace PcapDotNet.Packets.Icmp
/// <summary>
/// RFC 792.
/// </summary>
public class IcmpSourceQuenchLayer : IcmpLayer
public sealed class IcmpSourceQuenchLayer : IcmpLayer
{
/// <summary>
/// The value of this field determines the format of the remaining data.
......
......@@ -20,7 +20,7 @@ namespace PcapDotNet.Packets.Icmp
/// </pre>
/// </summary>
[IcmpDatagramRegistration(IcmpMessageType.TimeExceeded)]
public class IcmpTimeExceededDatagram : IcmpIpV4HeaderPlus64BitsPayloadDatagram
public sealed class IcmpTimeExceededDatagram : IcmpIpV4HeaderPlus64BitsPayloadDatagram
{
/// <summary>
/// Creates a Layer that represents the datagram to be used with PacketBuilder.
......
......@@ -3,7 +3,7 @@ namespace PcapDotNet.Packets.Icmp
/// <summary>
/// RFC 792.
/// </summary>
public class IcmpTimeExceededLayer : IcmpLayer
public sealed class IcmpTimeExceededLayer : IcmpLayer
{
/// <summary>
/// A sub-type of the message. Specific method of this message type.
......
......@@ -83,7 +83,7 @@ namespace PcapDotNet.Packets.Icmp
/// <summary>
/// Valid if the datagram's length is OK, the checksum is correct and the code is in the expected range.
/// </summary>
protected override bool CalculateIsValid()
protected sealed override bool CalculateIsValid()
{
return base.CalculateIsValid() && Length == DatagramLength;
}
......
......@@ -35,7 +35,7 @@ namespace PcapDotNet.Packets.Icmp
/// <summary>
/// The number of bytes the ICMP payload takes.
/// </summary>
protected override int PayloadLength
protected sealed override int PayloadLength
{
get { return IcmpTimestampDatagram.PayloadLength; }
}
......@@ -46,7 +46,7 @@ namespace PcapDotNet.Packets.Icmp
/// </summary>
/// <param name="buffer">The buffer to write the ICMP payload to.</param>
/// <param name="offset">The offset in the buffer to start writing the payload at.</param>
protected override void WritePayload(byte[] buffer, int offset)
protected sealed override void WritePayload(byte[] buffer, int offset)
{
IcmpTimestampDatagram.WriteHeaderAdditional(buffer, offset,
OriginateTimestamp, ReceiveTimestamp, TransmitTimestamp);
......@@ -55,7 +55,7 @@ namespace PcapDotNet.Packets.Icmp
/// <summary>
/// True iff the OriginateTimestamp, ReceiveTimestamp and the TransmitTimestamp fields are equal.
/// </summary>
protected override bool EqualPayload(IcmpLayer other)
protected sealed override bool EqualPayload(IcmpLayer other)
{
return EqualPayload(other as IcmpTimestampLayer);
}
......
......@@ -19,7 +19,7 @@ namespace PcapDotNet.Packets.Icmp
/// </pre>
/// </summary>
[IcmpDatagramRegistration(IcmpMessageType.TimestampReply)]
public class IcmpTimestampReplyDatagram : IcmpTimestampDatagram
public sealed class IcmpTimestampReplyDatagram : IcmpTimestampDatagram
{
/// <summary>
/// Creates a Layer that represents the datagram to be used with PacketBuilder.
......
......@@ -3,7 +3,7 @@ namespace PcapDotNet.Packets.Icmp
/// <summary>
/// RFC 792.
/// </summary>
public class IcmpTimestampReplyLayer : IcmpTimestampLayer
public sealed class IcmpTimestampReplyLayer : IcmpTimestampLayer
{
/// <summary>
/// The value of this field determines the format of the remaining data.
......
......@@ -22,7 +22,7 @@ namespace PcapDotNet.Packets.Icmp
/// </pre>
/// </summary>
[IcmpDatagramRegistration(IcmpMessageType.TraceRoute)]
public class IcmpTraceRouteDatagram : IcmpDatagram
public sealed class IcmpTraceRouteDatagram : IcmpDatagram
{
/// <summary>
/// The number of bytes this datagram should take.
......
......@@ -5,7 +5,7 @@ namespace PcapDotNet.Packets.Icmp
/// Represents an ICMP Trace Route message layer.
/// <seealso cref="IcmpTraceRouteDatagram"/>
/// </summary>
public class IcmpTraceRouteLayer : IcmpLayer
public sealed class IcmpTraceRouteLayer : IcmpLayer
{
/// <summary>
/// A sub-type of the message. Specific method of this message type.
......
......@@ -5,7 +5,7 @@ namespace PcapDotNet.Packets.Icmp
/// <summary>
/// Used to represent an ICMP datagram with an unknown message type.
/// </summary>
public class IcmpUnknownDatagram : IcmpDatagram
public sealed class IcmpUnknownDatagram : IcmpDatagram
{
/// <summary>
/// Creates a Layer that represents the datagram to be used with PacketBuilder.
......
......@@ -4,7 +4,7 @@ namespace PcapDotNet.Packets.Icmp
/// Represents an ICMP layer with an unknown message type.
/// <seealso cref="IcmpUnknownDatagram"/>
/// </summary>
public class IcmpUnknownLayer : IcmpLayer
public sealed class IcmpUnknownLayer : IcmpLayer
{
/// <summary>
/// The value of this field determines the format of the remaining data.
......
......@@ -90,7 +90,7 @@ namespace PcapDotNet.Packets.Igmp
/// +-----+------------------------------------------------------+
/// </pre>
/// </summary>
public class IgmpDatagram : Datagram
public sealed class IgmpDatagram : Datagram
{
/// <summary>
/// The number of bytes the IGMP header takes for all messages but query version 3.
......
......@@ -11,7 +11,7 @@ namespace PcapDotNet.Packets.Igmp
/// Represents an IGMP group record with all the relevant fields.
/// Used to build an IGMP report of version 3.
/// </summary>
public class IgmpGroupRecord : IEquatable<IgmpGroupRecord>
public sealed class IgmpGroupRecord : IEquatable<IgmpGroupRecord>
{
/// <summary>
/// Create the record according to all the fields.
......
......@@ -35,7 +35,7 @@ namespace PcapDotNet.Packets.Igmp
/// +-----+----------------------------------------------------+
/// </pre>
/// </summary>
public class IgmpGroupRecordDatagram : Datagram
public sealed class IgmpGroupRecordDatagram : Datagram
{
private static class Offset
{
......
......@@ -3,7 +3,7 @@ namespace PcapDotNet.Packets.Igmp
/// <summary>
/// RFC 2236.
/// </summary>
public class IgmpLeaveGroupVersion2Layer : IgmpVersion2Layer
public sealed class IgmpLeaveGroupVersion2Layer : IgmpVersion2Layer
{
/// <summary>
/// The type of the IGMP message of concern to the host-router interaction.
......
......@@ -3,7 +3,7 @@ namespace PcapDotNet.Packets.Igmp
/// <summary>
/// RFC 1112.
/// </summary>
public class IgmpQueryVersion1Layer : IgmpVersion1Layer
public sealed class IgmpQueryVersion1Layer : IgmpVersion1Layer
{
/// <summary>
/// The type of the IGMP message of concern to the host-router interaction.
......
......@@ -3,7 +3,7 @@ namespace PcapDotNet.Packets.Igmp
/// <summary>
/// RFC 2236.
/// </summary>
public class IgmpQueryVersion2Layer : IgmpVersion2Layer
public sealed class IgmpQueryVersion2Layer : IgmpVersion2Layer
{
/// <summary>
/// The type of the IGMP message of concern to the host-router interaction.
......
......@@ -11,7 +11,7 @@ namespace PcapDotNet.Packets.Igmp
/// Represents an IGMP Query version 3 layer.
/// <seealso cref="IgmpDatagram"/>
/// </summary>
public class IgmpQueryVersion3Layer : IgmpLayer, IIgmpLayerWithGroupAddress
public sealed class IgmpQueryVersion3Layer : IgmpLayer, IIgmpLayerWithGroupAddress
{
/// <summary>
/// Creates an instance of an IGMP Query Version 3 layer.
......
......@@ -3,7 +3,7 @@ namespace PcapDotNet.Packets.Igmp
/// <summary>
/// RFC 1112.
/// </summary>
public class IgmpReportVersion1Layer : IgmpVersion1Layer
public sealed class IgmpReportVersion1Layer : IgmpVersion1Layer
{
/// <summary>
/// The type of the IGMP message of concern to the host-router interaction.
......
......@@ -3,7 +3,7 @@ namespace PcapDotNet.Packets.Igmp
/// <summary>
/// RFC 2236.
/// </summary>
public class IgmpReportVersion2Layer : IgmpVersion2Layer
public sealed class IgmpReportVersion2Layer : IgmpVersion2Layer
{
/// <summary>
/// The type of the IGMP message of concern to the host-router interaction.
......
......@@ -10,7 +10,7 @@ namespace PcapDotNet.Packets.Igmp
/// Represents an IGMP Report version 3 layer.
/// <seealso cref="IgmpDatagram"/>
/// </summary>
public class IgmpReportVersion3Layer : IgmpLayer
public sealed class IgmpReportVersion3Layer : IgmpLayer
{
/// <summary>
/// Creates an instance of an IGMP Report Version 3 Layer with a default of no Group Records.
......
......@@ -20,7 +20,7 @@ namespace PcapDotNet.Packets.Igmp
/// <summary>
/// The number of bytes this layer will take.
/// </summary>
public override int Length
public sealed override int Length
{
get { return IgmpDatagram.HeaderLength; }
}
......@@ -31,7 +31,7 @@ namespace PcapDotNet.Packets.Igmp
/// </summary>
/// <param name="buffer">The buffer to write the layer to.</param>
/// <param name="offset">The offset in the buffer to start writing the layer at.</param>
protected override void Write(byte[] buffer, int offset)
protected sealed override void Write(byte[] buffer, int offset)
{
IgmpDatagram.WriteHeader(buffer, offset,
MessageType, MaxResponseTimeValue, GroupAddress);
......@@ -40,7 +40,7 @@ namespace PcapDotNet.Packets.Igmp
/// <summary>
/// Xor of the hash codes of the layer length, datalink, message type, query version and group address.
/// </summary>
public override sealed int GetHashCode()
public sealed override int GetHashCode()
{
return base.GetHashCode() ^
GroupAddress.GetHashCode();
......@@ -49,7 +49,7 @@ namespace PcapDotNet.Packets.Igmp
/// <summary>
/// true iff the the group address is equal.
/// </summary>
protected override sealed bool EqualFields(IgmpLayer other)
protected sealed override bool EqualFields(IgmpLayer other)
{
return EqualFields(other as IgmpSimpleLayer);
}
......
......@@ -12,7 +12,7 @@ namespace PcapDotNet.Packets.Igmp
/// <summary>
/// The actual time allowed, called the Max Resp Time.
/// </summary>
public override TimeSpan MaxResponseTimeValue
public sealed override TimeSpan MaxResponseTimeValue
{
get { return TimeSpan.Zero; }
}
......
......@@ -17,7 +17,7 @@ namespace PcapDotNet.Packets.Igmp
/// <summary>
/// The actual time allowed, called the Max Resp Time.
/// </summary>
public override TimeSpan MaxResponseTimeValue
public sealed override TimeSpan MaxResponseTimeValue
{
get { return MaxResponseTime; }
}
......
......@@ -31,7 +31,7 @@ namespace PcapDotNet.Packets.IpV4
/// +-----+-----------------------------------------------------------+
/// </pre>
/// </summary>
public class IpV4Datagram : Datagram
public sealed class IpV4Datagram : Datagram
{
/// <summary>
/// The minimum length of the header in bytes.
......
......@@ -7,7 +7,7 @@ namespace PcapDotNet.Packets.IpV4
/// Represents IPv4 layer.
/// <seealso cref="IpV4Datagram"/>
/// </summary>
public class IpV4Layer : Layer, IEthernetNextLayer, IIpV4NextLayer
public sealed class IpV4Layer : Layer, IEthernetNextLayer, IIpV4NextLayer
{
/// <summary>
/// Creates an IPv4 layer with all zero values.
......@@ -171,7 +171,7 @@ namespace PcapDotNet.Packets.IpV4
/// <summary>
/// True iff the two IPv4 layers have the same TypeOfService, Identification, Fragmentation, Ttl, Protocol, HeaderChecksum, Source, Destination and Options.
/// </summary>
public override sealed bool Equals(Layer other)
public override bool Equals(Layer other)
{
return Equals(other as IpV4Layer);
}
......
This diff is collapsed.
This diff is collapsed.
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