Commit a068e7c2 authored by Brickner_cp's avatar Brickner_cp

Documentation. 229 documentation warnings left.

parent 8daded36
...@@ -6,13 +6,32 @@ using System.Text; ...@@ -6,13 +6,32 @@ using System.Text;
namespace PcapDotNet.Base namespace PcapDotNet.Base
{ {
/// <summary>
/// Extension methods for IEnumerable of type T.
/// </summary>
public static class MoreIEnumerable public static class MoreIEnumerable
{ {
public static IEnumerable<T> Concat<T>(this IEnumerable<T> sequence, T value) /// <summary>
/// Concatenates a sequence with more values.
/// </summary>
/// <typeparam name="T">The type of an element in the sequence.</typeparam>
/// <param name="sequence">The sequence to concatenate.</param>
/// <param name="values">The values that will be concatenated with the sequence.</param>
/// <returns>A sequence containing all the original sequence elements cocatenated with values elements.</returns>
public static IEnumerable<T> Concat<T>(this IEnumerable<T> sequence, params T[] values)
{ {
return sequence.Concat(new[] {value}); return sequence.Concat((IEnumerable<T>)values);
} }
/// <summary>
/// Converts a sequence to a string by converting each element to a string.
/// </summary>
/// <typeparam name="T">The type of an element in the sequence.</typeparam>
/// <param name="sequence">The sequence with the elements to translate to string.</param>
/// <param name="separator">A separator between the elements.</param>
/// <param name="prefix">Prefix to the entire string.</param>
/// <param name="suffix">Suffix to the entire string.</param>
/// <returns>A string of all the elements.</returns>
public static string SequenceToString<T>(this IEnumerable<T> sequence, string separator, string prefix, string suffix) public static string SequenceToString<T>(this IEnumerable<T> sequence, string separator, string prefix, string suffix)
{ {
StringBuilder stringBuilder = new StringBuilder(); StringBuilder stringBuilder = new StringBuilder();
...@@ -30,21 +49,48 @@ namespace PcapDotNet.Base ...@@ -30,21 +49,48 @@ namespace PcapDotNet.Base
return stringBuilder.ToString(); return stringBuilder.ToString();
} }
/// <summary>
/// Converts a sequence to a string by converting each element to a string.
/// </summary>
/// <typeparam name="T">The type of an element in the sequence.</typeparam>
/// <param name="sequence">The sequence with the elements to translate to string.</param>
/// <param name="separator">A separator between the elements.</param>
/// <param name="prefix">Prefix to the entire string.</param>
/// <returns>A string of all the elements.</returns>
public static string SequenceToString<T>(this IEnumerable<T> sequence, string separator, string prefix) public static string SequenceToString<T>(this IEnumerable<T> sequence, string separator, string prefix)
{ {
return sequence.SequenceToString(separator, prefix, string.Empty); return sequence.SequenceToString(separator, prefix, string.Empty);
} }
/// <summary>
/// Converts a sequence to a string by converting each element to a string.
/// </summary>
/// <typeparam name="T">The type of an element in the sequence.</typeparam>
/// <param name="sequence">The sequence with the elements to translate to string.</param>
/// <param name="separator">A separator between the elements.</param>
/// <returns>A string of all the elements.</returns>
public static string SequenceToString<T>(this IEnumerable<T> sequence, string separator) public static string SequenceToString<T>(this IEnumerable<T> sequence, string separator)
{ {
return sequence.SequenceToString(separator, string.Empty); return sequence.SequenceToString(separator, string.Empty);
} }
/// <summary>
/// Converts a sequence to a string by converting each element to a string.
/// </summary>
/// <typeparam name="T">The type of an element in the sequence.</typeparam>
/// <param name="sequence">The sequence with the elements to translate to string.</param>
/// <returns>A string of all the elements.</returns>
public static string SequenceToString<T>(this IEnumerable<T> sequence) public static string SequenceToString<T>(this IEnumerable<T> sequence)
{ {
return sequence.SequenceToString(string.Empty); return sequence.SequenceToString(string.Empty);
} }
/// <summary>
/// Creates a hash code by xoring the hash codes of the elements in the sequence.
/// </summary>
/// <typeparam name="T">The type of the elements in the sequence.</typeparam>
/// <param name="sequence">The sequence with the elements to create the hash code for.</param>
/// <returns>The hash code created by xoring all the hash codes of the elements in the sequence.</returns>
public static int SequenceGetHashCode<T>(this IEnumerable<T> sequence) public static int SequenceGetHashCode<T>(this IEnumerable<T> sequence)
{ {
return sequence.Aggregate(0, (valueSoFar, element) => valueSoFar ^ element.GetHashCode()); return sequence.Aggregate(0, (valueSoFar, element) => valueSoFar ^ element.GetHashCode());
......
...@@ -3,8 +3,17 @@ using System.Collections.ObjectModel; ...@@ -3,8 +3,17 @@ using System.Collections.ObjectModel;
namespace PcapDotNet.Base namespace PcapDotNet.Base
{ {
/// <summary>
/// Extension methods for IList of type T.
/// </summary>
public static class MoreIList public static class MoreIList
{ {
/// <summary>
/// Wraps a list with a ReadOnlyCollection.
/// </summary>
/// <typeparam name="T">The type of an element in the collection.</typeparam>
/// <param name="list">The list to wrap in a ReadOnlyCollection.</param>
/// <returns></returns>
public static ReadOnlyCollection<T> AsReadOnly<T>(this IList<T> list) public static ReadOnlyCollection<T> AsReadOnly<T>(this IList<T> list)
{ {
return new ReadOnlyCollection<T>(list); return new ReadOnlyCollection<T>(list);
......
using System;
namespace PcapDotNet.Base namespace PcapDotNet.Base
{ {
public class Tuple<TValue1, TValue2> /// <summary>
/// A tuple of two values.
/// </summary>
/// <typeparam name="TValue1">The type of the first value.</typeparam>
/// <typeparam name="TValue2">The type of the second value.</typeparam>
public struct Tuple<TValue1, TValue2> : IEquatable<Tuple<TValue1, TValue2>>
{ {
/// <summary>
/// Constructs a tuple from two values.
/// </summary>
/// <param name="value1">The first value.</param>
/// <param name="value2">The second value.</param>
public Tuple(TValue1 value1, TValue2 value2) public Tuple(TValue1 value1, TValue2 value2)
{ {
_value1 = value1; _value1 = value1;
_value2 = value2; _value2 = value2;
} }
/// <summary>
/// The first value.
/// </summary>
public TValue1 Value1 public TValue1 Value1
{ {
get { return _value1; } get { return _value1; }
} }
/// <summary>
/// The second value.
/// </summary>
public TValue2 Value2 public TValue2 Value2
{ {
get { return _value2; } get { return _value2; }
} }
/// <summary>
/// Tuples are equal if all their values are equal.
/// </summary>
public bool Equals(Tuple<TValue1, TValue2> other)
{
return _value1.Equals(other._value1) &&
_value2.Equals(other._value2);
}
/// <summary>
/// Tuples are equal if all their values are equal.
/// </summary>
public override bool Equals(object obj)
{
return (obj is Tuple<TValue1, TValue2>) &&
Equals((Tuple<TValue1, TValue2>)obj);
}
/// <summary>
/// Tuples are equal if all their values are equal.
/// </summary>
public static bool operator ==(Tuple<TValue1, TValue2> value1, Tuple<TValue1, TValue2> value2)
{
return value1.Equals(value2);
}
/// <summary>
/// Tuples are equal if all their values are equal.
/// </summary>
public static bool operator !=(Tuple<TValue1, TValue2> value1, Tuple<TValue1, TValue2> value2)
{
return !(value1 == value2);
}
/// <summary>
/// A hash code for a tuple is a xor its values.
/// </summary>
public override int GetHashCode()
{
return _value1.GetHashCode() ^ _value2.GetHashCode();
}
private readonly TValue1 _value1; private readonly TValue1 _value1;
private readonly TValue2 _value2; private readonly TValue2 _value2;
} }
......
...@@ -7,49 +7,107 @@ using System.Text; ...@@ -7,49 +7,107 @@ using System.Text;
namespace PcapDotNet.Base namespace PcapDotNet.Base
{ {
/// <summary>
/// A 24 bit unsigned integer.
/// </summary>
[StructLayout(LayoutKind.Sequential, Pack = 1)] [StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct UInt24 public struct UInt24
{ {
/// <summary>
/// The number of bytes this type will take.
/// </summary>
public const int SizeOf = 3; public const int SizeOf = 3;
/// <summary>
/// The maximum value of this type.
/// </summary>
public static readonly UInt24 MaxValue = (UInt24)0x00FFFFFF; public static readonly UInt24 MaxValue = (UInt24)0x00FFFFFF;
/// <summary>
/// Converts a 32 bit signed integer to a 24 bit unsigned integer by taking the 24 least significant bits.
/// </summary>
/// <param name="value">The 32 bit value to convert.</param>
/// <returns>The 24 bit value created by taking the 24 least significant bits of the 32 bit value.</returns>
public static explicit operator UInt24(int value) public static explicit operator UInt24(int value)
{ {
return new UInt24(value); return new UInt24(value);
} }
/// <summary>
/// Converts the 24 bits unsigned integer to a 32 bits signed integer.
/// </summary>
/// <param name="value">The 24 bit value to convert.</param>
/// <returns>The 32 bit value converted from the 24 bit value.</returns>
public static implicit operator int(UInt24 value) public static implicit operator int(UInt24 value)
{ {
return value.ToInt(); return value.ToInt();
} }
/// <summary>
/// Returns true iff the two values represent the same value.
/// </summary>
/// <param name="other">The value to compare to.</param>
/// <returns>True iff the two values represent the same value.</returns>
public bool Equals(UInt24 other) public bool Equals(UInt24 other)
{ {
return _mostSignificant == other._mostSignificant && return _mostSignificant == other._mostSignificant &&
_leastSignificant == other._leastSignificant; _leastSignificant == other._leastSignificant;
} }
/// <summary>
/// Indicates whether this instance and a specified object are equal.
/// </summary>
/// <returns>
/// true if <paramref name="obj"/> and this instance are the same type and represent the same value; otherwise, false.
/// </returns>
/// <param name="obj">Another object to compare to. </param><filterpriority>2</filterpriority>
public override bool Equals(object obj) public override bool Equals(object obj)
{ {
return (obj is UInt24) && return (obj is UInt24) &&
Equals((UInt24)obj); Equals((UInt24)obj);
} }
/// <summary>
/// Returns true iff the two values represent the same value.
/// </summary>
/// <param name="value1">The first value to compare.</param>
/// <param name="value2">The second value to compare.</param>
/// <returns>True iff the two values represent the same value.</returns>
public static bool operator ==(UInt24 value1, UInt24 value2) public static bool operator ==(UInt24 value1, UInt24 value2)
{ {
return value1.Equals(value2); return value1.Equals(value2);
} }
/// <summary>
/// Returns true iff the two values represent different values.
/// </summary>
/// <param name="value1">The first value to compare.</param>
/// <param name="value2">The second value to compare.</param>
/// <returns>True iff the two values represent different values.</returns>
public static bool operator !=(UInt24 value1, UInt24 value2) public static bool operator !=(UInt24 value1, UInt24 value2)
{ {
return !(value1 == value2); return !(value1 == value2);
} }
/// <summary>
/// Returns the hash code for this instance.
/// </summary>
/// <returns>
/// A 32-bit signed integer that is the hash code for this instance.
/// </returns>
/// <filterpriority>2</filterpriority>
public override int GetHashCode() public override int GetHashCode()
{ {
return this; return this;
} }
/// <summary>
/// Returns the fully qualified type name of this instance.
/// </summary>
/// <returns>
/// A <see cref="T:System.String"/> containing a fully qualified type name.
/// </returns>
/// <filterpriority>2</filterpriority>
public override string ToString() public override string ToString()
{ {
return ((int)this).ToString(CultureInfo.InvariantCulture); return ((int)this).ToString(CultureInfo.InvariantCulture);
......
...@@ -3,49 +3,107 @@ using System.Runtime.InteropServices; ...@@ -3,49 +3,107 @@ using System.Runtime.InteropServices;
namespace PcapDotNet.Base namespace PcapDotNet.Base
{ {
/// <summary>
/// A 48 bit unsigned integer.
/// </summary>
[StructLayout(LayoutKind.Sequential, Pack = 1)] [StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct UInt48 public struct UInt48
{ {
/// <summary>
/// The number of bytes this type will take.
/// </summary>
public const int SizeOf = 6; public const int SizeOf = 6;
/// <summary>
/// The maximum value of this type.
/// </summary>
public static readonly UInt48 MaxValue = (UInt48)0x0000FFFFFFFFFFFF; public static readonly UInt48 MaxValue = (UInt48)0x0000FFFFFFFFFFFF;
/// <summary>
/// Converts a 64 bit signed integer to a 48 bit unsigned integer by taking the 48 least significant bits.
/// </summary>
/// <param name="value">The 64 bit value to convert.</param>
/// <returns>The 48 bit value created by taking the 48 least significant bits of the 64 bit value.</returns>
public static explicit operator UInt48(long value) public static explicit operator UInt48(long value)
{ {
return new UInt48(value); return new UInt48(value);
} }
/// <summary>
/// Converts the 48 bits unsigned integer to a 64 bits signed integer.
/// </summary>
/// <param name="value">The 48 bit value to convert.</param>
/// <returns>The 64 bit value converted from the 48 bit value.</returns>
public static implicit operator long(UInt48 value) public static implicit operator long(UInt48 value)
{ {
return value.ToLong(); return value.ToLong();
} }
/// <summary>
/// Returns true iff the two values represent the same value.
/// </summary>
/// <param name="other">The value to compare to.</param>
/// <returns>True iff the two values represent the same value.</returns>
public bool Equals(UInt48 other) public bool Equals(UInt48 other)
{ {
return _mostSignificant == other._mostSignificant && return _mostSignificant == other._mostSignificant &&
_leastSignificant == other._leastSignificant; _leastSignificant == other._leastSignificant;
} }
/// <summary>
/// Indicates whether this instance and a specified object are equal.
/// </summary>
/// <returns>
/// true if <paramref name="obj"/> and this instance are the same type and represent the same value; otherwise, false.
/// </returns>
/// <param name="obj">Another object to compare to. </param><filterpriority>2</filterpriority>
public override bool Equals(object obj) public override bool Equals(object obj)
{ {
return (obj is UInt48) && return (obj is UInt48) &&
Equals((UInt48)obj); Equals((UInt48)obj);
} }
/// <summary>
/// Returns true iff the two values represent the same value.
/// </summary>
/// <param name="value1">The first value to compare.</param>
/// <param name="value2">The second value to compare.</param>
/// <returns>True iff the two values represent the same value.</returns>
public static bool operator ==(UInt48 value1, UInt48 value2) public static bool operator ==(UInt48 value1, UInt48 value2)
{ {
return value1.Equals(value2); return value1.Equals(value2);
} }
/// <summary>
/// Returns true iff the two values represent different values.
/// </summary>
/// <param name="value1">The first value to compare.</param>
/// <param name="value2">The second value to compare.</param>
/// <returns>True iff the two values represent different values.</returns>
public static bool operator !=(UInt48 value1, UInt48 value2) public static bool operator !=(UInt48 value1, UInt48 value2)
{ {
return !(value1 == value2); return !(value1 == value2);
} }
/// <summary>
/// Returns the hash code for this instance.
/// </summary>
/// <returns>
/// A 32-bit signed integer that is the hash code for this instance.
/// </returns>
/// <filterpriority>2</filterpriority>
public override int GetHashCode() public override int GetHashCode()
{ {
return ((long)this).GetHashCode(); return ((long)this).GetHashCode();
} }
/// <summary>
/// Returns the fully qualified type name of this instance.
/// </summary>
/// <returns>
/// A <see cref="T:System.String"/> containing a fully qualified type name.
/// </returns>
/// <filterpriority>2</filterpriority>
public override string ToString() public override string ToString()
{ {
return ((long)this).ToString(CultureInfo.InvariantCulture); return ((long)this).ToString(CultureInfo.InvariantCulture);
......
using System; using System;
using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.VisualStudio.TestTools.UnitTesting;
using PcapDotNet.Base; using PcapDotNet.Base;
using PcapDotNet.Packets; using PcapDotNet.Packets.Ethernet;
using PcapDotNet.Packets.TestUtils; using PcapDotNet.Packets.TestUtils;
using PcapDotNet.TestUtils; using PcapDotNet.TestUtils;
......
...@@ -5,7 +5,7 @@ using namespace System; ...@@ -5,7 +5,7 @@ using namespace System;
using namespace System::Text; using namespace System::Text;
using namespace System::Net; using namespace System::Net;
using namespace PcapDotNet::Core; using namespace PcapDotNet::Core;
using namespace PcapDotNet::Packets; using namespace PcapDotNet::Packets::IpV4;
IpV4Address IpV4SocketAddress::Address::get() IpV4Address IpV4SocketAddress::Address::get()
{ {
......
...@@ -14,9 +14,9 @@ namespace PcapDotNet { namespace Core ...@@ -14,9 +14,9 @@ namespace PcapDotNet { namespace Core
/// <summary> /// <summary>
/// The ip version 4 address. /// The ip version 4 address.
/// </summary> /// </summary>
property Packets::IpV4Address Address property Packets::IpV4::IpV4Address Address
{ {
Packets::IpV4Address get(); Packets::IpV4::IpV4Address get();
} }
virtual System::String^ ToString() override; virtual System::String^ ToString() override;
...@@ -25,6 +25,6 @@ namespace PcapDotNet { namespace Core ...@@ -25,6 +25,6 @@ namespace PcapDotNet { namespace Core
IpV4SocketAddress(sockaddr *address); IpV4SocketAddress(sockaddr *address);
private: private:
Packets::IpV4Address _address; Packets::IpV4::IpV4Address _address;
}; };
}} }}
\ No newline at end of file
using System; using System;
using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.VisualStudio.TestTools.UnitTesting;
using PcapDotNet.Packets.Ethernet;
using PcapDotNet.Packets.TestUtils; using PcapDotNet.Packets.TestUtils;
using PcapDotNet.TestUtils; using PcapDotNet.TestUtils;
......
...@@ -3,6 +3,7 @@ using System.Text; ...@@ -3,6 +3,7 @@ using System.Text;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.VisualStudio.TestTools.UnitTesting;
using PcapDotNet.Packets.IpV4;
using PcapDotNet.Packets.TestUtils; using PcapDotNet.Packets.TestUtils;
namespace PcapDotNet.Packets.Test namespace PcapDotNet.Packets.Test
......
...@@ -3,6 +3,8 @@ using System.Collections.Generic; ...@@ -3,6 +3,8 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.VisualStudio.TestTools.UnitTesting;
using PcapDotNet.Base; using PcapDotNet.Base;
using PcapDotNet.Packets.Ethernet;
using PcapDotNet.Packets.IpV4;
using PcapDotNet.Packets.TestUtils; using PcapDotNet.Packets.TestUtils;
using PcapDotNet.TestUtils; using PcapDotNet.TestUtils;
...@@ -218,15 +220,6 @@ namespace PcapDotNet.Packets.Test ...@@ -218,15 +220,6 @@ namespace PcapDotNet.Packets.Test
Assert.Fail(); Assert.Fail();
} }
[TestMethod]
[ExpectedException(typeof(ArgumentException))]
public void IpV4OptionSimpleErrorTest()
{
IpV4Option option = new IpV4OptionSimple(IpV4OptionType.StrictSourceRouting);
Assert.IsNotNull(option);
Assert.Fail();
}
[TestMethod] [TestMethod]
[ExpectedException(typeof(ArgumentException))] [ExpectedException(typeof(ArgumentException))]
public void IpV4FragmentationOffsetErrorTest() public void IpV4FragmentationOffsetErrorTest()
......
using System; using System;
using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.VisualStudio.TestTools.UnitTesting;
using PcapDotNet.Packets.Ethernet;
using PcapDotNet.Packets.TestUtils; using PcapDotNet.Packets.TestUtils;
namespace PcapDotNet.Packets.Test namespace PcapDotNet.Packets.Test
......
...@@ -3,6 +3,8 @@ using System.Collections.Generic; ...@@ -3,6 +3,8 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using PcapDotNet.Packets; using PcapDotNet.Packets;
using PcapDotNet.Packets.Ethernet;
using PcapDotNet.Packets.IpV4;
using PcapDotNet.TestUtils; using PcapDotNet.TestUtils;
namespace PcapDotNet.Packets.TestUtils namespace PcapDotNet.Packets.TestUtils
...@@ -91,8 +93,9 @@ namespace PcapDotNet.Packets.TestUtils ...@@ -91,8 +93,9 @@ namespace PcapDotNet.Packets.TestUtils
switch (optionType) switch (optionType)
{ {
case IpV4OptionType.EndOfOptionList: case IpV4OptionType.EndOfOptionList:
return IpV4Option.End;
case IpV4OptionType.NoOperation: case IpV4OptionType.NoOperation:
return new IpV4OptionSimple(optionType); return IpV4Option.Nop;
case IpV4OptionType.Security: case IpV4OptionType.Security:
return new IpV4OptionSecurity(random.NextEnum<IpV4OptionSecurityLevel>(), random.NextUShort(), random.NextUShort(), return new IpV4OptionSecurity(random.NextEnum<IpV4OptionSecurityLevel>(), random.NextUShort(), random.NextUShort(),
......
...@@ -34,6 +34,8 @@ ...@@ -34,6 +34,8 @@
<Word>rcc</Word> <Word>rcc</Word>
<Word>internetwork</Word> <Word>internetwork</Word>
<Word>multiprotocol</Word> <Word>multiprotocol</Word>
<Word>avb</Word>
<Word>unicast</Word>
</Recognized> </Recognized>
<Deprecated> <Deprecated>
<!--Term PreferredAlternate="EnterpriseServices">complus</Term--> <!--Term PreferredAlternate="EnterpriseServices">complus</Term-->
......
...@@ -2,6 +2,7 @@ using System; ...@@ -2,6 +2,7 @@ using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using PcapDotNet.Packets.Ethernet;
namespace PcapDotNet.Packets namespace PcapDotNet.Packets
{ {
......
using System; using System;
using PcapDotNet.Packets.IpV4;
namespace PcapDotNet.Packets namespace PcapDotNet.Packets.Ethernet
{ {
/// <summary> /// <summary>
/// +------+-----------------+------------+------------------+ /// +------+-----------------+------------+------------------+
...@@ -63,16 +64,10 @@ namespace PcapDotNet.Packets ...@@ -63,16 +64,10 @@ namespace PcapDotNet.Packets
switch (EtherType) switch (EtherType)
{ {
case EthernetType.Arp:
case EthernetType.Ieee8021Q:
return true;
case EthernetType.IpV4: case EthernetType.IpV4:
return IpV4.IsValid; return IpV4.IsValid;
case EthernetType.IpV6:
return true;
default: default:
return false; return true;
} }
} }
......
namespace PcapDotNet.Packets namespace PcapDotNet.Packets.Ethernet
{ {
/// <summary>
/// EtherType is a two-octet field in an Ethernet frame, as defined by the Ethernet II framing networking standard.
/// It is used to indicate which protocol is encapsulated in the payload.
/// </summary>
public enum EthernetType : ushort public enum EthernetType : ushort
{ {
None, /// <summary>
/// No Ethernet type
/// </summary>
None = 0x0000,
/// <summary>
/// Internet Protocol, Version 4 (IPv4)
/// </summary>
IpV4 = 0x0800, IpV4 = 0x0800,
/// <summary>
/// Address Resolution Protocol (ARP)
/// </summary>
Arp = 0x0806, Arp = 0x0806,
Ieee8021Q = 0x8100, /// <summary>
IpV6 = 0x86DD /// Reverse Address Resolution Protocol (RARP)
/// </summary>
ReverseArp = 0x8035,
/// <summary>
/// AppleTalk (Ethertalk)
/// </summary>
AppleTalk = 0x809B,
/// <summary>
/// AppleTalk Address Resolution Protocol (AARP)
/// </summary>
AppleTalkArp = 0x80F3,
/// <summary>
/// VLAN-tagged frame (IEEE 802.1Q)
/// </summary>
VLanTaggedFrame = 0x8100,
/// <summary>
/// Novell IPX (alt)
/// </summary>
NovellInternetworkPacketExchange = 0x8137,
/// <summary>
/// Novell
/// </summary>
Novell = 0x8138,
/// <summary>
/// Internet Protocol, Version 6 (IPv6)
/// </summary>
IpV6 = 0x86DD,
/// <summary>
/// MAC Control
/// </summary>
MacControl = 0x8808,
/// <summary>
/// CobraNet
/// </summary>
CobraNet = 0x8819,
/// <summary>
/// MPLS unicast
/// </summary>
MultiprotocolLabelSwitchingUnicast = 0x8847,
/// <summary>
/// MPLS multicast
/// </summary>
MultiprotocolLabelSwitchingMulticast = 0x8848,
/// <summary>
/// PPPoE Discovery Stage
/// </summary>
PointToPointProtocolOverEthernetDiscoveryStage = 0x8863,
/// <summary>
/// PPPoE Session Stage
/// </summary>
PointToPointProtocolOverEthernetSessionStage = 0x8864,
/// <summary>
/// EAP over LAN (IEEE 802.1X)
/// </summary>
ExtensibleAuthenticationProtocolOverLan = 0x888E,
/// <summary>
/// HyperSCSI (SCSI over Ethernet)
/// </summary>
HyperScsi = 0x889A,
/// <summary>
/// ATA over Ethernet
/// </summary>
AtaOverEthernet = 0x88A2,
/// <summary>
/// EtherCAT Protocol
/// </summary>
EtherCatProtocol = 0x88A4,
/// <summary>
/// Provider Bridging (IEEE 802.1ad)
/// </summary>
ProviderBridging = 0x88A8,
/// <summary>
/// AVB Transport Protocol (AVBTP)
/// </summary>
AvbTransportProtocol = 0x88B5,
/// <summary>
/// SERCOS III
/// </summary>
SerialRealTimeCommunicationSystemIii = 0x88CD,
/// <summary>
/// Circuit Emulation Services over Ethernet (MEF-8)
/// </summary>
CircuitEmulationServicesOverEthernet = 0x88D8,
/// <summary>
/// HomePlug
/// </summary>
HomePlug = 0x88E1,
/// <summary>
/// MAC security (IEEE 802.1AE)
/// </summary>
MacSecurity = 0x88E5,
/// <summary>
/// Precision Time Protocol (IEEE 1588)
/// </summary>
PrecisionTimeProtocol = 0x88f7,
/// <summary>
/// IEEE 802.1ag Connectivity Fault Management (CFM) Protocol / ITU-T Recommendation Y.1731 (OAM)
/// </summary>
ConnectivityFaultManagementOrOperationsAdministrationManagement = 0x8902,
/// <summary>
/// Fibre Channel over Ethernet
/// </summary>
FibreChannelOverEthernet = 0x8906,
/// <summary>
/// FCoE Initialization Protocol
/// </summary>
FibreChannelOverEthernetInitializationProtocol = 0x8914,
/// <summary>
/// Q-in-Q
/// </summary>
QInQ = 0x9100,
/// <summary>
/// Veritas Low Latency Transport (LLT)
/// </summary>
VeritasLowLatencyTransport = 0xCAFE
} }
} }
\ No newline at end of file
...@@ -2,7 +2,7 @@ using System; ...@@ -2,7 +2,7 @@ using System;
using System.Globalization; using System.Globalization;
using PcapDotNet.Base; using PcapDotNet.Base;
namespace PcapDotNet.Packets namespace PcapDotNet.Packets.Ethernet
{ {
public struct MacAddress public struct MacAddress
{ {
......
using System.Globalization; using System.Globalization;
using System.Text; using System.Text;
namespace PcapDotNet.Packets namespace PcapDotNet.Packets.IpV4
{ {
public struct IpV4Address public struct IpV4Address
{ {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
using System.Linq; using System.Linq;
using System.Text; using System.Text;
namespace PcapDotNet.Packets namespace PcapDotNet.Packets.IpV4
{ {
/// <summary> /// <summary>
/// +-----+---------+-----+-----------------+-------+-----------------+ /// +-----+---------+-----+-----------------+-------+-----------------+
...@@ -197,4 +197,4 @@ namespace PcapDotNet.Packets ...@@ -197,4 +197,4 @@ namespace PcapDotNet.Packets
private bool? _isHeaderChecksumCorrect; private bool? _isHeaderChecksumCorrect;
private Datagram _tcp; private Datagram _tcp;
} }
} }
\ No newline at end of file
using System; using System;
namespace PcapDotNet.Packets namespace PcapDotNet.Packets.IpV4
{ {
public struct IpV4Fragmentation : IEquatable<IpV4Fragmentation> public struct IpV4Fragmentation : IEquatable<IpV4Fragmentation>
{ {
......
using System; using System;
namespace PcapDotNet.Packets namespace PcapDotNet.Packets.IpV4
{ {
[Flags] [Flags]
public enum IpV4FragmentationOptions : ushort public enum IpV4FragmentationOptions : ushort
......
using System; using System;
namespace PcapDotNet.Packets namespace PcapDotNet.Packets.IpV4
{ {
/// <summary>
/// Represents an ip option according to rfc 791.
/// </summary>
public abstract class IpV4Option : IEquatable<IpV4Option> public abstract class IpV4Option : IEquatable<IpV4Option>
{ {
///<summary>
/// This option indicates the end of the option list.
/// This might not coincide with the end of the internet header according to the internet header length.
/// This is used at the end of all options, not the end of each option, and need only be used if the end of the options would not otherwise coincide with the end of the internet header.
/// May be copied, introduced, or deleted on fragmentation, or for any other reason.
///</summary>
public static IpV4OptionSimple End public static IpV4OptionSimple End
{ {
get { return _end; } get { return _end; }
} }
/// <summary>
/// This option may be used between options, for example, to align the beginning of a subsequent option on a 32 bit boundary.
/// May be copied, introduced, or deleted on fragmentation, or for any other reason.
/// </summary>
public static IpV4OptionSimple Nop public static IpV4OptionSimple Nop
{ {
get { return _nop; } get { return _nop; }
} }
/// <summary>
/// The type of the ip option.
/// </summary>
public IpV4OptionType OptionType public IpV4OptionType OptionType
{ {
get { return _type; } get { return _type; }
} }
/// <summary>
/// The number of bytes this option will take.
/// </summary>
public abstract int Length public abstract int Length
{ {
get; get;
} }
/// <summary>
/// True iff this option may appear at most once in a datagram.
/// </summary>
public abstract bool IsAppearsAtMostOnce public abstract bool IsAppearsAtMostOnce
{ {
get; get;
} }
/// <summary>
/// Checks whether two options have equivalent type.
/// Useful to check if an option that must appear at most once appears in the list.
/// </summary>
public bool Equivalent(IpV4Option option) public bool Equivalent(IpV4Option option)
{ {
return OptionType == option.OptionType; return OptionType == option.OptionType;
} }
/// <summary>
/// Checks if the two options are exactly the same - including type and value.
/// </summary>
public virtual bool Equals(IpV4Option other) public virtual bool Equals(IpV4Option other)
{ {
if (other == null) if (other == null)
...@@ -41,16 +70,33 @@ namespace PcapDotNet.Packets ...@@ -41,16 +70,33 @@ namespace PcapDotNet.Packets
return Equivalent(other); return Equivalent(other);
} }
/// <summary>
/// Checks if the two options are exactly the same - including type and value.
/// </summary>
public override bool Equals(object obj) public override bool Equals(object obj)
{ {
return Equals(obj as IpV4Option); return Equals(obj as IpV4Option);
} }
/// <summary>
/// Serves as a hash function for a particular type.
/// </summary>
/// <returns>
/// A hash code for the current <see cref="T:System.Object"/>.
/// </returns>
/// <filterpriority>2</filterpriority>
public override int GetHashCode() public override int GetHashCode()
{ {
return (byte)OptionType; return (byte)OptionType;
} }
/// <summary>
/// Returns a <see cref="T:System.String"/> that represents the current <see cref="T:System.Object"/>.
/// </summary>
/// <returns>
/// A <see cref="T:System.String"/> that represents the current <see cref="T:System.Object"/>.
/// </returns>
/// <filterpriority>2</filterpriority>
public override string ToString() public override string ToString()
{ {
return OptionType.ToString(); return OptionType.ToString();
......
namespace PcapDotNet.Packets namespace PcapDotNet.Packets.IpV4
{ {
public abstract class IpV4OptionComplex : IpV4Option public abstract class IpV4OptionComplex : IpV4Option
{ {
......
...@@ -2,8 +2,46 @@ using System.Collections.Generic; ...@@ -2,8 +2,46 @@ using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using PcapDotNet.Base; using PcapDotNet.Base;
namespace PcapDotNet.Packets namespace PcapDotNet.Packets.IpV4
{ {
/// <summary>
/// Loose Source and Record Route
/// +--------+--------+--------+---------//--------+
/// |10000011| length | pointer| route data |
/// +--------+--------+--------+---------//--------+
/// Type=131
///
/// The loose source and record route (LSRR) option provides a means for the source of an internet datagram
/// to supply routing information to be used by the gateways in forwarding the datagram to the destination,
/// and to record the route information.
///
/// The option begins with the option type code.
/// The second octet is the option length which includes the option type code and the length octet,
/// the pointer octet, and length-3 octets of route data.
/// The third octet is the pointer into the route data indicating the octet which begins the next source address to be processed.
/// The pointer is relative to this option, and the smallest legal value for the pointer is 4.
///
/// A route data is composed of a series of internet addresses.
/// Each internet address is 32 bits or 4 octets.
/// If the pointer is greater than the length, the source route is empty (and the recorded route full)
/// and the routing is to be based on the destination address field.
/// If the address in destination address field has been reached and the pointer is not greater than the length,
/// the next address in the source route replaces the address in the destination address field,
/// and the recorded route address replaces the source address just used, and pointer is increased by four.
///
/// The recorded route address is the internet module's own internet address
/// as known in the environment into which this datagram is being forwarded.
///
/// This procedure of replacing the source route with the recorded route
/// (though it is in the reverse of the order it must be in to be used as a source route) means the option (and the IP header as a whole)
/// remains a constant length as the datagram progresses through the internet.
///
/// This option is a loose source route because the gateway or host IP
/// is allowed to use any route of any number of other intermediate gateways to reach the next address in the route.
///
/// Must be copied on fragmentation.
/// Appears at most once in a datagram.
/// </summary>
public class IpV4OptionLooseSourceRouting : IpV4OptionRoute public class IpV4OptionLooseSourceRouting : IpV4OptionRoute
{ {
public IpV4OptionLooseSourceRouting(IList<IpV4Address> addresses, byte pointedAddressIndex) public IpV4OptionLooseSourceRouting(IList<IpV4Address> addresses, byte pointedAddressIndex)
......
using System.Collections.Generic; using System.Collections.Generic;
using PcapDotNet.Base; using PcapDotNet.Base;
namespace PcapDotNet.Packets namespace PcapDotNet.Packets.IpV4
{ {
/// <summary>
/// Record Route
/// +--------+--------+--------+---------//--------+
/// |00000111| length | pointer| route data |
/// +--------+--------+--------+---------//--------+
/// Type=7
///
/// The record route option provides a means to record the route of an internet datagram.
///
/// The option begins with the option type code.
/// The second octet is the option length which includes the option type code and the length octet,
/// the pointer octet, and length-3 octets of route data.
/// The third octet is the pointer into the route data indicating the octet which begins the next area to store a route address.
/// The pointer is relative to this option, and the smallest legal value for the pointer is 4.
///
/// A recorded route is composed of a series of internet addresses.
/// Each internet address is 32 bits or 4 octets.
/// If the pointer is greater than the length, the recorded route data area is full.
/// The originating host must compose this option with a large enough route data area to hold all the address expected.
/// The size of the option does not change due to adding addresses.
/// The intitial contents of the route data area must be zero.
///
/// When an internet module routes a datagram it checks to see if the record route option is present.
/// If it is, it inserts its own internet address as known in the environment into which this datagram is being forwarded
/// into the recorded route begining at the octet indicated by the pointer,
/// and increments the pointer by four.
///
/// If the route data area is already full (the pointer exceeds the length)
/// the datagram is forwarded without inserting the address into the recorded route.
/// If there is some room but not enough room for a full address to be inserted,
/// the original datagram is considered to be in error and is discarded.
/// In either case an ICMP parameter problem message may be sent to the source host.
///
/// Not copied on fragmentation, goes in first fragment only.
/// Appears at most once in a datagram.
/// </summary>
public class IpV4OptionRecordRoute : IpV4OptionRoute public class IpV4OptionRecordRoute : IpV4OptionRoute
{ {
public IpV4OptionRecordRoute(byte pointedAddressIndex, IList<IpV4Address> addresses) public IpV4OptionRecordRoute(byte pointedAddressIndex, IList<IpV4Address> addresses)
......
...@@ -4,7 +4,7 @@ using System.Collections.ObjectModel; ...@@ -4,7 +4,7 @@ using System.Collections.ObjectModel;
using System.Linq; using System.Linq;
using PcapDotNet.Base; using PcapDotNet.Base;
namespace PcapDotNet.Packets namespace PcapDotNet.Packets.IpV4
{ {
public abstract class IpV4OptionRoute : IpV4OptionComplex, IEquatable<IpV4OptionRoute> public abstract class IpV4OptionRoute : IpV4OptionComplex, IEquatable<IpV4OptionRoute>
{ {
......
using System; using System;
using PcapDotNet.Base; using PcapDotNet.Base;
namespace PcapDotNet.Packets namespace PcapDotNet.Packets.IpV4
{ {
/// <summary>
/// This option provides a way for hosts to send security, compartmentation, handling restrictions, and TCC (closed user group) parameters.
///
/// The format for this option is as follows:
/// +--------+--------+---//---+---//---+---//---+---//---+
/// |10000010|00001011|SSS SSS|CCC CCC|HHH HHH| TCC |
/// +--------+--------+---//---+---//---+---//---+---//---+
/// Type=130 Length=11
///
/// Must be copied on fragmentation.
/// This option appears at most once in a datagram.
/// </summary>
public class IpV4OptionSecurity : IpV4OptionComplex, IEquatable<IpV4OptionSecurity> public class IpV4OptionSecurity : IpV4OptionComplex, IEquatable<IpV4OptionSecurity>
{ {
public const int OptionLength = 11; public const int OptionLength = 11;
...@@ -18,21 +30,39 @@ namespace PcapDotNet.Packets ...@@ -18,21 +30,39 @@ namespace PcapDotNet.Packets
_transmissionControlCode = transmissionControlCode; _transmissionControlCode = transmissionControlCode;
} }
/// <summary>
/// Specifies one of the levels of security.
/// </summary>
public IpV4OptionSecurityLevel Level public IpV4OptionSecurityLevel Level
{ {
get { return _level; } get { return _level; }
} }
/// <summary>
/// Compartments (C field): 16 bits
/// An all zero value is used when the information transmitted is not compartmented.
/// Other values for the compartments field may be obtained from the Defense Intelligence Agency.
/// </summary>
public ushort Compartments public ushort Compartments
{ {
get { return _compartments; } get { return _compartments; }
} }
/// <summary>
/// Handling Restrictions (H field): 16 bits
/// The values for the control and release markings are alphanumeric digraphs
/// and are defined in the Defense Intelligence Agency Manual DIAM 65-19, "Standard Security Markings".
/// </summary>
public ushort HandlingRestrictions public ushort HandlingRestrictions
{ {
get { return _handlingRestrictions; } get { return _handlingRestrictions; }
} }
/// <summary>
/// Transmission Control Code (TCC field): 24 bits
/// Provides a means to segregate traffic and define controlled communities of interest among subscribers.
/// The TCC values are trigraphs, and are available from HQ DCA Code 530.
/// </summary>
public UInt24 TransmissionControlCode public UInt24 TransmissionControlCode
{ {
get { return _transmissionControlCode; } get { return _transmissionControlCode; }
......
namespace PcapDotNet.Packets namespace PcapDotNet.Packets.IpV4
{ {
/// <summary>
/// Security (S field): 16 bits
/// </summary>
public enum IpV4OptionSecurityLevel : ushort public enum IpV4OptionSecurityLevel : ushort
{ {
/// <summary>
/// Unclassified
/// </summary>
Unclassified = 0x0000, Unclassified = 0x0000,
/// <summary>
/// Confidential
/// </summary>
Confidential = 0xF135, Confidential = 0xF135,
/// <summary>
/// Encrypted For Transmission Only (EFTO)
/// </summary>
EncryptedForTransmissionOnly = 0x789A, EncryptedForTransmissionOnly = 0x789A,
/// <summary>
/// MMMM
/// </summary>
Mmmm = 0xBC4D, Mmmm = 0xBC4D,
/// <summary>
/// PROG
/// </summary>
Prog = 0x5E26, Prog = 0x5E26,
/// <summary>
/// Restricted
/// </summary>
Restricted = 0xAF13, Restricted = 0xAF13,
/// <summary>
/// Secret
/// </summary>
Secret = 0xD788, Secret = 0xD788,
/// <summary>
/// Top Secret
/// </summary>
TopSecret = 0x6BC5 TopSecret = 0x6BC5
} }
} }
\ No newline at end of file
using System; using System;
namespace PcapDotNet.Packets namespace PcapDotNet.Packets.IpV4
{ {
public class IpV4OptionSimple : IpV4Option public class IpV4OptionSimple : IpV4Option
{ {
public const int OptionLength = 1; public const int OptionLength = 1;
public IpV4OptionSimple(IpV4OptionType optionType)
: base(optionType)
{
if (optionType != IpV4OptionType.EndOfOptionList &&
optionType != IpV4OptionType.NoOperation)
{
throw new ArgumentException("OptionType " + optionType + " Can't be a simple option", "optionType");
}
}
public override int Length public override int Length
{ {
get { return OptionLength; } get { return OptionLength; }
...@@ -26,5 +15,10 @@ namespace PcapDotNet.Packets ...@@ -26,5 +15,10 @@ namespace PcapDotNet.Packets
{ {
get { return false; } get { return false; }
} }
internal IpV4OptionSimple(IpV4OptionType optionType)
: base(optionType)
{
}
} }
} }
\ No newline at end of file
using System; using System;
namespace PcapDotNet.Packets namespace PcapDotNet.Packets.IpV4
{ {
/// <summary>
/// Stream Identifier
/// +--------+--------+--------+--------+
/// |10001000|00000010| Stream ID |
/// +--------+--------+--------+--------+
/// Type=136 Length=4
///
/// This option provides a way for the 16-bit SATNET stream identifier to be carried through networks that do not support the stream concept.
///
/// Must be copied on fragmentation.
/// Appears at most once in a datagram.
/// </summary>
public class IpV4OptionStreamIdentifier : IpV4OptionComplex, IEquatable<IpV4OptionStreamIdentifier> public class IpV4OptionStreamIdentifier : IpV4OptionComplex, IEquatable<IpV4OptionStreamIdentifier>
{ {
public const int OptionLength = 4; public const int OptionLength = 4;
......
using System.Collections.Generic; using System.Collections.Generic;
using PcapDotNet.Base; using PcapDotNet.Base;
namespace PcapDotNet.Packets namespace PcapDotNet.Packets.IpV4
{ {
/// <summary>
/// Strict Source and Record Route
/// +--------+--------+--------+---------//--------+
/// |10001001| length | pointer| route data |
/// +--------+--------+--------+---------//--------+
/// Type=137
///
/// The strict source and record route (SSRR) option provides a means for the source of an internet datagram
/// to supply routing information to be used by the gateways in forwarding the datagram to the destination,
/// and to record the route information.
///
/// The option begins with the option type code.
/// The second octet is the option length which includes the option type code and the length octet,
/// the pointer octet, and length-3 octets of route data.
/// The third octet is the pointer into the route data indicating the octet which begins the next source address to be processed.
/// The pointer is relative to this option, and the smallest legal value for the pointer is 4.
///
/// A route data is composed of a series of internet addresses.
/// Each internet address is 32 bits or 4 octets.
/// If the pointer is greater than the length, the source route is empty (and the recorded route full)
/// and the routing is to be based on the destination address field.
///
/// If the address in destination address field has been reached and the pointer is not greater than the length,
/// the next address in the source route replaces the address in the destination address field,
/// and the recorded route address replaces the source address just used, and pointer is increased by four.
///
/// The recorded route address is the internet module's own internet address as known in the environment
/// into which this datagram is being forwarded.
///
/// This procedure of replacing the source route with the recorded route
/// (though it is in the reverse of the order it must be in to be used as a source route)
/// means the option (and the IP header as a whole) remains a constant length as the datagram progresses through the internet.
///
/// This option is a strict source route because the gateway or host IP
/// must send the datagram directly to the next address in the source route through only the directly connected network
/// indicated in the next address to reach the next gateway or host specified in the route.
///
/// Must be copied on fragmentation.
/// Appears at most once in a datagram.
/// </summary>
public class IpV4OptionStrictSourceRouting : IpV4OptionRoute public class IpV4OptionStrictSourceRouting : IpV4OptionRoute
{ {
public IpV4OptionStrictSourceRouting(IList<IpV4Address> addresses, byte pointedAddressIndex) public IpV4OptionStrictSourceRouting(IList<IpV4Address> addresses, byte pointedAddressIndex)
......
using System; using System;
namespace PcapDotNet.Packets namespace PcapDotNet.Packets.IpV4
{ {
public struct IpV4OptionTimedAddress : IEquatable<IpV4OptionTimedAddress> public struct IpV4OptionTimedAddress : IEquatable<IpV4OptionTimedAddress>
{ {
......
using System; using System;
namespace PcapDotNet.Packets namespace PcapDotNet.Packets.IpV4
{ {
/// <summary>
/// Internet Timestamp
/// +--------+--------+--------+--------+
/// |01000100| length | pointer|oflw|flg|
/// +--------+--------+--------+--------+
/// | internet address |
/// +--------+--------+--------+--------+
/// | timestamp |
/// +--------+--------+--------+--------+
/// | . |
/// .
/// .
/// Type = 68
///
/// The Option Length is the number of octets in the option counting the type, length, pointer, and overflow/flag octets (maximum length 40).
///
/// The Pointer is the number of octets from the beginning of this option to the end of timestamps plus one
/// (i.e., it points to the octet beginning the space for next timestamp).
/// The smallest legal value is 5.
/// The timestamp area is full when the pointer is greater than the length.
///
/// The Overflow (oflw) [4 bits] is the number of IP modules that cannot register timestamps due to lack of space.
///
/// The Flag (flg) [4 bits] values are
/// 0 -- time stamps only, stored in consecutive 32-bit words,
/// 1 -- each timestamp is preceded with internet address of the registering entity,
/// 3 -- the internet address fields are prespecified.
/// An IP module only registers its timestamp if it matches its own address with the next specified internet address.
///
/// The Timestamp is a right-justified, 32-bit timestamp in milliseconds since midnight UT.
/// If the time is not available in milliseconds or cannot be provided with respect to midnight UT
/// then any time may be inserted as a timestamp provided the high order bit of the timestamp field is set to one
/// to indicate the use of a non-standard value.
///
/// The originating host must compose this option with a large enough timestamp data area to hold all the timestamp information expected.
/// The size of the option does not change due to adding timestamps.
/// The intitial contents of the timestamp data area must be zero or internet address/zero pairs.
///
/// If the timestamp data area is already full (the pointer exceeds the length) the datagram is forwarded without inserting the timestamp,
/// but the overflow count is incremented by one.
/// If there is some room but not enough room for a full timestamp to be inserted, or the overflow count itself overflows,
/// the original datagram is considered to be in error and is discarded.
/// In either case an ICMP parameter problem message may be sent to the source host.
///
/// The timestamp option is not copied upon fragmentation.
/// It is carried in the first fragment.
/// Appears at most once in a datagram.
/// </summary>
public abstract class IpV4OptionTimestamp : IpV4OptionComplex, IEquatable<IpV4OptionTimestamp> public abstract class IpV4OptionTimestamp : IpV4OptionComplex, IEquatable<IpV4OptionTimestamp>
{ {
public const int OptionMinimumLength = 4; public const int OptionMinimumLength = 4;
......
...@@ -4,7 +4,7 @@ using System.Collections.ObjectModel; ...@@ -4,7 +4,7 @@ using System.Collections.ObjectModel;
using System.Linq; using System.Linq;
using PcapDotNet.Base; using PcapDotNet.Base;
namespace PcapDotNet.Packets namespace PcapDotNet.Packets.IpV4
{ {
public class IpV4OptionTimestampAndAddress : IpV4OptionTimestamp public class IpV4OptionTimestampAndAddress : IpV4OptionTimestamp
{ {
......
...@@ -4,7 +4,7 @@ using System.Collections.ObjectModel; ...@@ -4,7 +4,7 @@ using System.Collections.ObjectModel;
using System.Linq; using System.Linq;
using PcapDotNet.Base; using PcapDotNet.Base;
namespace PcapDotNet.Packets namespace PcapDotNet.Packets.IpV4
{ {
public class IpV4OptionTimestampOnly : IpV4OptionTimestamp public class IpV4OptionTimestampOnly : IpV4OptionTimestamp
{ {
......
using System; using System;
namespace PcapDotNet.Packets namespace PcapDotNet.Packets.IpV4
{ {
public enum IpV4OptionTimestampType : byte public enum IpV4OptionTimestampType : byte
{ {
......
namespace PcapDotNet.Packets namespace PcapDotNet.Packets.IpV4
{ {
/// <summary>
/// The option-type octet is viewed as having 3 fields:
/// 1 bit copied flag,
/// 2 bits option class,
/// 5 bits option number.
///
/// The copied flag indicates that this option is copied into all fragments on fragmentation.
/// 0 = not copied
/// 1 = copied
///
/// The option classes are:
/// 0 = control
/// 1 = reserved for future use
/// 2 = debugging and measurement
/// 3 = reserved for future use
/// </summary>
public enum IpV4OptionType : byte public enum IpV4OptionType : byte
{ {
/// <summary>
/// End of Option list.
/// This option occupies only 1 octet; it has no length octet.
/// </summary>
EndOfOptionList = 0, EndOfOptionList = 0,
/// <summary>
/// No Operation.
/// This option occupies only 1 octet; it has no length octet.
/// </summary>
NoOperation = 1, NoOperation = 1,
/// <summary>
/// Security.
/// Used to carry Security, Compartmentation, User Group (TCC), and Handling Restriction Codes compatible with DOD requirements.
/// </summary>
Security = 130, Security = 130,
/// <summary>
/// Loose Source Routing.
/// Used to route the internet datagram based on information supplied by the source.
/// </summary>
LooseSourceRouting = 131, LooseSourceRouting = 131,
/// <summary>
/// Strict Source Routing.
/// Used to route the internet datagram based on information supplied by the source.
/// </summary>
StrictSourceRouting = 137, StrictSourceRouting = 137,
/// <summary>
/// Record Route.
/// Used to trace the route an internet datagram takes.
/// </summary>
RecordRoute = 7, RecordRoute = 7,
/// <summary>
/// Stream ID.
/// Used to carry the stream identifier.
/// </summary>
StreamIdentifier = 136, StreamIdentifier = 136,
/// <summary>
/// Internet Timestamp.
/// </summary>
InternetTimestamp = 68 InternetTimestamp = 68
} }
} }
\ No newline at end of file
...@@ -4,7 +4,7 @@ using System.Collections.ObjectModel; ...@@ -4,7 +4,7 @@ using System.Collections.ObjectModel;
using System.Linq; using System.Linq;
using PcapDotNet.Base; using PcapDotNet.Base;
namespace PcapDotNet.Packets namespace PcapDotNet.Packets.IpV4
{ {
public class IpV4Options : ReadOnlyCollection<IpV4Option>, IEquatable<IpV4Options> public class IpV4Options : ReadOnlyCollection<IpV4Option>, IEquatable<IpV4Options>
{ {
......
namespace PcapDotNet.Packets namespace PcapDotNet.Packets.IpV4
{ {
public enum IpV4Protocol : byte public enum IpV4Protocol : byte
{ {
......
using System; using System;
using System.Net; using System.Net;
using PcapDotNet.Base; using PcapDotNet.Base;
using PcapDotNet.Packets.Ethernet;
using PcapDotNet.Packets.IpV4;
namespace PcapDotNet.Packets namespace PcapDotNet.Packets
{ {
public static class MoreByteArray public static class MoreByteArray
{ {
public static void BlockCopy(this byte[] source, int sourceOffset, byte[] destination, int destinationOffset, int count)
{
Buffer.BlockCopy(source, sourceOffset, destination, destinationOffset, count);
}
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames", MessageId = "short")] [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames", MessageId = "short")]
public static short ReadShort(this byte[] buffer, int offset, Endianity endianity) public static short ReadShort(this byte[] buffer, int offset, Endianity endianity)
{ {
......
This diff is collapsed.
using System; using System;
using PcapDotNet.Packets.Ethernet;
using PcapDotNet.Packets.IpV4;
namespace PcapDotNet.Packets namespace PcapDotNet.Packets
{ {
......
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