diff --git a/PcapDotNet/src/PcapDotNet.Core.Test/LivePacketDeviceTests.cs b/PcapDotNet/src/PcapDotNet.Core.Test/LivePacketDeviceTests.cs index 321a9cf8..f568f234 100644 --- a/PcapDotNet/src/PcapDotNet.Core.Test/LivePacketDeviceTests.cs +++ b/PcapDotNet/src/PcapDotNet.Core.Test/LivePacketDeviceTests.cs @@ -32,7 +32,7 @@ public LivePacketDeviceTests() #endif [Fact] - public void SendAndReceievePacketTest() + public void SendAndReceivePacketTest() { const string SourceMac = "11:22:33:44:55:66"; const string DestinationMac = "77:88:99:AA:BB:CC"; diff --git a/PcapDotNet/src/PcapDotNet.Core.Test/OfflinePacketDeviceTests.cs b/PcapDotNet/src/PcapDotNet.Core.Test/OfflinePacketDeviceTests.cs index 28634e93..504096cd 100644 --- a/PcapDotNet/src/PcapDotNet.Core.Test/OfflinePacketDeviceTests.cs +++ b/PcapDotNet/src/PcapDotNet.Core.Test/OfflinePacketDeviceTests.cs @@ -310,7 +310,7 @@ public void SetSamplingMethodOneEveryNTest() public void SetSamplingMethodFirstAfterIntervalTest() { const int NumPackets = 10; - + Packet expectedPacket = _random.NextEthernetPacket(100); using (PacketCommunicator communicator = OpenOfflineDevice(NumPackets, expectedPacket, TimeSpan.FromSeconds(1))) { @@ -338,7 +338,7 @@ public void DumpToBadFileTest() { Assert.Throws(() => OpenOfflineDevice(10, _random.NextEthernetPacket(100), TimeSpan.Zero, "??")); } - + [Fact] public void EmptyNameTest() { @@ -404,7 +404,6 @@ public void ReadUnicodeFilenameTest() Assert.True(File.Exists(ReadUnicodeFilename), string.Format("File {0} doesn't exist", ReadUnicodeFilename)); } - [Fact] public void ReadNonExistingUnicodeFilenameTest() { diff --git a/PcapDotNet/src/PcapDotNet.Core.Test/WiresharkCompareTests.cs b/PcapDotNet/src/PcapDotNet.Core.Test/WiresharkCompareTests.cs index 91a8fea6..6ae6978d 100644 --- a/PcapDotNet/src/PcapDotNet.Core.Test/WiresharkCompareTests.cs +++ b/PcapDotNet/src/PcapDotNet.Core.Test/WiresharkCompareTests.cs @@ -452,7 +452,7 @@ private static void ComparePacketsToWireshark(IEnumerable packets) { // Wireshark's preferences file is %APPDATA%\Wireshark\preferences FileName = Path.Combine(wiresharkDirectory, WiresharkTshark), - Arguments = "-o ip.check_checksum:TRUE " + + Arguments = "-o ip.check_checksum:TRUE " + "-o ipv6.use_geoip:FALSE " + "-o udp.check_checksum:TRUE " + "-o tcp.relative_sequence_numbers:FALSE " + diff --git a/PcapDotNet/src/PcapDotNet.Core/BerkeleyPacketFilter.cs b/PcapDotNet/src/PcapDotNet.Core/BerkeleyPacketFilter.cs index 2b1a1cc2..c1366232 100644 --- a/PcapDotNet/src/PcapDotNet.Core/BerkeleyPacketFilter.cs +++ b/PcapDotNet/src/PcapDotNet.Core/BerkeleyPacketFilter.cs @@ -72,7 +72,7 @@ public void Dispose() /// /// Returns if a given filter applies to an offline packet. - /// This method is used to apply a filter to a packet that is currently in memory. + /// This method is used to apply a filter to a packet that is currently in memory. /// This process does not need to open an adapter; we need just to create the proper filter (by settings parameters like the snapshot length, or the link-layer type) by means of the Pcap. /// The current API of libpcap does not allow to receive a packet and to filter the packet after it has been received. However, this can be useful in case you want to filter packets in the application, instead of into the receiving process. This function allows you to do the job. /// diff --git a/PcapDotNet/src/PcapDotNet.Core/Native/PcapUnixPal.cs b/PcapDotNet/src/PcapDotNet.Core/Native/PcapUnixPal.cs index 3294a7fb..242bb5fe 100644 --- a/PcapDotNet/src/PcapDotNet.Core/Native/PcapUnixPal.cs +++ b/PcapDotNet/src/PcapDotNet.Core/Native/PcapUnixPal.cs @@ -699,7 +699,7 @@ internal extern static int pcap_getnonblock( internal extern static int pcap_minor_version(PcapHandle /* pcap_t* */ p); /// - /// pcap_activate() is used to activate a packet capture handle to look at packets on the network, with the options that were set on the handle being in effect. + /// pcap_activate() is used to activate a packet capture handle to look at packets on the network, with the options that were set on the handle being in effect. /// /// Returns 0 on success without warnings, a non-zero positive value on success with warnings, and a negative value on error. A non-zero return value indicates what warning or error condition occurred. [DllImport(PCAP_DLL, CallingConvention = CallingConvention.Cdecl)] diff --git a/PcapDotNet/src/PcapDotNet.Core/PacketCommunicator/PacketCommunicator.cs b/PcapDotNet/src/PcapDotNet.Core/PacketCommunicator/PacketCommunicator.cs index 2a69212b..75de47b5 100644 --- a/PcapDotNet/src/PcapDotNet.Core/PacketCommunicator/PacketCommunicator.cs +++ b/PcapDotNet/src/PcapDotNet.Core/PacketCommunicator/PacketCommunicator.cs @@ -20,7 +20,7 @@ namespace PcapDotNet.Core public delegate void HandleStatistics(PacketSampleStatistics statistics); /// - /// Used to receive and send packets accross the network or to read and write packets to a pcap file. + /// Used to receive and send packets across the network or to read and write packets to a pcap file. /// public abstract class PacketCommunicator : IDisposable { @@ -34,13 +34,13 @@ protected PacketCommunicator(SocketAddress netmask) } /// - /// Close the files associated with the capture and deallocates resources. + /// Close the files associated with the capture and deallocates resources. /// protected virtual void Dispose(bool disposing) { PcapDescriptor.Dispose(); } - + /// public void Dispose() { @@ -110,7 +110,7 @@ public ReadOnlyCollection SupportedDataLinks } /// - /// The dimension of the packet portion (in bytes) that is delivered to the application. + /// The dimension of the packet portion (in bytes) that is delivered to the application. /// public int SnapshotLength { get => Interop.Pcap.pcap_snapshot(PcapDescriptor); } @@ -230,12 +230,12 @@ public void SetKernelMinimumBytesToCopy(int size) /// /// Define a sampling method for packet capture. - /// This function allows applying a sampling method to the packet capture process. + /// This function allows applying a sampling method to the packet capture process. /// The method will be applied as soon as the capture starts. /// /// /// Warning: Sampling parameters cannot be changed when a capture is active. These parameters must be applied before starting the capture. If they are applied when the capture is in progress, the new settings are ignored. - /// Warning: Sampling works only when capturing data on Win32 or reading from a file. It has not been implemented on other platforms. Sampling works on remote machines provided that the probe (i.e. the capturing device) is a Win32 workstation. + /// Warning: Sampling works only when capturing data on Win32 or reading from a file. It has not been implemented on other platforms. Sampling works on remote machines provided that the probe (i.e. the capturing device) is a Win32 workstation. /// /// The sampling method to be applied public void SetSamplingMethod(SamplingMethod method) @@ -290,7 +290,7 @@ public PacketCommunicatorReceiveResult ReceivePacket(out Packet packet) /// /// Collect a group of packets. - /// Used to collect and process packets. + /// Used to collect and process packets. /// /// /// diff --git a/PcapDotNet/src/PcapDotNet.Core/PacketCommunicator/SamplingMethod.cs b/PcapDotNet/src/PcapDotNet.Core/PacketCommunicator/SamplingMethod.cs index 45cfd455..6c665eed 100644 --- a/PcapDotNet/src/PcapDotNet.Core/PacketCommunicator/SamplingMethod.cs +++ b/PcapDotNet/src/PcapDotNet.Core/PacketCommunicator/SamplingMethod.cs @@ -1,4 +1,4 @@ -using System; +using System; namespace PcapDotNet.Core { @@ -31,7 +31,7 @@ public abstract class SamplingMethod public const int PCAP_SAMP_FIRST_AFTER_N_MS = 2; internal abstract int Method { get; } - + internal abstract int Value { get; } } @@ -40,7 +40,7 @@ public abstract class SamplingMethod /// 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. /// public sealed class SamplingMethodFirstAfterInterval : SamplingMethod - { + { private readonly int _intervalInMilliseconds; /// @@ -82,7 +82,7 @@ public SamplingMethodFirstAfterInterval(TimeSpan interval) /// /// No sampling has to be done on the current capture. - /// In this case, no sampling algorithms are applied to the current capture. + /// In this case, no sampling algorithms are applied to the current capture. /// public sealed class SamplingMethodNone : SamplingMethod { diff --git a/PcapDotNet/src/PcapDotNet.Core/PacketDevice/LivePacketDevice.cs b/PcapDotNet/src/PcapDotNet.Core/PacketDevice/LivePacketDevice.cs index 6e622d34..ce6fe8b9 100644 --- a/PcapDotNet/src/PcapDotNet.Core/PacketDevice/LivePacketDevice.cs +++ b/PcapDotNet/src/PcapDotNet.Core/PacketDevice/LivePacketDevice.cs @@ -22,7 +22,7 @@ public sealed class LivePacketDevice : PacketDevice /// /// /// Thrown if some errors occurred. - /// An error could be due to several reasons: + /// An error could be due to several reasons: /// /// libpcap/WinPcap was not installed on the local/remote host. /// The user does not have enough privileges to list the devices. diff --git a/PcapDotNet/src/PcapDotNet.Core/PacketDevice/OfflinePacketDevice.cs b/PcapDotNet/src/PcapDotNet.Core/PacketDevice/OfflinePacketDevice.cs index f1526613..81493ff5 100644 --- a/PcapDotNet/src/PcapDotNet.Core/PacketDevice/OfflinePacketDevice.cs +++ b/PcapDotNet/src/PcapDotNet.Core/PacketDevice/OfflinePacketDevice.cs @@ -11,7 +11,7 @@ namespace PcapDotNet.Core public sealed class OfflinePacketDevice : PacketDevice { private readonly string _fileName; - + /// /// Creates a device object from a pcap file. /// The device can opened to read packets from. @@ -39,7 +39,7 @@ public override string Description } /// - /// Interface flags. Currently the only possible flag is Loopback, that is set if the interface is a loopback interface. + /// Interface flags. Currently the only possible flag is Loopback, that is set if the interface is a loopback interface. /// public override DeviceAttributes Attributes { @@ -55,7 +55,7 @@ public override ReadOnlyCollection Addresses } /// - /// Open a generic source in order to capture / send (WinPcap only) traffic. + /// Open a generic source in order to capture / send (WinPcap only) traffic. /// /// length of the packet that has to be retained. For each packet received by the filter, only the first 'snapshotLength' bytes are stored in the buffer and passed to the user application. For instance, snaplen equal to 100 means that only the first 100 bytes of each packet are stored. /// Keeps several flags that can be needed for capturing packets. @@ -65,5 +65,5 @@ public override PacketCommunicator Open(int snapshotLength, PacketDeviceOpenAttr { return new OfflinePacketCommunicator(_fileName); } - }; + } } diff --git a/PcapDotNet/src/PcapDotNet.Core/PacketDevice/PacketDevice.cs b/PcapDotNet/src/PcapDotNet.Core/PacketDevice/PacketDevice.cs index 4d6c0001..e9263a3c 100644 --- a/PcapDotNet/src/PcapDotNet.Core/PacketDevice/PacketDevice.cs +++ b/PcapDotNet/src/PcapDotNet.Core/PacketDevice/PacketDevice.cs @@ -13,7 +13,7 @@ protected PacketDevice() { } #pragma warning restore CS1591 // Missing XML comment for publicly visible type or member /// - /// This snapshort length value should be sufficient, on most if not all networks, to capture all the data available from the packet. + /// This snapshot length value should be sufficient, on most if not all networks, to capture all the data available from the packet. /// public const int DefaultSnapshotLength = 65536; @@ -28,7 +28,7 @@ protected PacketDevice() { } public abstract string Description { get; } /// - /// Interface flags. Currently the only possible flag is Loopback, that is set if the interface is a loopback interface. + /// Interface flags. Currently the only possible flag is Loopback, that is set if the interface is a loopback interface. /// public abstract DeviceAttributes Attributes { get; } @@ -47,8 +47,8 @@ protected PacketDevice() { } public abstract PacketCommunicator Open(int snapshotLength, PacketDeviceOpenAttributes attributes, int readTimeout); /// - /// Open a generic source in order to capture / send (WinPcap only) traffic. - /// Uses maxmimum snapshotLength (65536), promiscuous mode and 1 second read timeout. + /// Open a generic source in order to capture / send (WinPcap only) traffic. + /// Uses maximum snapshotLength (65536), promiscuous mode and 1 second read timeout. /// public virtual PacketCommunicator Open() { diff --git a/PcapDotNet/src/PcapDotNet.Core/PacketSendBuffer.cs b/PcapDotNet/src/PcapDotNet.Core/PacketSendBuffer.cs index 4d401cc1..a25ff6b3 100644 --- a/PcapDotNet/src/PcapDotNet.Core/PacketSendBuffer.cs +++ b/PcapDotNet/src/PcapDotNet.Core/PacketSendBuffer.cs @@ -44,7 +44,7 @@ public void Enqueue(Packet packet) { throw new ArgumentNullException(nameof(packet)); } - + var hdrSize = Interop.Pcap.PcapHeaderSize; if (hdrSize + packet.Length > _buffer.Length - _currentBufferPosition) { diff --git a/PcapDotNet/src/PcapDotNet.Core/PacketTotalStatistics.cs b/PcapDotNet/src/PcapDotNet.Core/PacketTotalStatistics.cs index e8ce13de..e6ba6f4e 100644 --- a/PcapDotNet/src/PcapDotNet.Core/PacketTotalStatistics.cs +++ b/PcapDotNet/src/PcapDotNet.Core/PacketTotalStatistics.cs @@ -6,7 +6,7 @@ namespace PcapDotNet.Core { /// - /// Statistics on capture from the start of the run. + /// Statistics on capture from the start of the run. /// public sealed class PacketTotalStatistics : IEquatable { diff --git a/PcapDotNet/src/PcapDotNet.Core/PcapDataLink.cs b/PcapDotNet/src/PcapDotNet.Core/PcapDataLink.cs index d3bf6179..b6f5c669 100644 --- a/PcapDotNet/src/PcapDotNet.Core/PcapDataLink.cs +++ b/PcapDotNet/src/PcapDotNet.Core/PcapDataLink.cs @@ -140,7 +140,7 @@ public override string ToString() { return Name + " (" + Description + ")"; } - + /// public bool Equals(PcapDataLink other) { diff --git a/PcapDotNet/src/PcapDotNet.Packets.Test/DnsTests.cs b/PcapDotNet/src/PcapDotNet.Packets.Test/DnsTests.cs index 9d3e3641..ebb2a6f7 100644 --- a/PcapDotNet/src/PcapDotNet.Packets.Test/DnsTests.cs +++ b/PcapDotNet/src/PcapDotNet.Packets.Test/DnsTests.cs @@ -86,7 +86,7 @@ public void DnsDomainNameCompressionTest() { DnsLayer dnsLayer = new DnsLayer(); TestDomainNameCompression(0, dnsLayer); - + dnsLayer.Queries = new List(); dnsLayer.Answers = new List(); dnsLayer.Authorities = new List(); @@ -181,7 +181,7 @@ public void DnsOptResourceRecordTest() DnsResourceDataOptions data = (DnsResourceDataOptions)random.NextDnsResourceData(DnsType.Opt); DnsOptResourceRecord record = new DnsOptResourceRecord(domainName, sendersUdpPayloadSize, extendedRcode, version, flags, data); - + Assert.Equal(domainName, record.DomainName); Assert.Equal(sendersUdpPayloadSize, record.SendersUdpPayloadSize); Assert.Equal(extendedRcode, record.ExtendedReturnCode); @@ -723,7 +723,7 @@ public void DnsResourceDataDelegationSignerConstructorNullDigestTest() { Assert.Throws(() => new DnsResourceDataDelegationSigner(1, DnsAlgorithm.PrivateDns, DnsDigestType.Sha1, null)); } - + [Fact] public void DnsResourceDataDomainNameParseWrongLengthTest() { diff --git a/PcapDotNet/src/PcapDotNet.Packets/ByteArrayExtensions.cs b/PcapDotNet/src/PcapDotNet.Packets/ByteArrayExtensions.cs index 086be526..f36b78f4 100644 --- a/PcapDotNet/src/PcapDotNet.Packets/ByteArrayExtensions.cs +++ b/PcapDotNet/src/PcapDotNet.Packets/ByteArrayExtensions.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.Globalization; -using System.Linq; using System.Net; using System.Numerics; using System.Text; @@ -141,7 +140,7 @@ public static void BlockCopy(this byte[] source, int sourceOffset, byte[] destin /// The value read from the buffer. public static byte ReadByte(this byte[] buffer, int offset) { - if (buffer == null) + if (buffer == null) throw new ArgumentNullException("buffer"); return buffer[offset]; } @@ -387,7 +386,7 @@ public static UInt128 ReadUInt128(this byte[] buffer, int offset, Endianity endi /// The value converted from the read bytes according to the endianity. public static BigInteger ReadUnsignedBigInteger(this byte[] buffer, int offset, int length, Endianity endianity) { - if (buffer == null) + if (buffer == null) throw new ArgumentNullException("buffer"); BigInteger value = BigInteger.Zero; @@ -494,7 +493,7 @@ public static IpV6Address ReadIpV6Address(this byte[] buffer, int offset, Endian /// The value to write. public static void Write(this byte[] buffer, int offset, byte value) { - if (buffer == null) + if (buffer == null) throw new ArgumentNullException("buffer"); buffer[offset] = value; @@ -520,9 +519,9 @@ public static void Write(this byte[] buffer, ref int offset, byte value) /// The value to write. public static void Write(this byte[] buffer, ref int offset, IEnumerable value) { - if (buffer == null) + if (buffer == null) throw new ArgumentNullException("buffer"); - if (value == null) + if (value == null) throw new ArgumentNullException("value"); foreach (byte b in value) @@ -751,9 +750,9 @@ public static void Write(this byte[] buffer, ref int offset, UInt128 value, Endi /// The endianity to use when converting the value to bytes. public static void WriteUnsigned(this byte[] buffer, int offset, BigInteger value, int length, Endianity endianity) { - if (buffer == null) + if (buffer == null) throw new ArgumentNullException("buffer"); - + if (value.Sign < 0) throw new ArgumentOutOfRangeException("value", value, "Must be non-negative."); for (int i = 0; i != length && value != BigInteger.Zero; ++i, value >>= 8) @@ -801,7 +800,7 @@ public static void Write(this byte[] buffer, int offset, DataSegment value) /// The value to write. public static void Write(this byte[] buffer, ref int offset, DataSegment value) { - if (value == null) + if (value == null) throw new ArgumentNullException("value"); value.Write(buffer, offset); @@ -967,7 +966,7 @@ private static UInt48 HostToNetworkOrder(UInt48 value) { UInt48* resultPtr = &result; byte* resultBytePtr = (byte*)resultPtr; - + UInt48* valuePtr = &value; byte* valueBytePtr = (byte*)valuePtr; @@ -1088,7 +1087,7 @@ private static void Write(byte[] buffer, int offset, UInt24 value) } } } - + private static void Write(byte[] buffer, int offset, int value) { unsafe diff --git a/PcapDotNet/src/PcapDotNet.Packets/DataSegment.cs b/PcapDotNet/src/PcapDotNet.Packets/DataSegment.cs index 39537c90..0034936d 100644 --- a/PcapDotNet/src/PcapDotNet.Packets/DataSegment.cs +++ b/PcapDotNet/src/PcapDotNet.Packets/DataSegment.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using System.Globalization; using System.IO; -using System.Linq; using System.Numerics; using System.Text; using PcapDotNet.Base; diff --git a/PcapDotNet/src/PcapDotNet.Packets/Dns/ResourceData/DnsResourceData.cs b/PcapDotNet/src/PcapDotNet.Packets/Dns/ResourceData/DnsResourceData.cs index 5643788d..9dddb4a2 100644 --- a/PcapDotNet/src/PcapDotNet.Packets/Dns/ResourceData/DnsResourceData.cs +++ b/PcapDotNet/src/PcapDotNet.Packets/Dns/ResourceData/DnsResourceData.cs @@ -2,9 +2,7 @@ using System.Collections; using System.Collections.Generic; using System.Linq; -using System.Numerics; using System.Reflection; -using PcapDotNet.Base; namespace PcapDotNet.Packets.Dns { @@ -14,7 +12,7 @@ namespace PcapDotNet.Packets.Dns /// public abstract class DnsResourceData { - internal const int StringMinimumLength = sizeof(byte); + internal const int StringMinimumLength = sizeof(byte); /// /// Returns the DnsResourceData concrete type that should be created for the given DnsType. diff --git a/PcapDotNet/src/PcapDotNet.Packets/Dns/ResourceData/DnsResourceDataHostIdentityProtocol.cs b/PcapDotNet/src/PcapDotNet.Packets/Dns/ResourceData/DnsResourceDataHostIdentityProtocol.cs index b1d3e164..0671c713 100644 --- a/PcapDotNet/src/PcapDotNet.Packets/Dns/ResourceData/DnsResourceDataHostIdentityProtocol.cs +++ b/PcapDotNet/src/PcapDotNet.Packets/Dns/ResourceData/DnsResourceDataHostIdentityProtocol.cs @@ -99,7 +99,7 @@ public DnsResourceDataHostIdentityProtocol(DataSegment hostIdentityTag, DnsPubli public ReadOnlyCollection RendezvousServers { get; private set; } /// - /// Two DnsResourceDataHostIdentityProtocol are equal iff their host identity tag, public key algorithm, public key and rendezvous servers fields + /// Two DnsResourceDataHostIdentityProtocol are equal iff their host identity tag, public key algorithm, public key and rendezvous servers fields /// are equal. /// public bool Equals(DnsResourceDataHostIdentityProtocol other) @@ -112,7 +112,7 @@ public bool Equals(DnsResourceDataHostIdentityProtocol other) } /// - /// Two DnsResourceDataHostIdentityProtocol are equal iff their host identity tag, public key algorithm, public key and rendezvous servers fields + /// Two DnsResourceDataHostIdentityProtocol are equal iff their host identity tag, public key algorithm, public key and rendezvous servers fields /// are equal. /// public override bool Equals(object obj) @@ -163,7 +163,7 @@ internal override DnsResourceData CreateInstance(DnsDatagram dns, int offsetInDn int hostIdentityTagLength = dns[offsetInDns + Offset.HostIdentityTagLength]; DnsPublicKeyAlgorithm publicKeyAlgorithm = (DnsPublicKeyAlgorithm)dns[offsetInDns + Offset.PublicKeyAlgorithm]; int publicKeyLength = dns.ReadUShort(offsetInDns + Offset.PublicKeyLength, Endianity.Big); - + if (length < ConstantPartLength + hostIdentityTagLength + publicKeyLength) return null; DataSegment hostIdentityTag = dns.Subsegment(offsetInDns + Offset.HostIdentityTag, hostIdentityTagLength); diff --git a/PcapDotNet/src/PcapDotNet.Packets/Ethernet/EthernetBaseDatagram.cs b/PcapDotNet/src/PcapDotNet.Packets/Ethernet/EthernetBaseDatagram.cs index 999f5d4a..1d13b351 100644 --- a/PcapDotNet/src/PcapDotNet.Packets/Ethernet/EthernetBaseDatagram.cs +++ b/PcapDotNet/src/PcapDotNet.Packets/Ethernet/EthernetBaseDatagram.cs @@ -159,7 +159,7 @@ public IpDatagram Ip } } } - + /// /// The Ethernet payload as an ARP datagram. /// diff --git a/PcapDotNet/src/PcapDotNet.Packets/Ethernet/MacAddress.cs b/PcapDotNet/src/PcapDotNet.Packets/Ethernet/MacAddress.cs index 77c19f5f..3a64ad6b 100644 --- a/PcapDotNet/src/PcapDotNet.Packets/Ethernet/MacAddress.cs +++ b/PcapDotNet/src/PcapDotNet.Packets/Ethernet/MacAddress.cs @@ -17,7 +17,7 @@ public struct MacAddress : IEquatable /// /// A MAC Address of all zeros (00:00:00:00:00:00). /// - public static MacAddress Zero + public static MacAddress Zero { get { return _zero; } } diff --git a/PcapDotNet/src/PcapDotNet.Packets/Gre/GreSourceRouteEntryAs.cs b/PcapDotNet/src/PcapDotNet.Packets/Gre/GreSourceRouteEntryAs.cs index 73370bf7..50d13bd9 100644 --- a/PcapDotNet/src/PcapDotNet.Packets/Gre/GreSourceRouteEntryAs.cs +++ b/PcapDotNet/src/PcapDotNet.Packets/Gre/GreSourceRouteEntryAs.cs @@ -31,7 +31,7 @@ public override GreSourceRouteEntryAddressFamily AddressFamily } /// - /// The SRE Length field contains the number of octets in the SRE. + /// The SRE Length field contains the number of octets in the SRE. /// public override byte PayloadLength { diff --git a/PcapDotNet/src/PcapDotNet.Packets/Gre/GreSourceRouteEntryIp.cs b/PcapDotNet/src/PcapDotNet.Packets/Gre/GreSourceRouteEntryIp.cs index fdaeb091..37462388 100644 --- a/PcapDotNet/src/PcapDotNet.Packets/Gre/GreSourceRouteEntryIp.cs +++ b/PcapDotNet/src/PcapDotNet.Packets/Gre/GreSourceRouteEntryIp.cs @@ -24,7 +24,7 @@ public GreSourceRouteEntryIp(ReadOnlyCollection addresses, int next } /// - /// The Address Family field contains a two octet value which indicates the syntax and semantics of the Routing Information field. + /// The Address Family field contains a two octet value which indicates the syntax and semantics of the Routing Information field. /// public override GreSourceRouteEntryAddressFamily AddressFamily { @@ -32,7 +32,7 @@ public override GreSourceRouteEntryAddressFamily AddressFamily } /// - /// The SRE Length field contains the number of octets in the SRE. + /// The SRE Length field contains the number of octets in the SRE. /// public override byte PayloadLength { diff --git a/PcapDotNet/src/PcapDotNet.Packets/Http/HttpField.cs b/PcapDotNet/src/PcapDotNet.Packets/Http/HttpField.cs index 675ab7d8..9256226c 100644 --- a/PcapDotNet/src/PcapDotNet.Packets/Http/HttpField.cs +++ b/PcapDotNet/src/PcapDotNet.Packets/Http/HttpField.cs @@ -1,12 +1,9 @@ using System; -using System.CodeDom; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Globalization; -using System.IO; using System.Linq; using System.Text; -using Microsoft.CSharp; using PcapDotNet.Base; using EncodingExtensions = PcapDotNet.Base.EncodingExtensions; @@ -53,7 +50,7 @@ public static HttpField CreateField(string fieldName, byte[] fieldValue) /// The constructed HTTP field. public static HttpField CreateField(string fieldName, string fieldValue, Encoding fieldValueEncoding) { - if (fieldValueEncoding == null) + if (fieldValueEncoding == null) throw new ArgumentNullException("fieldValueEncoding"); return CreateField(fieldName, fieldValueEncoding.GetBytes(NormalizeValue(fieldValue))); @@ -143,7 +140,7 @@ internal HttpField(string name, string value) } internal HttpField(string name, string value, Encoding encoding) - : this(name, encoding == null ? null : encoding.GetBytes(NormalizeValue(value))) + : this(name, encoding?.GetBytes(NormalizeValue(value))) { } @@ -157,7 +154,7 @@ internal HttpField(string name, ReadOnlyCollection value) Name = name; Value = value; } - + internal void Write(byte[] buffer, ref int offset) { buffer.Write(ref offset, Name, Encoding.ASCII); diff --git a/PcapDotNet/src/PcapDotNet.Packets/Http/HttpParser.cs b/PcapDotNet/src/PcapDotNet.Packets/Http/HttpParser.cs index 5016a14c..ce3a210b 100644 --- a/PcapDotNet/src/PcapDotNet.Packets/Http/HttpParser.cs +++ b/PcapDotNet/src/PcapDotNet.Packets/Http/HttpParser.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Collections.ObjectModel; using System.Linq; using System.Text; using PcapDotNet.Base; @@ -44,7 +43,7 @@ public HttpParser Token(out Datagram token) token = null; return Fail(); } - + token = new Datagram(_buffer, _offset, tokenLength); _offset += token.Length; return this; @@ -133,7 +132,7 @@ public HttpParser FieldContent(out IEnumerable fieldContent) _offset += text.Count(); } } - + return this; } @@ -351,7 +350,7 @@ public HttpParser SkipChunkExtensions() while (Success && IsNext(AsciiBytes.Semicolon)) { Bytes(AsciiBytes.Semicolon); - + string chunkExtensionName; Token(out chunkExtensionName); if (IsNext(AsciiBytes.EqualsSign)) @@ -444,7 +443,7 @@ public HttpParser Skip(int count) } private static readonly byte[] _httpSlash = Encoding.ASCII.GetBytes("HTTP/"); - + private readonly byte[] _buffer; private int _offset; private readonly int _totalLength; diff --git a/PcapDotNet/src/PcapDotNet.Packets/Http/HttpRegex.cs b/PcapDotNet/src/PcapDotNet.Packets/Http/HttpRegex.cs index a752d1d0..ac18c119 100644 --- a/PcapDotNet/src/PcapDotNet.Packets/Http/HttpRegex.cs +++ b/PcapDotNet/src/PcapDotNet.Packets/Http/HttpRegex.cs @@ -94,7 +94,7 @@ public static Regex AtLeast(Regex regex, int minCount) return AtLeastOne(regex); return Build(string.Format(CultureInfo.InvariantCulture, "(?:{0}){{{1},}}", regex, minCount)); } - + public static Regex CommaSeparatedRegex(Regex element, int minCount) { Regex linearWhiteSpacesRegex = Any(LinearWhiteSpace); @@ -125,7 +125,7 @@ private static string Bracket(string pattern) private static readonly Regex _qdtextRegex = Or(_linearWhiteSpaceRegex, Build(@"[^\x00-\x1F\x7F""]")); private static readonly Regex _quotedStringRegex = Concat(Build('"'), Any(Or(_qdtextRegex, _quotedPairRegex)), Build('"')); private static readonly Regex _tokenRegex = AtLeastOne(Build(@"[\x21\x23-\x27\x2A\x2B\x2D\x2E0-9A-Z\x5E-\x7A\x7C\x7E-\xFE]")); - private static readonly Regex _valueRegex = Or(Token, QuotedString); + private static readonly Regex _valueRegex = Or(Token, QuotedString); private static readonly Regex _parameterRegex = Concat(Capture(_tokenRegex, ParameterNameGroupName), Build("="), Capture(_valueRegex, ParameterValueGroupName)); private static readonly Regex _optionalParametersRegex = Any(Concat(Build(";"), Optional(_linearWhiteSpaceRegex), _parameterRegex)); diff --git a/PcapDotNet/src/PcapDotNet.Packets/Http/HttpRequestLayer.cs b/PcapDotNet/src/PcapDotNet.Packets/Http/HttpRequestLayer.cs index f731baf3..278cd56e 100644 --- a/PcapDotNet/src/PcapDotNet.Packets/Http/HttpRequestLayer.cs +++ b/PcapDotNet/src/PcapDotNet.Packets/Http/HttpRequestLayer.cs @@ -1,6 +1,4 @@ using System; -using System.Text; -using PcapDotNet.Base; using EncodingExtensions = PcapDotNet.Base.EncodingExtensions; namespace PcapDotNet.Packets.Http diff --git a/PcapDotNet/src/PcapDotNet.Packets/Icmp/IcmpDatagramFactory.cs b/PcapDotNet/src/PcapDotNet.Packets/Icmp/IcmpDatagramFactory.cs index 0947b652..fc04d60f 100644 --- a/PcapDotNet/src/PcapDotNet.Packets/Icmp/IcmpDatagramFactory.cs +++ b/PcapDotNet/src/PcapDotNet.Packets/Icmp/IcmpDatagramFactory.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using System.Linq; using System.Reflection; -using PcapDotNet.Base; namespace PcapDotNet.Packets.Icmp { diff --git a/PcapDotNet/src/PcapDotNet.Packets/Ip/OptionComplexFactory.cs b/PcapDotNet/src/PcapDotNet.Packets/Ip/OptionComplexFactory.cs index e00bcfa9..6f8b9cf1 100644 --- a/PcapDotNet/src/PcapDotNet.Packets/Ip/OptionComplexFactory.cs +++ b/PcapDotNet/src/PcapDotNet.Packets/Ip/OptionComplexFactory.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using System.Linq; using System.Reflection; -using PcapDotNet.Base; namespace PcapDotNet.Packets.Ip { diff --git a/PcapDotNet/src/PcapDotNet.Packets/IpV6/ExtensionHeaders/IpV6ExtensionHeader.cs b/PcapDotNet/src/PcapDotNet.Packets/IpV6/ExtensionHeaders/IpV6ExtensionHeader.cs index 931a1e63..8f2524e5 100644 --- a/PcapDotNet/src/PcapDotNet.Packets/IpV6/ExtensionHeaders/IpV6ExtensionHeader.cs +++ b/PcapDotNet/src/PcapDotNet.Packets/IpV6/ExtensionHeaders/IpV6ExtensionHeader.cs @@ -1,8 +1,6 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; -using System.Diagnostics; -using System.Globalization; using System.Linq; using PcapDotNet.Base; using PcapDotNet.Packets.IpV4; diff --git a/PcapDotNet/src/PcapDotNet.Packets/IpV6/ExtensionHeaders/IpV6ExtensionHeaderRoutingProtocolLowPowerAndLossyNetworks.cs b/PcapDotNet/src/PcapDotNet.Packets/IpV6/ExtensionHeaders/IpV6ExtensionHeaderRoutingProtocolLowPowerAndLossyNetworks.cs index d303009b..c8ee23fb 100644 --- a/PcapDotNet/src/PcapDotNet.Packets/IpV6/ExtensionHeaders/IpV6ExtensionHeaderRoutingProtocolLowPowerAndLossyNetworks.cs +++ b/PcapDotNet/src/PcapDotNet.Packets/IpV6/ExtensionHeaders/IpV6ExtensionHeaderRoutingProtocolLowPowerAndLossyNetworks.cs @@ -53,7 +53,7 @@ private static class RoutingDataMask public const byte CommonPrefixLengthForLastAddress = 0x0F; public const byte PadSize = 0xF0; } - + private static class RoutingDataShift { public const int CommonPrefixLengthForNonLastAddresses = 4; @@ -87,8 +87,8 @@ private static class RoutingDataShift /// For example, a header carrying full IPv6 addresses in Addresses[1..n-1] sets this to 0. /// /// - /// Number of prefix octets from the last segment (i.e., segment n) that are elided. - /// For example, a header carrying a full IPv6 address in Addresses[n] sets this to 0. + /// Number of prefix octets from the last segment (i.e., segment n) that are elided. + /// For example, a header carrying a full IPv6 address in Addresses[n] sets this to 0. /// /// Routing addresses. public IpV6ExtensionHeaderRoutingProtocolLowPowerAndLossyNetworks(IpV4Protocol? nextHeader, byte segmentsLeft, byte commonPrefixLengthForNonLastAddresses, @@ -155,8 +155,8 @@ public override IpV6RoutingType RoutingType public byte CommonPrefixLengthForNonLastAddresses { get; private set; } /// - /// Number of prefix octets from the last segment (i.e., segment n) that are elided. - /// For example, a header carrying a full IPv6 address in Addresses[n] sets this to 0. + /// Number of prefix octets from the last segment (i.e., segment n) that are elided. + /// For example, a header carrying a full IPv6 address in Addresses[n] sets this to 0. /// public byte CommonPrefixLengthForLastAddress { get; private set; } diff --git a/PcapDotNet/src/PcapDotNet.Packets/IpV6/ExtensionHeaders/IpV6ExtensionHeaderStandard.cs b/PcapDotNet/src/PcapDotNet.Packets/IpV6/ExtensionHeaders/IpV6ExtensionHeaderStandard.cs index 2e6b6372..d20fb1dd 100644 --- a/PcapDotNet/src/PcapDotNet.Packets/IpV6/ExtensionHeaders/IpV6ExtensionHeaderStandard.cs +++ b/PcapDotNet/src/PcapDotNet.Packets/IpV6/ExtensionHeaders/IpV6ExtensionHeaderStandard.cs @@ -59,7 +59,7 @@ public sealed override int GetHashCode() internal abstract int GetDataHashCode(); - internal IpV6ExtensionHeaderStandard(IpV4Protocol? nextHeader) + internal IpV6ExtensionHeaderStandard(IpV4Protocol? nextHeader) : base(nextHeader) { } diff --git a/PcapDotNet/src/PcapDotNet.Packets/IpV6/IpV6Address.cs b/PcapDotNet/src/PcapDotNet.Packets/IpV6/IpV6Address.cs index c76e40e2..5b227dfa 100644 --- a/PcapDotNet/src/PcapDotNet.Packets/IpV6/IpV6Address.cs +++ b/PcapDotNet/src/PcapDotNet.Packets/IpV6/IpV6Address.cs @@ -55,7 +55,7 @@ public IpV6Address(string value) throw new ArgumentNullException("value"); string cannonizedValue = value; - + // Handle ...:1.2.3.4 int lastColonIndex = cannonizedValue.LastIndexOf(':'); if (lastColonIndex == -1) diff --git a/PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6AccessNetworkIdentifierSubOptions.cs b/PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6AccessNetworkIdentifierSubOptions.cs index e304f2e7..9ff2f136 100644 --- a/PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6AccessNetworkIdentifierSubOptions.cs +++ b/PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6AccessNetworkIdentifierSubOptions.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using System.Linq; using System.Reflection; -using PcapDotNet.Base; namespace PcapDotNet.Packets.IpV6 { diff --git a/PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6FlowIdentificationSubOptions.cs b/PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6FlowIdentificationSubOptions.cs index b920c69d..433322c4 100644 --- a/PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6FlowIdentificationSubOptions.cs +++ b/PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6FlowIdentificationSubOptions.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using System.Linq; using System.Reflection; -using PcapDotNet.Base; namespace PcapDotNet.Packets.IpV6 { diff --git a/PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6Options.cs b/PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6Options.cs index ce01ee99..fea5b58e 100644 --- a/PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6Options.cs +++ b/PcapDotNet/src/PcapDotNet.Packets/IpV6/Options/IpV6Options.cs @@ -44,7 +44,7 @@ public IpV6Options(params IpV6Option[] options) { } - internal IpV6Options(DataSegment data) + internal IpV6Options(DataSegment data) : this(Read(data)) { } @@ -58,7 +58,7 @@ internal IpV6Options Pad(int paddingSize) return new IpV6Options(new Tuple, bool>(paddedOptions.ToList(), IsValid)); } - internal static Tuple, bool> Read(DataSegment data) + internal static Tuple, bool> Read(DataSegment data) { int offset = 0; List options = new List(); @@ -102,7 +102,7 @@ private IpV6Options(Tuple, bool> optionsAndIsValid) : base(optionsAndIsValid.Item1, optionsAndIsValid.Item2, SumBytesLength(optionsAndIsValid.Item1)) { } - + private static IpV6Option CreateOption(IpV6OptionType optionType, DataSegment data) { IIpV6OptionComplexFactory factory; diff --git a/PcapDotNet/src/PcapDotNet.Packets/Packet.cs b/PcapDotNet/src/PcapDotNet.Packets/Packet.cs index f1d50c42..1516d03f 100644 --- a/PcapDotNet/src/PcapDotNet.Packets/Packet.cs +++ b/PcapDotNet/src/PcapDotNet.Packets/Packet.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections; using System.Collections.Generic; using System.Globalization; @@ -49,7 +49,7 @@ public static Packet FromHexadecimalString(string value, DateTime timestamp, IDa /// A timestamp of the packet - when it was captured. /// The type of the datalink of the packet. /// - /// Length this packet (off wire). + /// Length this packet (off wire). /// If the value is less than the data size, it is ignored and the original length is considered to be equal to the data size. /// public Packet(byte[] data, DateTime timestamp, IDataLink dataLink, uint originalLength) @@ -79,7 +79,7 @@ public Packet(byte[] data, DateTime timestamp, IDataLink dataLink) /// A timestamp of the packet - when it was captured. /// The type of the datalink of the packet. /// - /// Length this packet (off wire). + /// Length this packet (off wire). /// If the value is less than the data size, it is ignored and the original length is considered to be equal to the data size. /// public Packet(byte[] data, DateTime timestamp, DataLinkKind dataLink, uint originalLength) @@ -220,7 +220,7 @@ public void RemoveAt(int index) public byte this[int index] { get { return Buffer[index]; } - set { throw new InvalidOperationException("Immutable collection"); ; } + set { throw new InvalidOperationException("Immutable collection"); } } ///