本文整理汇总了Java中org.jnetpcap.util.checksum.Checksum.inChecksumShouldBe方法的典型用法代码示例。如果您正苦于以下问题:Java Checksum.inChecksumShouldBe方法的具体用法?Java Checksum.inChecksumShouldBe怎么用?Java Checksum.inChecksumShouldBe使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jnetpcap.util.checksum.Checksum
的用法示例。
在下文中一共展示了Checksum.inChecksumShouldBe方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: calculateChecksum
import org.jnetpcap.util.checksum.Checksum; //导入方法依赖的package包/类
/**
* Calculates a checksum using protocol specification for a header. Checksums
* for partial headers or fragmented packets (unless the protocol alows it)
* are not calculated.
*
* @return header's calculated checksum
*/
public int calculateChecksum() {
if (getIndex() == -1) {
throw new IllegalStateException("Oops index not set");
}
final int ipOffset = getPreviousHeaderOffset();
return Checksum.inChecksumShouldBe(checksum(),
Checksum.icmp(packet, ipOffset, this.getOffset()));
}
示例2: calculateChecksum
import org.jnetpcap.util.checksum.Checksum; //导入方法依赖的package包/类
/**
* Calculates a checksum using protocol specification for a header. Checksums
* for partial headers or fragmented packets (unless the protocol alows it)
* are not calculated.
*
* @return header's calculated checksum
*/
public int calculateChecksum() {
if (getIndex() == -1) {
throw new IllegalStateException("Oops index not set");
}
final int ipOffset = getPreviousHeaderOffset();
return Checksum.inChecksumShouldBe(checksum(),
Checksum.pseudoTcp(this.packet, ipOffset, getOffset()));
}
示例3: calculateChecksum
import org.jnetpcap.util.checksum.Checksum; //导入方法依赖的package包/类
/**
* Calculates a checksum using protocol specification for a header. Checksums
* for partial headers or fragmented packets (unless the protocol alows it)
* are not calculated.
*
* @return header's calculated checksum
*/
public int calculateChecksum() {
if (getIndex() == -1) {
throw new IllegalStateException("Oops index not set");
}
final int ipOffset = getPreviousHeaderOffset();
return Checksum.inChecksumShouldBe(checksum(), Checksum.icmp(packet,
ipOffset, this.getOffset()));
}
示例4: calculateChecksum
import org.jnetpcap.util.checksum.Checksum; //导入方法依赖的package包/类
/**
* Calculates a checksum using protocol specification for a header. Checksums
* for partial headers or fragmented packets (unless the protocol alows it)
* are not calculated.
* <p>
* The method used to compute the checksum is defined in RFC 768:
*
* <pre>
* Checksum is the 16-bit one's complement of the one's complement sum of
* a pseudo header of information from the IP header, the UDP header,
* and the data, padded with zero octets at the end (if necessary) to make
* a multiple of two octets.
* </pre>
*
* In other words, all 16-bit words are summed using one's complement
* arithmetic. The sum is then one's complemented to yield the value of the
* UDP checksum field. If the checksum calculation results in the value zero
* (all 16 bits 0) it should be sent as the one's complement (all 1's). The
* difference between IPv4 and IPv6 is in the data used to compute the
* checksum.
* </p>
*
* @return header's calculated checksum
*/
public int calculateChecksum() {
if (getIndex() == -1) {
throw new IllegalStateException("Oops index not set");
}
final int ipOffset = getPreviousHeaderOffset();
return Checksum.inChecksumShouldBe(checksum(),
Checksum.pseudoUdp(this.packet, ipOffset, getOffset()));
}
示例5: calculateChecksum
import org.jnetpcap.util.checksum.Checksum; //导入方法依赖的package包/类
/**
* Calculates a checksum using protocol specification for a header. Checksums
* for partial headers or fragmented packets (unless the protocol alows it)
* are not calculated.
* <p>
* The method used to compute the checksum is defined in RFC 768:
*
* <pre>
* Checksum is the 16-bit one's complement of the one's complement sum of
* a pseudo header of information from the IP header, the UDP header,
* and the data, padded with zero octets at the end (if necessary) to make
* a multiple of two octets.
* </pre>
*
* In other words, all 16-bit words are summed using one's complement
* arithmetic. The sum is then one's complemented to yield the value of the
* UDP checksum field. If the checksum calculation results in the value zero
* (all 16 bits 0) it should be sent as the one's complement (all 1's). The
* difference between IPv4 and IPv6 is in the data used to compute the
* checksum.
* </p>
*
* @return header's calculated checksum
*/
public int calculateChecksum() {
if (getIndex() == -1) {
throw new IllegalStateException("Oops index not set");
}
final int ipOffset = getPreviousHeaderOffset();
return Checksum.inChecksumShouldBe(checksum(), Checksum.pseudoUdp(
this.packet, ipOffset, getOffset()));
}
示例6: calculateChecksum
import org.jnetpcap.util.checksum.Checksum; //导入方法依赖的package包/类
/**
* Calculates a checksum using protocol specification for a header. Checksums
* for partial headers or fragmented packets (unless the protocol alows it)
* are not calculated.
*
* @return header's calculated checksum
*/
public int calculateChecksum() {
return Checksum.inChecksumShouldBe(this.checksum(),
Checksum.inChecksum(this, 0, this.size()));
}
示例7: calculateChecksum
import org.jnetpcap.util.checksum.Checksum; //导入方法依赖的package包/类
/**
* Calculates a checksum using protocol specification for a header. Checksums
* for partial headers or fragmented packets (unless the protocol alows it)
* are not calculated.
*
* @return header's calculated checksum
*/
public int calculateChecksum() {
return Checksum.inChecksumShouldBe(this.checksum(), Checksum.inChecksum(
this, 0, this.size()));
}