当前位置: 首页>>代码示例>>Java>>正文


Java Checksum.inChecksumShouldBe方法代码示例

本文整理汇总了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()));
}
 
开发者ID:pvenne,项目名称:jgoose,代码行数:19,代码来源:Icmp.java

示例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()));
}
 
开发者ID:pvenne,项目名称:jgoose,代码行数:19,代码来源:Tcp.java

示例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()));
}
 
开发者ID:GlacialSoftware,项目名称:PCAPReader,代码行数:19,代码来源:Icmp.java

示例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()));
}
 
开发者ID:pvenne,项目名称:jgoose,代码行数:36,代码来源:Udp.java

示例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()));
}
 
开发者ID:GlacialSoftware,项目名称:PCAPReader,代码行数:36,代码来源:Udp.java

示例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()));
}
 
开发者ID:pvenne,项目名称:jgoose,代码行数:12,代码来源:Ip4.java

示例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()));
}
 
开发者ID:GlacialSoftware,项目名称:PCAPReader,代码行数:12,代码来源:Ip4.java


注:本文中的org.jnetpcap.util.checksum.Checksum.inChecksumShouldBe方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。