Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
P
Pcap-Net
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Pcap-Net
Commits
b0b58a33
Commit
b0b58a33
authored
May 20, 2010
by
Brickner_cp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Resharper 5.0 inspection fixes.
parent
d41fce73
Hide whitespace changes
Inline
Side-by-side
Showing
106 changed files
with
255 additions
and
660 deletions
+255
-660
PcapDotNet.5.0.ReSharper
PcapDotNet/src/PcapDotNet.5.0.ReSharper
+6
-2
FuncExtensionsTest.cs
PcapDotNet/src/PcapDotNet.Base.Test/FuncExtensionsTest.cs
+3
-10
IEnumerableExtensionsTests.cs
...et/src/PcapDotNet.Base.Test/IEnumerableExtensionsTests.cs
+6
-12
MemberInfoExtensionsTests.cs
...Net/src/PcapDotNet.Base.Test/MemberInfoExtensionsTests.cs
+3
-10
PropertyInfoExtensionsTests.cs
...t/src/PcapDotNet.Base.Test/PropertyInfoExtensionsTests.cs
+3
-10
UInt128Tests.cs
PcapDotNet/src/PcapDotNet.Base.Test/UInt128Tests.cs
+14
-19
UInt24Tests.cs
PcapDotNet/src/PcapDotNet.Base.Test/UInt24Tests.cs
+8
-14
UInt48Tests.cs
PcapDotNet/src/PcapDotNet.Base.Test/UInt48Tests.cs
+6
-14
FuncExtensions.cs
PcapDotNet/src/PcapDotNet.Base/FuncExtensions.cs
+0
-2
IEnumerableExtensions.cs
PcapDotNet/src/PcapDotNet.Base/IEnumerableExtensions.cs
+2
-2
IListExtensions.cs
PcapDotNet/src/PcapDotNet.Base/IListExtensions.cs
+2
-0
AssemblyInfo.cs
PcapDotNet/src/PcapDotNet.Base/Properties/AssemblyInfo.cs
+0
-1
TimeSpanExtensions.cs
PcapDotNet/src/PcapDotNet.Base/TimeSpanExtensions.cs
+0
-2
UInt128.cs
PcapDotNet/src/PcapDotNet.Base/UInt128.cs
+1
-1
UInt24.cs
PcapDotNet/src/PcapDotNet.Base/UInt24.cs
+1
-5
UInt48.cs
PcapDotNet/src/PcapDotNet.Base/UInt48.cs
+1
-1
LivePacketDeviceExtensions.cs
.../PcapDotNet.Core.Extensions/LivePacketDeviceExtensions.cs
+2
-8
PacketCommunicatorExtensions.cs
...capDotNet.Core.Extensions/PacketCommunicatorExtensions.cs
+0
-2
AssemblyInfo.cs
...src/PcapDotNet.Core.Extensions/Properties/AssemblyInfo.cs
+0
-1
BerkeleyPacketFilterTests.cs
...Net/src/PcapDotNet.Core.Test/BerkeleyPacketFilterTests.cs
+10
-17
LivePacketDeviceExtensionsTests.cs
...c/PcapDotNet.Core.Test/LivePacketDeviceExtensionsTests.cs
+3
-11
LivePacketDeviceTests.cs
PcapDotNet/src/PcapDotNet.Core.Test/LivePacketDeviceTests.cs
+15
-19
MarshalingServicesTests.cs
...otNet/src/PcapDotNet.Core.Test/MarshalingServicesTests.cs
+0
-7
MoreIpV4Option.cs
PcapDotNet/src/PcapDotNet.Core.Test/MoreIpV4Option.cs
+3
-5
MoreTcpOption.cs
PcapDotNet/src/PcapDotNet.Core.Test/MoreTcpOption.cs
+0
-1
OfflinePacketDeviceTests.cs
...tNet/src/PcapDotNet.Core.Test/OfflinePacketDeviceTests.cs
+11
-20
PacketDumpFileTests.cs
PcapDotNet/src/PcapDotNet.Core.Test/PacketDumpFileTests.cs
+14
-24
PacketSendBufferTests.cs
PcapDotNet/src/PcapDotNet.Core.Test/PacketSendBufferTests.cs
+5
-12
PcapDataLinkTests.cs
PcapDotNet/src/PcapDotNet.Core.Test/PcapDataLinkTests.cs
+5
-14
PcapLibTests.cs
PcapDotNet/src/PcapDotNet.Core.Test/PcapLibTests.cs
+5
-16
AssemblyInfo.cs
...otNet/src/PcapDotNet.Core.Test/Properties/AssemblyInfo.cs
+0
-1
WiresharkCompareTests.cs
PcapDotNet/src/PcapDotNet.Core.Test/WiresharkCompareTests.cs
+16
-17
ArpTests.cs
PcapDotNet/src/PcapDotNet.Packets.Test/ArpTests.cs
+3
-11
ByteArrayExtensionsTests.cs
...t/src/PcapDotNet.Packets.Test/ByteArrayExtensionsTests.cs
+3
-10
DataLinkTests.cs
PcapDotNet/src/PcapDotNet.Packets.Test/DataLinkTests.cs
+6
-11
DatagramTests.cs
PcapDotNet/src/PcapDotNet.Packets.Test/DatagramTests.cs
+4
-11
EndianitiyTests.cs
PcapDotNet/src/PcapDotNet.Packets.Test/EndianitiyTests.cs
+9
-16
EthernetTests.cs
PcapDotNet/src/PcapDotNet.Packets.Test/EthernetTests.cs
+4
-11
GreTests.cs
PcapDotNet/src/PcapDotNet.Packets.Test/GreTests.cs
+0
-9
IcmpTests.cs
PcapDotNet/src/PcapDotNet.Packets.Test/IcmpTests.cs
+1
-10
IgmpTests.cs
PcapDotNet/src/PcapDotNet.Packets.Test/IgmpTests.cs
+4
-13
IpV4AddressTests.cs
PcapDotNet/src/PcapDotNet.Packets.Test/IpV4AddressTests.cs
+4
-18
IpV4Tests.cs
PcapDotNet/src/PcapDotNet.Packets.Test/IpV4Tests.cs
+9
-17
IpV6AddressTests.cs
PcapDotNet/src/PcapDotNet.Packets.Test/IpV6AddressTests.cs
+0
-8
MacAddressTests.cs
PcapDotNet/src/PcapDotNet.Packets.Test/MacAddressTests.cs
+4
-11
PacketBuilderTests.cs
PcapDotNet/src/PcapDotNet.Packets.Test/PacketBuilderTests.cs
+3
-10
PacketTests.cs
PcapDotNet/src/PcapDotNet.Packets.Test/PacketTests.cs
+4
-11
PayloadLayerTests.cs
PcapDotNet/src/PcapDotNet.Packets.Test/PayloadLayerTests.cs
+3
-10
AssemblyInfo.cs
...et/src/PcapDotNet.Packets.Test/Properties/AssemblyInfo.cs
+0
-1
TcpTests.cs
PcapDotNet/src/PcapDotNet.Packets.Test/TcpTests.cs
+4
-13
UdpTests.cs
PcapDotNet/src/PcapDotNet.Packets.Test/UdpTests.cs
+4
-12
AssemblyInfo.cs
...c/PcapDotNet.Packets.TestUtils/Properties/AssemblyInfo.cs
+0
-1
RandomPacketsExtensions.cs
...c/PcapDotNet.Packets.TestUtils/RandomPacketsExtensions.cs
+5
-12
ArpDatagram.cs
PcapDotNet/src/PcapDotNet.Packets/Arp/ArpDatagram.cs
+0
-1
ArpLayer.cs
PcapDotNet/src/PcapDotNet.Packets/Arp/ArpLayer.cs
+0
-10
ByteArrayExtensions.cs
PcapDotNet/src/PcapDotNet.Packets/ByteArrayExtensions.cs
+0
-2
Datagram.cs
PcapDotNet/src/PcapDotNet.Packets/Datagram.cs
+0
-1
EthernetDatagram.cs
...otNet/src/PcapDotNet.Packets/Ethernet/EthernetDatagram.cs
+10
-13
GreDatagram.cs
PcapDotNet/src/PcapDotNet.Packets/Gre/GreDatagram.cs
+10
-13
GreSourceRouteEntry.cs
PcapDotNet/src/PcapDotNet.Packets/Gre/GreSourceRouteEntry.cs
+1
-1
IOptionUnknownFactory.cs
PcapDotNet/src/PcapDotNet.Packets/IOptionUnknownFactory.cs
+1
-1
IcmpAddressMaskRequestDatagram.cs
...PcapDotNet.Packets/Icmp/IcmpAddressMaskRequestDatagram.cs
+0
-1
IcmpConversionFailedDatagram.cs
...c/PcapDotNet.Packets/Icmp/IcmpConversionFailedDatagram.cs
+0
-1
IcmpDatagram.cs
PcapDotNet/src/PcapDotNet.Packets/Icmp/IcmpDatagram.cs
+0
-2
IcmpDestinationUnreachableDatagram.cs
...DotNet.Packets/Icmp/IcmpDestinationUnreachableDatagram.cs
+0
-1
IcmpEchoDatagram.cs
PcapDotNet/src/PcapDotNet.Packets/Icmp/IcmpEchoDatagram.cs
+0
-2
IcmpEchoReplyDatagram.cs
...tNet/src/PcapDotNet.Packets/Icmp/IcmpEchoReplyDatagram.cs
+0
-2
IcmpInformationReplyDatagram.cs
...c/PcapDotNet.Packets/Icmp/IcmpInformationReplyDatagram.cs
+0
-2
IcmpInformationRequestDatagram.cs
...PcapDotNet.Packets/Icmp/IcmpInformationRequestDatagram.cs
+0
-2
IcmpIpV4HeaderPlus64BitsPayloadDatagram.cs
...t.Packets/Icmp/IcmpIpV4HeaderPlus64BitsPayloadDatagram.cs
+0
-2
IcmpLayer.cs
PcapDotNet/src/PcapDotNet.Packets/Icmp/IcmpLayer.cs
+0
-1
IcmpParameterProblemDatagram.cs
...c/PcapDotNet.Packets/Icmp/IcmpParameterProblemDatagram.cs
+0
-2
IcmpRedirectDatagram.cs
...otNet/src/PcapDotNet.Packets/Icmp/IcmpRedirectDatagram.cs
+0
-1
IcmpRouterAdvertisementLayer.cs
...c/PcapDotNet.Packets/Icmp/IcmpRouterAdvertisementLayer.cs
+0
-8
IcmpRouterSolicitationDatagram.cs
...PcapDotNet.Packets/Icmp/IcmpRouterSolicitationDatagram.cs
+0
-2
IcmpSecurityFailuresDatagram.cs
...c/PcapDotNet.Packets/Icmp/IcmpSecurityFailuresDatagram.cs
+0
-1
IcmpSourceQuenchDatagram.cs
...t/src/PcapDotNet.Packets/Icmp/IcmpSourceQuenchDatagram.cs
+0
-2
IcmpTimestampDatagram.cs
...tNet/src/PcapDotNet.Packets/Icmp/IcmpTimestampDatagram.cs
+0
-1
IcmpTraceRouteDatagram.cs
...Net/src/PcapDotNet.Packets/Icmp/IcmpTraceRouteDatagram.cs
+0
-1
IcmpTraceRouteLayer.cs
...DotNet/src/PcapDotNet.Packets/Icmp/IcmpTraceRouteLayer.cs
+0
-2
IgmpQueryVersion3Layer.cs
...Net/src/PcapDotNet.Packets/Igmp/IgmpQueryVersion3Layer.cs
+0
-1
IgmpReportVersion3Layer.cs
...et/src/PcapDotNet.Packets/Igmp/IgmpReportVersion3Layer.cs
+0
-1
IpV4Datagram.cs
PcapDotNet/src/PcapDotNet.Packets/IpV4/IpV4Datagram.cs
+1
-9
IpV4OptionBasicSecurity.cs
...et/src/PcapDotNet.Packets/IpV4/IpV4OptionBasicSecurity.cs
+0
-1
IpV4OptionComplex.cs
PcapDotNet/src/PcapDotNet.Packets/IpV4/IpV4OptionComplex.cs
+0
-5
IpV4OptionLooseSourceRouting.cs
...c/PcapDotNet.Packets/IpV4/IpV4OptionLooseSourceRouting.cs
+0
-2
IpV4OptionRecordRoute.cs
...tNet/src/PcapDotNet.Packets/IpV4/IpV4OptionRecordRoute.cs
+0
-1
IpV4OptionStrictSourceRouting.cs
.../PcapDotNet.Packets/IpV4/IpV4OptionStrictSourceRouting.cs
+0
-1
IpV4OptionTimestampOnly.cs
...et/src/PcapDotNet.Packets/IpV4/IpV4OptionTimestampOnly.cs
+0
-1
IpV4OptionTimestampType.cs
...et/src/PcapDotNet.Packets/IpV4/IpV4OptionTimestampType.cs
+0
-2
IpV4Options.cs
PcapDotNet/src/PcapDotNet.Packets/IpV4/IpV4Options.cs
+0
-4
Layer.cs
PcapDotNet/src/PcapDotNet.Packets/Layer.cs
+3
-1
OptionComplexFactory.cs
PcapDotNet/src/PcapDotNet.Packets/OptionComplexFactory.cs
+2
-3
OptionComplexFactoryBase.cs
...DotNet/src/PcapDotNet.Packets/OptionComplexFactoryBase.cs
+0
-19
Packet.cs
PcapDotNet/src/PcapDotNet.Packets/Packet.cs
+1
-6
PcapDotNet.Packets.csproj
PcapDotNet/src/PcapDotNet.Packets/PcapDotNet.Packets.csproj
+0
-1
AssemblyInfo.cs
PcapDotNet/src/PcapDotNet.Packets/Properties/AssemblyInfo.cs
+0
-1
TcpDatagram.cs
PcapDotNet/src/PcapDotNet.Packets/Transport/TcpDatagram.cs
+1
-6
TcpOptionSelectiveAcknowledgmentBlock.cs
...ackets/Transport/TcpOptionSelectiveAcknowledgmentBlock.cs
+3
-1
TcpOptions.cs
PcapDotNet/src/PcapDotNet.Packets/Transport/TcpOptions.cs
+0
-1
TransportDatagram.cs
...Net/src/PcapDotNet.Packets/Transport/TransportDatagram.cs
+0
-2
TransportLayer.cs
...DotNet/src/PcapDotNet.Packets/Transport/TransportLayer.cs
+2
-1
UdpDatagram.cs
PcapDotNet/src/PcapDotNet.Packets/Transport/UdpDatagram.cs
+0
-2
MoreAssert.cs
PcapDotNet/src/PcapDotNet.TestUtils/MoreAssert.cs
+0
-1
AssemblyInfo.cs
...otNet/src/PcapDotNet.TestUtils/Properties/AssemblyInfo.cs
+0
-1
RandomExtensions.cs
PcapDotNet/src/PcapDotNet.TestUtils/RandomExtensions.cs
+1
-2
No files found.
PcapDotNet/src/PcapDotNet.5.0.ReSharper
View file @
b0b58a33
...
@@ -5,6 +5,9 @@
...
@@ -5,6 +5,9 @@
<Sharing>SOLUTION</Sharing>
<Sharing>SOLUTION</Sharing>
<CSharp>
<CSharp>
<FormatSettings>
<FormatSettings>
<ANONYMOUS_METHOD_DECLARATION_BRACES>NEXT_LINE</ANONYMOUS_METHOD_DECLARATION_BRACES>
<CASE_BLOCK_BRACES>NEXT_LINE</CASE_BLOCK_BRACES>
<INITIALIZER_BRACES>NEXT_LINE</INITIALIZER_BRACES>
<MODIFIERS_ORDER IsNull="False">
<MODIFIERS_ORDER IsNull="False">
<Item>public</Item>
<Item>public</Item>
<Item>protected</Item>
<Item>protected</Item>
...
@@ -23,6 +26,7 @@
...
@@ -23,6 +26,7 @@
</MODIFIERS_ORDER>
</MODIFIERS_ORDER>
<SPACE_AFTER_TYPECAST_PARENTHESES>False</SPACE_AFTER_TYPECAST_PARENTHESES>
<SPACE_AFTER_TYPECAST_PARENTHESES>False</SPACE_AFTER_TYPECAST_PARENTHESES>
<SPACE_AROUND_MULTIPLICATIVE_OP>True</SPACE_AROUND_MULTIPLICATIVE_OP>
<SPACE_AROUND_MULTIPLICATIVE_OP>True</SPACE_AROUND_MULTIPLICATIVE_OP>
<WRAP_LIMIT>160</WRAP_LIMIT>
</FormatSettings>
</FormatSettings>
<UsingsSettings />
<UsingsSettings />
<Naming2>
<Naming2>
...
@@ -73,14 +77,14 @@
...
@@ -73,14 +77,14 @@
<PredefinedRule Inspect="True" Prefix="T" Suffix="" Style="AaBb" ElementKind="TypeParameters" />
<PredefinedRule Inspect="True" Prefix="T" Suffix="" Style="AaBb" ElementKind="TypeParameters" />
<PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="MethodPropertyEvent" />
<PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="MethodPropertyEvent" />
<PredefinedRule Inspect="True" Prefix="" Suffix="" Style="aaBb" ElementKind="Locals" />
<PredefinedRule Inspect="True" Prefix="" Suffix="" Style="aaBb" ElementKind="Locals" />
<PredefinedRule Inspect="True" Prefix="" Suffix="" Style="
a
aBb" ElementKind="LocalConstants" />
<PredefinedRule Inspect="True" Prefix="" Suffix="" Style="
A
aBb" ElementKind="LocalConstants" />
<PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="PublicFields" />
<PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="PublicFields" />
<PredefinedRule Inspect="True" Prefix="_" Suffix="" Style="aaBb" ElementKind="PrivateInstanceFields" />
<PredefinedRule Inspect="True" Prefix="_" Suffix="" Style="aaBb" ElementKind="PrivateInstanceFields" />
<PredefinedRule Inspect="True" Prefix="_" Suffix="" Style="aaBb" ElementKind="PrivateStaticFields" />
<PredefinedRule Inspect="True" Prefix="_" Suffix="" Style="aaBb" ElementKind="PrivateStaticFields" />
<PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="Constants" />
<PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="Constants" />
<PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="PrivateConstants" />
<PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="PrivateConstants" />
<PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="StaticReadonly" />
<PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="StaticReadonly" />
<PredefinedRule Inspect="True" Prefix="
" Suffix="" Style="A
aBb" ElementKind="PrivateStaticReadonly" />
<PredefinedRule Inspect="True" Prefix="
_" Suffix="" Style="a
aBb" ElementKind="PrivateStaticReadonly" />
<PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="EnumMember" />
<PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="EnumMember" />
<PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="Other" />
<PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="Other" />
</Naming2>
</Naming2>
...
...
PcapDotNet/src/PcapDotNet.Base.Test/FuncExtensionsTest.cs
View file @
b0b58a33
...
@@ -9,17 +9,10 @@ namespace PcapDotNet.Base.Test
...
@@ -9,17 +9,10 @@ namespace PcapDotNet.Base.Test
[
TestClass
]
[
TestClass
]
public
class
FuncExtensionsTest
public
class
FuncExtensionsTest
{
{
public
FuncExtensionsTest
()
{
//
// TODO: Add constructor logic here
//
}
/// <summary>
/// <summary>
///Gets or sets the test context which provides
///
Gets or sets the test context which provides
///information about and functionality for the current test run.
///
information about and functionality for the current test run.
///</summary>
///
</summary>
public
TestContext
TestContext
{
get
;
set
;
}
public
TestContext
TestContext
{
get
;
set
;
}
#
region
Additional
test
attributes
#
region
Additional
test
attributes
...
...
PcapDotNet/src/PcapDotNet.Base.Test/IEnumerableExtensionsTests.cs
View file @
b0b58a33
using
System
;
using
System
;
using
System.Linq
;
using
System.Linq
;
using
Microsoft.VisualStudio.TestTools.UnitTesting
;
using
Microsoft.VisualStudio.TestTools.UnitTesting
;
using
PcapDotNet.TestUtils
;
namespace
PcapDotNet.Base.Test
namespace
PcapDotNet.Base.Test
{
{
...
@@ -9,20 +8,15 @@ namespace PcapDotNet.Base.Test
...
@@ -9,20 +8,15 @@ namespace PcapDotNet.Base.Test
/// Summary description for IEnumerableExtensionsTests
/// Summary description for IEnumerableExtensionsTests
/// </summary>
/// </summary>
[
TestClass
]
[
TestClass
]
// ReSharper disable InconsistentNaming
public
class
IEnumerableExtensionsTests
public
class
IEnumerableExtensionsTests
// ReSharper restore InconsistentNaming
{
{
public
IEnumerableExtensionsTests
()
{
//
// TODO: Add constructor logic here
//
}
/// <summary>
/// <summary>
///Gets or sets the test context which provides
///
Gets or sets the test context which provides
///information about and functionality for the current test run.
///
information about and functionality for the current test run.
///</summary>
///
</summary>
public
TestContext
TestContext
{
get
;
set
;
}
public
TestContext
TestContext
{
get
;
set
;
}
#
region
Additional
test
attributes
#
region
Additional
test
attributes
//
//
...
...
PcapDotNet/src/PcapDotNet.Base.Test/MemberInfoExtensionsTests.cs
View file @
b0b58a33
...
@@ -9,17 +9,10 @@ namespace PcapDotNet.Base.Test
...
@@ -9,17 +9,10 @@ namespace PcapDotNet.Base.Test
[
TestClass
]
[
TestClass
]
public
class
MemberInfoExtensionsTests
public
class
MemberInfoExtensionsTests
{
{
public
MemberInfoExtensionsTests
()
{
//
// TODO: Add constructor logic here
//
}
/// <summary>
/// <summary>
///Gets or sets the test context which provides
///
Gets or sets the test context which provides
///information about and functionality for the current test run.
///
information about and functionality for the current test run.
///</summary>
///
</summary>
public
TestContext
TestContext
{
get
;
set
;
}
public
TestContext
TestContext
{
get
;
set
;
}
#
region
Additional
test
attributes
#
region
Additional
test
attributes
...
...
PcapDotNet/src/PcapDotNet.Base.Test/PropertyInfoExtensionsTests.cs
View file @
b0b58a33
...
@@ -9,17 +9,10 @@ namespace PcapDotNet.Base.Test
...
@@ -9,17 +9,10 @@ namespace PcapDotNet.Base.Test
[
TestClass
]
[
TestClass
]
public
class
PropertyInfoExtensionsTests
public
class
PropertyInfoExtensionsTests
{
{
public
PropertyInfoExtensionsTests
()
{
//
// TODO: Add constructor logic here
//
}
/// <summary>
/// <summary>
///Gets or sets the test context which provides
///
Gets or sets the test context which provides
///information about and functionality for the current test run.
///
information about and functionality for the current test run.
///</summary>
///
</summary>
public
TestContext
TestContext
{
get
;
set
;
}
public
TestContext
TestContext
{
get
;
set
;
}
#
region
Additional
test
attributes
#
region
Additional
test
attributes
...
...
PcapDotNet/src/PcapDotNet.Base.Test/UInt128Tests.cs
View file @
b0b58a33
...
@@ -11,13 +11,6 @@ namespace PcapDotNet.Base.Test
...
@@ -11,13 +11,6 @@ namespace PcapDotNet.Base.Test
[
TestClass
]
[
TestClass
]
public
class
UInt128Tests
public
class
UInt128Tests
{
{
public
UInt128Tests
()
{
//
// TODO: Add constructor logic here
//
}
/// <summary>
/// <summary>
/// Gets or sets the test context which provides
/// Gets or sets the test context which provides
/// information about and functionality for the current test run.
/// information about and functionality for the current test run.
...
@@ -58,8 +51,10 @@ namespace PcapDotNet.Base.Test
...
@@ -58,8 +51,10 @@ namespace PcapDotNet.Base.Test
Assert
.
AreNotEqual
(
value
,
string
.
Empty
);
Assert
.
AreNotEqual
(
value
,
string
.
Empty
);
Assert
.
AreNotEqual
(
value
,
UInt128
.
MaxValue
);
Assert
.
AreNotEqual
(
value
,
UInt128
.
MaxValue
);
Assert
.
AreNotEqual
(
value
,
UInt128
.
Zero
);
Assert
.
AreNotEqual
(
value
,
UInt128
.
Zero
);
// ReSharper disable EqualExpressionComparison
Assert
.
IsTrue
(
value
==
value
);
Assert
.
IsTrue
(
value
==
value
);
Assert
.
IsFalse
(
value
!=
value
);
Assert
.
IsFalse
(
value
!=
value
);
// ReSharper restore EqualExpressionComparison
Assert
.
IsNotNull
(
value
.
GetHashCode
());
Assert
.
IsNotNull
(
value
.
GetHashCode
());
Assert
.
AreEqual
(
value
,
UInt128
.
Parse
(
value
.
ToString
(
"X32"
),
NumberStyles
.
HexNumber
,
CultureInfo
.
InvariantCulture
));
Assert
.
AreEqual
(
value
,
UInt128
.
Parse
(
value
.
ToString
(
"X32"
),
NumberStyles
.
HexNumber
,
CultureInfo
.
InvariantCulture
));
Assert
.
AreEqual
(
value
>>
64
,
UInt128
.
Parse
(((
ulong
)(
value
>>
64
)).
ToString
(
"X16"
),
NumberStyles
.
HexNumber
,
CultureInfo
.
InvariantCulture
));
Assert
.
AreEqual
(
value
>>
64
,
UInt128
.
Parse
(((
ulong
)(
value
>>
64
)).
ToString
(
"X16"
),
NumberStyles
.
HexNumber
,
CultureInfo
.
InvariantCulture
));
...
@@ -69,13 +64,13 @@ namespace PcapDotNet.Base.Test
...
@@ -69,13 +64,13 @@ namespace PcapDotNet.Base.Test
[
TestMethod
]
[
TestMethod
]
public
void
ShiftRightTest
()
public
void
ShiftRightTest
()
{
{
const
string
v
alueString
=
"0123456789ABCDEFFEDCBA9876543210"
;
const
string
V
alueString
=
"0123456789ABCDEFFEDCBA9876543210"
;
UInt128
value
=
UInt128
.
Parse
(
v
alueString
,
NumberStyles
.
HexNumber
,
CultureInfo
.
InvariantCulture
);
UInt128
value
=
UInt128
.
Parse
(
V
alueString
,
NumberStyles
.
HexNumber
,
CultureInfo
.
InvariantCulture
);
Assert
.
AreEqual
(
UInt128
.
Parse
(
v
alueString
,
NumberStyles
.
HexNumber
,
CultureInfo
.
InvariantCulture
),
value
);
Assert
.
AreEqual
(
UInt128
.
Parse
(
V
alueString
,
NumberStyles
.
HexNumber
,
CultureInfo
.
InvariantCulture
),
value
);
for
(
int
i
=
0
;
i
<=
124
;
i
+=
4
)
for
(
int
i
=
0
;
i
<=
124
;
i
+=
4
)
{
{
string
expectedValueString
=
new
string
(
'0'
,
i
/
4
)
+
valueString
.
Substring
(
0
,
v
alueString
.
Length
-
i
/
4
);
string
expectedValueString
=
new
string
(
'0'
,
i
/
4
)
+
ValueString
.
Substring
(
0
,
V
alueString
.
Length
-
i
/
4
);
UInt128
expectedValue
=
UInt128
.
Parse
(
expectedValueString
,
NumberStyles
.
HexNumber
,
CultureInfo
.
InvariantCulture
);
UInt128
expectedValue
=
UInt128
.
Parse
(
expectedValueString
,
NumberStyles
.
HexNumber
,
CultureInfo
.
InvariantCulture
);
Assert
.
AreEqual
(
expectedValue
,
value
>>
i
,
i
.
ToString
());
Assert
.
AreEqual
(
expectedValue
,
value
>>
i
,
i
.
ToString
());
Assert
.
AreEqual
(
expectedValue
,
value
>>
(
i
/
2
)
>>
(
i
/
2
),
i
.
ToString
());
Assert
.
AreEqual
(
expectedValue
,
value
>>
(
i
/
2
)
>>
(
i
/
2
),
i
.
ToString
());
...
@@ -86,15 +81,15 @@ namespace PcapDotNet.Base.Test
...
@@ -86,15 +81,15 @@ namespace PcapDotNet.Base.Test
[
TestMethod
]
[
TestMethod
]
public
void
BitwiseAndTest
()
public
void
BitwiseAndTest
()
{
{
const
string
v
alueString
=
"0123456789ABCDEFFEDCBA9876543210"
;
const
string
V
alueString
=
"0123456789ABCDEFFEDCBA9876543210"
;
UInt128
value
=
UInt128
.
Parse
(
v
alueString
,
NumberStyles
.
HexNumber
,
CultureInfo
.
InvariantCulture
);
UInt128
value
=
UInt128
.
Parse
(
V
alueString
,
NumberStyles
.
HexNumber
,
CultureInfo
.
InvariantCulture
);
Assert
.
AreEqual
(
UInt128
.
Parse
(
v
alueString
,
NumberStyles
.
HexNumber
,
CultureInfo
.
InvariantCulture
),
value
);
Assert
.
AreEqual
(
UInt128
.
Parse
(
V
alueString
,
NumberStyles
.
HexNumber
,
CultureInfo
.
InvariantCulture
),
value
);
for
(
int
i
=
0
;
i
<=
32
;
++
i
)
for
(
int
i
=
0
;
i
<=
32
;
++
i
)
{
{
string
andValueString
=
new
string
(
'0'
,
i
)
+
new
string
(
'F'
,
v
alueString
.
Length
-
i
);
string
andValueString
=
new
string
(
'0'
,
i
)
+
new
string
(
'F'
,
V
alueString
.
Length
-
i
);
UInt128
andValue
=
UInt128
.
Parse
(
andValueString
,
NumberStyles
.
HexNumber
,
CultureInfo
.
InvariantCulture
);
UInt128
andValue
=
UInt128
.
Parse
(
andValueString
,
NumberStyles
.
HexNumber
,
CultureInfo
.
InvariantCulture
);
string
expectedValueString
=
new
string
(
'0'
,
i
)
+
valueString
.
Substring
(
i
,
v
alueString
.
Length
-
i
);
string
expectedValueString
=
new
string
(
'0'
,
i
)
+
ValueString
.
Substring
(
i
,
V
alueString
.
Length
-
i
);
UInt128
expectedValue
=
UInt128
.
Parse
(
expectedValueString
,
NumberStyles
.
HexNumber
,
CultureInfo
.
InvariantCulture
);
UInt128
expectedValue
=
UInt128
.
Parse
(
expectedValueString
,
NumberStyles
.
HexNumber
,
CultureInfo
.
InvariantCulture
);
UInt128
actualValue
=
value
&
andValue
;
UInt128
actualValue
=
value
&
andValue
;
Assert
.
AreEqual
(
expectedValue
,
actualValue
,
i
.
ToString
());
Assert
.
AreEqual
(
expectedValue
,
actualValue
,
i
.
ToString
());
...
@@ -112,9 +107,9 @@ namespace PcapDotNet.Base.Test
...
@@ -112,9 +107,9 @@ namespace PcapDotNet.Base.Test
[
TestMethod
]
[
TestMethod
]
public
void
ToStringTest
()
public
void
ToStringTest
()
{
{
const
string
v
alueString
=
"0123456789ABCDEFFEDCBA9876543210"
;
const
string
V
alueString
=
"0123456789ABCDEFFEDCBA9876543210"
;
UInt128
value
=
UInt128
.
Parse
(
v
alueString
,
NumberStyles
.
HexNumber
,
CultureInfo
.
InvariantCulture
);
UInt128
value
=
UInt128
.
Parse
(
V
alueString
,
NumberStyles
.
HexNumber
,
CultureInfo
.
InvariantCulture
);
Assert
.
AreEqual
(
v
alueString
,
value
.
ToString
(
"X32"
));
Assert
.
AreEqual
(
V
alueString
,
value
.
ToString
(
"X32"
));
}
}
}
}
}
}
\ No newline at end of file
PcapDotNet/src/PcapDotNet.Base.Test/UInt24Tests.cs
View file @
b0b58a33
using
System
;
using
System
;
using
System.Globalization
;
using
Microsoft.VisualStudio.TestTools.UnitTesting
;
using
Microsoft.VisualStudio.TestTools.UnitTesting
;
using
PcapDotNet.TestUtils
;
using
PcapDotNet.TestUtils
;
...
@@ -11,18 +10,11 @@ namespace PcapDotNet.Base.Test
...
@@ -11,18 +10,11 @@ namespace PcapDotNet.Base.Test
[
TestClass
]
[
TestClass
]
public
class
UInt24Tests
public
class
UInt24Tests
{
{
public
UInt24Tests
()
{
//
// TODO: Add constructor logic here
//
}
/// <summary>
/// <summary>
///Gets or sets the test context which provides
///
Gets or sets the test context which provides
///information about and functionality for the current test run.
///
information about and functionality for the current test run.
///</summary>
///
</summary>
public
TestContext
TestContext
{
get
;
set
;
}
public
TestContext
TestContext
{
get
;
set
;
}
#
region
Additional
test
attributes
#
region
Additional
test
attributes
//
//
...
@@ -55,11 +47,13 @@ namespace PcapDotNet.Base.Test
...
@@ -55,11 +47,13 @@ namespace PcapDotNet.Base.Test
UInt24
value
=
random
.
NextUInt24
();
UInt24
value
=
random
.
NextUInt24
();
Assert
.
AreEqual
(
value
,
value
);
Assert
.
AreEqual
(
value
,
value
);
// ReSharper disable EqualExpressionComparison
Assert
.
IsTrue
(
value
==
value
);
Assert
.
IsTrue
(
value
==
value
);
Assert
.
IsFalse
(
value
!=
value
);
Assert
.
IsFalse
(
value
!=
value
);
// ReSharper restore EqualExpressionComparison
Assert
.
AreNotEqual
(
value
,
"string"
);
Assert
.
AreNotEqual
(
value
,
"string"
);
Assert
.
AreNotEqual
(
value
,
(
UInt24
)(((
value
&
0x00FFFF
)
+
1
)|
value
&
0xFF0000
));
Assert
.
AreNotEqual
(
value
,
(
UInt24
)(((
value
&
0x00FFFF
)
+
1
)
|
value
&
0xFF0000
));
Assert
.
AreNotEqual
(
value
,
(
UInt24
)((
value
&
0x00FFFF
)|
((
value
&
0xFF0000
)
+
0x010000
)));
Assert
.
AreNotEqual
(
value
,
(
UInt24
)((
value
&
0x00FFFF
)
|
((
value
&
0xFF0000
)
+
0x010000
)));
Assert
.
IsNotNull
(
value
.
GetHashCode
());
Assert
.
IsNotNull
(
value
.
GetHashCode
());
Assert
.
AreEqual
(((
int
)
value
).
ToString
(),
value
.
ToString
());
Assert
.
AreEqual
(((
int
)
value
).
ToString
(),
value
.
ToString
());
}
}
...
...
PcapDotNet/src/PcapDotNet.Base.Test/UInt48Tests.cs
View file @
b0b58a33
using
System
;
using
System
;
using
System.Globalization
;
using
System.Globalization
;
using
System.Text
;
using
System.Collections.Generic
;
using
System.Linq
;
using
Microsoft.VisualStudio.TestTools.UnitTesting
;
using
Microsoft.VisualStudio.TestTools.UnitTesting
;
using
PcapDotNet.TestUtils
;
using
PcapDotNet.TestUtils
;
...
@@ -14,18 +11,11 @@ namespace PcapDotNet.Base.Test
...
@@ -14,18 +11,11 @@ namespace PcapDotNet.Base.Test
[
TestClass
]
[
TestClass
]
public
class
UInt48Tests
public
class
UInt48Tests
{
{
public
UInt48Tests
()
{
//
// TODO: Add constructor logic here
//
}
/// <summary>
/// <summary>
///Gets or sets the test context which provides
///
Gets or sets the test context which provides
///information about and functionality for the current test run.
///
information about and functionality for the current test run.
///</summary>
///
</summary>
public
TestContext
TestContext
{
get
;
set
;
}
public
TestContext
TestContext
{
get
;
set
;
}
#
region
Additional
test
attributes
#
region
Additional
test
attributes
//
//
...
@@ -97,8 +87,10 @@ namespace PcapDotNet.Base.Test
...
@@ -97,8 +87,10 @@ namespace PcapDotNet.Base.Test
Assert
.
AreEqual
(
value
,
value
);
Assert
.
AreEqual
(
value
,
value
);
Assert
.
AreNotEqual
(
value
,
"1"
);
Assert
.
AreNotEqual
(
value
,
"1"
);
// ReSharper disable EqualExpressionComparison
Assert
.
IsTrue
(
value
==
value
);
Assert
.
IsTrue
(
value
==
value
);
Assert
.
IsFalse
(
value
!=
value
);
Assert
.
IsFalse
(
value
!=
value
);
// ReSharper restore EqualExpressionComparison
Assert
.
IsNotNull
(
value
.
GetHashCode
());
Assert
.
IsNotNull
(
value
.
GetHashCode
());
if
(
value
<
uint
.
MaxValue
)
if
(
value
<
uint
.
MaxValue
)
...
...
PcapDotNet/src/PcapDotNet.Base/FuncExtensions.cs
View file @
b0b58a33
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.ObjectModel
;
namespace
PcapDotNet.Base
namespace
PcapDotNet.Base
{
{
...
...
PcapDotNet/src/PcapDotNet.Base/IEnumerableExtensions.cs
View file @
b0b58a33
using
System
;
using
System
;
using
System.Collections.ObjectModel
;
using
System.Globalization
;
using
System.Globalization
;
using
System.Linq
;
using
System.Linq
;
using
System.Collections
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Text
;
using
System.Text
;
...
@@ -11,7 +9,9 @@ namespace PcapDotNet.Base
...
@@ -11,7 +9,9 @@ namespace PcapDotNet.Base
/// <summary>
/// <summary>
/// Extension methods for IEnumerable of type T.
/// Extension methods for IEnumerable of type T.
/// </summary>
/// </summary>
// ReSharper disable InconsistentNaming
public
static
class
IEnumerableExtensions
public
static
class
IEnumerableExtensions
// ReSharper restore InconsistentNaming
{
{
/// <summary>
/// <summary>
/// True iff the sequence has no elements.
/// True iff the sequence has no elements.
...
...
PcapDotNet/src/PcapDotNet.Base/IListExtensions.cs
View file @
b0b58a33
...
@@ -6,7 +6,9 @@ namespace PcapDotNet.Base
...
@@ -6,7 +6,9 @@ namespace PcapDotNet.Base
/// <summary>
/// <summary>
/// Extension methods for IList of type T.
/// Extension methods for IList of type T.
/// </summary>
/// </summary>
// ReSharper disable InconsistentNaming
public
static
class
IListExtensions
public
static
class
IListExtensions
// ReSharper restore InconsistentNaming
{
{
/// <summary>
/// <summary>
/// Wraps a list with a ReadOnlyCollection.
/// Wraps a list with a ReadOnlyCollection.
...
...
PcapDotNet/src/PcapDotNet.Base/Properties/AssemblyInfo.cs
View file @
b0b58a33
using
System
;
using
System
;
using
System.Reflection
;
using
System.Reflection
;
using
System.Runtime.CompilerServices
;
using
System.Runtime.InteropServices
;
using
System.Runtime.InteropServices
;
// General Information about an assembly is controlled through the following
// General Information about an assembly is controlled through the following
...
...
PcapDotNet/src/PcapDotNet.Base/TimeSpanExtensions.cs
View file @
b0b58a33
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.ObjectModel
;
namespace
PcapDotNet.Base
namespace
PcapDotNet.Base
{
{
...
...
PcapDotNet/src/PcapDotNet.Base/UInt128.cs
View file @
b0b58a33
...
@@ -78,7 +78,7 @@ namespace PcapDotNet.Base
...
@@ -78,7 +78,7 @@ namespace PcapDotNet.Base
throw
new
NotSupportedException
(
"Only "
+
NumberStyles
.
HexNumber
+
" style is supported"
);
throw
new
NotSupportedException
(
"Only "
+
NumberStyles
.
HexNumber
+
" style is supported"
);
ulong
mostSignficantLong
=
0
;
ulong
mostSignficantLong
=
0
;
ulong
leastSignficantLong
=
0
;
ulong
leastSignficantLong
;
if
(
value
.
Length
>
16
)
if
(
value
.
Length
>
16
)
{
{
leastSignficantLong
=
ulong
.
Parse
(
value
.
Substring
(
value
.
Length
-
16
,
16
),
style
,
provider
);
leastSignficantLong
=
ulong
.
Parse
(
value
.
Substring
(
value
.
Length
-
16
,
16
),
style
,
provider
);
...
...
PcapDotNet/src/PcapDotNet.Base/UInt24.cs
View file @
b0b58a33
using
System
;
using
System.Globalization
;
using
System.Collections.Generic
;
using
System.Globalization
;
using
System.Linq
;
using
System.Runtime.InteropServices
;
using
System.Runtime.InteropServices
;
using
System.Text
;
namespace
PcapDotNet.Base
namespace
PcapDotNet.Base
{
{
...
...
PcapDotNet/src/PcapDotNet.Base/UInt48.cs
View file @
b0b58a33
...
@@ -481,7 +481,7 @@ namespace PcapDotNet.Base
...
@@ -481,7 +481,7 @@ namespace PcapDotNet.Base
/// <returns>The 8 bit value converted from the 48 bit value.</returns>
/// <returns>The 8 bit value converted from the 48 bit value.</returns>
public
static
explicit
operator
byte
(
UInt48
value
)
public
static
explicit
operator
byte
(
UInt48
value
)
{
{
return
(
byte
)
value
.
ToByte
();
return
value
.
ToByte
();
}
}
/// <summary>
/// <summary>
...
...
PcapDotNet/src/PcapDotNet.Core.Extensions/LivePacketDeviceExtensions.cs
View file @
b0b58a33
using
System
;
using
System
;
using
System.Linq
;
using
System.Net.NetworkInformation
;
using
System.Net.NetworkInformation
;
using
PcapDotNet.Base
;
using
PcapDotNet.Packets
;
using
PcapDotNet.Packets
;
using
PcapDotNet.Packets.Ethernet
;
using
PcapDotNet.Packets.Ethernet
;
...
@@ -24,13 +24,7 @@ namespace PcapDotNet.Core.Extensions
...
@@ -24,13 +24,7 @@ namespace PcapDotNet.Core.Extensions
if
(
livePacketDevice
==
null
)
if
(
livePacketDevice
==
null
)
throw
new
ArgumentNullException
(
"livePacketDevice"
);
throw
new
ArgumentNullException
(
"livePacketDevice"
);
foreach
(
NetworkInterface
networkInterface
in
NetworkInterface
.
GetAllNetworkInterfaces
())
return
NetworkInterface
.
GetAllNetworkInterfaces
().
FirstOrDefault
(
networkInterface
=>
@"rpcap://\Device\NPF_"
+
networkInterface
.
Id
==
livePacketDevice
.
Name
);
{
if
(
@"rpcap://\Device\NPF_"
+
networkInterface
.
Id
==
livePacketDevice
.
Name
)
return
networkInterface
;
}
return
null
;
}
}
/// <summary>
/// <summary>
...
...
PcapDotNet/src/PcapDotNet.Core.Extensions/PacketCommunicatorExtensions.cs
View file @
b0b58a33
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
PcapDotNet.Packets
;
using
PcapDotNet.Packets
;
namespace
PcapDotNet.Core.Extensions
namespace
PcapDotNet.Core.Extensions
...
...
PcapDotNet/src/PcapDotNet.Core.Extensions/Properties/AssemblyInfo.cs
View file @
b0b58a33
using
System
;
using
System
;
using
System.Reflection
;
using
System.Reflection
;
using
System.Runtime.CompilerServices
;
using
System.Runtime.InteropServices
;
using
System.Runtime.InteropServices
;
// General Information about an assembly is controlled through the following
// General Information about an assembly is controlled through the following
...
...
PcapDotNet/src/PcapDotNet.Core.Test/BerkeleyPacketFilterTests.cs
View file @
b0b58a33
...
@@ -11,13 +11,6 @@ namespace PcapDotNet.Core.Test
...
@@ -11,13 +11,6 @@ namespace PcapDotNet.Core.Test
[
TestClass
]
[
TestClass
]
public
class
BerkeleyPacketFilterTests
public
class
BerkeleyPacketFilterTests
{
{
public
BerkeleyPacketFilterTests
()
{
//
// TODO: Add constructor logic here
//
}
/// <summary>
/// <summary>
/// Gets or sets the test context which provides
/// Gets or sets the test context which provides
/// information about and functionality for the current test run.
/// information about and functionality for the current test run.
...
@@ -99,23 +92,23 @@ namespace PcapDotNet.Core.Test
...
@@ -99,23 +92,23 @@ namespace PcapDotNet.Core.Test
{
{
const
string
SourceMac
=
"11:22:33:44:55:66"
;
const
string
SourceMac
=
"11:22:33:44:55:66"
;
const
string
DestinationMac
=
"77:88:99:AA:BB:CC"
;
const
string
DestinationMac
=
"77:88:99:AA:BB:CC"
;
const
int
s
napshotLength
=
500
;
const
int
S
napshotLength
=
500
;
Random
random
=
new
Random
();
Random
random
=
new
Random
();
using
(
BerkeleyPacketFilter
filter
=
new
BerkeleyPacketFilter
(
"ether src "
+
SourceMac
+
" and ether dst "
+
DestinationMac
,
s
napshotLength
,
DataLinkKind
.
Ethernet
))
using
(
BerkeleyPacketFilter
filter
=
new
BerkeleyPacketFilter
(
"ether src "
+
SourceMac
+
" and ether dst "
+
DestinationMac
,
S
napshotLength
,
DataLinkKind
.
Ethernet
))
{
{
Assert
.
IsTrue
(
filter
.
Test
(
random
.
NextEthernetPacket
(
s
napshotLength
/
2
,
SourceMac
,
DestinationMac
)));
Assert
.
IsTrue
(
filter
.
Test
(
random
.
NextEthernetPacket
(
S
napshotLength
/
2
,
SourceMac
,
DestinationMac
)));
Assert
.
IsTrue
(
filter
.
Test
(
random
.
NextEthernetPacket
(
s
napshotLength
-
1
,
SourceMac
,
DestinationMac
)));
Assert
.
IsTrue
(
filter
.
Test
(
random
.
NextEthernetPacket
(
S
napshotLength
-
1
,
SourceMac
,
DestinationMac
)));
Assert
.
IsTrue
(
filter
.
Test
(
random
.
NextEthernetPacket
(
s
napshotLength
,
SourceMac
,
DestinationMac
)));
Assert
.
IsTrue
(
filter
.
Test
(
random
.
NextEthernetPacket
(
S
napshotLength
,
SourceMac
,
DestinationMac
)));
Assert
.
IsTrue
(
filter
.
Test
(
random
.
NextEthernetPacket
(
s
napshotLength
+
1
,
SourceMac
,
DestinationMac
)));
Assert
.
IsTrue
(
filter
.
Test
(
random
.
NextEthernetPacket
(
S
napshotLength
+
1
,
SourceMac
,
DestinationMac
)));
Assert
.
IsTrue
(
filter
.
Test
(
random
.
NextEthernetPacket
(
s
napshotLength
*
2
,
SourceMac
,
DestinationMac
)));
Assert
.
IsTrue
(
filter
.
Test
(
random
.
NextEthernetPacket
(
S
napshotLength
*
2
,
SourceMac
,
DestinationMac
)));
Assert
.
IsFalse
(
filter
.
Test
(
random
.
NextEthernetPacket
(
s
napshotLength
/
2
,
DestinationMac
,
SourceMac
)));
Assert
.
IsFalse
(
filter
.
Test
(
random
.
NextEthernetPacket
(
S
napshotLength
/
2
,
DestinationMac
,
SourceMac
)));
int
actualSnapshotLength
;
int
actualSnapshotLength
;
Assert
.
IsTrue
(
filter
.
Test
(
out
actualSnapshotLength
,
random
.
NextEthernetPacket
(
s
napshotLength
/
2
,
SourceMac
,
DestinationMac
)));
Assert
.
IsTrue
(
filter
.
Test
(
out
actualSnapshotLength
,
random
.
NextEthernetPacket
(
S
napshotLength
/
2
,
SourceMac
,
DestinationMac
)));
Assert
.
AreEqual
(
s
napshotLength
,
actualSnapshotLength
);
Assert
.
AreEqual
(
S
napshotLength
,
actualSnapshotLength
);
}
}
}
}
...
...
PcapDotNet/src/PcapDotNet.Core.Test/LivePacketDeviceExtensionsTests.cs
View file @
b0b58a33
using
System
;
using
System
;
using
Microsoft.VisualStudio.TestTools.UnitTesting
;
using
Microsoft.VisualStudio.TestTools.UnitTesting
;
using
PcapDotNet.Core.Extensions
;
using
PcapDotNet.Core.Extensions
;
using
PcapDotNet.TestUtils
;
namespace
PcapDotNet.Core.Test
namespace
PcapDotNet.Core.Test
{
{
...
@@ -11,17 +10,10 @@ namespace PcapDotNet.Core.Test
...
@@ -11,17 +10,10 @@ namespace PcapDotNet.Core.Test
[
TestClass
]
[
TestClass
]
public
class
LivePacketDeviceExtensionsTests
public
class
LivePacketDeviceExtensionsTests
{
{
public
LivePacketDeviceExtensionsTests
()
{
//
// TODO: Add constructor logic here
//
}
/// <summary>
/// <summary>
///Gets or sets the test context which provides
///
Gets or sets the test context which provides
///information about and functionality for the current test run.
///
information about and functionality for the current test run.
///</summary>
///
</summary>
public
TestContext
TestContext
{
get
;
set
;
}
public
TestContext
TestContext
{
get
;
set
;
}
#
region
Additional
test
attributes
#
region
Additional
test
attributes
...
...
PcapDotNet/src/PcapDotNet.Core.Test/LivePacketDeviceTests.cs
View file @
b0b58a33
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.IO
;
using
System.Linq
;
using
System.Net
;
using
System.Text.RegularExpressions
;
using
System.Threading
;
using
System.Threading
;
using
PcapDotNet.Core.Extensions
;
using
PcapDotNet.Core.Extensions
;
using
PcapDotNet.Packets
;
using
PcapDotNet.Packets
;
...
@@ -29,10 +25,10 @@ namespace PcapDotNet.Core.Test
...
@@ -29,10 +25,10 @@ namespace PcapDotNet.Core.Test
}
}
/// <summary>
/// <summary>
///Gets or sets the test context which provides
///
Gets or sets the test context which provides
///information about and functionality for the current test run.
///
information about and functionality for the current test run.
///</summary>
///
</summary>
public
TestContext
TestContext
{
get
;
set
;
}
public
TestContext
TestContext
{
get
;
set
;
}
#
region
Additional
test
attributes
#
region
Additional
test
attributes
//
//
...
@@ -152,7 +148,7 @@ namespace PcapDotNet.Core.Test
...
@@ -152,7 +148,7 @@ namespace PcapDotNet.Core.Test
TestReceivePacketsEnumerable
(
NumPacketsToSend
,
NumPacketsToSend
/
2
,
int
.
MaxValue
,
2
,
PacketSize
,
NumPacketsToSend
/
2
,
0
,
0.032
);
TestReceivePacketsEnumerable
(
NumPacketsToSend
,
NumPacketsToSend
/
2
,
int
.
MaxValue
,
2
,
PacketSize
,
NumPacketsToSend
/
2
,
0
,
0.032
);
// Wait for more packets
// Wait for more packets
TestReceivePacketsEnumerable
(
NumPacketsToSend
,
-
1
,
int
.
MaxValue
,
2
,
PacketSize
,
NumPacketsToSend
,
2
,
2.0
29
);
TestReceivePacketsEnumerable
(
NumPacketsToSend
,
-
1
,
int
.
MaxValue
,
2
,
PacketSize
,
NumPacketsToSend
,
2
,
2.0
31
);
TestReceivePacketsEnumerable
(
NumPacketsToSend
,
NumPacketsToSend
+
1
,
int
.
MaxValue
,
2
,
PacketSize
,
NumPacketsToSend
,
2
,
2.13
);
TestReceivePacketsEnumerable
(
NumPacketsToSend
,
NumPacketsToSend
+
1
,
int
.
MaxValue
,
2
,
PacketSize
,
NumPacketsToSend
,
2
,
2.13
);
// Break loop
// Break loop
...
@@ -682,7 +678,7 @@ namespace PcapDotNet.Core.Test
...
@@ -682,7 +678,7 @@ namespace PcapDotNet.Core.Test
private
static
void
TestReceiveSomePackets
(
int
numPacketsToSend
,
int
numPacketsToGet
,
int
numPacketsToBreakLoop
,
int
packetSize
,
bool
nonBlocking
,
private
static
void
TestReceiveSomePackets
(
int
numPacketsToSend
,
int
numPacketsToGet
,
int
numPacketsToBreakLoop
,
int
packetSize
,
bool
nonBlocking
,
PacketCommunicatorReceiveResult
expectedResult
,
int
expectedNumPackets
,
double
expectedMinSeconds
,
double
expectedMaxSeconds
)
PacketCommunicatorReceiveResult
expectedResult
,
int
expectedNumPackets
,
double
expectedMinSeconds
,
double
expectedMaxSeconds
)
{
{
string
T
estDescription
=
"NumPacketsToSend="
+
numPacketsToSend
+
". NumPacketsToGet="
+
numPacketsToGet
+
string
t
estDescription
=
"NumPacketsToSend="
+
numPacketsToSend
+
". NumPacketsToGet="
+
numPacketsToGet
+
". NumPacketsToBreakLoop="
+
numPacketsToBreakLoop
+
". PacketSize="
+
packetSize
+
". NumPacketsToBreakLoop="
+
numPacketsToBreakLoop
+
". PacketSize="
+
packetSize
+
". NonBlocking="
+
nonBlocking
;
". NonBlocking="
+
nonBlocking
;
...
@@ -711,9 +707,9 @@ namespace PcapDotNet.Core.Test
...
@@ -711,9 +707,9 @@ namespace PcapDotNet.Core.Test
DateTime
finishedWaiting
=
DateTime
.
Now
;
DateTime
finishedWaiting
=
DateTime
.
Now
;
Assert
.
AreEqual
(
expectedResult
,
result
);
Assert
.
AreEqual
(
expectedResult
,
result
);
Assert
.
AreEqual
(
expectedNumPackets
,
numPacketsGot
,
"NumPacketsGot. Test: "
+
T
estDescription
);
Assert
.
AreEqual
(
expectedNumPackets
,
numPacketsGot
,
"NumPacketsGot. Test: "
+
t
estDescription
);
Assert
.
AreEqual
(
expectedNumPackets
,
handler
.
NumPacketsHandled
,
"NumPacketsHandled. Test: "
+
T
estDescription
);
Assert
.
AreEqual
(
expectedNumPackets
,
handler
.
NumPacketsHandled
,
"NumPacketsHandled. Test: "
+
t
estDescription
);
MoreAssert
.
IsInRange
(
expectedMinSeconds
,
expectedMaxSeconds
,
(
finishedWaiting
-
startWaiting
).
TotalSeconds
,
T
estDescription
);
MoreAssert
.
IsInRange
(
expectedMinSeconds
,
expectedMaxSeconds
,
(
finishedWaiting
-
startWaiting
).
TotalSeconds
,
t
estDescription
);
}
}
}
}
...
@@ -721,7 +717,7 @@ namespace PcapDotNet.Core.Test
...
@@ -721,7 +717,7 @@ namespace PcapDotNet.Core.Test
PacketCommunicatorReceiveResult
expectedResult
,
int
expectedNumPackets
,
PacketCommunicatorReceiveResult
expectedResult
,
int
expectedNumPackets
,
double
expectedMinSeconds
,
double
expectedMaxSeconds
)
double
expectedMinSeconds
,
double
expectedMaxSeconds
)
{
{
string
T
estDescription
=
"NumPacketsToSend="
+
numPacketsToSend
+
". NumPacketsToWait="
+
numPacketsToWait
+
string
t
estDescription
=
"NumPacketsToSend="
+
numPacketsToSend
+
". NumPacketsToWait="
+
numPacketsToWait
+
". NumPacketsToBreakLoop="
+
numPacketsToBreakLoop
+
". SecondsToWait="
+
". NumPacketsToBreakLoop="
+
numPacketsToBreakLoop
+
". SecondsToWait="
+
secondsToWait
+
". PacketSize="
+
packetSize
;
secondsToWait
+
". PacketSize="
+
packetSize
;
...
@@ -756,7 +752,7 @@ namespace PcapDotNet.Core.Test
...
@@ -756,7 +752,7 @@ namespace PcapDotNet.Core.Test
thread
.
Abort
();
thread
.
Abort
();
DateTime
finishedWaiting
=
DateTime
.
Now
;
DateTime
finishedWaiting
=
DateTime
.
Now
;
Assert
.
AreEqual
(
expectedResult
,
result
,
T
estDescription
);
Assert
.
AreEqual
(
expectedResult
,
result
,
t
estDescription
);
Assert
.
AreEqual
(
expectedNumPackets
,
handler
.
NumPacketsHandled
);
Assert
.
AreEqual
(
expectedNumPackets
,
handler
.
NumPacketsHandled
);
MoreAssert
.
IsInRange
(
expectedMinSeconds
,
expectedMaxSeconds
,
(
finishedWaiting
-
startWaiting
).
TotalSeconds
);
MoreAssert
.
IsInRange
(
expectedMinSeconds
,
expectedMaxSeconds
,
(
finishedWaiting
-
startWaiting
).
TotalSeconds
);
}
}
...
@@ -765,7 +761,7 @@ namespace PcapDotNet.Core.Test
...
@@ -765,7 +761,7 @@ namespace PcapDotNet.Core.Test
private
static
void
TestReceivePacketsEnumerable
(
int
numPacketsToSend
,
int
numPacketsToWait
,
int
numPacketsToBreakLoop
,
double
secondsToWait
,
private
static
void
TestReceivePacketsEnumerable
(
int
numPacketsToSend
,
int
numPacketsToWait
,
int
numPacketsToBreakLoop
,
double
secondsToWait
,
int
packetSize
,
int
expectedNumPackets
,
double
expectedMinSeconds
,
double
expectedMaxSeconds
)
int
packetSize
,
int
expectedNumPackets
,
double
expectedMinSeconds
,
double
expectedMaxSeconds
)
{
{
string
T
estDescription
=
"NumPacketsToSend="
+
numPacketsToSend
+
". NumPacketsToWait="
+
numPacketsToWait
+
string
t
estDescription
=
"NumPacketsToSend="
+
numPacketsToSend
+
". NumPacketsToWait="
+
numPacketsToWait
+
". NumPacketsToBreakLoop="
+
numPacketsToBreakLoop
+
". SecondsToWait="
+
". NumPacketsToBreakLoop="
+
numPacketsToBreakLoop
+
". SecondsToWait="
+
secondsToWait
+
". PacketSize="
+
packetSize
;
secondsToWait
+
". PacketSize="
+
packetSize
;
...
@@ -806,8 +802,8 @@ namespace PcapDotNet.Core.Test
...
@@ -806,8 +802,8 @@ namespace PcapDotNet.Core.Test
thread
.
Abort
();
thread
.
Abort
();
DateTime
finishedWaiting
=
DateTime
.
Now
;
DateTime
finishedWaiting
=
DateTime
.
Now
;
Assert
.
AreEqual
(
expectedNumPackets
,
actualPacketsReceived
,
T
estDescription
);
Assert
.
AreEqual
(
expectedNumPackets
,
actualPacketsReceived
,
t
estDescription
);
MoreAssert
.
IsInRange
(
expectedMinSeconds
,
expectedMaxSeconds
,
(
finishedWaiting
-
startWaiting
).
TotalSeconds
,
T
estDescription
);
MoreAssert
.
IsInRange
(
expectedMinSeconds
,
expectedMaxSeconds
,
(
finishedWaiting
-
startWaiting
).
TotalSeconds
,
t
estDescription
);
}
}
}
}
...
@@ -874,6 +870,6 @@ namespace PcapDotNet.Core.Test
...
@@ -874,6 +870,6 @@ namespace PcapDotNet.Core.Test
}
}
}
}
private
static
Random
_random
=
new
Random
();
private
static
readonly
Random
_random
=
new
Random
();
}
}
}
}
\ No newline at end of file
PcapDotNet/src/PcapDotNet.Core.Test/MarshalingServicesTests.cs
View file @
b0b58a33
...
@@ -8,13 +8,6 @@ namespace PcapDotNet.Core.Test
...
@@ -8,13 +8,6 @@ namespace PcapDotNet.Core.Test
[
TestClass
]
[
TestClass
]
public
class
MarshalingServicesTests
public
class
MarshalingServicesTests
{
{
public
MarshalingServicesTests
()
{
//
// TODO: Add constructor logic here
//
}
/// <summary>
/// <summary>
/// Gets or sets the test context which provides
/// Gets or sets the test context which provides
/// information about and functionality for the current test run.
/// information about and functionality for the current test run.
...
...
PcapDotNet/src/PcapDotNet.Core.Test/MoreIpV4Option.cs
View file @
b0b58a33
...
@@ -2,7 +2,6 @@ using System;
...
@@ -2,7 +2,6 @@ using System;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Linq
;
using
System.Text
;
using
System.Text
;
using
Microsoft.VisualStudio.TestTools.UnitTesting
;
using
PcapDotNet.Base
;
using
PcapDotNet.Base
;
using
PcapDotNet.Packets.IpV4
;
using
PcapDotNet.Packets.IpV4
;
...
@@ -52,10 +51,7 @@ namespace PcapDotNet.Core.Test
...
@@ -52,10 +51,7 @@ namespace PcapDotNet.Core.Test
StringBuilder
quickStartWireshark
=
new
StringBuilder
(
"Quick-Start: "
);
StringBuilder
quickStartWireshark
=
new
StringBuilder
(
"Quick-Start: "
);
if
(
quickStart
.
Function
==
IpV4OptionQuickStartFunction
.
RateRequest
)
quickStartWireshark
.
Append
(
quickStart
.
Function
==
IpV4OptionQuickStartFunction
.
RateRequest
?
"Rate request"
:
"Rate report"
);
quickStartWireshark
.
Append
(
"Rate request"
);
else
quickStartWireshark
.
Append
(
"Rate report"
);
quickStartWireshark
.
Append
(
", "
);
quickStartWireshark
.
Append
(
", "
);
...
@@ -146,7 +142,9 @@ namespace PcapDotNet.Core.Test
...
@@ -146,7 +142,9 @@ namespace PcapDotNet.Core.Test
}
}
break
;
break
;
// ReSharper disable RedundantCaseLabel
case
IpV4OptionType
.
BasicSecurity
:
case
IpV4OptionType
.
BasicSecurity
:
// ReSharper restore RedundantCaseLabel
default
:
default
:
if
(
typeof
(
IpV4OptionType
).
GetEnumValues
<
IpV4OptionType
>().
Contains
(
option
.
OptionType
))
if
(
typeof
(
IpV4OptionType
).
GetEnumValues
<
IpV4OptionType
>().
Contains
(
option
.
OptionType
))
throw
new
InvalidOperationException
(
"Invalid option type "
+
option
.
OptionType
);
throw
new
InvalidOperationException
(
"Invalid option type "
+
option
.
OptionType
);
...
...
PcapDotNet/src/PcapDotNet.Core.Test/MoreTcpOption.cs
View file @
b0b58a33
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Linq
;
using
System.Text
;
using
PcapDotNet.Base
;
using
PcapDotNet.Base
;
using
PcapDotNet.Packets.Transport
;
using
PcapDotNet.Packets.Transport
;
...
...
PcapDotNet/src/PcapDotNet.Core.Test/OfflinePacketDeviceTests.cs
View file @
b0b58a33
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.IO
;
using
System.IO
;
using
System.Linq
;
using
System.Threading
;
using
System.Threading
;
using
Microsoft.VisualStudio.TestTools.UnitTesting
;
using
Microsoft.VisualStudio.TestTools.UnitTesting
;
using
PcapDotNet.Packets
;
using
PcapDotNet.Packets
;
...
@@ -16,18 +14,11 @@ namespace PcapDotNet.Core.Test
...
@@ -16,18 +14,11 @@ namespace PcapDotNet.Core.Test
[
TestClass
]
[
TestClass
]
public
class
OfflinePacketDeviceTests
public
class
OfflinePacketDeviceTests
{
{
public
OfflinePacketDeviceTests
()
{
//
// TODO: Add constructor logic here
//
}
/// <summary>
/// <summary>
///Gets or sets the test context which provides
///
Gets or sets the test context which provides
///information about and functionality for the current test run.
///
information about and functionality for the current test run.
///</summary>
///
</summary>
public
TestContext
TestContext
{
get
;
set
;
}
public
TestContext
TestContext
{
get
;
set
;
}
#
region
Additional
test
attributes
#
region
Additional
test
attributes
//
//
...
@@ -156,7 +147,7 @@ namespace PcapDotNet.Core.Test
...
@@ -156,7 +147,7 @@ namespace PcapDotNet.Core.Test
[
ExpectedException
(
typeof
(
InvalidOperationException
))]
[
ExpectedException
(
typeof
(
InvalidOperationException
))]
public
void
OpenInvalidFileTest
()
public
void
OpenInvalidFileTest
()
{
{
using
(
PacketCommunicator
communicator
=
new
OfflinePacketDevice
(
"myinvalidfile"
).
Open
())
using
(
new
OfflinePacketDevice
(
"myinvalidfile"
).
Open
())
{
{
}
}
}
}
...
@@ -256,7 +247,7 @@ namespace PcapDotNet.Core.Test
...
@@ -256,7 +247,7 @@ namespace PcapDotNet.Core.Test
PacketCommunicatorReceiveResult
expectedResult
,
int
expectedNumPackets
,
PacketCommunicatorReceiveResult
expectedResult
,
int
expectedNumPackets
,
double
expectedMinSeconds
,
double
expectedMaxSeconds
)
double
expectedMinSeconds
,
double
expectedMaxSeconds
)
{
{
string
T
estDescription
=
"NumPacketsToSend="
+
numPacketsToSend
+
". NumPacketsToGet="
+
numPacketsToGet
+
string
t
estDescription
=
"NumPacketsToSend="
+
numPacketsToSend
+
". NumPacketsToGet="
+
numPacketsToGet
+
". NumPacketsToBreakLoop="
+
numPacketsToBreakLoop
;
". NumPacketsToBreakLoop="
+
numPacketsToBreakLoop
;
const
string
SourceMac
=
"11:22:33:44:55:66"
;
const
string
SourceMac
=
"11:22:33:44:55:66"
;
...
@@ -275,8 +266,8 @@ namespace PcapDotNet.Core.Test
...
@@ -275,8 +266,8 @@ namespace PcapDotNet.Core.Test
int
numPacketsGot
;
int
numPacketsGot
;
PacketCommunicatorReceiveResult
result
=
communicator
.
ReceiveSomePackets
(
out
numPacketsGot
,
numPacketsToGet
,
handler
.
Handle
);
PacketCommunicatorReceiveResult
result
=
communicator
.
ReceiveSomePackets
(
out
numPacketsGot
,
numPacketsToGet
,
handler
.
Handle
);
Assert
.
AreEqual
(
expectedResult
,
result
);
Assert
.
AreEqual
(
expectedResult
,
result
);
Assert
.
AreEqual
(
expectedNumPackets
,
numPacketsGot
,
"NumPacketsGot. Test: "
+
T
estDescription
);
Assert
.
AreEqual
(
expectedNumPackets
,
numPacketsGot
,
"NumPacketsGot. Test: "
+
t
estDescription
);
Assert
.
AreEqual
(
expectedNumPackets
,
handler
.
NumPacketsHandled
,
"NumPacketsHandled. Test: "
+
T
estDescription
);
Assert
.
AreEqual
(
expectedNumPackets
,
handler
.
NumPacketsHandled
,
"NumPacketsHandled. Test: "
+
t
estDescription
);
}
}
}
}
...
@@ -284,7 +275,7 @@ namespace PcapDotNet.Core.Test
...
@@ -284,7 +275,7 @@ namespace PcapDotNet.Core.Test
PacketCommunicatorReceiveResult
expectedResult
,
int
expectedNumPackets
,
PacketCommunicatorReceiveResult
expectedResult
,
int
expectedNumPackets
,
double
expectedMinSeconds
,
double
expectedMaxSeconds
)
double
expectedMinSeconds
,
double
expectedMaxSeconds
)
{
{
string
T
estDescription
=
"NumPacketsToSend="
+
numPacketsToSend
+
". NumPacketsToGet="
+
numPacketsToGet
+
string
t
estDescription
=
"NumPacketsToSend="
+
numPacketsToSend
+
". NumPacketsToGet="
+
numPacketsToGet
+
". NumPacketsToBreakLoop="
+
numPacketsToBreakLoop
;
". NumPacketsToBreakLoop="
+
numPacketsToBreakLoop
;
const
string
SourceMac
=
"11:22:33:44:55:66"
;
const
string
SourceMac
=
"11:22:33:44:55:66"
;
...
@@ -312,7 +303,7 @@ namespace PcapDotNet.Core.Test
...
@@ -312,7 +303,7 @@ namespace PcapDotNet.Core.Test
thread
.
Abort
();
thread
.
Abort
();
}
}
Assert
.
AreEqual
(
expectedResult
,
result
,
T
estDescription
);
Assert
.
AreEqual
(
expectedResult
,
result
,
t
estDescription
);
Assert
.
AreEqual
(
expectedNumPackets
,
handler
.
NumPacketsHandled
);
Assert
.
AreEqual
(
expectedNumPackets
,
handler
.
NumPacketsHandled
);
}
}
}
}
...
@@ -383,6 +374,6 @@ namespace PcapDotNet.Core.Test
...
@@ -383,6 +374,6 @@ namespace PcapDotNet.Core.Test
}
}
}
}
private
static
Random
_random
=
new
Random
();
private
static
readonly
Random
_random
=
new
Random
();
}
}
}
}
\ No newline at end of file
PcapDotNet/src/PcapDotNet.Core.Test/PacketDumpFileTests.cs
View file @
b0b58a33
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.IO
;
using
System.IO
;
using
Microsoft.VisualStudio.TestTools.UnitTesting
;
using
Microsoft.VisualStudio.TestTools.UnitTesting
;
using
PcapDotNet.Packets
;
using
PcapDotNet.Packets
;
using
PcapDotNet.Packets.Ethernet
;
using
PcapDotNet.Packets.Ethernet
;
using
PcapDotNet.Packets.Icmp
;
using
PcapDotNet.Packets.IpV4
;
namespace
PcapDotNet.Core.Test
namespace
PcapDotNet.Core.Test
{
{
...
@@ -15,18 +12,11 @@ namespace PcapDotNet.Core.Test
...
@@ -15,18 +12,11 @@ namespace PcapDotNet.Core.Test
[
TestClass
]
[
TestClass
]
public
class
PacketDumpFileTests
public
class
PacketDumpFileTests
{
{
public
PacketDumpFileTests
()
{
//
// TODO: Add constructor logic here
//
}
/// <summary>
/// <summary>
///Gets or sets the test context which provides
///
Gets or sets the test context which provides
///information about and functionality for the current test run.
///
information about and functionality for the current test run.
///</summary>
///
</summary>
public
TestContext
TestContext
{
get
;
set
;
}
public
TestContext
TestContext
{
get
;
set
;
}
#
region
Additional
test
attributes
#
region
Additional
test
attributes
//
//
...
@@ -56,16 +46,16 @@ namespace PcapDotNet.Core.Test
...
@@ -56,16 +46,16 @@ namespace PcapDotNet.Core.Test
string
filename
=
Path
.
GetTempPath
()
+
@"dump.pcap"
;
string
filename
=
Path
.
GetTempPath
()
+
@"dump.pcap"
;
Packet
expectedPacket
=
PacketBuilder
.
Build
(
DateTime
.
Now
,
Packet
expectedPacket
=
PacketBuilder
.
Build
(
DateTime
.
Now
,
new
EthernetLayer
new
EthernetLayer
{
{
Source
=
new
MacAddress
(
1
),
Source
=
new
MacAddress
(
1
),
Destination
=
new
MacAddress
(
2
),
Destination
=
new
MacAddress
(
2
),
EtherType
=
EthernetType
.
QInQ
,
EtherType
=
EthernetType
.
QInQ
,
},
},
new
PayloadLayer
new
PayloadLayer
{
{
Data
=
new
Datagram
(
new
byte
[]
{
1
,
2
,
3
})
Data
=
new
Datagram
(
new
byte
[]
{
1
,
2
,
3
})
});
});
PacketDumpFile
.
Dump
(
filename
,
new
PcapDataLink
(
DataLinkKind
.
Ethernet
),
PacketDevice
.
DefaultSnapshotLength
,
PacketDumpFile
.
Dump
(
filename
,
new
PcapDataLink
(
DataLinkKind
.
Ethernet
),
PacketDevice
.
DefaultSnapshotLength
,
new
[]
{
expectedPacket
});
new
[]
{
expectedPacket
});
...
...
PcapDotNet/src/PcapDotNet.Core.Test/PacketSendBufferTests.cs
View file @
b0b58a33
...
@@ -13,18 +13,11 @@ namespace PcapDotNet.Core.Test
...
@@ -13,18 +13,11 @@ namespace PcapDotNet.Core.Test
[
TestClass
]
[
TestClass
]
public
class
PacketSendQueueTests
public
class
PacketSendQueueTests
{
{
public
PacketSendQueueTests
()
{
//
// TODO: Add constructor logic here
//
}
/// <summary>
/// <summary>
///Gets or sets the test context which provides
///
Gets or sets the test context which provides
///information about and functionality for the current test run.
///
information about and functionality for the current test run.
///</summary>
///
</summary>
public
TestContext
TestContext
{
get
;
set
;
}
public
TestContext
TestContext
{
get
;
set
;
}
#
region
Additional
test
attributes
#
region
Additional
test
attributes
//
//
...
@@ -153,6 +146,6 @@ namespace PcapDotNet.Core.Test
...
@@ -153,6 +146,6 @@ namespace PcapDotNet.Core.Test
return
queue
;
return
queue
;
}
}
private
static
Random
_random
=
new
Random
();
private
static
readonly
Random
_random
=
new
Random
();
}
}
}
}
\ No newline at end of file
PcapDotNet/src/PcapDotNet.Core.Test/PcapDataLinkTests.cs
View file @
b0b58a33
using
System
;
using
System
;
using
Microsoft.VisualStudio.TestTools.UnitTesting
;
using
Microsoft.VisualStudio.TestTools.UnitTesting
;
using
PcapDotNet.Packets
;
namespace
PcapDotNet.Core.Test
namespace
PcapDotNet.Core.Test
{
{
...
@@ -10,18 +9,11 @@ namespace PcapDotNet.Core.Test
...
@@ -10,18 +9,11 @@ namespace PcapDotNet.Core.Test
[
TestClass
]
[
TestClass
]
public
class
PcapDataLinkTests
public
class
PcapDataLinkTests
{
{
public
PcapDataLinkTests
()
{
//
// TODO: Add constructor logic here
//
}
/// <summary>
/// <summary>
///Gets or sets the test context which provides
///
Gets or sets the test context which provides
///information about and functionality for the current test run.
///
information about and functionality for the current test run.
///</summary>
///
</summary>
public
TestContext
TestContext
{
get
;
set
;
}
public
TestContext
TestContext
{
get
;
set
;
}
#
region
Additional
test
attributes
#
region
Additional
test
attributes
//
//
...
@@ -109,10 +101,9 @@ namespace PcapDotNet.Core.Test
...
@@ -109,10 +101,9 @@ namespace PcapDotNet.Core.Test
for
(
int
i
=
0
;
i
!=
1000
;
++
i
)
for
(
int
i
=
0
;
i
!=
1000
;
++
i
)
{
{
PcapDataLink
dataLink
=
new
PcapDataLink
(
i
);
PcapDataLink
dataLink
=
new
PcapDataLink
(
i
);
string
dataLinkName
;
try
try
{
{
dataLinkName
=
dataLink
.
Name
;
string
dataLinkName
=
dataLink
.
Name
;
Assert
.
IsNotNull
(
dataLinkName
);
Assert
.
IsNotNull
(
dataLinkName
);
}
}
catch
(
InvalidOperationException
)
catch
(
InvalidOperationException
)
...
...
PcapDotNet/src/PcapDotNet.Core.Test/PcapLibTests.cs
View file @
b0b58a33
using
System.Text
;
using
Microsoft.VisualStudio.TestTools.UnitTesting
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text.RegularExpressions
;
using
Microsoft.VisualStudio.TestTools.UnitTesting
;
using
PcapDotNet.TestUtils
;
using
PcapDotNet.TestUtils
;
namespace
PcapDotNet.Core.Test
namespace
PcapDotNet.Core.Test
...
@@ -13,18 +9,11 @@ namespace PcapDotNet.Core.Test
...
@@ -13,18 +9,11 @@ namespace PcapDotNet.Core.Test
[
TestClass
]
[
TestClass
]
public
class
PcapLibTests
public
class
PcapLibTests
{
{
public
PcapLibTests
()
{
//
// TODO: Add constructor logic here
//
}
/// <summary>
/// <summary>
///Gets or sets the test context which provides
///
Gets or sets the test context which provides
///information about and functionality for the current test run.
///
information about and functionality for the current test run.
///</summary>
///
</summary>
public
TestContext
TestContext
{
get
;
set
;
}
public
TestContext
TestContext
{
get
;
set
;
}
#
region
Additional
test
attributes
#
region
Additional
test
attributes
//
//
...
...
PcapDotNet/src/PcapDotNet.Core.Test/Properties/AssemblyInfo.cs
View file @
b0b58a33
using
System.Reflection
;
using
System.Reflection
;
using
System.Runtime.CompilerServices
;
using
System.Runtime.InteropServices
;
using
System.Runtime.InteropServices
;
// General Information about an assembly is controlled through the following
// General Information about an assembly is controlled through the following
...
...
PcapDotNet/src/PcapDotNet.Core.Test/WiresharkCompareTests.cs
View file @
b0b58a33
...
@@ -31,18 +31,11 @@ namespace PcapDotNet.Core.Test
...
@@ -31,18 +31,11 @@ namespace PcapDotNet.Core.Test
private
const
string
WiresharkDiretory
=
@"C:\Program Files\Wireshark\"
;
private
const
string
WiresharkDiretory
=
@"C:\Program Files\Wireshark\"
;
private
const
string
WiresharkTsharkPath
=
WiresharkDiretory
+
@"tshark.exe"
;
private
const
string
WiresharkTsharkPath
=
WiresharkDiretory
+
@"tshark.exe"
;
public
WiresharkCompareTests
()
{
//
// TODO: Add constructor logic here
//
}
/// <summary>
/// <summary>
///Gets or sets the test context which provides
///
Gets or sets the test context which provides
///information about and functionality for the current test run.
///
information about and functionality for the current test run.
///</summary>
///
</summary>
public
TestContext
TestContext
{
get
;
set
;
}
public
TestContext
TestContext
{
get
;
set
;
}
#
region
Additional
test
attributes
#
region
Additional
test
attributes
//
//
...
@@ -82,8 +75,8 @@ namespace PcapDotNet.Core.Test
...
@@ -82,8 +75,8 @@ namespace PcapDotNet.Core.Test
[
TestMethod
]
[
TestMethod
]
public
void
CompareTimestampPacketsToWiresharkTest
()
public
void
CompareTimestampPacketsToWiresharkTest
()
{
{
const
long
t
icks
=
633737178954260865
;
const
long
T
icks
=
633737178954260865
;
DateTime
timestamp
=
new
DateTime
(
t
icks
).
ToUniversalTime
().
ToLocalTime
();
DateTime
timestamp
=
new
DateTime
(
T
icks
).
ToUniversalTime
().
ToLocalTime
();
// Create packet
// Create packet
Packet
packet
=
new
Packet
(
new
byte
[
14
],
timestamp
,
DataLinkKind
.
Ethernet
);
Packet
packet
=
new
Packet
(
new
byte
[
14
],
timestamp
,
DataLinkKind
.
Ethernet
);
...
@@ -180,19 +173,25 @@ namespace PcapDotNet.Core.Test
...
@@ -180,19 +173,25 @@ namespace PcapDotNet.Core.Test
{
{
string
pcapFilename
=
Path
.
GetTempPath
()
+
"temp."
+
new
Random
().
NextByte
()
+
".pcap"
;
string
pcapFilename
=
Path
.
GetTempPath
()
+
"temp."
+
new
Random
().
NextByte
()
+
".pcap"
;
// const bool isRetry = true;
// const bool isRetry = true;
const
bool
isRetry
=
false
;
const
bool
IsRetry
=
false
;
if
(!
isRetry
)
#pragma warning disable 162
// ReSharper disable ConditionIsAlwaysTrueOrFalse
// ReSharper disable HeuristicUnreachableCode
if
(!
IsRetry
)
{
{
PacketDumpFile
.
Dump
(
pcapFilename
,
new
PcapDataLink
(
DataLinkKind
.
Ethernet
),
PacketDevice
.
DefaultSnapshotLength
,
packets
);
PacketDumpFile
.
Dump
(
pcapFilename
,
new
PcapDataLink
(
DataLinkKind
.
Ethernet
),
PacketDevice
.
DefaultSnapshotLength
,
packets
);
}
}
else
else
{
{
const
byte
r
etryNumber
=
55
;
const
byte
R
etryNumber
=
55
;
pcapFilename
=
Path
.
GetTempPath
()
+
"temp."
+
r
etryNumber
+
".pcap"
;
pcapFilename
=
Path
.
GetTempPath
()
+
"temp."
+
R
etryNumber
+
".pcap"
;
List
<
Packet
>
packetsList
=
new
List
<
Packet
>();
List
<
Packet
>
packetsList
=
new
List
<
Packet
>();
new
OfflinePacketDevice
(
pcapFilename
).
Open
().
ReceivePackets
(
1000
,
packetsList
.
Add
);
new
OfflinePacketDevice
(
pcapFilename
).
Open
().
ReceivePackets
(
1000
,
packetsList
.
Add
);
packets
=
packetsList
;
packets
=
packetsList
;
}
}
// ReSharper restore HeuristicUnreachableCode
// ReSharper restore ConditionIsAlwaysTrueOrFalse
#pragma warning restore 162
// Create pdml file
// Create pdml file
string
documentFilename
=
pcapFilename
+
".pdml"
;
string
documentFilename
=
pcapFilename
+
".pdml"
;
...
...
PcapDotNet/src/PcapDotNet.Packets.Test/ArpTests.cs
View file @
b0b58a33
...
@@ -5,7 +5,6 @@ using PcapDotNet.Packets.Arp;
...
@@ -5,7 +5,6 @@ using PcapDotNet.Packets.Arp;
using
PcapDotNet.Packets.Ethernet
;
using
PcapDotNet.Packets.Ethernet
;
using
PcapDotNet.Packets.IpV4
;
using
PcapDotNet.Packets.IpV4
;
using
PcapDotNet.Packets.TestUtils
;
using
PcapDotNet.Packets.TestUtils
;
using
PcapDotNet.TestUtils
;
namespace
PcapDotNet.Packets.Test
namespace
PcapDotNet.Packets.Test
{
{
...
@@ -15,17 +14,10 @@ namespace PcapDotNet.Packets.Test
...
@@ -15,17 +14,10 @@ namespace PcapDotNet.Packets.Test
[
TestClass
]
[
TestClass
]
public
class
ArpTests
public
class
ArpTests
{
{
public
ArpTests
()
{
//
// TODO: Add constructor logic here
//
}
/// <summary>
/// <summary>
///Gets or sets the test context which provides
///
Gets or sets the test context which provides
///information about and functionality for the current test run.
///
information about and functionality for the current test run.
///</summary>
///
</summary>
public
TestContext
TestContext
{
get
;
set
;
}
public
TestContext
TestContext
{
get
;
set
;
}
#
region
Additional
test
attributes
#
region
Additional
test
attributes
...
...
PcapDotNet/src/PcapDotNet.Packets.Test/ByteArrayExtensionsTests.cs
View file @
b0b58a33
...
@@ -10,17 +10,10 @@ namespace PcapDotNet.Packets.Test
...
@@ -10,17 +10,10 @@ namespace PcapDotNet.Packets.Test
[
TestClass
]
[
TestClass
]
public
class
ByteArrayExtensionsTests
public
class
ByteArrayExtensionsTests
{
{
public
ByteArrayExtensionsTests
()
{
//
// TODO: Add constructor logic here
//
}
/// <summary>
/// <summary>
///Gets or sets the test context which provides
///
Gets or sets the test context which provides
///information about and functionality for the current test run.
///
information about and functionality for the current test run.
///</summary>
///
</summary>
public
TestContext
TestContext
{
get
;
set
;
}
public
TestContext
TestContext
{
get
;
set
;
}
#
region
Additional
test
attributes
#
region
Additional
test
attributes
...
...
PcapDotNet/src/PcapDotNet.Packets.Test/DataLinkTests.cs
View file @
b0b58a33
...
@@ -8,18 +8,11 @@ namespace PcapDotNet.Packets.Test
...
@@ -8,18 +8,11 @@ namespace PcapDotNet.Packets.Test
[
TestClass
]
[
TestClass
]
public
class
DataLinkTests
public
class
DataLinkTests
{
{
public
DataLinkTests
()
{
//
// TODO: Add constructor logic here
//
}
/// <summary>
/// <summary>
///Gets or sets the test context which provides
///
Gets or sets the test context which provides
///information about and functionality for the current test run.
///
information about and functionality for the current test run.
///</summary>
///
</summary>
public
TestContext
TestContext
{
get
;
set
;
}
public
TestContext
TestContext
{
get
;
set
;
}
#
region
Additional
test
attributes
#
region
Additional
test
attributes
//
//
...
@@ -50,8 +43,10 @@ namespace PcapDotNet.Packets.Test
...
@@ -50,8 +43,10 @@ namespace PcapDotNet.Packets.Test
Assert
.
AreNotEqual
(
DataLink
.
Ethernet
,
2
);
Assert
.
AreNotEqual
(
DataLink
.
Ethernet
,
2
);
Assert
.
AreEqual
(
DataLinkKind
.
Ethernet
.
ToString
(),
DataLink
.
Ethernet
.
ToString
());
Assert
.
AreEqual
(
DataLinkKind
.
Ethernet
.
ToString
(),
DataLink
.
Ethernet
.
ToString
());
Assert
.
AreEqual
(
DataLink
.
Ethernet
.
GetHashCode
(),
DataLink
.
Ethernet
.
GetHashCode
());
Assert
.
AreEqual
(
DataLink
.
Ethernet
.
GetHashCode
(),
DataLink
.
Ethernet
.
GetHashCode
());
// ReSharper disable EqualExpressionComparison
Assert
.
IsTrue
(
DataLink
.
Ethernet
==
DataLink
.
Ethernet
);
Assert
.
IsTrue
(
DataLink
.
Ethernet
==
DataLink
.
Ethernet
);
Assert
.
IsFalse
(
DataLink
.
Ethernet
!=
DataLink
.
Ethernet
);
Assert
.
IsFalse
(
DataLink
.
Ethernet
!=
DataLink
.
Ethernet
);
// ReSharper restore EqualExpressionComparison
}
}
}
}
}
}
\ No newline at end of file
PcapDotNet/src/PcapDotNet.Packets.Test/DatagramTests.cs
View file @
b0b58a33
...
@@ -16,18 +16,11 @@ namespace PcapDotNet.Packets.Test
...
@@ -16,18 +16,11 @@ namespace PcapDotNet.Packets.Test
[
TestClass
]
[
TestClass
]
public
class
DatagramTests
public
class
DatagramTests
{
{
public
DatagramTests
()
{
//
// TODO: Add constructor logic here
//
}
/// <summary>
/// <summary>
///Gets or sets the test context which provides
///
Gets or sets the test context which provides
///information about and functionality for the current test run.
///
information about and functionality for the current test run.
///</summary>
///
</summary>
public
TestContext
TestContext
{
get
;
set
;
}
public
TestContext
TestContext
{
get
;
set
;
}
#
region
Additional
test
attributes
#
region
Additional
test
attributes
//
//
...
...
PcapDotNet/src/PcapDotNet.Packets.Test/EndianitiyTests.cs
View file @
b0b58a33
...
@@ -9,18 +9,11 @@ namespace PcapDotNet.Packets.Test
...
@@ -9,18 +9,11 @@ namespace PcapDotNet.Packets.Test
[
TestClass
]
[
TestClass
]
public
class
EndianitiyTests
public
class
EndianitiyTests
{
{
public
EndianitiyTests
()
{
//
// TODO: Add constructor logic here
//
}
/// <summary>
/// <summary>
///Gets or sets the test context which provides
///
Gets or sets the test context which provides
///information about and functionality for the current test run.
///
information about and functionality for the current test run.
///</summary>
///
</summary>
public
TestContext
TestContext
{
get
;
set
;
}
public
TestContext
TestContext
{
get
;
set
;
}
#
region
Additional
test
attributes
#
region
Additional
test
attributes
//
//
...
@@ -119,18 +112,18 @@ namespace PcapDotNet.Packets.Test
...
@@ -119,18 +112,18 @@ namespace PcapDotNet.Packets.Test
[
TestMethod
]
[
TestMethod
]
public
void
UIntTest
()
public
void
UIntTest
()
{
{
const
uint
v
alue
=
0x01020304
;
const
uint
V
alue
=
0x01020304
;
byte
[]
buffer
=
new
byte
[
sizeof
(
uint
)];
byte
[]
buffer
=
new
byte
[
sizeof
(
uint
)];
buffer
.
Write
(
0
,
v
alue
,
Endianity
.
Big
);
buffer
.
Write
(
0
,
V
alue
,
Endianity
.
Big
);
Assert
.
AreEqual
(
v
alue
,
buffer
.
ReadUInt
(
0
,
Endianity
.
Big
));
Assert
.
AreEqual
(
V
alue
,
buffer
.
ReadUInt
(
0
,
Endianity
.
Big
));
Assert
.
AreEqual
(
0x01
,
buffer
[
0
]);
Assert
.
AreEqual
(
0x01
,
buffer
[
0
]);
Assert
.
AreEqual
(
0x02
,
buffer
[
1
]);
Assert
.
AreEqual
(
0x02
,
buffer
[
1
]);
Assert
.
AreEqual
(
0x03
,
buffer
[
2
]);
Assert
.
AreEqual
(
0x03
,
buffer
[
2
]);
Assert
.
AreEqual
(
0x04
,
buffer
[
3
]);
Assert
.
AreEqual
(
0x04
,
buffer
[
3
]);
buffer
.
Write
(
0
,
v
alue
,
Endianity
.
Small
);
buffer
.
Write
(
0
,
V
alue
,
Endianity
.
Small
);
Assert
.
AreEqual
(
v
alue
,
buffer
.
ReadUInt
(
0
,
Endianity
.
Small
));
Assert
.
AreEqual
(
V
alue
,
buffer
.
ReadUInt
(
0
,
Endianity
.
Small
));
Assert
.
AreEqual
(
0x04
,
buffer
[
0
]);
Assert
.
AreEqual
(
0x04
,
buffer
[
0
]);
Assert
.
AreEqual
(
0x03
,
buffer
[
1
]);
Assert
.
AreEqual
(
0x03
,
buffer
[
1
]);
Assert
.
AreEqual
(
0x02
,
buffer
[
2
]);
Assert
.
AreEqual
(
0x02
,
buffer
[
2
]);
...
...
PcapDotNet/src/PcapDotNet.Packets.Test/EthernetTests.cs
View file @
b0b58a33
...
@@ -13,18 +13,11 @@ namespace PcapDotNet.Packets.Test
...
@@ -13,18 +13,11 @@ namespace PcapDotNet.Packets.Test
[
TestClass
]
[
TestClass
]
public
class
EthernetTests
public
class
EthernetTests
{
{
public
EthernetTests
()
{
//
// TODO: Add constructor logic here
//
}
/// <summary>
/// <summary>
///Gets or sets the test context which provides
///
Gets or sets the test context which provides
///information about and functionality for the current test run.
///
information about and functionality for the current test run.
///</summary>
///
</summary>
public
TestContext
TestContext
{
get
;
set
;
}
public
TestContext
TestContext
{
get
;
set
;
}
#
region
Additional
test
attributes
#
region
Additional
test
attributes
//
//
...
...
PcapDotNet/src/PcapDotNet.Packets.Test/GreTests.cs
View file @
b0b58a33
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Collections.ObjectModel
;
using
System.Linq
;
using
System.Linq
;
using
Microsoft.VisualStudio.TestTools.UnitTesting
;
using
Microsoft.VisualStudio.TestTools.UnitTesting
;
using
PcapDotNet.Base
;
using
PcapDotNet.Packets.Ethernet
;
using
PcapDotNet.Packets.Ethernet
;
using
PcapDotNet.Packets.Gre
;
using
PcapDotNet.Packets.Gre
;
using
PcapDotNet.Packets.Icmp
;
using
PcapDotNet.Packets.Icmp
;
...
@@ -19,13 +17,6 @@ namespace PcapDotNet.Packets.Test
...
@@ -19,13 +17,6 @@ namespace PcapDotNet.Packets.Test
[
TestClass
]
[
TestClass
]
public
class
GreTests
public
class
GreTests
{
{
public
GreTests
()
{
//
// TODO: Add constructor logic here
//
}
/// <summary>
/// <summary>
/// Gets or sets the test context which provides
/// Gets or sets the test context which provides
/// information about and functionality for the current test run.
/// information about and functionality for the current test run.
...
...
PcapDotNet/src/PcapDotNet.Packets.Test/IcmpTests.cs
View file @
b0b58a33
...
@@ -2,10 +2,8 @@ using System;
...
@@ -2,10 +2,8 @@ using System;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Linq
;
using
Microsoft.VisualStudio.TestTools.UnitTesting
;
using
Microsoft.VisualStudio.TestTools.UnitTesting
;
using
PcapDotNet.Base
;
using
PcapDotNet.Packets.Ethernet
;
using
PcapDotNet.Packets.Ethernet
;
using
PcapDotNet.Packets.Icmp
;
using
PcapDotNet.Packets.Icmp
;
using
PcapDotNet.Packets.Igmp
;
using
PcapDotNet.Packets.IpV4
;
using
PcapDotNet.Packets.IpV4
;
using
PcapDotNet.Packets.TestUtils
;
using
PcapDotNet.Packets.TestUtils
;
using
PcapDotNet.TestUtils
;
using
PcapDotNet.TestUtils
;
...
@@ -18,18 +16,11 @@ namespace PcapDotNet.Packets.Test
...
@@ -18,18 +16,11 @@ namespace PcapDotNet.Packets.Test
[
TestClass
]
[
TestClass
]
public
class
IcmpTests
public
class
IcmpTests
{
{
public
IcmpTests
()
{
//
// TODO: Add constructor logic here
//
}
/// <summary>
/// <summary>
/// Gets or sets the test context which provides
/// Gets or sets the test context which provides
/// information about and functionality for the current test run.
/// information about and functionality for the current test run.
/// </summary>
/// </summary>
public
TestContext
TestContext
{
get
;
set
;
}
public
TestContext
TestContext
{
get
;
set
;
}
#
region
Additional
test
attributes
#
region
Additional
test
attributes
//
//
...
...
PcapDotNet/src/PcapDotNet.Packets.Test/IgmpTests.cs
View file @
b0b58a33
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Linq
;
using
Microsoft.VisualStudio.TestTools.UnitTesting
;
using
Microsoft.VisualStudio.TestTools.UnitTesting
;
using
PcapDotNet.Base
;
using
PcapDotNet.Base
;
using
PcapDotNet.Packets.Ethernet
;
using
PcapDotNet.Packets.Ethernet
;
using
PcapDotNet.Packets.Igmp
;
using
PcapDotNet.Packets.Igmp
;
using
PcapDotNet.Packets.IpV4
;
using
PcapDotNet.Packets.IpV4
;
using
PcapDotNet.Packets.TestUtils
;
using
PcapDotNet.Packets.TestUtils
;
using
PcapDotNet.Packets.Transport
;
using
PcapDotNet.TestUtils
;
using
PcapDotNet.TestUtils
;
namespace
PcapDotNet.Packets.Test
namespace
PcapDotNet.Packets.Test
...
@@ -18,18 +16,11 @@ namespace PcapDotNet.Packets.Test
...
@@ -18,18 +16,11 @@ namespace PcapDotNet.Packets.Test
[
TestClass
]
[
TestClass
]
public
class
IgmpTests
public
class
IgmpTests
{
{
public
IgmpTests
()
{
//
// TODO: Add constructor logic here
//
}
/// <summary>
/// <summary>
///Gets or sets the test context which provides
///
Gets or sets the test context which provides
///information about and functionality for the current test run.
///
information about and functionality for the current test run.
///</summary>
///
</summary>
public
TestContext
TestContext
{
get
;
set
;
}
public
TestContext
TestContext
{
get
;
set
;
}
#
region
Additional
test
attributes
#
region
Additional
test
attributes
//
//
...
...
PcapDotNet/src/PcapDotNet.Packets.Test/IpV4AddressTests.cs
View file @
b0b58a33
using
System
;
using
System
;
using
System.Text
;
using
System.Collections.Generic
;
using
System.Linq
;
using
Microsoft.VisualStudio.TestTools.UnitTesting
;
using
Microsoft.VisualStudio.TestTools.UnitTesting
;
using
PcapDotNet.Packets.IpV4
;
using
PcapDotNet.Packets.IpV4
;
using
PcapDotNet.Packets.TestUtils
;
using
PcapDotNet.Packets.TestUtils
;
...
@@ -14,22 +11,11 @@ namespace PcapDotNet.Packets.Test
...
@@ -14,22 +11,11 @@ namespace PcapDotNet.Packets.Test
[
TestClass
]
[
TestClass
]
public
class
IpV4AddressTests
public
class
IpV4AddressTests
{
{
public
IpV4AddressTests
()
{
//
// TODO: Add constructor logic here
//
}
/// <summary>
/// <summary>
///Gets or sets the test context which provides
/// Gets or sets the test context which provides
///information about and functionality for the current test run.
/// information about and functionality for the current test run.
///</summary>
/// </summary>
public
TestContext
TestContext
public
TestContext
TestContext
{
get
;
set
;
}
{
get
;
set
;
}
#
region
Additional
test
attributes
#
region
Additional
test
attributes
//
//
...
...
PcapDotNet/src/PcapDotNet.Packets.Test/IpV4Tests.cs
View file @
b0b58a33
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
Microsoft.VisualStudio.TestTools.UnitTesting
;
using
Microsoft.VisualStudio.TestTools.UnitTesting
;
using
PcapDotNet.Base
;
using
PcapDotNet.Packets.Ethernet
;
using
PcapDotNet.Packets.Ethernet
;
using
PcapDotNet.Packets.IpV4
;
using
PcapDotNet.Packets.IpV4
;
using
PcapDotNet.Packets.TestUtils
;
using
PcapDotNet.Packets.TestUtils
;
...
@@ -17,18 +14,11 @@ namespace PcapDotNet.Packets.Test
...
@@ -17,18 +14,11 @@ namespace PcapDotNet.Packets.Test
[
TestClass
]
[
TestClass
]
public
class
IpV4Tests
public
class
IpV4Tests
{
{
public
IpV4Tests
()
{
//
// TODO: Add constructor logic here
//
}
/// <summary>
/// <summary>
///Gets or sets the test context which provides
///
Gets or sets the test context which provides
///information about and functionality for the current test run.
///
information about and functionality for the current test run.
///</summary>
///
</summary>
public
TestContext
TestContext
{
get
;
set
;
}
public
TestContext
TestContext
{
get
;
set
;
}
#
region
Additional
test
attributes
#
region
Additional
test
attributes
//
//
...
@@ -90,13 +80,13 @@ namespace PcapDotNet.Packets.Test
...
@@ -90,13 +80,13 @@ namespace PcapDotNet.Packets.Test
{
{
MacAddress
ethernetSource
=
new
MacAddress
(
"00:01:02:03:04:05"
);
MacAddress
ethernetSource
=
new
MacAddress
(
"00:01:02:03:04:05"
);
MacAddress
ethernetDestination
=
new
MacAddress
(
"A0:A1:A2:A3:A4:A5"
);
MacAddress
ethernetDestination
=
new
MacAddress
(
"A0:A1:A2:A3:A4:A5"
);
const
EthernetType
e
thernetType
=
EthernetType
.
IpV4
;
const
EthernetType
E
thernetType
=
EthernetType
.
IpV4
;
EthernetLayer
ethernetLayer
=
new
EthernetLayer
EthernetLayer
ethernetLayer
=
new
EthernetLayer
{
{
Source
=
ethernetSource
,
Source
=
ethernetSource
,
Destination
=
ethernetDestination
,
Destination
=
ethernetDestination
,
EtherType
=
e
thernetType
EtherType
=
E
thernetType
};
};
Random
random
=
new
Random
();
Random
random
=
new
Random
();
...
@@ -237,7 +227,7 @@ namespace PcapDotNet.Packets.Test
...
@@ -237,7 +227,7 @@ namespace PcapDotNet.Packets.Test
public
void
IpV4OptionRoutePointedAddressIndexErrorTest
()
public
void
IpV4OptionRoutePointedAddressIndexErrorTest
()
{
{
Random
random
=
new
Random
();
Random
random
=
new
Random
();
IpV4Option
option
=
new
IpV4OptionRecordRoute
(
random
.
NextByte
(
IpV4OptionR
ecordR
oute
.
PointedAddressIndexMaxValue
+
1
,
byte
.
MaxValue
+
1
));
IpV4Option
option
=
new
IpV4OptionRecordRoute
(
random
.
NextByte
(
IpV4OptionRoute
.
PointedAddressIndexMaxValue
+
1
,
byte
.
MaxValue
+
1
));
Assert
.
IsNotNull
(
option
);
Assert
.
IsNotNull
(
option
);
Assert
.
Fail
();
Assert
.
Fail
();
}
}
...
@@ -327,8 +317,10 @@ namespace PcapDotNet.Packets.Test
...
@@ -327,8 +317,10 @@ namespace PcapDotNet.Packets.Test
IpV4TimeOfDay
timeSinceMidnight
=
new
IpV4TimeOfDay
(
timeOfDay
);
IpV4TimeOfDay
timeSinceMidnight
=
new
IpV4TimeOfDay
(
timeOfDay
);
Assert
.
AreEqual
(
timeOfDay
,
timeSinceMidnight
.
TimeSinceMidnightUniversalTime
);
Assert
.
AreEqual
(
timeOfDay
,
timeSinceMidnight
.
TimeSinceMidnightUniversalTime
);
Assert
.
AreEqual
<
object
>(
timeSinceMidnight
,
timeSinceMidnight
);
Assert
.
AreEqual
<
object
>(
timeSinceMidnight
,
timeSinceMidnight
);
// ReSharper disable EqualExpressionComparison
Assert
.
IsTrue
(
timeSinceMidnight
==
timeSinceMidnight
);
Assert
.
IsTrue
(
timeSinceMidnight
==
timeSinceMidnight
);
Assert
.
IsFalse
(
timeSinceMidnight
!=
timeSinceMidnight
);
Assert
.
IsFalse
(
timeSinceMidnight
!=
timeSinceMidnight
);
// ReSharper restore EqualExpressionComparison
}
}
[
TestMethod
]
[
TestMethod
]
...
...
PcapDotNet/src/PcapDotNet.Packets.Test/IpV6AddressTests.cs
View file @
b0b58a33
using
System
;
using
System
;
using
Microsoft.VisualStudio.TestTools.UnitTesting
;
using
Microsoft.VisualStudio.TestTools.UnitTesting
;
using
PcapDotNet.Packets.IpV4
;
using
PcapDotNet.Packets.IpV6
;
using
PcapDotNet.Packets.IpV6
;
using
PcapDotNet.Packets.TestUtils
;
using
PcapDotNet.Packets.TestUtils
;
...
@@ -12,13 +11,6 @@ namespace PcapDotNet.Packets.Test
...
@@ -12,13 +11,6 @@ namespace PcapDotNet.Packets.Test
[
TestClass
]
[
TestClass
]
public
class
IpV6AddressTests
public
class
IpV6AddressTests
{
{
public
IpV6AddressTests
()
{
//
// TODO: Add constructor logic here
//
}
/// <summary>
/// <summary>
/// Gets or sets the test context which provides
/// Gets or sets the test context which provides
/// information about and functionality for the current test run.
/// information about and functionality for the current test run.
...
...
PcapDotNet/src/PcapDotNet.Packets.Test/MacAddressTests.cs
View file @
b0b58a33
...
@@ -11,18 +11,11 @@ namespace PcapDotNet.Packets.Test
...
@@ -11,18 +11,11 @@ namespace PcapDotNet.Packets.Test
[
TestClass
]
[
TestClass
]
public
class
MacAddressTests
public
class
MacAddressTests
{
{
public
MacAddressTests
()
{
//
// TODO: Add constructor logic here
//
}
/// <summary>
/// <summary>
///Gets or sets the test context which provides
///
Gets or sets the test context which provides
///information about and functionality for the current test run.
///
information about and functionality for the current test run.
///</summary>
///
</summary>
public
TestContext
TestContext
{
get
;
set
;
}
public
TestContext
TestContext
{
get
;
set
;
}
#
region
Additional
test
attributes
#
region
Additional
test
attributes
//
//
...
...
PcapDotNet/src/PcapDotNet.Packets.Test/PacketBuilderTests.cs
View file @
b0b58a33
...
@@ -10,17 +10,10 @@ namespace PcapDotNet.Packets.Test
...
@@ -10,17 +10,10 @@ namespace PcapDotNet.Packets.Test
[
TestClass
]
[
TestClass
]
public
class
PacketBuilderTests
public
class
PacketBuilderTests
{
{
public
PacketBuilderTests
()
{
//
// TODO: Add constructor logic here
//
}
/// <summary>
/// <summary>
///Gets or sets the test context which provides
///
Gets or sets the test context which provides
///information about and functionality for the current test run.
///
information about and functionality for the current test run.
///</summary>
///
</summary>
public
TestContext
TestContext
{
get
;
set
;
}
public
TestContext
TestContext
{
get
;
set
;
}
#
region
Additional
test
attributes
#
region
Additional
test
attributes
...
...
PcapDotNet/src/PcapDotNet.Packets.Test/PacketTests.cs
View file @
b0b58a33
...
@@ -14,18 +14,11 @@ namespace PcapDotNet.Packets.Test
...
@@ -14,18 +14,11 @@ namespace PcapDotNet.Packets.Test
[
TestClass
]
[
TestClass
]
public
class
PacketTests
public
class
PacketTests
{
{
public
PacketTests
()
{
//
// TODO: Add constructor logic here
//
}
/// <summary>
/// <summary>
///Gets or sets the test context which provides
///
Gets or sets the test context which provides
///information about and functionality for the current test run.
///
information about and functionality for the current test run.
///</summary>
///
</summary>
public
TestContext
TestContext
{
get
;
set
;
}
public
TestContext
TestContext
{
get
;
set
;
}
#
region
Additional
test
attributes
#
region
Additional
test
attributes
//
//
...
...
PcapDotNet/src/PcapDotNet.Packets.Test/PayloadLayerTests.cs
View file @
b0b58a33
...
@@ -12,17 +12,10 @@ namespace PcapDotNet.Packets.Test
...
@@ -12,17 +12,10 @@ namespace PcapDotNet.Packets.Test
[
TestClass
]
[
TestClass
]
public
class
PayloadLayerTests
public
class
PayloadLayerTests
{
{
public
PayloadLayerTests
()
{
//
// TODO: Add constructor logic here
//
}
/// <summary>
/// <summary>
///Gets or sets the test context which provides
///
Gets or sets the test context which provides
///information about and functionality for the current test run.
///
information about and functionality for the current test run.
///</summary>
///
</summary>
public
TestContext
TestContext
{
get
;
set
;}
public
TestContext
TestContext
{
get
;
set
;}
#
region
Additional
test
attributes
#
region
Additional
test
attributes
...
...
PcapDotNet/src/PcapDotNet.Packets.Test/Properties/AssemblyInfo.cs
View file @
b0b58a33
using
System.Reflection
;
using
System.Reflection
;
using
System.Runtime.CompilerServices
;
using
System.Runtime.InteropServices
;
using
System.Runtime.InteropServices
;
// General Information about an assembly is controlled through the following
// General Information about an assembly is controlled through the following
...
...
PcapDotNet/src/PcapDotNet.Packets.Test/TcpTests.cs
View file @
b0b58a33
using
System
;
using
System
;
using
System.Collections.Generic
;
using
Microsoft.VisualStudio.TestTools.UnitTesting
;
using
Microsoft.VisualStudio.TestTools.UnitTesting
;
using
PcapDotNet.Packets.Ethernet
;
using
PcapDotNet.Packets.Ethernet
;
using
PcapDotNet.Packets.IpV4
;
using
PcapDotNet.Packets.IpV4
;
using
PcapDotNet.Packets.TestUtils
;
using
PcapDotNet.Packets.TestUtils
;
using
PcapDotNet.Packets.Transport
;
using
PcapDotNet.Packets.Transport
;
using
PcapDotNet.TestUtils
;
namespace
PcapDotNet.Packets.Test
namespace
PcapDotNet.Packets.Test
{
{
...
@@ -15,18 +13,11 @@ namespace PcapDotNet.Packets.Test
...
@@ -15,18 +13,11 @@ namespace PcapDotNet.Packets.Test
[
TestClass
]
[
TestClass
]
public
class
TcpTests
public
class
TcpTests
{
{
public
TcpTests
()
{
//
// TODO: Add constructor logic here
//
}
/// <summary>
/// <summary>
///Gets or sets the test context which provides
///
Gets or sets the test context which provides
///information about and functionality for the current test run.
///
information about and functionality for the current test run.
///</summary>
///
</summary>
public
TestContext
TestContext
{
get
;
set
;
}
public
TestContext
TestContext
{
get
;
set
;
}
#
region
Additional
test
attributes
#
region
Additional
test
attributes
//
//
...
...
PcapDotNet/src/PcapDotNet.Packets.Test/UdpTests.cs
View file @
b0b58a33
...
@@ -4,7 +4,6 @@ using PcapDotNet.Packets.Ethernet;
...
@@ -4,7 +4,6 @@ using PcapDotNet.Packets.Ethernet;
using
PcapDotNet.Packets.IpV4
;
using
PcapDotNet.Packets.IpV4
;
using
PcapDotNet.Packets.TestUtils
;
using
PcapDotNet.Packets.TestUtils
;
using
PcapDotNet.Packets.Transport
;
using
PcapDotNet.Packets.Transport
;
using
PcapDotNet.TestUtils
;
namespace
PcapDotNet.Packets.Test
namespace
PcapDotNet.Packets.Test
{
{
...
@@ -14,18 +13,11 @@ namespace PcapDotNet.Packets.Test
...
@@ -14,18 +13,11 @@ namespace PcapDotNet.Packets.Test
[
TestClass
]
[
TestClass
]
public
class
UdpTests
public
class
UdpTests
{
{
public
UdpTests
()
{
//
// TODO: Add constructor logic here
//
}
/// <summary>
/// <summary>
///Gets or sets the test context which provides
///
Gets or sets the test context which provides
///information about and functionality for the current test run.
///
information about and functionality for the current test run.
///</summary>
///
</summary>
public
TestContext
TestContext
{
get
;
set
;
}
public
TestContext
TestContext
{
get
;
set
;
}
#
region
Additional
test
attributes
#
region
Additional
test
attributes
//
//
...
...
PcapDotNet/src/PcapDotNet.Packets.TestUtils/Properties/AssemblyInfo.cs
View file @
b0b58a33
using
System.Reflection
;
using
System.Reflection
;
using
System.Runtime.CompilerServices
;
using
System.Runtime.InteropServices
;
using
System.Runtime.InteropServices
;
// General Information about an assembly is controlled through the following
// General Information about an assembly is controlled through the following
...
...
PcapDotNet/src/PcapDotNet.Packets.TestUtils/RandomPacketsExtensions.cs
View file @
b0b58a33
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Linq
;
using
System.Runtime.InteropServices
;
using
System.Text
;
using
PcapDotNet.Base
;
using
PcapDotNet.Base
;
using
PcapDotNet.Packets
;
using
PcapDotNet.Packets.Arp
;
using
PcapDotNet.Packets.Arp
;
using
PcapDotNet.Packets.Ethernet
;
using
PcapDotNet.Packets.Ethernet
;
using
PcapDotNet.Packets.Gre
;
using
PcapDotNet.Packets.Gre
;
...
@@ -511,11 +508,11 @@ namespace PcapDotNet.Packets.TestUtils
...
@@ -511,11 +508,11 @@ namespace PcapDotNet.Packets.TestUtils
IgmpQueryVersion
igmpQueryVersion
=
IgmpQueryVersion
.
None
;
IgmpQueryVersion
igmpQueryVersion
=
IgmpQueryVersion
.
None
;
TimeSpan
igmpMaxResponseTime
=
random
.
NextTimeSpan
(
TimeSpan
.
FromSeconds
(
0.1
),
TimeSpan
.
FromSeconds
(
256
*
0.1
)
-
TimeSpan
.
FromTicks
(
1
));
TimeSpan
igmpMaxResponseTime
=
random
.
NextTimeSpan
(
TimeSpan
.
FromSeconds
(
0.1
),
TimeSpan
.
FromSeconds
(
256
*
0.1
)
-
TimeSpan
.
FromTicks
(
1
));
IpV4Address
igmpGroupAddress
=
random
.
NextIpV4Address
();
IpV4Address
igmpGroupAddress
=
random
.
NextIpV4Address
();
bool
?
igmpIsSuppressRouterSideProcessing
=
null
;
bool
?
igmpIsSuppressRouterSideProcessing
;
byte
?
igmpQueryRobustnessVariable
=
null
;
byte
?
igmpQueryRobustnessVariable
;
TimeSpan
?
igmpQueryInterval
=
null
;
TimeSpan
?
igmpQueryInterval
;
IpV4Address
[]
igmpSourceAddresses
=
null
;
IpV4Address
[]
igmpSourceAddresses
;
IgmpGroupRecord
[]
igmpGroupRecords
=
null
;
IgmpGroupRecord
[]
igmpGroupRecords
;
switch
(
igmpMessageType
)
switch
(
igmpMessageType
)
{
{
...
@@ -870,10 +867,6 @@ namespace PcapDotNet.Packets.TestUtils
...
@@ -870,10 +867,6 @@ namespace PcapDotNet.Packets.TestUtils
icmpPayloadLayers
=
icmpPayloadLayers
.
Concat
(
random
.
NextIpV4Layer
(),
random
.
NextPayloadLayer
(
IcmpIpV4HeaderPlus64BitsPayloadDatagram
.
OriginalDatagramPayloadLength
));
icmpPayloadLayers
=
icmpPayloadLayers
.
Concat
(
random
.
NextIpV4Layer
(),
random
.
NextPayloadLayer
(
IcmpIpV4HeaderPlus64BitsPayloadDatagram
.
OriginalDatagramPayloadLength
));
break
;
break
;
case
IcmpMessageType
.
ConversionFailed
:
case
IcmpMessageType
.
ConversionFailed
:
IpV4Protocol
icmpIpV4Protocol
=
random
.
NextBool
()
?
random
.
NextValue
(
new
[]
{
IpV4Protocol
.
Udp
,
IpV4Protocol
.
Tcp
})
:
random
.
NextEnum
<
IpV4Protocol
>();
IpV4Layer
icmpIpV4Layer
=
random
.
NextIpV4Layer
();
IpV4Layer
icmpIpV4Layer
=
random
.
NextIpV4Layer
();
icmpPayloadLayers
=
icmpPayloadLayers
.
Concat
(
icmpIpV4Layer
);
icmpPayloadLayers
=
icmpPayloadLayers
.
Concat
(
icmpIpV4Layer
);
if
(
icmpLayer
.
MessageTypeAndCode
==
IcmpMessageTypeAndCode
.
ConversionFailedUnsupportedTransportProtocol
)
if
(
icmpLayer
.
MessageTypeAndCode
==
IcmpMessageTypeAndCode
.
ConversionFailedUnsupportedTransportProtocol
)
...
...
PcapDotNet/src/PcapDotNet.Packets/Arp/ArpDatagram.cs
View file @
b0b58a33
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Collections.ObjectModel
;
using
System.Collections.ObjectModel
;
using
System.Linq
;
using
PcapDotNet.Base
;
using
PcapDotNet.Base
;
using
PcapDotNet.Packets.Ethernet
;
using
PcapDotNet.Packets.Ethernet
;
using
PcapDotNet.Packets.IpV4
;
using
PcapDotNet.Packets.IpV4
;
...
...
PcapDotNet/src/PcapDotNet.Packets/Arp/ArpLayer.cs
View file @
b0b58a33
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.ObjectModel
;
using
System.Collections.ObjectModel
;
using
System.Linq
;
using
System.Linq
;
using
System.Xml.Serialization
;
using
PcapDotNet.Base
;
using
PcapDotNet.Packets.Ethernet
;
using
PcapDotNet.Packets.Ethernet
;
namespace
PcapDotNet.Packets.Arp
namespace
PcapDotNet.Packets.Arp
...
@@ -13,13 +10,6 @@ namespace PcapDotNet.Packets.Arp
...
@@ -13,13 +10,6 @@ namespace PcapDotNet.Packets.Arp
/// </summary>
/// </summary>
public
class
ArpLayer
:
Layer
,
IEthernetNextLayer
public
class
ArpLayer
:
Layer
,
IEthernetNextLayer
{
{
/// <summary>
/// Create an ARP layer.
/// </summary>
public
ArpLayer
()
{
}
/// <summary>
/// <summary>
/// Each protocol is assigned a number used in this field.
/// Each protocol is assigned a number used in this field.
/// </summary>
/// </summary>
...
...
PcapDotNet/src/PcapDotNet.Packets/ByteArrayExtensions.cs
View file @
b0b58a33
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Net
;
using
System.Net
;
using
System.Text
;
using
PcapDotNet.Base
;
using
PcapDotNet.Base
;
using
PcapDotNet.Packets.Ethernet
;
using
PcapDotNet.Packets.Ethernet
;
using
PcapDotNet.Packets.IpV4
;
using
PcapDotNet.Packets.IpV4
;
...
...
PcapDotNet/src/PcapDotNet.Packets/Datagram.cs
View file @
b0b58a33
...
@@ -2,7 +2,6 @@ using System;
...
@@ -2,7 +2,6 @@ using System;
using
System.Collections
;
using
System.Collections
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.IO
;
using
System.IO
;
using
System.Linq
;
using
PcapDotNet.Base
;
using
PcapDotNet.Base
;
using
PcapDotNet.Packets.Ethernet
;
using
PcapDotNet.Packets.Ethernet
;
using
PcapDotNet.Packets.IpV4
;
using
PcapDotNet.Packets.IpV4
;
...
...
PcapDotNet/src/PcapDotNet.Packets/Ethernet/EthernetDatagram.cs
View file @
b0b58a33
...
@@ -79,12 +79,12 @@ namespace PcapDotNet.Packets.Ethernet
...
@@ -79,12 +79,12 @@ namespace PcapDotNet.Packets.Ethernet
/// </summary>
/// </summary>
public
override
ILayer
ExtractLayer
()
public
override
ILayer
ExtractLayer
()
{
{
return
new
EthernetLayer
()
return
new
EthernetLayer
{
{
Source
=
Source
,
Source
=
Source
,
Destination
=
Destination
,
Destination
=
Destination
,
EtherType
=
EtherType
,
EtherType
=
EtherType
,
};
};
}
}
/// <summary>
/// <summary>
...
@@ -138,13 +138,10 @@ namespace PcapDotNet.Packets.Ethernet
...
@@ -138,13 +138,10 @@ namespace PcapDotNet.Packets.Ethernet
{
{
get
get
{
{
if
(
_payloadDatagrams
==
null
)
return
_payloadDatagrams
??
(
_payloadDatagrams
=
new
EthernetPayloadDatagrams
(
Length
>=
HeaderLength
{
?
new
Datagram
(
Buffer
,
StartOffset
+
HeaderLength
,
_payloadDatagrams
=
new
EthernetPayloadDatagrams
(
Length
>=
HeaderLength
Length
-
HeaderLength
)
?
new
Datagram
(
Buffer
,
StartOffset
+
HeaderLength
,
Length
-
HeaderLength
)
:
null
));
:
null
);
}
return
_payloadDatagrams
;
}
}
}
}
...
...
PcapDotNet/src/PcapDotNet.Packets/Gre/GreDatagram.cs
View file @
b0b58a33
...
@@ -380,14 +380,14 @@ namespace PcapDotNet.Packets.Gre
...
@@ -380,14 +380,14 @@ namespace PcapDotNet.Packets.Gre
ReadOnlyCollection
<
GreSourceRouteEntry
>
routing
,
ushort
?
routingOffset
,
bool
strictSourceRoute
)
ReadOnlyCollection
<
GreSourceRouteEntry
>
routing
,
ushort
?
routingOffset
,
bool
strictSourceRoute
)
{
{
buffer
.
Write
(
offset
+
Offset
.
ChecksumPresent
,
buffer
.
Write
(
offset
+
Offset
.
ChecksumPresent
,
(
byte
)((
checksumPresent
?
Mask
.
ChecksumPresent
:
(
byte
)
0
)
|
(
byte
)((
checksumPresent
?
Mask
.
ChecksumPresent
:
0
)
|
(
routing
!=
null
?
Mask
.
RoutingPresent
:
(
byte
)
0
)
|
(
routing
!=
null
?
Mask
.
RoutingPresent
:
0
)
|
(
key
!=
null
?
Mask
.
KeyPresent
:
(
byte
)
0
)
|
(
key
!=
null
?
Mask
.
KeyPresent
:
0
)
|
(
sequenceNumber
!=
null
?
Mask
.
SequenceNumberPresent
:
(
byte
)
0
)
|
(
sequenceNumber
!=
null
?
Mask
.
SequenceNumberPresent
:
0
)
|
(
strictSourceRoute
?
Mask
.
StrictSourceRoute
:
(
byte
)
0
)
|
(
strictSourceRoute
?
Mask
.
StrictSourceRoute
:
0
)
|
(
recursionControl
&
Mask
.
RecursionControl
)));
(
recursionControl
&
Mask
.
RecursionControl
)));
buffer
.
Write
(
offset
+
Offset
.
FutureUseBits
,
(
byte
)((
acknowledgmentSequenceNumber
!=
null
?
Mask
.
AcknowledgmentSequenceNumberPresent
:
(
byte
)
0
)
|
buffer
.
Write
(
offset
+
Offset
.
FutureUseBits
,
(
byte
)((
acknowledgmentSequenceNumber
!=
null
?
Mask
.
AcknowledgmentSequenceNumberPresent
:
0
)
|
((
flags
<<
Shift
.
FutureUseBits
)
&
Mask
.
FutureUseBits
)
|
((
flags
<<
Shift
.
FutureUseBits
)
&
Mask
.
FutureUseBits
)
|
((
byte
)
version
&
Mask
.
Version
)));
((
byte
)
version
&
Mask
.
Version
)));
...
@@ -515,13 +515,10 @@ namespace PcapDotNet.Packets.Gre
...
@@ -515,13 +515,10 @@ namespace PcapDotNet.Packets.Gre
{
{
get
get
{
{
if
(
_payloadDatagrams
==
null
)
return
_payloadDatagrams
??
(
_payloadDatagrams
=
new
EthernetPayloadDatagrams
(
Length
>=
HeaderLength
{
?
new
Datagram
(
Buffer
,
StartOffset
+
HeaderLength
,
_payloadDatagrams
=
new
EthernetPayloadDatagrams
(
Length
>=
HeaderLength
Length
-
HeaderLength
)
?
new
Datagram
(
Buffer
,
StartOffset
+
HeaderLength
,
Length
-
HeaderLength
)
:
null
));
:
null
);
}
return
_payloadDatagrams
;
}
}
}
}
...
...
PcapDotNet/src/PcapDotNet.Packets/Gre/GreSourceRouteEntry.cs
View file @
b0b58a33
...
@@ -133,7 +133,7 @@ namespace PcapDotNet.Packets.Gre
...
@@ -133,7 +133,7 @@ namespace PcapDotNet.Packets.Gre
{
{
buffer
.
Write
(
offset
+
Offset
.
AddressFamily
,
(
ushort
)
AddressFamily
,
Endianity
.
Big
);
buffer
.
Write
(
offset
+
Offset
.
AddressFamily
,
(
ushort
)
AddressFamily
,
Endianity
.
Big
);
buffer
.
Write
(
offset
+
Offset
.
SreOffset
,
PayloadOffset
);
buffer
.
Write
(
offset
+
Offset
.
SreOffset
,
PayloadOffset
);
buffer
.
Write
(
offset
+
Offset
.
SreLength
,
(
byte
)
PayloadLength
);
buffer
.
Write
(
offset
+
Offset
.
SreLength
,
PayloadLength
);
WritePayload
(
buffer
,
offset
+
HeaderLength
);
WritePayload
(
buffer
,
offset
+
HeaderLength
);
offset
+=
Length
;
offset
+=
Length
;
}
}
...
...
PcapDotNet/src/PcapDotNet.Packets/IOptionUnknownFactory.cs
View file @
b0b58a33
...
@@ -4,7 +4,7 @@ namespace PcapDotNet.Packets
...
@@ -4,7 +4,7 @@ namespace PcapDotNet.Packets
/// A factory interface for an unknown option.
/// A factory interface for an unknown option.
/// </summary>
/// </summary>
/// <typeparam name="TOptionType">The option type enum type.</typeparam>
/// <typeparam name="TOptionType">The option type enum type.</typeparam>
public
interface
IOptionUnknownFactory
<
TOptionType
>
public
interface
IOptionUnknownFactory
<
in
TOptionType
>
{
{
/// <summary>
/// <summary>
/// Creates an unknown option from its type and by reading a buffer for its value.
/// Creates an unknown option from its type and by reading a buffer for its value.
...
...
PcapDotNet/src/PcapDotNet.Packets/Icmp/IcmpAddressMaskRequestDatagram.cs
View file @
b0b58a33
using
System
;
using
PcapDotNet.Packets.IpV4
;
using
PcapDotNet.Packets.IpV4
;
namespace
PcapDotNet.Packets.Icmp
namespace
PcapDotNet.Packets.Icmp
...
...
PcapDotNet/src/PcapDotNet.Packets/Icmp/IcmpConversionFailedDatagram.cs
View file @
b0b58a33
using
System
;
using
System.Linq
;
using
System.Linq
;
using
PcapDotNet.Base
;
using
PcapDotNet.Base
;
using
PcapDotNet.Packets.IpV4
;
using
PcapDotNet.Packets.IpV4
;
...
...
PcapDotNet/src/PcapDotNet.Packets/Icmp/IcmpDatagram.cs
View file @
b0b58a33
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Globalization
;
using
System.Linq
;
using
System.Linq
;
using
System.Reflection
;
using
System.Reflection
;
using
PcapDotNet.Packets.IpV4
;
using
PcapDotNet.Base
;
using
PcapDotNet.Base
;
namespace
PcapDotNet.Packets.Icmp
namespace
PcapDotNet.Packets.Icmp
...
...
PcapDotNet/src/PcapDotNet.Packets/Icmp/IcmpDestinationUnreachableDatagram.cs
View file @
b0b58a33
using
System
;
using
System.Linq
;
using
System.Linq
;
using
PcapDotNet.Base
;
using
PcapDotNet.Base
;
...
...
PcapDotNet/src/PcapDotNet.Packets/Icmp/IcmpEchoDatagram.cs
View file @
b0b58a33
using
System
;
namespace
PcapDotNet.Packets.Icmp
namespace
PcapDotNet.Packets.Icmp
{
{
/// <summary>
/// <summary>
...
...
PcapDotNet/src/PcapDotNet.Packets/Icmp/IcmpEchoReplyDatagram.cs
View file @
b0b58a33
using
System
;
namespace
PcapDotNet.Packets.Icmp
namespace
PcapDotNet.Packets.Icmp
{
{
/// <summary>
/// <summary>
...
...
PcapDotNet/src/PcapDotNet.Packets/Icmp/IcmpInformationReplyDatagram.cs
View file @
b0b58a33
using
System
;
namespace
PcapDotNet.Packets.Icmp
namespace
PcapDotNet.Packets.Icmp
{
{
/// <summary>
/// <summary>
...
...
PcapDotNet/src/PcapDotNet.Packets/Icmp/IcmpInformationRequestDatagram.cs
View file @
b0b58a33
using
System
;
namespace
PcapDotNet.Packets.Icmp
namespace
PcapDotNet.Packets.Icmp
{
{
/// <summary>
/// <summary>
...
...
PcapDotNet/src/PcapDotNet.Packets/Icmp/IcmpIpV4HeaderPlus64BitsPayloadDatagram.cs
View file @
b0b58a33
using
PcapDotNet.Packets.IpV4
;
namespace
PcapDotNet.Packets.Icmp
namespace
PcapDotNet.Packets.Icmp
{
{
/// <summary>
/// <summary>
...
...
PcapDotNet/src/PcapDotNet.Packets/Icmp/IcmpLayer.cs
View file @
b0b58a33
using
System
;
using
PcapDotNet.Packets.IpV4
;
using
PcapDotNet.Packets.IpV4
;
namespace
PcapDotNet.Packets.Icmp
namespace
PcapDotNet.Packets.Icmp
...
...
PcapDotNet/src/PcapDotNet.Packets/Icmp/IcmpParameterProblemDatagram.cs
View file @
b0b58a33
using
System
;
namespace
PcapDotNet.Packets.Icmp
namespace
PcapDotNet.Packets.Icmp
{
{
/// <summary>
/// <summary>
...
...
PcapDotNet/src/PcapDotNet.Packets/Icmp/IcmpRedirectDatagram.cs
View file @
b0b58a33
using
System
;
using
System.Linq
;
using
System.Linq
;
using
PcapDotNet.Base
;
using
PcapDotNet.Base
;
using
PcapDotNet.Packets.IpV4
;
using
PcapDotNet.Packets.IpV4
;
...
...
PcapDotNet/src/PcapDotNet.Packets/Icmp/IcmpRouterAdvertisementLayer.cs
View file @
b0b58a33
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.ObjectModel
;
using
System.Collections.ObjectModel
;
using
System.Linq
;
using
System.Linq
;
...
@@ -12,13 +11,6 @@ namespace PcapDotNet.Packets.Icmp
...
@@ -12,13 +11,6 @@ namespace PcapDotNet.Packets.Icmp
/// </summary>
/// </summary>
public
class
IcmpRouterAdvertisementLayer
:
IcmpLayer
public
class
IcmpRouterAdvertisementLayer
:
IcmpLayer
{
{
/// <summary>
/// Creates an ICMP layer instance.
/// </summary>
public
IcmpRouterAdvertisementLayer
()
{
}
/// <summary>
/// <summary>
/// The maximum time that the router addresses may be considered valid.
/// The maximum time that the router addresses may be considered valid.
/// </summary>
/// </summary>
...
...
PcapDotNet/src/PcapDotNet.Packets/Icmp/IcmpRouterSolicitationDatagram.cs
View file @
b0b58a33
using
System
;
namespace
PcapDotNet.Packets.Icmp
namespace
PcapDotNet.Packets.Icmp
{
{
/// <summary>
/// <summary>
...
...
PcapDotNet/src/PcapDotNet.Packets/Icmp/IcmpSecurityFailuresDatagram.cs
View file @
b0b58a33
using
System
;
using
System.Linq
;
using
System.Linq
;
using
PcapDotNet.Base
;
using
PcapDotNet.Base
;
...
...
PcapDotNet/src/PcapDotNet.Packets/Icmp/IcmpSourceQuenchDatagram.cs
View file @
b0b58a33
using
System
;
namespace
PcapDotNet.Packets.Icmp
namespace
PcapDotNet.Packets.Icmp
{
{
/// <summary>
/// <summary>
...
...
PcapDotNet/src/PcapDotNet.Packets/Icmp/IcmpTimestampDatagram.cs
View file @
b0b58a33
using
System
;
using
PcapDotNet.Packets.IpV4
;
using
PcapDotNet.Packets.IpV4
;
namespace
PcapDotNet.Packets.Icmp
namespace
PcapDotNet.Packets.Icmp
...
...
PcapDotNet/src/PcapDotNet.Packets/Icmp/IcmpTraceRouteDatagram.cs
View file @
b0b58a33
using
System
;
using
System.Linq
;
using
System.Linq
;
using
PcapDotNet.Base
;
using
PcapDotNet.Base
;
...
...
PcapDotNet/src/PcapDotNet.Packets/Icmp/IcmpTraceRouteLayer.cs
View file @
b0b58a33
using
System
;
namespace
PcapDotNet.Packets.Icmp
namespace
PcapDotNet.Packets.Icmp
{
{
/// <summary>
/// <summary>
...
...
PcapDotNet/src/PcapDotNet.Packets/Igmp/IgmpQueryVersion3Layer.cs
View file @
b0b58a33
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.ObjectModel
;
using
System.Collections.ObjectModel
;
using
System.Linq
;
using
System.Linq
;
using
PcapDotNet.Base
;
using
PcapDotNet.Base
;
...
...
PcapDotNet/src/PcapDotNet.Packets/Igmp/IgmpReportVersion3Layer.cs
View file @
b0b58a33
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.ObjectModel
;
using
System.Collections.ObjectModel
;
using
System.Linq
;
using
System.Linq
;
using
PcapDotNet.Base
;
using
PcapDotNet.Base
;
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV4/IpV4Datagram.cs
View file @
b0b58a33
using
System
;
using
System
;
using
System.Collections
;
using
System.Linq
;
using
System.Text
;
using
PcapDotNet.Packets.Gre
;
using
PcapDotNet.Packets.Gre
;
using
PcapDotNet.Packets.Icmp
;
using
PcapDotNet.Packets.Icmp
;
using
PcapDotNet.Packets.Igmp
;
using
PcapDotNet.Packets.Igmp
;
...
@@ -180,12 +177,7 @@ namespace PcapDotNet.Packets.IpV4
...
@@ -180,12 +177,7 @@ namespace PcapDotNet.Packets.IpV4
/// </summary>
/// </summary>
public
IpV4Options
Options
public
IpV4Options
Options
{
{
get
get
{
return
_options
??
(
_options
=
new
IpV4Options
(
Buffer
,
StartOffset
+
Offset
.
Options
,
RealHeaderLength
-
HeaderMinimumLength
));
}
{
if
(
_options
==
null
)
_options
=
new
IpV4Options
(
Buffer
,
StartOffset
+
Offset
.
Options
,
RealHeaderLength
-
HeaderMinimumLength
);
return
_options
;
}
}
}
/// <summary>
/// <summary>
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV4/IpV4OptionBasicSecurity.cs
View file @
b0b58a33
using
System
;
using
System
;
using
PcapDotNet.Base
;
namespace
PcapDotNet.Packets.IpV4
namespace
PcapDotNet.Packets.IpV4
{
{
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV4/IpV4OptionComplex.cs
View file @
b0b58a33
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Reflection
;
namespace
PcapDotNet.Packets.IpV4
namespace
PcapDotNet.Packets.IpV4
{
{
/// <summary>
/// <summary>
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV4/IpV4OptionLooseSourceRouting.cs
View file @
b0b58a33
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Collections.ObjectModel
;
using
PcapDotNet.Base
;
namespace
PcapDotNet.Packets.IpV4
namespace
PcapDotNet.Packets.IpV4
{
{
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV4/IpV4OptionRecordRoute.cs
View file @
b0b58a33
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
PcapDotNet.Base
;
namespace
PcapDotNet.Packets.IpV4
namespace
PcapDotNet.Packets.IpV4
{
{
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV4/IpV4OptionStrictSourceRouting.cs
View file @
b0b58a33
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
PcapDotNet.Base
;
namespace
PcapDotNet.Packets.IpV4
namespace
PcapDotNet.Packets.IpV4
{
{
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV4/IpV4OptionTimestampOnly.cs
View file @
b0b58a33
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Collections.ObjectModel
;
using
System.Collections.ObjectModel
;
using
System.Linq
;
using
System.Linq
;
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV4/IpV4OptionTimestampType.cs
View file @
b0b58a33
using
System
;
namespace
PcapDotNet.Packets.IpV4
namespace
PcapDotNet.Packets.IpV4
{
{
/// <summary>
/// <summary>
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV4/IpV4Options.cs
View file @
b0b58a33
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Collections.ObjectModel
;
using
System.Linq
;
using
PcapDotNet.Base
;
namespace
PcapDotNet.Packets.IpV4
namespace
PcapDotNet.Packets.IpV4
{
{
...
...
PcapDotNet/src/PcapDotNet.Packets/Layer.cs
View file @
b0b58a33
using
System
;
namespace
PcapDotNet.Packets
namespace
PcapDotNet.Packets
{
{
/// <summary>
/// <summary>
...
@@ -7,7 +9,7 @@ namespace PcapDotNet.Packets
...
@@ -7,7 +9,7 @@ namespace PcapDotNet.Packets
/// A packet can be according to a sequence of layers.
/// A packet can be according to a sequence of layers.
/// <seealso cref="PacketBuilder"/>
/// <seealso cref="PacketBuilder"/>
/// </summary>
/// </summary>
public
abstract
class
Layer
:
ILayer
public
abstract
class
Layer
:
ILayer
,
IEquatable
<
Layer
>
{
{
/// <summary>
/// <summary>
/// The number of bytes this layer will take.
/// The number of bytes this layer will take.
...
...
PcapDotNet/src/PcapDotNet.Packets/OptionComplexFactory.cs
View file @
b0b58a33
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Diagnostics
;
using
System.Linq
;
using
System.Linq
;
using
System.Reflection
;
using
System.Reflection
;
using
PcapDotNet.Base
;
using
PcapDotNet.Base
;
...
@@ -25,7 +24,7 @@ namespace PcapDotNet.Packets
...
@@ -25,7 +24,7 @@ namespace PcapDotNet.Packets
IOptionComplexFactory
prototype
;
IOptionComplexFactory
prototype
;
if
(!
_complexOptions
.
TryGetValue
(
optionType
,
out
prototype
))
if
(!
_complexOptions
.
TryGetValue
(
optionType
,
out
prototype
))
return
U
nknownFactoryOptionPrototype
.
CreateInstance
(
optionType
,
buffer
,
ref
offset
,
optionValueLength
);
return
_u
nknownFactoryOptionPrototype
.
CreateInstance
(
optionType
,
buffer
,
ref
offset
,
optionValueLength
);
return
prototype
.
CreateInstance
(
buffer
,
ref
offset
,
optionValueLength
);
return
prototype
.
CreateInstance
(
buffer
,
ref
offset
,
optionValueLength
);
}
}
...
@@ -72,6 +71,6 @@ namespace PcapDotNet.Packets
...
@@ -72,6 +71,6 @@ namespace PcapDotNet.Packets
}
}
private
static
readonly
Dictionary
<
TOptionType
,
IOptionComplexFactory
>
_complexOptions
=
InitializeComplexOptions
();
private
static
readonly
Dictionary
<
TOptionType
,
IOptionComplexFactory
>
_complexOptions
=
InitializeComplexOptions
();
private
static
readonly
IOptionUnknownFactory
<
TOptionType
>
U
nknownFactoryOptionPrototype
=
InitializeUnknownOptionPrototype
();
private
static
readonly
IOptionUnknownFactory
<
TOptionType
>
_u
nknownFactoryOptionPrototype
=
InitializeUnknownOptionPrototype
();
}
}
}
}
\ No newline at end of file
PcapDotNet/src/PcapDotNet.Packets/OptionComplexFactoryBase.cs
deleted
100644 → 0
View file @
d41fce73
using
System
;
using
System.Diagnostics
;
namespace
PcapDotNet.Packets
{
// internal static class OptionComplexFactoryBase
// {
// /// <summary>
// /// The header length in bytes for the option (type and size).
// /// </summary>
// public const int OptionHeaderLength = 2;
//
//// [DebuggerHidden]
//// protected OptionComplexFactoryBase()
//// {
//// throw new NotImplementedException();
//// }
// }
}
\ No newline at end of file
PcapDotNet/src/PcapDotNet.Packets/Packet.cs
View file @
b0b58a33
...
@@ -252,12 +252,7 @@ namespace PcapDotNet.Packets
...
@@ -252,12 +252,7 @@ namespace PcapDotNet.Packets
/// </summary>
/// </summary>
public
EthernetDatagram
Ethernet
public
EthernetDatagram
Ethernet
{
{
get
get
{
return
_ethernet
??
(
_ethernet
=
new
EthernetDatagram
(
Buffer
,
0
,
Length
));
}
{
if
(
_ethernet
==
null
)
_ethernet
=
new
EthernetDatagram
(
Buffer
,
0
,
Length
);
return
_ethernet
;
}
}
}
private
bool
CalculateIsValid
()
private
bool
CalculateIsValid
()
...
...
PcapDotNet/src/PcapDotNet.Packets/PcapDotNet.Packets.csproj
View file @
b0b58a33
...
@@ -223,7 +223,6 @@
...
@@ -223,7 +223,6 @@
<Compile
Include=
"IpV4\IpV4Protocol.cs"
/>
<Compile
Include=
"IpV4\IpV4Protocol.cs"
/>
<Compile
Include=
"ByteArrayExtensions.cs"
/>
<Compile
Include=
"ByteArrayExtensions.cs"
/>
<Compile
Include=
"OptionComplexFactory.cs"
/>
<Compile
Include=
"OptionComplexFactory.cs"
/>
<Compile
Include=
"OptionComplexFactoryBase.cs"
/>
<Compile
Include=
"Options.cs"
/>
<Compile
Include=
"Options.cs"
/>
<Compile
Include=
"OptionTypeRegistrationAttribute.cs"
/>
<Compile
Include=
"OptionTypeRegistrationAttribute.cs"
/>
<Compile
Include=
"Packet.cs"
/>
<Compile
Include=
"Packet.cs"
/>
...
...
PcapDotNet/src/PcapDotNet.Packets/Properties/AssemblyInfo.cs
View file @
b0b58a33
using
System
;
using
System
;
using
System.Reflection
;
using
System.Reflection
;
using
System.Runtime.CompilerServices
;
using
System.Runtime.InteropServices
;
using
System.Runtime.InteropServices
;
// General Information about an assembly is controlled through the following
// General Information about an assembly is controlled through the following
...
...
PcapDotNet/src/PcapDotNet.Packets/Transport/TcpDatagram.cs
View file @
b0b58a33
...
@@ -159,12 +159,7 @@ namespace PcapDotNet.Packets.Transport
...
@@ -159,12 +159,7 @@ namespace PcapDotNet.Packets.Transport
/// </summary>
/// </summary>
public
TcpOptions
Options
public
TcpOptions
Options
{
{
get
get
{
return
_options
??
(
_options
=
new
TcpOptions
(
Buffer
,
StartOffset
+
Offset
.
Options
,
RealHeaderLength
-
HeaderMinimumLength
));
}
{
if
(
_options
==
null
)
_options
=
new
TcpOptions
(
Buffer
,
StartOffset
+
Offset
.
Options
,
RealHeaderLength
-
HeaderMinimumLength
);
return
_options
;
}
}
}
/// <summary>
/// <summary>
...
...
PcapDotNet/src/PcapDotNet.Packets/Transport/TcpOptionSelectiveAcknowledgmentBlock.cs
View file @
b0b58a33
using
System
;
namespace
PcapDotNet.Packets.Transport
namespace
PcapDotNet.Packets.Transport
{
{
/// <summary>
/// <summary>
/// Represents a block to ack when using the selective ack option.
/// Represents a block to ack when using the selective ack option.
/// </summary>
/// </summary>
public
struct
TcpOptionSelectiveAcknowledgmentBlock
public
struct
TcpOptionSelectiveAcknowledgmentBlock
:
IEquatable
<
TcpOptionSelectiveAcknowledgmentBlock
>
{
{
/// <summary>
/// <summary>
/// The number of bytes this struct take.
/// The number of bytes this struct take.
...
...
PcapDotNet/src/PcapDotNet.Packets/Transport/TcpOptions.cs
View file @
b0b58a33
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
namespace
PcapDotNet.Packets.Transport
namespace
PcapDotNet.Packets.Transport
...
...
PcapDotNet/src/PcapDotNet.Packets/Transport/TransportDatagram.cs
View file @
b0b58a33
using
System
;
namespace
PcapDotNet.Packets.Transport
namespace
PcapDotNet.Packets.Transport
{
{
/// <summary>
/// <summary>
...
...
PcapDotNet/src/PcapDotNet.Packets/Transport/TransportLayer.cs
View file @
b0b58a33
using
System
;
using
PcapDotNet.Packets.IpV4
;
using
PcapDotNet.Packets.IpV4
;
namespace
PcapDotNet.Packets.Transport
namespace
PcapDotNet.Packets.Transport
...
@@ -6,7 +7,7 @@ namespace PcapDotNet.Packets.Transport
...
@@ -6,7 +7,7 @@ namespace PcapDotNet.Packets.Transport
/// Contains the common part of UDP and TCP layers.
/// Contains the common part of UDP and TCP layers.
/// <seealso cref="TransportDatagram"/>
/// <seealso cref="TransportDatagram"/>
/// </summary>
/// </summary>
public
abstract
class
TransportLayer
:
Layer
,
IIpV4NextTransportLayer
public
abstract
class
TransportLayer
:
Layer
,
IIpV4NextTransportLayer
,
IEquatable
<
TransportLayer
>
{
{
/// <summary>
/// <summary>
/// Checksum is the 16-bit one's complement of the one's complement sum of a pseudo header of information from the IP header,
/// Checksum is the 16-bit one's complement of the one's complement sum of a pseudo header of information from the IP header,
...
...
PcapDotNet/src/PcapDotNet.Packets/Transport/UdpDatagram.cs
View file @
b0b58a33
using
System
;
namespace
PcapDotNet.Packets.Transport
namespace
PcapDotNet.Packets.Transport
{
{
/// <summary>
/// <summary>
...
...
PcapDotNet/src/PcapDotNet.TestUtils/MoreAssert.cs
View file @
b0b58a33
...
@@ -3,7 +3,6 @@ using System.Collections.Generic;
...
@@ -3,7 +3,6 @@ using System.Collections.Generic;
using
System.Linq
;
using
System.Linq
;
using
System.Text.RegularExpressions
;
using
System.Text.RegularExpressions
;
using
Microsoft.VisualStudio.TestTools.UnitTesting
;
using
Microsoft.VisualStudio.TestTools.UnitTesting
;
using
PcapDotNet.Base
;
namespace
PcapDotNet.TestUtils
namespace
PcapDotNet.TestUtils
{
{
...
...
PcapDotNet/src/PcapDotNet.TestUtils/Properties/AssemblyInfo.cs
View file @
b0b58a33
using
System.Reflection
;
using
System.Reflection
;
using
System.Runtime.CompilerServices
;
using
System.Runtime.InteropServices
;
using
System.Runtime.InteropServices
;
// General Information about an assembly is controlled through the following
// General Information about an assembly is controlled through the following
...
...
PcapDotNet/src/PcapDotNet.TestUtils/RandomExtensions.cs
View file @
b0b58a33
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Linq
;
using
System.Text
;
using
PcapDotNet.Base
;
using
PcapDotNet.Base
;
namespace
PcapDotNet.TestUtils
namespace
PcapDotNet.TestUtils
...
@@ -121,7 +120,7 @@ namespace PcapDotNet.TestUtils
...
@@ -121,7 +120,7 @@ namespace PcapDotNet.TestUtils
if
(
enumValues
.
Count
==
0
)
if
(
enumValues
.
Count
==
0
)
throw
new
ArgumentException
(
"T is an enum with no values"
,
"T"
);
throw
new
ArgumentException
(
"T is an enum with no values"
,
"T"
);
return
(
T
)
random
.
NextValue
(
enumValues
);
return
random
.
NextValue
(
enumValues
);
}
}
public
static
T
NextEnum
<
T
>(
this
Random
random
,
params
T
[]
valuesToIgnore
)
public
static
T
NextEnum
<
T
>(
this
Random
random
,
params
T
[]
valuesToIgnore
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment