org.jnetpcap.packet
Interface JHeaderChecksum

All Known Implementing Classes:
Icmp, Ip4, Tcp, Udp

public interface JHeaderChecksum

Interface implemented by protocol headers that maintain a header and possibly payload checksums.

Author:
Mark Bednarczyk, Sly Technologies, Inc.

Method Summary
 int calculateChecksum()
          Calculates a checksum using protocol specification for a header.
 int checksum()
          Retrieves the header's checksum.
 boolean isChecksumValid()
          Validates the header's data against the stored checksum.
 

Method Detail

checksum

int checksum()
Retrieves the header's checksum.

Returns:
header's stored checksum

calculateChecksum

int calculateChecksum()
Calculates a checksum using protocol specification for a header. Checksums for partial headers or fragmented packets (unless the protocol alows it) are not calculated.

Returns:
header's calculated checksum

isChecksumValid

boolean isChecksumValid()
Validates the header's data against the stored checksum. Checksums for partial headers or fragmented packets (unless the protocol alows it) are not validated and true is always returned.

Returns:
Calculates a checksum and validates it against the store checksum in the header. If checksums match or header is a fragment true is returned, otherwise if the checksums don't match false is returned.