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
87cc08fe
Commit
87cc08fe
authored
May 02, 2010
by
Brickner_cp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactoring
parent
7c8be298
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
39 additions
and
38 deletions
+39
-38
UInt128Tests.cs
PcapDotNet/src/PcapDotNet.Base.Test/UInt128Tests.cs
+1
-0
UInt48Tests.cs
PcapDotNet/src/PcapDotNet.Base.Test/UInt48Tests.cs
+0
-35
LivePacketDeviceTests.cs
PcapDotNet/src/PcapDotNet.Core.Test/LivePacketDeviceTests.cs
+1
-1
EndianitiyTests.cs
PcapDotNet/src/PcapDotNet.Packets.Test/EndianitiyTests.cs
+35
-0
ByteArrayExtensions.cs
PcapDotNet/src/PcapDotNet.Packets/ByteArrayExtensions.cs
+1
-1
PcapDotNet.Packets.csproj
PcapDotNet/src/PcapDotNet.Packets/PcapDotNet.Packets.csproj
+1
-1
No files found.
PcapDotNet/src/PcapDotNet.Base.Test/UInt128Tests.cs
View file @
87cc08fe
...
@@ -55,6 +55,7 @@ namespace PcapDotNet.Base.Test
...
@@ -55,6 +55,7 @@ namespace PcapDotNet.Base.Test
UInt128
value
=
random
.
NextUInt128
();
UInt128
value
=
random
.
NextUInt128
();
Assert
.
AreEqual
(
value
,
value
);
Assert
.
AreEqual
(
value
,
value
);
Assert
.
AreNotEqual
(
value
,
string
.
Empty
);
Assert
.
IsTrue
(
value
==
value
);
Assert
.
IsTrue
(
value
==
value
);
Assert
.
IsFalse
(
value
!=
value
);
Assert
.
IsFalse
(
value
!=
value
);
Assert
.
IsNotNull
(
value
.
GetHashCode
());
Assert
.
IsNotNull
(
value
.
GetHashCode
());
...
...
PcapDotNet/src/PcapDotNet.Base.Test/UInt48Tests.cs
View file @
87cc08fe
...
@@ -87,41 +87,6 @@ namespace PcapDotNet.Base.Test
...
@@ -87,41 +87,6 @@ namespace PcapDotNet.Base.Test
Assert
.
IsNotNull
(
value
);
Assert
.
IsNotNull
(
value
);
}
}
// [TestMethod]
// public void UInt48Test()
// {
// UInt48 value = (UInt48)0x010203040506;
// byte[] buffer = new byte[UInt48.SizeOf];
//
// buffer.Write(0, value, Endianity.Big);
// Assert.AreEqual(value, buffer.ReadUInt48(0, Endianity.Big));
// Assert.AreEqual(0x01, buffer[0]);
// Assert.AreEqual(0x02, buffer[1]);
// Assert.AreEqual(0x03, buffer[2]);
// Assert.AreEqual(0x04, buffer[3]);
// Assert.AreEqual(0x05, buffer[4]);
// Assert.AreEqual(0x06, buffer[5]);
//
// int offset = 0;
// buffer.Write(ref offset, value, Endianity.Big);
// Assert.AreEqual(value, buffer.ReadUInt48(0, Endianity.Big));
// Assert.AreEqual(6, offset);
//
// buffer.Write(0, value, Endianity.Small);
// Assert.AreEqual(value, buffer.ReadUInt48(0, Endianity.Small));
// Assert.AreEqual(0x06, buffer[0]);
// Assert.AreEqual(0x05, buffer[1]);
// Assert.AreEqual(0x04, buffer[2]);
// Assert.AreEqual(0x03, buffer[3]);
// Assert.AreEqual(0x02, buffer[4]);
// Assert.AreEqual(0x01, buffer[5]);
//
// offset = 0;
// buffer.Write(ref offset, value, Endianity.Small);
// Assert.AreEqual(value, buffer.ReadUInt48(0, Endianity.Small));
// Assert.AreEqual(6, offset);
// }
[
TestMethod
]
[
TestMethod
]
public
void
UInt48Test
()
public
void
UInt48Test
()
{
{
...
...
PcapDotNet/src/PcapDotNet.Core.Test/LivePacketDeviceTests.cs
View file @
87cc08fe
...
@@ -152,7 +152,7 @@ namespace PcapDotNet.Core.Test
...
@@ -152,7 +152,7 @@ namespace PcapDotNet.Core.Test
TestReceivePacketsEnumerable
(
NumPacketsToSend
,
NumPacketsToSend
/
2
,
int
.
MaxValue
,
2
,
PacketSize
,
NumPacketsToSend
/
2
,
0
,
0.027
);
TestReceivePacketsEnumerable
(
NumPacketsToSend
,
NumPacketsToSend
/
2
,
int
.
MaxValue
,
2
,
PacketSize
,
NumPacketsToSend
/
2
,
0
,
0.027
);
// Wait for more packets
// Wait for more packets
TestReceivePacketsEnumerable
(
NumPacketsToSend
,
-
1
,
int
.
MaxValue
,
2
,
PacketSize
,
NumPacketsToSend
,
2
,
2.02
);
TestReceivePacketsEnumerable
(
NumPacketsToSend
,
-
1
,
int
.
MaxValue
,
2
,
PacketSize
,
NumPacketsToSend
,
2
,
2.02
1
);
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
...
...
PcapDotNet/src/PcapDotNet.Packets.Test/EndianitiyTests.cs
View file @
87cc08fe
...
@@ -81,6 +81,41 @@ namespace PcapDotNet.Packets.Test
...
@@ -81,6 +81,41 @@ namespace PcapDotNet.Packets.Test
Assert
.
AreEqual
(
3
,
offset
);
Assert
.
AreEqual
(
3
,
offset
);
}
}
[
TestMethod
]
public
void
UInt48Test
()
{
UInt48
value
=
(
UInt48
)
0x010203040506
;
byte
[]
buffer
=
new
byte
[
UInt48
.
SizeOf
];
buffer
.
Write
(
0
,
value
,
Endianity
.
Big
);
Assert
.
AreEqual
(
value
,
buffer
.
ReadUInt48
(
0
,
Endianity
.
Big
));
Assert
.
AreEqual
(
0x01
,
buffer
[
0
]);
Assert
.
AreEqual
(
0x02
,
buffer
[
1
]);
Assert
.
AreEqual
(
0x03
,
buffer
[
2
]);
Assert
.
AreEqual
(
0x04
,
buffer
[
3
]);
Assert
.
AreEqual
(
0x05
,
buffer
[
4
]);
Assert
.
AreEqual
(
0x06
,
buffer
[
5
]);
int
offset
=
0
;
buffer
.
Write
(
ref
offset
,
value
,
Endianity
.
Big
);
Assert
.
AreEqual
(
value
,
buffer
.
ReadUInt48
(
0
,
Endianity
.
Big
));
Assert
.
AreEqual
(
6
,
offset
);
buffer
.
Write
(
0
,
value
,
Endianity
.
Small
);
Assert
.
AreEqual
(
value
,
buffer
.
ReadUInt48
(
0
,
Endianity
.
Small
));
Assert
.
AreEqual
(
0x06
,
buffer
[
0
]);
Assert
.
AreEqual
(
0x05
,
buffer
[
1
]);
Assert
.
AreEqual
(
0x04
,
buffer
[
2
]);
Assert
.
AreEqual
(
0x03
,
buffer
[
3
]);
Assert
.
AreEqual
(
0x02
,
buffer
[
4
]);
Assert
.
AreEqual
(
0x01
,
buffer
[
5
]);
offset
=
0
;
buffer
.
Write
(
ref
offset
,
value
,
Endianity
.
Small
);
Assert
.
AreEqual
(
value
,
buffer
.
ReadUInt48
(
0
,
Endianity
.
Small
));
Assert
.
AreEqual
(
6
,
offset
);
}
[
TestMethod
]
[
TestMethod
]
public
void
UIntTest
()
public
void
UIntTest
()
{
{
...
...
PcapDotNet/src/PcapDotNet.Packets/
MoreByteArray
.cs
→
PcapDotNet/src/PcapDotNet.Packets/
ByteArrayExtensions
.cs
View file @
87cc08fe
...
@@ -12,7 +12,7 @@ namespace PcapDotNet.Packets
...
@@ -12,7 +12,7 @@ namespace PcapDotNet.Packets
/// <summary>
/// <summary>
/// Extension methods for byte[].
/// Extension methods for byte[].
/// </summary>
/// </summary>
public
static
class
MoreByteArray
public
static
class
ByteArrayExtensions
{
{
/// <summary>
/// <summary>
/// Copies a specified number of bytes from a source array starting at a particular offset to a destination array starting at a particular offset.
/// Copies a specified number of bytes from a source array starting at a particular offset to a destination array starting at a particular offset.
...
...
PcapDotNet/src/PcapDotNet.Packets/PcapDotNet.Packets.csproj
View file @
87cc08fe
...
@@ -195,7 +195,7 @@
...
@@ -195,7 +195,7 @@
<Compile
Include=
"IpV4\IpV4OptionTraceRoute.cs"
/>
<Compile
Include=
"IpV4\IpV4OptionTraceRoute.cs"
/>
<Compile
Include=
"IpV4\IpV4OptionType.cs"
/>
<Compile
Include=
"IpV4\IpV4OptionType.cs"
/>
<Compile
Include=
"IpV4\IpV4Protocol.cs"
/>
<Compile
Include=
"IpV4\IpV4Protocol.cs"
/>
<Compile
Include=
"
MoreByteArray
.cs"
/>
<Compile
Include=
"
ByteArrayExtensions
.cs"
/>
<Compile
Include=
"OptionComplexFactory.cs"
/>
<Compile
Include=
"OptionComplexFactory.cs"
/>
<Compile
Include=
"OptionComplexFactoryBase.cs"
/>
<Compile
Include=
"OptionComplexFactoryBase.cs"
/>
<Compile
Include=
"Options.cs"
/>
<Compile
Include=
"Options.cs"
/>
...
...
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