Commit a1d11f17 authored by Brickner_cp's avatar Brickner_cp

IPv6

parent 14e2149e
...@@ -687,6 +687,18 @@ namespace PcapDotNet.Packets ...@@ -687,6 +687,18 @@ namespace PcapDotNet.Packets
buffer.Write(offset, (long)value, endianity); buffer.Write(offset, (long)value, endianity);
} }
/// <summary>
/// Writes the given value to the buffer using the given endianity and increments the offset by the number of bytes written.
/// </summary>
/// <param name="buffer">The buffer to write the value to.</param>
/// <param name="offset">The offset in the buffer to start writing.</param>
/// <param name="value">The value to write.</param>
/// <param name="endianity">The endianity to use when converting the value to bytes.</param>
public static void Write(this byte[] buffer, ref int offset, ulong value, Endianity endianity)
{
buffer.Write(offset, (long)value, endianity);
}
/// <summary> /// <summary>
/// Writes the given value to the buffer using the given endianity. /// Writes the given value to the buffer using the given endianity.
/// </summary> /// </summary>
......
using System;
namespace PcapDotNet.Packets.IpV6 namespace PcapDotNet.Packets.IpV6
{ {
/// <summary> /// <summary>
...@@ -7,7 +9,6 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -7,7 +9,6 @@ namespace PcapDotNet.Packets.IpV6
/// | 0 | 0 | /// | 0 | 0 |
/// +-----+-----+ /// +-----+-----+
/// </summary> /// </summary>
[IpV6OptionTypeRegistration(IpV6OptionType.Pad1)]
public class IpV6OptionPad1 : IpV6OptionSimple public class IpV6OptionPad1 : IpV6OptionSimple
{ {
public const int OptionLength = sizeof(byte); public const int OptionLength = sizeof(byte);
...@@ -16,11 +17,6 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -16,11 +17,6 @@ namespace PcapDotNet.Packets.IpV6
: base(IpV6OptionType.Pad1) : base(IpV6OptionType.Pad1)
{ {
} }
internal override IpV6Option CreateInstance(DataSegment data)
{
return new IpV6OptionPad1();
}
} }
/// <summary> /// <summary>
...@@ -31,7 +27,6 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -31,7 +27,6 @@ namespace PcapDotNet.Packets.IpV6
/// | 0 | 0 | /// | 0 | 0 |
/// +-----+-----+ /// +-----+-----+
/// </summary> /// </summary>
[IpV6MobilityOptionTypeRegistration(IpV6MobilityOptionType.Pad1)]
public class IpV6MobilityOptionPad1 : IpV6MobilityOption public class IpV6MobilityOptionPad1 : IpV6MobilityOption
{ {
public const int OptionLength = sizeof(byte); public const int OptionLength = sizeof(byte);
...@@ -43,7 +38,7 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -43,7 +38,7 @@ namespace PcapDotNet.Packets.IpV6
internal override IpV6MobilityOption CreateInstance(DataSegment data) internal override IpV6MobilityOption CreateInstance(DataSegment data)
{ {
return new IpV6MobilityOptionPad1(); throw new InvalidOperationException("Pad1 options shouldn't be registered.");
} }
} }
} }
\ No newline at end of file
...@@ -3,14 +3,16 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -3,14 +3,16 @@ namespace PcapDotNet.Packets.IpV6
/// <summary> /// <summary>
/// RFC 2460. /// RFC 2460.
/// <pre> /// <pre>
/// +-----+-------------+--------------+ /// +-----+-------------+
/// | Bit | 0-7 | 8-15 | /// | Bit | 0-7 |
/// +-----+-------------+--------------+ /// +-----+-------------+
/// | 0 | Option Type | N | /// | 0 | Option Type |
/// +-----+-------------+--------------+ /// +-----+-------------+
/// | 16 | 0 | /// | 8 | N |
/// | ... | | /// +-----+-------------+
/// +-----+----------------------------+ /// | 16 | 0 |
/// | ... | |
/// +-----+-------------+
/// </pre> /// </pre>
/// </summary> /// </summary>
[IpV6OptionTypeRegistration(IpV6OptionType.PadN)] [IpV6OptionTypeRegistration(IpV6OptionType.PadN)]
......
using System;
namespace PcapDotNet.Packets.IpV6 namespace PcapDotNet.Packets.IpV6
{ {
/// <summary> /// <summary>
...@@ -25,5 +27,10 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -25,5 +27,10 @@ namespace PcapDotNet.Packets.IpV6
{ {
base.Write(buffer, ref offset); base.Write(buffer, ref offset);
} }
internal override sealed IpV6Option CreateInstance(DataSegment data)
{
throw new InvalidOperationException("Simple options shouldn't be registered.");
}
} }
} }
\ No newline at end of file
...@@ -99,7 +99,7 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -99,7 +99,7 @@ namespace PcapDotNet.Packets.IpV6
/// <summary> /// <summary>
/// RFC 6275. /// RFC 6275.
/// </summary> /// </summary>
AuthorizationData = 0x05, BindingAuthorizationData = 0x05,
/// <summary> /// <summary>
/// RFC 3963. /// RFC 3963.
...@@ -111,25 +111,25 @@ namespace PcapDotNet.Packets.IpV6 ...@@ -111,25 +111,25 @@ namespace PcapDotNet.Packets.IpV6
/// RFC 5568. /// RFC 5568.
/// Mobility Header Link-Layer Address option. /// Mobility Header Link-Layer Address option.
/// </summary> /// </summary>
MobilityHeaderLinkLayerAddress = 0x07, LinkLayerAddress = 0x07,
/// <summary> /// <summary>
/// RFC 4283. /// RFC 4283.
/// MN-ID-OPTION-TYPE. /// MN-ID-OPTION-TYPE.
/// </summary> /// </summary>
MnId = 0x08, MobileNodeIdentifier = 0x08,
/// <summary> /// <summary>
/// RFC 4285. /// RFC 4285.
/// AUTH-OPTION-TYPE. /// AUTH-OPTION-TYPE.
/// </summary> /// </summary>
Auth = 0x09, Authentication = 0x09,
/// <summary> /// <summary>
/// RFC 4285. /// RFC 4285.
/// MESG-ID-OPTION-TYPE /// MESG-ID-OPTION-TYPE
/// </summary> /// </summary>
MesgId = 0x0A, ReplayProtection = 0x0A,
/// <summary> /// <summary>
/// RFC 4866. /// RFC 4866.
......
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