Commit 4245a0fc authored by Brickner_cp's avatar Brickner_cp

Documentation Formatting

parent d499834d
......@@ -34,6 +34,7 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<NoWarn>1718</NoWarn>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
......
......@@ -40,6 +40,9 @@
<WarningLevel>4</WarningLevel>
<RunCodeAnalysis>true</RunCodeAnalysis>
<DocumentationFile>..\..\bin\Release\PcapDotNet.Base.XML</DocumentationFile>
<CodeAnalysisRules>-Microsoft.Design#CA1004</CodeAnalysisRules>
<NoWarn>
</NoWarn>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
......
......@@ -27,7 +27,7 @@ namespace PcapDotNet { namespace Core
}
/// <summary>
/// number of packets dropped by the interface.
/// Number of packets dropped by the interface.
/// </summary>
property unsigned int PacketsDroppedByInterface
{
......
......@@ -34,6 +34,7 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<NoWarn>1718</NoWarn>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
......
......@@ -6,6 +6,7 @@ namespace PcapDotNet.Packets.Ethernet
/// <summary>
/// Represents an Ethernet datagram.
///
/// <pre>
/// +------+-----------------+------------+------------------+
/// | Byte | 0-5 | 6-11 | 12-13 |
/// +------+-----------------+------------+------------------+
......@@ -13,6 +14,7 @@ namespace PcapDotNet.Packets.Ethernet
/// +------+-----------------+------------+------------------+
/// | 14 | Data |
/// +------+-------------------------------------------------+
/// </pre>
/// </summary>
public class EthernetDatagram : Datagram
{
......
......@@ -9,6 +9,7 @@ namespace PcapDotNet.Packets.IpV4
/// <summary>
/// Represents an IPv4 datagram.
///
/// <pre>
/// +-----+---------+-----+-----------------+-------+-----------------+
/// | Bit | 0-3 | 4-7 | 8-15 | 16-18 | 19-31 |
/// +-----+---------+-----+-----------------+-------+-----------------+
......@@ -28,6 +29,7 @@ namespace PcapDotNet.Packets.IpV4
/// | to | |
/// | 360 | |
/// +-----+-----------------------------------------------------------+
/// </pre>
/// </summary>
public class IpV4Datagram : Datagram
{
......
......@@ -8,7 +8,7 @@ namespace PcapDotNet.Packets.IpV4
public abstract class IpV4Option : Option, IEquatable<IpV4Option>
{
///<summary>
/// This option indicates the end of the option list.
/// This option indicates the end of the option list.<br/>
/// 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.
......
......@@ -7,22 +7,29 @@ namespace PcapDotNet.Packets.IpV4
/// This option identifies the U.S. classification level at which the datagram is to be protected
/// and the authorities whose protection rules apply to each datagram.
///
/// This option is used by end systems and intermediate systems of aninternet to:
/// <para>
/// This option is used by end systems and intermediate systems of an internet to:
/// <list type="number">
/// <item>Transmit from source to destination in a network standard representation the common security labels required by computer security models.</item>
/// <item>Validate the datagram as appropriate for transmission from the source and delivery to the destination.</item>
/// <item>
/// Ensure that the route taken by the datagram is protected to the level required by all protection authorities indicated on the datagram.
/// In order to provide this facility in a general Internet environment, interior and exterior gateway protocols must be augmented
/// to include security label information in support of routing control.
/// </item>
/// </list>
/// </para>
///
/// <para>
/// The DoD Basic Security option must be copied on fragmentation.
/// This option appears at most once in a datagram.
/// Some security systems require this to be the first option if more than one option is carried in the IP header,
/// but this is not a generic requirement levied by this specification.
/// </para>
///
/// a. Transmit from source to destination in a network standard representation the common security labels required by computer security models,
///
/// b. Validate the datagram as appropriate for transmission from the source and delivery to the destination,
///
/// c. Ensure that the route taken by the datagram is protected to the level required by all protection authorities indicated on the datagram.
/// In order to provide this facility in a general Internet environment, interior and exterior gateway protocols must be augmented
/// to include security label information in support of routing control.
///
/// The DoD Basic Security option must be copied on fragmentation.
/// This option appears at most once in a datagram.
/// Some security systems require this to be the first option if more than one option is carried in the IP header,
/// but this is not a generic requirement levied by this specification.
///
/// The format of the DoD Basic Security option is as follows:
/// <para>
/// The format of the DoD Basic Security option is as follows:
/// <pre>
/// +------------+------------+------------+-------------//----------+
/// | 10000010 | XXXXXXXX | SSSSSSSS | AAAAAAA[1] AAAAAAA0 |
/// | | | | [0] |
......@@ -30,6 +37,8 @@ namespace PcapDotNet.Packets.IpV4
/// TYPE = 130 LENGTH CLASSIFICATION PROTECTION
/// LEVEL AUTHORITY
/// FLAGS
/// </pre>
/// </para>
/// </summary>
[OptionTypeRegistration(typeof(IpV4OptionType), IpV4OptionType.BasicSecurity)]
public class IpV4OptionBasicSecurity : IpV4OptionComplex, IOptionComplexFactory, IEquatable<IpV4OptionBasicSecurity>
......
......@@ -6,41 +6,57 @@ namespace PcapDotNet.Packets.IpV4
{
/// <summary>
/// Loose Source and Record Route
/// <pre>
/// +--------+--------+--------+---------//--------+
/// |10000011| length | pointer| route data |
/// +--------+--------+--------+---------//--------+
/// Type=131
/// </pre>
///
/// 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.
/// <para>
/// 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.
/// </para>
///
/// 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.
/// <para>
/// 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.
/// </para>
///
/// 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.
/// <para>
/// 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.
/// </para>
///
/// The recorded route address is the internet module's own internet address
/// as known in the environment into which this datagram is being forwarded.
/// <para>
/// The recorded route address is the internet module's own internet address
/// as known in the environment into which this datagram is being forwarded.
/// </para>
///
/// 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.
/// <para>
/// 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.
/// </para>
///
/// 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.
/// <para>
/// 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.
/// </para>
///
/// Must be copied on fragmentation.
/// Appears at most once in a datagram.
/// <para>
/// Must be copied on fragmentation.
/// Appears at most once in a datagram.
/// </para>
/// </summary>
[OptionTypeRegistration(typeof(IpV4OptionType), IpV4OptionType.LooseSourceRouting)]
public class IpV4OptionLooseSourceRouting : IpV4OptionRoute, IOptionComplexFactory
......
......@@ -5,15 +5,19 @@ namespace PcapDotNet.Packets.IpV4
/// <summary>
/// The Quick-Start Option for IPv4
///
/// The Quick-Start Request for IPv4 is defined as follows:
/// 0 1 2 3
/// 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
/// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
/// | Option | Length=8 | Func. | Rate | QS TTL |
/// | | | 0000 |Request| |
/// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
/// | QS Nonce | R |
/// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
/// <para>
/// The Quick-Start Request for IPv4 is defined as follows:
/// <pre>
/// +--------+----------+-------+---------+-------+-------+
/// | 0-7 | 8-15 | 16-19 | 20-23 | 24-29 | 30-31 |
/// +--------+----------+-------+---------+-------+-------+
/// | Option | Length=8 | Func. | Rate | QS TTL |
/// | | | 0000 | Request | |
/// +--------+----------+-------+---------+-------+-------+
/// | QS Nonce | R |
/// +---------------------------------------------+-------+
/// </pre>
/// </para>
/// </summary>
[OptionTypeRegistration(typeof(IpV4OptionType), IpV4OptionType.QuickStart)]
public class IpV4OptionQuickStart : IpV4OptionComplex, IOptionComplexFactory, IEquatable<IpV4OptionQuickStart>
......@@ -113,9 +117,11 @@ namespace PcapDotNet.Packets.IpV4
/// Routers that approve the Quick-Start Request decrement the QS TTL (mod 256) by the same amount that they decrement the IP TTL.
/// The QS TTL is used by the sender to detect if all the routers along the path understood and approved the Quick-Start option.
///
/// For a Rate Request, the transport sender MUST calculate and store the TTL Diff,
/// the difference between the IP TTL value, and the QS TTL value in the Quick-Start Request packet, as follows:
/// TTL Diff = ( IP TTL - QS TTL ) mod 256
/// <para>
/// For a Rate Request, the transport sender MUST calculate and store the TTL Diff,
/// the difference between the IP TTL value, and the QS TTL value in the Quick-Start Request packet, as follows:
/// TTL Diff = ( IP TTL - QS TTL ) mod 256
/// </para>
/// </summary>
public byte Ttl
{
......@@ -129,35 +135,45 @@ namespace PcapDotNet.Packets.IpV4
/// Without the QS Nonce, there is nothing to prevent the receiver from reporting back to the sender a Rate Request of K,
/// when the received Rate Request was, in fact, less than K.
///
/// The format for the 30-bit QS Nonce.
/// Bits Purpose
/// --------- ------------------
/// Bits 0-1: Rate 15 -> Rate 14
/// Bits 2-3: Rate 14 -> Rate 13
/// Bits 4-5: Rate 13 -> Rate 12
/// Bits 6-7: Rate 12 -> Rate 11
/// Bits 8-9: Rate 11 -> Rate 10
/// Bits 10-11: Rate 10 -> Rate 9
/// Bits 12-13: Rate 9 -> Rate 8
/// Bits 14-15: Rate 8 -> Rate 7
/// Bits 16-17: Rate 7 -> Rate 6
/// Bits 18-19: Rate 6 -> Rate 5
/// Bits 20-21: Rate 5 -> Rate 4
/// Bits 22-23: Rate 4 -> Rate 3
/// Bits 24-25: Rate 3 -> Rate 2
/// Bits 26-27: Rate 2 -> Rate 1
/// Bits 28-29: Rate 1 -> Rate 0
/// <para>
/// The format for the 30-bit QS Nonce.
/// <list type="table">
/// <listheader>
/// <term>Bits</term>
/// <description>Purpose</description>
/// </listheader>
/// <item><term>Bits 0-1</term><description>Rate 15 -> Rate 14</description></item>
/// <item><term>Bits 2-3</term><description>Rate 14 -> Rate 13</description></item>
/// <item><term>Bits 4-5</term><description>Rate 13 -> Rate 12</description></item>
/// <item><term>Bits 6-7</term><description>Rate 12 -> Rate 11</description></item>
/// <item><term>Bits 8-9</term><description>Rate 11 -> Rate 10</description></item>
/// <item><term>Bits 10-11</term><description>Rate 10 -> Rate 9</description></item>
/// <item><term>Bits 12-13</term><description>Rate 9 -> Rate 8</description></item>
/// <item><term>Bits 14-15</term><description>Rate 8 -> Rate 7</description></item>
/// <item><term>Bits 16-17</term><description>Rate 7 -> Rate 6</description></item>
/// <item><term>Bits 18-19</term><description>Rate 6 -> Rate 5</description></item>
/// <item><term>Bits 20-21</term><description>Rate 5 -> Rate 4</description></item>
/// <item><term>Bits 22-23</term><description>Rate 4 -> Rate 3</description></item>
/// <item><term>Bits 24-25</term><description>Rate 3 -> Rate 2</description></item>
/// <item><term>Bits 26-27</term><description>Rate 2 -> Rate 1</description></item>
/// <item><term>Bits 28-29</term><description>Rate 1 -> Rate 0</description></item>
/// </list>
/// </para>
///
/// <para>
/// The transport sender MUST initialize the QS Nonce to a random value.
/// If the router reduces the Rate Request from rate K to rate K-1,
/// then the router MUST set the field in the QS Nonce for "Rate K -> Rate K-1" to a new random value.
/// Similarly, if the router reduces the Rate Request by N steps,
/// the router MUST set the 2N bits in the relevant fields in the QS Nonce to a new random value.
/// The receiver MUST report the QS Nonce back to the sender.
/// </para>
///
/// <para>
/// If the Rate Request was not decremented in the network, then the QS Nonce should have its original value.
/// Similarly, if the Rate Request was decremented by N steps in the network,
/// and the receiver reports back a Rate Request of K, then the last 2K bits of the QS Nonce should have their original value.
/// </para>
/// </summary>
public uint Nonce
{
......
......@@ -5,39 +5,53 @@ namespace PcapDotNet.Packets.IpV4
{
/// <summary>
/// Record Route
/// <pre>
/// +--------+--------+--------+---------//--------+
/// |00000111| length | pointer| route data |
/// +--------+--------+--------+---------//--------+
/// Type=7
/// </pre>
///
/// <para>
/// The record route option provides a means to record the route of an internet datagram.
/// </para>
///
/// <para>
/// 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.
/// </para>
///
/// <para>
/// 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.
/// </para>
///
/// <para>
/// 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.
/// </para>
///
/// <para>
/// 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.
/// </para>
///
/// <para>
/// Not copied on fragmentation, goes in first fragment only.
/// Appears at most once in a datagram.
/// </para>
/// </summary>
[OptionTypeRegistration(typeof(IpV4OptionType), IpV4OptionType.RecordRoute)]
public class IpV4OptionRecordRoute : IpV4OptionRoute, IOptionComplexFactory
......
......@@ -8,20 +8,28 @@ namespace PcapDotNet.Packets.IpV4
/// RSVP can cause the message to be intercepted while causing little or no performance
/// penalty on the forwarding of normal data packets.
///
/// <para>
/// Routers that support option processing in the fast path already demultiplex processing based on the option type field.
/// If all option types are supported in the fast path, then the addition of another option type to process is unlikely to impact performance.
/// If some option types are not supported in the fast path,
/// this new option type will be unrecognized and cause packets carrying it to be kicked out into the slow path,
/// so no change to the fast path is necessary, and no performance penalty will be incurred for regular data packets.
/// </para>
///
/// <para>
/// Routers that do not support option processing in the fast path will cause packets carrying this new option
/// to be forwarded through the slow path, so no change to the fast path is necessary and no performance penalty
/// will be incurred for regular data packets.
/// </para>
///
/// <para>
/// The Router Alert option has the following format:
/// <pre>
/// +--------+--------+--------+--------+
/// |10010100|00000100| 2 octet value |
/// +--------+--------+--------+--------+
/// </pre>
/// </para>
/// </summary>
[OptionTypeRegistration(typeof(IpV4OptionType), IpV4OptionType.RouterAlert)]
public class IpV4OptionRouterAlert : IpV4OptionComplex, IOptionComplexFactory, IEquatable<IpV4OptionRouterAlert>
......
......@@ -4,10 +4,12 @@ namespace PcapDotNet.Packets.IpV4
{
/// <summary>
/// Stream Identifier option.
/// <pre>
/// +--------+--------+--------+--------+
/// |10001000|00000010| Stream ID |
/// +--------+--------+--------+--------+
/// Type=136 Length=4
/// </pre>
///
/// This option provides a way for the 16-bit SATNET stream identifier to be carried through networks that do not support the stream concept.
///
......
......@@ -5,43 +5,61 @@ namespace PcapDotNet.Packets.IpV4
{
/// <summary>
/// Strict Source and Record Route
/// <pre>
/// +--------+--------+--------+---------//--------+
/// |10001001| length | pointer| route data |
/// +--------+--------+--------+---------//--------+
/// Type=137
/// </pre>
///
/// <para>
/// 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.
/// </para>
///
/// <para>
/// 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.
/// </para>
///
/// <para>
/// 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.
/// </para>
///
/// <para>
/// 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.
/// </para>
///
/// <para>
/// The recorded route address is the internet module's own internet address as known in the environment
/// into which this datagram is being forwarded.
/// </para>
///
/// <para>
/// 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.
/// </para>
///
/// <para>
/// 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.
/// </para>
///
/// <para>
/// Must be copied on fragmentation.
/// Appears at most once in a datagram.
/// </para>
/// </summary>
[OptionTypeRegistration(typeof(IpV4OptionType), IpV4OptionType.StrictSourceRouting)]
public class IpV4OptionStrictSourceRouting : IpV4OptionRoute, IOptionComplexFactory
......
......@@ -4,6 +4,7 @@ namespace PcapDotNet.Packets.IpV4
{
/// <summary>
/// Internet Timestamp
/// <pre>
/// +--------+--------+--------+--------+
/// |01000100| length | pointer|oflw|flg|
/// +--------+--------+--------+--------+
......@@ -15,40 +16,59 @@ namespace PcapDotNet.Packets.IpV4
/// .
/// .
/// Type = 68
/// </pre>
///
/// <para>
/// The Option Length is the number of octets in the option counting the type, length, pointer, and overflow/flag octets (maximum length 40).
/// </para>
///
/// <para>
/// 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.
/// </para>
///
/// <para>
/// The Overflow (oflw) [4 bits] is the number of IP modules that cannot register timestamps due to lack of space.
/// </para>
///
/// 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.
/// <para>
/// The Flag (flg) [4 bits] values are
/// <list type="bullet">
/// <item>0 - time stamps only, stored in consecutive 32-bit words.</item>
/// <item>1 - each timestamp is preceded with internet address of the registering entity.</item>
/// <item>3 - the internet address fields are prespecified.</item>
/// </list>
/// An IP module only registers its timestamp if it matches its own address with the next specified internet address.
/// </para>
///
/// <para>
/// 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.
/// </para>
///
/// <para>
/// 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.
/// </para>
///
/// <para>
/// 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.
/// </para>
///
/// <para>
/// The timestamp option is not copied upon fragmentation.
/// It is carried in the first fragment.
/// Appears at most once in a datagram.
/// </para>
/// </summary>
public abstract class IpV4OptionTimestamp : IpV4OptionComplex, IEquatable<IpV4OptionTimestamp>
{
......
......@@ -10,7 +10,9 @@ namespace PcapDotNet.Packets.IpV4
/// hereinafter refered to as the Return Packet, to be traced
/// (provided the Outbound Packet's destination preserves the IP Traceroute option in the Return Packet).
///
/// <para>
/// IP Traceroute option format
/// <pre>
/// 0 8 16 24
/// +-+---+---------+---------------+-------------------------------+
/// |F| C | Number | Length | ID Number |
......@@ -19,10 +21,14 @@ namespace PcapDotNet.Packets.IpV4
/// +-------------------------------+-------------------------------+
/// | Originator IP Address |
/// +---------------------------------------------------------------+
/// </pre>
/// </para>
///
/// <para>
/// F (copy to fragments): 0 (do not copy to fragments)
/// C (class): 2 (Debugging and Measurement)
/// Number: 18 (F+C+Number = 82)
/// </para>
/// </summary>
[OptionTypeRegistration(typeof(IpV4OptionType), IpV4OptionType.TraceRoute)]
public class IpV4OptionTraceRoute : IpV4OptionComplex, IOptionComplexFactory, IEquatable<IpV4OptionTraceRoute>
......
......@@ -2,23 +2,46 @@ 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
///
/// DoD Extended Security Option (133), RFC 1108, is not supported because it only defines abstract option and no concrete option RFC is available.
/// EIP: The Extended Internet Protocol, RFC 1385, is not supported because according iana.org its option type is 145 but according to the RFC its option type is 138 (0x8A).
/// <list type="table">
/// <listheader>
/// <term>Bits</term>
/// <description>Description</description>
/// </listheader>
/// <item><term>1 bit</term>
/// <description>
/// Copied flag.
/// <para>
/// The copied flag indicates that this option is copied into all fragments on fragmentation.
/// <list type="bullet">
/// <item>0 = not copied.</item>
/// <item>1 = copied.</item>
/// </list>
/// </para>
/// </description>
/// </item>
/// <item><term>2 bits</term>
/// <description>
/// Option class.
/// <para>
/// The option classes are:
/// <list type="bullet">
/// <item>0 = control.</item>
/// <item>1 = reserved for future use.</item>
/// <item>2 = debugging and measurement.</item>
/// <item>3 = reserved for future use.</item>
/// </list>
/// </para>
/// </description>
/// </item>
/// <item><term>5 bits</term><description>Option number.</description></item>
/// </list>
/// </summary>
/// <remarks>
/// <list type="bullet">
/// <item>DoD Extended Security Option (133), RFC 1108, is not supported because it only defines abstract option and no concrete option RFC is available.</item>
/// <item>EIP: The Extended Internet Protocol, RFC 1385, is not supported because according iana.org its option type is 145 but according to the RFC its option type is 138 (0x8A).</item>
/// </list>
/// </remarks>
public enum IpV4OptionType : byte
{
/// <summary>
......
......@@ -3,12 +3,14 @@ using System;
namespace PcapDotNet.Packets.Transport
{
/// <summary>
/// TCP Header Format
/// TCP control bits format
/// <pre>
/// +-----+-----+----+-----+-----+-----+-----+-----+-----+-----+-----+
/// | Bit | 0-6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
/// +-----+-----+----+-----+-----+-----+-----+-----+-----+-----+-----+
/// | 0 | | NS | CWR | ECE | URG | ACK | PSH | RST | SYN | FIN |
/// +-----+-----+----+-----+-----+-----+-----+-----+-----+-----+-----+
/// </pre>
/// </summary>
[Flags]
public enum TcpControlBits : ushort
......
......@@ -4,6 +4,7 @@ namespace PcapDotNet.Packets.Transport
{
/// <summary>
/// TCP Header Format
/// <pre>
/// +-----+-------------+----------+----+-----+-----+-----+-----+-----+-----+-----+-----+------------------+
/// | Bit | 0-3 | 4-6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16-31 |
/// +-----+-------------+----------+----+-----+-----+-----+-----+-----+-----+-----+-----+------------------+
......@@ -19,6 +20,7 @@ namespace PcapDotNet.Packets.Transport
/// +-----+-----------------------------------------------------------------------------+------------------+
/// | 160 | Options + Padding |
/// +-----+------------------------------------------------------------------------------------------------+
/// </pre>
/// </summary>
public class TcpDatagram : TransportDatagram
{
......
......@@ -9,19 +9,29 @@ namespace PcapDotNet.Packets.Transport
/// <summary>
/// TCP Alternate Checksum Data Option (RFC 1146).
///
/// <para>
/// The format of the TCP Alternate Checksum Data Option is:
/// <pre>
/// +---------+---------+---------+ +---------+
/// | Kind=15 |Length=N | data | ... | data |
/// +---------+---------+---------+ +---------+
/// </pre>
/// </para>
///
/// <para>
/// This field is used only when the alternate checksum that is negotiated is longer than 16 bits.
/// These checksums will not fit in the checksum field of the TCP header and thus at least part of them must be put in an option.
/// Whether the checksum is split between the checksum field in the TCP header and the option or the entire checksum is placed in the option
/// is determined on a checksum by checksum basis.
/// </para>
///
/// <para>
/// The length of this option will depend on the choice of alternate checksum algorithm for this connection.
/// </para>
///
/// <para>
/// While computing the alternate checksum, the TCP checksum field and the data portion TCP Alternate Checksum Data Option are replaced with zeros.
/// </para>
/// </summary>
[OptionTypeRegistration(typeof(TcpOptionType), TcpOptionType.AlternateChecksumData)]
public class TcpOptionAlternateChecksumData : TcpOptionComplex, IOptionComplexFactory, IEquatable<TcpOptionAlternateChecksumData>
......
......@@ -4,18 +4,28 @@ namespace PcapDotNet.Packets.Transport
{
/// <summary>
/// TCP Alternate Checksum Request Option (RFC 1146).
/// <pre>
/// +----------+----------+----------+
/// | Kind=14 | Length=3 | chksum |
/// +----------+----------+----------+
/// </pre>
///
/// <para>
/// Here chksum is a number identifying the type of checksum to be used.
/// </para>
///
/// <para>
/// The currently defined values of chksum are:
/// 0 -- TCP checksum.
/// 1 -- 8-bit Fletcher's algorithm.
/// 2 -- 16-bit Fletcher's algorithm.
/// <list>
/// <item>0 - TCP checksum.</item>
/// <item>1 - 8-bit Fletcher's algorithm.</item>
/// <item>2 - 16-bit Fletcher's algorithm.</item>
/// </list>
/// </para>
///
/// <para>
/// Note that the 8-bit Fletcher algorithm gives a 16-bit checksum and the 16-bit algorithm gives a 32-bit checksum.
/// </para>
/// </summary>
[OptionTypeRegistration(typeof(TcpOptionType), TcpOptionType.AlternateChecksumRequest)]
public class TcpOptionAlternateChecksumRequest : TcpOptionComplex, IOptionComplexFactory, IEquatable<TcpOptionAlternateChecksumRequest>
......
......@@ -2,14 +2,18 @@ namespace PcapDotNet.Packets.Transport
{
/// <summary>
/// CC Option (RFC 1644).
/// <pre>
/// +--------+--------+--------+--------+--------+--------+
/// |00001011|00000110| Connection Count: SEG.CC |
/// +--------+--------+--------+--------+--------+--------+
/// Kind=11 Length=6
/// </pre>
///
/// <para>
/// This option may be sent in an initial SYN segment, and it may be sent in other segments if a CC or CC.NEW option
/// has been received for this incarnation of the connection.
/// Its SEG.CC value is the TCB.CCsend value from the sender's TCB.
/// </para>
/// </summary>
[OptionTypeRegistration(typeof(TcpOptionType), TcpOptionType.ConnectionCount)]
public class TcpOptionConnectionCount : TcpOptionConnectionCountBase, IOptionComplexFactory
......
......@@ -2,16 +2,22 @@ namespace PcapDotNet.Packets.Transport
{
/// <summary>
/// CC.ECHO Option (RFC 1644).
/// <pre>
/// +--------+--------+--------+--------+--------+--------+
/// |00001101|00000110| Connection Count: SEG.CC |
/// +--------+--------+--------+--------+--------+--------+
/// Kind=13 Length=6
/// </pre>
///
/// <para>
/// This option must be sent (in addition to a CC option) in a segment containing both a SYN and an ACK bit,
/// if the initial SYN segment contained a CC or CC.NEW option.
/// Its SEG.CC value is the SEG.CC value from the initial SYN.
/// </para>
///
/// <para>
/// A CC.ECHO option should be sent only in a &lt;SYN,ACK&gt; segment and should be ignored if it is received in any other segment.
/// </para>
/// </summary>
[OptionTypeRegistration(typeof(TcpOptionType), TcpOptionType.ConnectionCountEcho)]
public class TcpOptionConnectionCountEcho : TcpOptionConnectionCountBase, IOptionComplexFactory
......
......@@ -2,14 +2,18 @@ namespace PcapDotNet.Packets.Transport
{
/// <summary>
/// CC.NEW Option (RFC 1644).
/// <pre>
/// +--------+--------+--------+--------+--------+--------+
/// |00001100|00000110| Connection Count: SEG.CC |
/// +--------+--------+--------+--------+--------+--------+
/// Kind=12 Length=6
/// </pre>
///
/// <para>
/// This option may be sent instead of a CC option in an initial &lt;SYN&gt; segment (i.e., SYN but not ACK bit),
/// to indicate that the SEG.CC value may not be larger than the previous value.
/// Its SEG.CC value is the TCB.CCsend value from the sender's TCB.
/// </para>
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")]
[OptionTypeRegistration(typeof(TcpOptionType), TcpOptionType.ConnectionCountNew)]
......
......@@ -4,15 +4,21 @@ namespace PcapDotNet.Packets.Transport
{
/// <summary>
/// TCP Echo Option:
/// <pre>
/// +--------+--------+--------+--------+--------+--------+
/// | Kind=6 | Length | 4 bytes of info to be echoed |
/// +--------+--------+--------+--------+--------+--------+
/// </pre>
///
/// <para>
/// This option carries four bytes of information that the receiving TCP may send back in a subsequent TCP Echo Reply option.
/// A TCP may send the TCP Echo option in any segment, but only if a TCP Echo option was received in a SYN segment for the connection.
/// </para>
///
/// <para>
/// When the TCP echo option is used for RTT measurement, it will be included in data segments,
/// and the four information bytes will define the time at which the data segment was transmitted in any format convenient to the sender.
/// </para>
/// </summary>
[OptionTypeRegistration(typeof(TcpOptionType), TcpOptionType.Echo)]
public class TcpOptionEcho : TcpOptionComplex, IOptionComplexFactory, IEquatable<TcpOptionEcho>
......
......@@ -4,20 +4,28 @@ namespace PcapDotNet.Packets.Transport
{
/// <summary>
/// TCP Echo Reply Option:
/// <pre>
/// +--------+--------+--------+--------+--------+--------+
/// | Kind=7 | Length | 4 bytes of echoed info |
/// +--------+--------+--------+--------+--------+--------+
/// </pre>
///
/// <para>
/// A TCP that receives a TCP Echo option containing four information bytes will return these same bytes in a TCP Echo Reply option.
/// </para>
///
/// <para>
/// This TCP Echo Reply option must be returned in the next segment (e.g., an ACK segment) that is sent.
/// If more than one Echo option is received before a reply segment is sent, the TCP must choose only one of the options to echo,
/// ignoring the others; specifically, it must choose the newest segment with the oldest sequence number.
/// </para>
///
/// <para>
/// To use the TCP Echo and Echo Reply options, a TCP must send a TCP Echo option in its own SYN segment
/// and receive a TCP Echo option in a SYN segment from the other TCP.
/// A TCP that does not implement the TCP Echo or Echo Reply options must simply ignore any TCP Echo options it receives.
/// However, a TCP should not receive one of these options in a non-SYN segment unless it included a TCP Echo option in its own SYN segment.
/// </para>
/// </summary>
[OptionTypeRegistration(typeof(TcpOptionType), TcpOptionType.EchoReply)]
public class TcpOptionEchoReply : TcpOptionComplex, IOptionComplexFactory, IEquatable<TcpOptionEchoReply>
......
......@@ -4,14 +4,18 @@ namespace PcapDotNet.Packets.Transport
{
/// <summary>
/// Maximum Segment Size (RFC 793)
/// <pre>
/// +--------+--------+---------+--------+
/// |00000010|00000100| max seg size |
/// +--------+--------+---------+--------+
/// Kind=2 Length=4
/// </pre>
///
/// <para>
/// If this option is present, then it communicates the maximum receive segment size at the TCP which sends this segment.
/// This field must only be sent in the initial connection request (i.e., in segments with the SYN control bit set).
/// If this option is not used, any segment size is allowed.
/// </para>
/// </summary>
[OptionTypeRegistration(typeof(TcpOptionType), TcpOptionType.MaximumSegmentSize)]
public class TcpOptionMaximumSegmentSize : TcpOptionComplex, IOptionComplexFactory, IEquatable<TcpOptionMaximumSegmentSize>
......
......@@ -6,6 +6,7 @@ using System.Linq;
namespace PcapDotNet.Packets.Transport
{
/// <summary>
/// <pre>
/// +---------+---------+-------------------+
/// | Kind=19 |Length=18| MD5 digest... |
/// +---------+---------+-------------------+
......@@ -17,8 +18,11 @@ namespace PcapDotNet.Packets.Transport
/// +-------------------+-------------------+
/// | |
/// +-------------------+
/// </pre>
///
/// <para>
/// The MD5 digest is always 16 bytes in length, and the option would appear in every segment of a connection.
/// </para>
/// </summary>
[OptionTypeRegistration(typeof(TcpOptionType), TcpOptionType.Md5Signature)]
public class TcpOptionMd5Signature: TcpOptionComplex, IOptionComplexFactory, IEquatable<TcpOptionMd5Signature>
......
......@@ -4,9 +4,11 @@ namespace PcapDotNet.Packets.Transport
{
/// <summary>
/// TCP POC-permitted Option (RFC 1693)
/// <pre>
/// +-----------+-------------+
/// | Kind=9 | Length=2 |
/// +-----------+-------------+
/// </pre>
/// </summary>
[OptionTypeRegistration(typeof(TcpOptionType), TcpOptionType.PartialOrderConnectionPermitted)]
public class TcpOptionPartialOrderConnectionPermitted : TcpOptionComplex, IOptionComplexFactory, IEquatable<TcpOptionPartialOrderConnectionPermitted>
......
......@@ -5,11 +5,14 @@ namespace PcapDotNet.Packets.Transport
/// <summary>
/// TCP POC-service-profile Option (RFC 1693).
///
/// <pre>
/// 1 bit 1 bit 6 bits
/// +----------+----------+------------+----------+--------+
/// | Kind=10 | Length=3 | Start_flag | End_flag | Filler |
/// +----------+----------+------------+----------+--------+
/// </pre>
///
/// <para>
/// Contains two 1-bit flags necessary to handle the case where the service profile does not fit in a single TCP segment.
/// The "Start_flag" indicates that the information in the data section represents the beginning of the service profile
/// and the "End_flag" represents the converse.
......@@ -17,6 +20,7 @@ namespace PcapDotNet.Packets.Transport
/// Otherwise, the Start_flag is set in the initial segment and the End_flag in the final segment
/// allowing the peer entity to reconstrcut the entire service profile (using the normal sequence numbers in the segment header).
/// The "Filler" field serves merely to complete the third byte of the option.
/// </para>
/// </summary>
[OptionTypeRegistration(typeof(TcpOptionType), TcpOptionType.PartialOrderServiceProfile)]
public class TcpOptionPartialOrderServiceProfile : TcpOptionComplex, IOptionComplexFactory, IEquatable<TcpOptionPartialOrderServiceProfile>
......
......@@ -8,6 +8,7 @@ namespace PcapDotNet.Packets.Transport
/// <summary>
/// The SACK option is to be used to convey extended acknowledgment information from the receiver to the sender over an established TCP connection.
///
/// <pre>
/// +--------+--------+
/// | Kind=5 | Length |
/// +--------+--------+--------+--------+
......@@ -23,18 +24,24 @@ namespace PcapDotNet.Packets.Transport
/// +--------+--------+--------+--------+
/// | Right Edge of nth Block |
/// +--------+--------+--------+--------+
/// </pre>
///
/// <para>
/// The SACK option is to be sent by a data receiver to inform the data sender of non-contiguous blocks of data that have been received and queued.
/// The data receiver awaits the receipt of data (perhaps by means of retransmissions) to fill the gaps in sequence space between received blocks.
/// When missing segments are received, the data receiver acknowledges the data normally by advancing
/// the left window edge in the Acknowledgement Number Field of the TCP header.
/// The SACK option does not change the meaning of the Acknowledgement Number field.
/// </para>
///
/// <para>
/// This option contains a list of some of the blocks of contiguous sequence space occupied by data that has been received and queued within the window.
/// Each contiguous block of data queued at the data receiver is defined in the SACK option by two 32-bit unsigned integers in network byte order:
/// * Left Edge of Block - This is the first sequence number of this block.
/// * Right Edge of Block - This is the sequence number immediately following the last sequence number of this block.
///
/// <list type="bullet">
/// <item>Left Edge of Block - This is the first sequence number of this block.</item>
/// <item>Right Edge of Block - This is the sequence number immediately following the last sequence number of this block.</item>
/// </list>
/// </para>
/// Each block represents received bytes of data that are contiguous and isolated;
/// that is, the bytes just below the block, (Left Edge of Block - 1), and just above the block, (Right Edge of Block), have not been received.
///
......
......@@ -8,9 +8,11 @@ namespace PcapDotNet.Packets.Transport
/// the SACK option once the connection has opened.
/// It MUST NOT be sent on non-SYN segments.
///
/// <pre>
/// +---------+---------+
/// | Kind=4 | Length=2|
/// +---------+---------+
/// </pre>
/// </summary>
[OptionTypeRegistration(typeof(TcpOptionType), TcpOptionType.SelectiveAcknowledgmentPermitted)]
public class TcpOptionSelectiveAcknowledgmentPermitted : TcpOptionComplex, IOptionComplexFactory, IEquatable<TcpOptionSelectiveAcknowledgmentPermitted>
......
......@@ -4,21 +4,29 @@ namespace PcapDotNet.Packets.Transport
{
/// <summary>
/// TCP Timestamps Option (TSopt):
/// <pre>
/// +-------+-------+---------------------+---------------------+
/// |Kind=8 | 10 | TS Value (TSval) |TS Echo Reply (TSecr)|
/// +-------+-------+---------------------+---------------------+
/// 1 1 4 4
/// </pre>
///
/// <para>
/// The Timestamps option carries two four-byte timestamp fields.
/// The Timestamp Value field (TSval) contains the current value of the timestamp clock of the TCP sending the option.
/// </para>
///
/// <para>
/// The Timestamp Echo Reply field (TSecr) is only valid if the ACK bit is set in the TCP header;
/// if it is valid, it echos a timestamp value that was sent by the remote TCP in the TSval field of a Timestamps option.
/// When TSecr is not valid, its value must be zero.
/// The TSecr value will generally be from the most recent Timestamp option that was received; however, there are exceptions that are explained below.
/// </para>
///
/// <para>
/// A TCP may send the Timestamps option (TSopt) in an initial &lt;SYN&gt; segment (i.e., segment containing a SYN bit and no ACK bit),
/// and may send a TSopt in other segments only if it received a TSopt in the initial &lt;SYN&gt; segment for the connection.
/// </para>
/// </summary>
[OptionTypeRegistration(typeof(TcpOptionType), TcpOptionType.Timestamp)]
public class TcpOptionTimestamp : TcpOptionComplex, IOptionComplexFactory, IEquatable<TcpOptionTimestamp>
......
......@@ -10,20 +10,28 @@ namespace PcapDotNet.Packets.Transport
/// Thus, a TCP that is prepared to scale windows should send the option, even if its own scale factor is 1.
/// The scale factor is limited to a power of two and encoded logarithmically, so it may be implemented by binary shift operations.
///
/// <pre>
/// +---------+---------+---------+
/// | Kind=3 |Length=3 |shift.cnt|
/// +---------+---------+---------+
/// </pre>
///
/// <para>
/// This option is an offer, not a promise; both sides must send Window Scale options in their SYN segments to enable window scaling in either direction.
/// If window scaling is enabled, then the TCP that sent this option will right-shift its true receive-window values by 'shift.cnt' bits
/// for transmission in SEG.WND.
/// The value 'shift.cnt' may be zero (offering to scale, while applying a scale factor of 1 to the receive window).
/// </para>
///
/// <para>
/// This option may be sent in an initial SYN segment (i.e., a segment with the SYN bit on and the ACK bit off).
/// It may also be sent in a SYN,ACK segment, but only if a Window Scale option was received in the initial SYN segment.
/// A Window Scale option in a segment without a SYN bit should be ignored.
/// </para>
///
/// <para>
/// The Window field in a SYN (i.e., a SYN or SYN,ACK) segment itself is never scaled.
/// </para>
/// </summary>
[OptionTypeRegistration(typeof(TcpOptionType), TcpOptionType.WindowScale)]
public class TcpOptionWindowScale: TcpOptionComplex, IOptionComplexFactory, IEquatable<TcpOptionWindowScale>
......
......@@ -5,7 +5,9 @@ namespace PcapDotNet.Packets.Transport
/// <summary>
/// Contains the common part of UDP and TCP.
///
/// <para>
/// Format:
/// <pre>
/// +-----+-------------+----------+-----+-----+-----+-----+-----+-----+------------------+
/// | Bit | 0-4 | 4-9 | 10 | 11 | 12 | 13 | 14 | 15 | 16-31 |
/// +-----+-------------+----------+-----+-----+-----+-----+-----+-----+------------------+
......@@ -13,6 +15,8 @@ namespace PcapDotNet.Packets.Transport
/// +-----+------------------------------------------------------------+------------------+
/// | 32 | Sequence Number |
/// +-----+-------------------------------------------------------------------------------+
/// </pre>
/// </para>
/// </summary>
public abstract class TransportDatagram : Datagram
{
......
......@@ -7,12 +7,16 @@ namespace PcapDotNet.Packets.Transport
/// in the environment of an interconnected set of computer networks.
/// This protocol assumes that the Internet Protocol (IP) is used as the underlying protocol.
///
/// <para>
/// This protocol provides a procedure for application programs to send messages to other programs
/// with a minimum of protocol mechanism.
/// The protocol is transaction oriented, and delivery and duplicate protection are not guaranteed.
/// Applications requiring ordered reliable delivery of streams of data should use the Transmission Control Protocol (TCP).
/// </para>
///
/// <para>
/// Format
/// <pre>
/// 0 7 8 15 16 23 24 31
/// +--------+--------+--------+--------+
/// | Source | Destination |
......@@ -24,6 +28,8 @@ namespace PcapDotNet.Packets.Transport
/// |
/// | data octets ...
/// +---------------- ...
/// </pre>
/// </para>
/// </summary>
public class UdpDatagram : TransportDatagram
{
......
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