net.clackrouter.component.tcp
Class TCPChecksum

java.lang.Object
  extended by net.clackrouter.component.tcp.TCPChecksum

public class TCPChecksum
extends java.lang.Object

Helper class to perform the TCP checksum algorithm.


Field Summary
static int CHECKSUM_OFFSET
           
 
Constructor Summary
TCPChecksum()
           
 
Method Summary
static int calcTCPChecksum(IPPacket ippacket)
          Calculates the TCP checksum for the supplied IP packet
static void setTCPChecksum(IPPacket ippacket)
          Sets the Checksum field in the TCP header.
static boolean verifyTCPChecksum(IPPacket ippacket)
          Verifies the Checksum field in the TCP header.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CHECKSUM_OFFSET

public static final int CHECKSUM_OFFSET
See Also:
Constant Field Values
Constructor Detail

TCPChecksum

public TCPChecksum()
Method Detail

calcTCPChecksum

public static int calcTCPChecksum(IPPacket ippacket)
Calculates the TCP checksum for the supplied IP packet

Parameters:
ippacket -
Returns:
TCP header checksum

setTCPChecksum

public static void setTCPChecksum(IPPacket ippacket)
Sets the Checksum field in the TCP header.

Parameters:
ippacket -

verifyTCPChecksum

public static boolean verifyTCPChecksum(IPPacket ippacket)
Verifies the Checksum field in the TCP header.

Parameters:
ippacket -
Returns:
true if the checksum is value, false otherwise.