Commit 2d5666f2 authored by Brickner_cp's avatar Brickner_cp

IPv6

parent af901f28
...@@ -85,6 +85,7 @@ ...@@ -85,6 +85,7 @@
<Compile Include="PacketBuilderTests.cs" /> <Compile Include="PacketBuilderTests.cs" />
<Compile Include="PacketTests.cs" /> <Compile Include="PacketTests.cs" />
<Compile Include="PayloadLayerTests.cs" /> <Compile Include="PayloadLayerTests.cs" />
<Compile Include="PppFrameCheckSequenceCalculatorTests.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="IpV4AddressTests.cs" /> <Compile Include="IpV4AddressTests.cs" />
<Compile Include="TcpTests.cs" /> <Compile Include="TcpTests.cs" />
......
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
...@@ -48,7 +48,7 @@ namespace PcapDotNet.Packets.Ethernet ...@@ -48,7 +48,7 @@ namespace PcapDotNet.Packets.Ethernet
} }
/// <summary> /// <summary>
/// The 4 bytes of the France Check Sequence (FCS). /// The 4 bytes of the Frame Check Sequence (FCS).
/// Usually, these bytes won't be available because the device remvoed them after checking their validity. /// 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. /// 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. /// 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.
......
...@@ -3,6 +3,7 @@ ...@@ -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_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/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_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: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: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> <s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/EventHandlerPatternLong/@EntryValue">$object$_On$event$</s:String>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment