C# Class Tx.Network.NetworkTransformExtentions

Mostra file Open project: Reactive-Extensions/Tx

Public Methods

Method Description
GetUdpCheckSum ( this input ) : ushort

Uses the UDP Pseudoheader, UDP Header, and UDP payload to compute the checksum used in UDP transmission, per RFC 768

Private Methods

Method Description
GetInternetChecksum ( byte input ) : ushort

Takes an IpPacket object and encodes it for transmission on the network in a byte array. Includes computing checksums.

Takes an UDPDatagram object and encodes it for transmission on the network in a byte array. Includes computing checksums.

Per RFC 768, compute a ones complement sum over the sum of the 16bit words in the byte array. If the array is too short a zero-pad byte is added.

This is not a CRC but is the checksum used for IP headers, UDP datagrams or TCP segments. Note that if the 16 bit integers on input are in network order, the answer will also be in network order.

NetworkOrderUshort ( ushort input ) : ushort
UdpHeaderToWireBytes ( this input ) : byte[]

Takes an IpPacket object and encodes the IP header for transmission on the network in a byte array. Includes computing checksums.

Takes a UDP Datagram object and encodes the UDP header for transmission on the network. Assumes UDP checksum is computed.

UdpPseudoHeader ( this input ) : byte[]

From a UDP datagram object, creates the UDP pseudoheader that is used to compute the UDP checksum per RFC 768

Method Details

GetUdpCheckSum() public static method

Uses the UDP Pseudoheader, UDP Header, and UDP payload to compute the checksum used in UDP transmission, per RFC 768
public static GetUdpCheckSum ( this input ) : ushort
input this The UdpDatagram object to check
return ushort