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
2d5666f2
Commit
2d5666f2
authored
Sep 07, 2012
by
Brickner_cp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
IPv6
parent
af901f28
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
311 additions
and
2 deletions
+311
-2
PcapDotNet.Packets.Test.csproj
...rc/PcapDotNet.Packets.Test/PcapDotNet.Packets.Test.csproj
+1
-0
PppFrameCheckSequenceCalculatorTests.cs
...tNet.Packets.Test/PppFrameCheckSequenceCalculatorTests.cs
+67
-0
EthernetBaseDatagram.cs
...t/src/PcapDotNet.Packets/Ethernet/EthernetBaseDatagram.cs
+1
-1
IpV6Datagram.cs
PcapDotNet/src/PcapDotNet.Packets/IpV6/IpV6Datagram.cs
+241
-1
PcapDotNet.sln.DotSettings
PcapDotNet/src/PcapDotNet.sln.DotSettings
+1
-0
No files found.
PcapDotNet/src/PcapDotNet.Packets.Test/PcapDotNet.Packets.Test.csproj
View file @
2d5666f2
...
...
@@ -85,6 +85,7 @@
<Compile
Include=
"PacketBuilderTests.cs"
/>
<Compile
Include=
"PacketTests.cs"
/>
<Compile
Include=
"PayloadLayerTests.cs"
/>
<Compile
Include=
"PppFrameCheckSequenceCalculatorTests.cs"
/>
<Compile
Include=
"Properties\AssemblyInfo.cs"
/>
<Compile
Include=
"IpV4AddressTests.cs"
/>
<Compile
Include=
"TcpTests.cs"
/>
...
...
PcapDotNet/src/PcapDotNet.Packets.Test/PppFrameCheckSequenceCalculatorTests.cs
0 → 100644
View file @
2d5666f2
using
System
;
using
Microsoft.VisualStudio.TestTools.UnitTesting
;
using
PcapDotNet.Packets.IpV6
;
using
PcapDotNet.Packets.TestUtils
;
namespace
PcapDotNet.Packets.Test
{
/// <summary>
/// Summary description for PppFrameCheckSequenceCalculatorTests
/// </summary>
[
TestClass
]
public
class
PppFrameCheckSequenceCalculatorTests
{
/// <summary>
/// Gets or sets the test context which provides
/// information about and functionality for the current test run.
/// </summary>
public
TestContext
TestContext
{
get
;
set
;
}
#
region
Additional
test
attributes
//
// You can use the following additional attributes as you write your tests:
//
// Use ClassInitialize to run code before running the first test in the class
// [ClassInitialize()]
// public static void MyClassInitialize(TestContext testContext) { }
//
// Use ClassCleanup to run code after all tests in a class have run
// [ClassCleanup()]
// public static void MyClassCleanup() { }
//
// Use TestInitialize to run code before running each test
// [TestInitialize()]
// public void MyTestInitialize() { }
//
// Use TestCleanup to run code after each test has run
// [TestCleanup()]
// public void MyTestCleanup() { }
//
#
endregion
[
TestMethod
]
public
void
RandomFcs16Test
()
{
Random
random
=
new
Random
();
for
(
int
i
=
0
;
i
!=
100
;
++
i
)
{
DataSegment
data
=
random
.
NextDataSegment
(
random
.
Next
(
1000
));
ushort
fcs
=
PppFrameCheckSequenceCalculator
.
CalculateFcs16
(
data
);
}
}
[
TestMethod
]
public
void
GoodFcs16Test
()
{
const
ushort
GoodFcs16
=
0xf0b8
;
for
(
int
fcs16Value
=
0
;
fcs16Value
<=
ushort
.
MaxValue
;
++
fcs16Value
)
{
ushort
extraValue
=
(
ushort
)(
fcs16Value
^
0xffff
);
// Complement.
Assert
.
AreEqual
(
GoodFcs16
,
PppFrameCheckSequenceCalculator
.
CalculateFcs16
((
ushort
)
fcs16Value
,
new
[]
{
(
byte
)
extraValue
,
(
byte
)(
extraValue
>>
8
)
}));
}
}
}
}
\ No newline at end of file
PcapDotNet/src/PcapDotNet.Packets/Ethernet/EthernetBaseDatagram.cs
View file @
2d5666f2
...
...
@@ -48,7 +48,7 @@ namespace PcapDotNet.Packets.Ethernet
}
/// <summary>
/// The 4 bytes of the Fra
nc
e Check Sequence (FCS).
/// The 4 bytes of the Fra
m
e Check Sequence (FCS).
/// Usually, these bytes won't be available because the device remvoed them after checking their validity.
/// We assume they exist when we see that the Ethernet padding pads to 68 bytes or more.
/// If the padding isn't that long or we don't know how to calculate the real payload length, <see langword="null"/> will be returned.
...
...
PcapDotNet/src/PcapDotNet.Packets/IpV6/IpV6Datagram.cs
View file @
2d5666f2
This diff is collapsed.
Click to expand it.
PcapDotNet/src/PcapDotNet.sln.DotSettings
View file @
2d5666f2
...
...
@@ -3,6 +3,7 @@
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/INDENT_ANONYMOUS_METHOD_BLOCK/@EntryValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/INDENT_EMBRACED_INITIALIZER_BLOCK/@EntryValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/SPACE_AFTER_TYPECAST_PARENTHESES/@EntryValue">False</s:Boolean>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/SPACE_AROUND_MULTIPLICATIVE_OP/@EntryValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/SPACE_BEFORE_SIZEOF_PARENTHESES/@EntryValue">False</s:Boolean>
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_LIMIT/@EntryValue">160</s:Int64>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/EventHandlerPatternLong/@EntryValue">$object$_On$event$</s:String>
...
...
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