Class IPPacket
Represents an IP (Internet Protocol) packet.
Inherited Members
Namespace: Cosmos.System.Network.IPv4
Assembly: Cosmos.System2.dll
Syntax
public class IPPacket : EthernetPacket
Remarks
See also: EthernetPacket.
Constructors
| Improve this Doc View SourceIPPacket(MACAddress, MACAddress, UInt16, Byte, Address, Address, Byte)
Initializes a new instance of the IPPacket class.
Declaration
public IPPacket(MACAddress srcMAC, MACAddress destMAC, ushort dataLength, byte protocol, Address source, Address dest, byte Flags)
Parameters
Type | Name | Description |
---|---|---|
MACAddress | srcMAC | Source MAC address. |
MACAddress | destMAC | Destination MAC address. |
System.UInt16 | dataLength | Data length. |
System.Byte | protocol | Protocol. |
Address | source | Source address. |
Address | dest | Destionation address. |
System.Byte | Flags | Flags. |
IPPacket(Byte[])
Create new instance of the IPPacket class.
Declaration
public IPPacket(byte[] rawData)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | rawData | Raw data. |
IPPacket(UInt16, Byte, Address, Address, Byte)
Initializes a new instance of the IPPacket class.
Declaration
protected IPPacket(ushort dataLength, byte protocol, Address source, Address dest, byte Flags)
Parameters
Type | Name | Description |
---|---|---|
System.UInt16 | dataLength | Data length. |
System.Byte | protocol | Protocol. |
Address | source | Source address. |
Address | dest | Destionation address. |
System.Byte | Flags | Flags. |
IPPacket(UInt16, Byte, Address, Address, Byte, MACAddress)
Initializes a new instance of the IPPacket class.
Declaration
protected IPPacket(ushort dataLength, byte protocol, Address source, Address dest, byte Flags, MACAddress broadcast)
Parameters
Type | Name | Description |
---|---|---|
System.UInt16 | dataLength | Data length. |
System.Byte | protocol | Protocol. |
Address | source | Source address. |
Address | dest | Destionation address. |
System.Byte | Flags | Flags. |
MACAddress | broadcast | Mac address |
Fields
| Improve this Doc View SourceipHeaderLength
Declaration
protected byte ipHeaderLength
Field Value
Type | Description |
---|---|
System.Byte |
Properties
| Improve this Doc View SourceNextIPFragmentID
Gets the next IP fragment ID.
Declaration
public static ushort NextIPFragmentID { get; }
Property Value
Type | Description |
---|---|
System.UInt16 |
Methods
| Improve this Doc View SourceCalcIPCRC(UInt16)
Calculates the CRC of the packet.
Declaration
protected ushort CalcIPCRC(ushort headerLength)
Parameters
Type | Name | Description |
---|---|---|
System.UInt16 | headerLength | The length of the header, in bytes. |
Returns
Type | Description |
---|---|
System.UInt16 |
CalcOcCRC(Byte[], UInt16, Int32)
Calculates the CRC of the packet.
Declaration
protected static ushort CalcOcCRC(byte[] buffer, ushort offset, int length)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | buffer | The buffer to use. |
System.UInt16 | offset | The offset, in bytes. |
System.Int32 | length | The length, in bytes. |
Returns
Type | Description |
---|---|
System.UInt16 |
CalcOcCRC(UInt16, UInt16)
Calculates the CRC of the packet.
Declaration
protected ushort CalcOcCRC(ushort offset, ushort length)
Parameters
Type | Name | Description |
---|---|---|
System.UInt16 | offset | The offset, in bytes. |
System.UInt16 | length | The length, in bytes. |
Returns
Type | Description |
---|---|
System.UInt16 |
InitializeFields()
Initializes all internal fields.
Declaration
protected override void InitializeFields()
Overrides
Exceptions
Type | Condition |
---|---|
System.ArgumentException | Thrown if RawData is invalid or null. |
SumShortValues(Byte[], Int32, Int32)
Declaration
protected static ushort SumShortValues(byte[] buffer, int offset, int length)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | buffer | |
System.Int32 | offset | |
System.Int32 | length |
Returns
Type | Description |
---|---|
System.UInt16 |
ToString()
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String |