Commit c17d49be authored by Brickner_cp's avatar Brickner_cp

IGMP

parent 45344f31
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
namespace PcapDotNet.Base
{
public static class MoreTimeSpan
{
public static TimeSpan Divide(this TimeSpan timeSpan, double value)
{
return TimeSpan.FromTicks((long)(timeSpan.Ticks / value));
}
}
}
\ No newline at end of file
......@@ -62,6 +62,7 @@
<Compile Include="MoreIEnumerable.cs" />
<Compile Include="MoreIList.cs" />
<Compile Include="MorePropertyInfo.cs" />
<Compile Include="MoreTimeSpan.cs" />
<Compile Include="MoreType.cs" />
<Compile Include="Tuple.cs" />
<Compile Include="UInt24.cs" />
......
This diff is collapsed.
......@@ -49,6 +49,7 @@
<Compile Include="DataLinkTests.cs" />
<Compile Include="EndianitiyTests.cs" />
<Compile Include="EthernetTests.cs" />
<Compile Include="IgmpTests.cs" />
<Compile Include="IpV4Tests.cs" />
<Compile Include="MacAddressTests.cs" />
<Compile Include="PacketTests.cs" />
......
......@@ -48,6 +48,9 @@ namespace PcapDotNet.Packets.Igmp
public const int HeaderMinimumLength = 8;
/// <summary>
/// The type of group record included in the report message.
/// </summary>
public IgmpRecordType RecordType
{
get { return (IgmpRecordType)this[Offset.RecordType]; }
......
namespace PcapDotNet.Packets.Igmp
{
public enum IgmpType : byte
public enum IgmpMessageType : byte
{
/// <summary>
/// Illegal type.
......
......@@ -13,6 +13,19 @@ namespace PcapDotNet.Packets.IpV4
/// </summary>
public const int SizeOf = sizeof(uint);
/// <summary>
/// The zero address (0.0.0.0).
/// </summary>
public static IpV4Address Zero
{
get { return _zero; }
}
public static IpV4Address AllHostsHroupAddress
{
get { return _allHostsHroupAddress; }
}
/// <summary>
/// Create an address from a 32 bit integer.
/// 0 -> 0.0.0.0
......@@ -36,14 +49,6 @@ namespace PcapDotNet.Packets.IpV4
(byte.Parse(values[3], CultureInfo.InvariantCulture)));
}
/// <summary>
/// The zero address (0.0.0.0).
/// </summary>
public static IpV4Address Zero
{
get { return _zero; }
}
/// <summary>
/// Gets the address valud as a 32 bit integer.
/// </summary>
......@@ -113,5 +118,6 @@ namespace PcapDotNet.Packets.IpV4
private readonly uint _value;
private static readonly IpV4Address _zero = new IpV4Address(0);
private static readonly IpV4Address _allHostsHroupAddress = new IpV4Address("224.0.0.1");
}
}
\ No newline at end of file
......@@ -75,7 +75,7 @@
<Compile Include="Igmp\IgmpGroupRecordDatagram.cs" />
<Compile Include="Igmp\IgmpQueryVersion.cs" />
<Compile Include="Igmp\IgmpRecordType.cs" />
<Compile Include="Igmp\IgmpType.cs" />
<Compile Include="Igmp\IgmpMessageType.cs" />
<Compile Include="IOptionUnknownFactory.cs" />
<Compile Include="IpV4\IpV4OptionUnknown.cs" />
<Compile Include="Option.cs" />
......
......@@ -101,6 +101,11 @@ namespace PcapDotNet.TestUtils
return random.NextDateTime(DateTime.MinValue, DateTime.MaxValue);
}
public static TimeSpan NextTimeSpan(this Random random, TimeSpan minimumValue, TimeSpan maximumValue)
{
return TimeSpan.FromTicks(random.NextLong(minimumValue.Ticks, maximumValue.Ticks + 1));
}
public static T NextEnum<T>(this Random random, IEnumerable<T> valuesToIgnore)
{
Type type = typeof(T);
......
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