本文整理汇总了Java中org.jnetpcap.packet.annotate.Dynamic类的典型用法代码示例。如果您正苦于以下问题:Java Dynamic类的具体用法?Java Dynamic怎么用?Java Dynamic使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Dynamic类属于org.jnetpcap.packet.annotate包,在下文中一共展示了Dynamic类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checksumDescription
import org.jnetpcap.packet.annotate.Dynamic; //导入依赖的package包/类
/**
* Checksum description.
*
* @return the string
*/
@Dynamic(Field.Property.DESCRIPTION)
public String checksumDescription() {
if (isFragmented()) {
return "supressed for fragments";
}
if (isPayloadTruncated()) {
return "supressed for truncated packets";
}
final int crc16 = calculateChecksum();
if (checksum() == crc16) {
return "correct";
} else {
return "incorrect: 0x" + Integer.toHexString(crc16).toUpperCase();
}
}
示例2: checksumDescription
import org.jnetpcap.packet.annotate.Dynamic; //导入依赖的package包/类
/**
* Returns a dynamic description of the checksum field. Specifically it checks
* and displays, as description, the state of the checksum field, if it
* matches the calculated checksum or not.
*
* @return additional information about the state of the checksum field
*/
@Dynamic(Field.Property.DESCRIPTION)
public String checksumDescription() {
if (isFragmented()) {
return "supressed for fragments";
}
if (isPayloadTruncated()) {
return "supressed for truncated packets";
}
final int crc16 = calculateChecksum();
if (checksum() == crc16) {
return "correct";
} else {
return "incorrect: 0x" + Integer.toHexString(crc16).toUpperCase();
}
}
示例3: checksumDescription
import org.jnetpcap.packet.annotate.Dynamic; //导入依赖的package包/类
/**
* Checksum description.
*
* @return the string
*/
@Dynamic(Field.Property.DESCRIPTION)
public String checksumDescription() {
final int crc32 = calculateChecksum();
if (checksum() == crc32) {
return "correct";
} else {
return "incorrect: 0x" + Long.toHexString(crc32 & 0xFFFFFFFF).toUpperCase();
}
}
示例4: checksumDescription
import org.jnetpcap.packet.annotate.Dynamic; //导入依赖的package包/类
/**
* Checksum description.
*
* @return the string
*/
@Dynamic(Field.Property.DESCRIPTION)
public String checksumDescription() {
final long crc32 = calculateChecksum();
if (checksum() == crc32) {
return "correct";
} else {
return "incorrect: 0x" + Long.toHexString(crc32).toUpperCase();
}
}
示例5: checksumDescription
import org.jnetpcap.packet.annotate.Dynamic; //导入依赖的package包/类
/**
* Checksum description.
*
* @return the string
*/
@Dynamic(Field.Property.DESCRIPTION)
public String checksumDescription() {
final int crc16 = calculateChecksum();
if (checksum() == crc16) {
return "correct";
} else {
return "incorrect: 0x" + Integer.toHexString(crc16).toUpperCase();
}
}
示例6: hlenDescription
import org.jnetpcap.packet.annotate.Dynamic; //导入依赖的package包/类
/**
* Hlen description.
*
* @return the string
*/
@Dynamic(Field.Property.DESCRIPTION)
public String hlenDescription() {
String pre = "" + hlen() + " * 4 = " + (hlen() * 4) + " bytes";
return (hlen() == 5) ? pre + ", No Ip Options" : pre
+ ", Ip Options Present";
}
示例7: flags_BEDescription
import org.jnetpcap.packet.annotate.Dynamic; //导入依赖的package包/类
/**
* Returns a description of the current state of U flag
*
* @return description
*/
@Dynamic(Field.Property.DESCRIPTION)
public String flags_BEDescription() {
switch (flags_BE()) {
case 0:
return "Middle piece of a fragmented user message";
case 1 :
return "Last piece of a fragmented user message";
case 2 :
return "First piece of a fragmented user message";
case 3 :
return "Unfragmented message";
}
return "unknown option";
}
示例8: inspectMethod
import org.jnetpcap.packet.annotate.Dynamic; //导入依赖的package包/类
/**
* Inspect method.
*
* @param method
* the method
* @return the annotated field method
*/
public static AnnotatedFieldMethod inspectMethod(Method method) {
Dynamic runtime = method.getAnnotation(Dynamic.class);
Field.Property function = runtime.value();
switch (function) {
case LENGTH:
case OFFSET:
checkSignature(method, int.class);
return new IntFunction(method, function);
case MASK:
checkSignature(method, long.class);
return new LongFunction(method, function);
case VALUE:
checkSignature(method, Object.class);
return new ObjectFunction(method, function);
case CHECK:
checkSignature(method, boolean.class);
return new BooleanFunction(method, function);
case DISPLAY:
case DESCRIPTION:
checkSignature(method, String.class);
return new StringFunction(method, function);
default:
throw new HeaderDefinitionError("Unsupported Dynamic function type "
+ function.toString());
}
}
示例9: hlenDescription
import org.jnetpcap.packet.annotate.Dynamic; //导入依赖的package包/类
/**
* Hlen description.
*
* @return the string
*/
@Dynamic(Field.Property.DESCRIPTION)
public String hlenDescription() {
String pre = "" + hlen() + " * 4 = " + (hlen() * 4) + " bytes";
return (hlen() == 5) ? pre + ", No Ip Options" : pre
+ ", Ip Options Present";
}
示例10: fieldOffset
import org.jnetpcap.packet.annotate.Dynamic; //导入依赖的package包/类
/**
* Field offset.
*
* @param field
* the field
* @return the int
*/
@Dynamic(Field.Property.OFFSET)
protected int fieldOffset(String field) {
if (fieldMap.get(map(field)) == null) {
return -1;
}
return fieldMap.get(map(field)).getOffset(this);
}
示例11: offsetDescription
import org.jnetpcap.packet.annotate.Dynamic; //导入依赖的package包/类
/**
* Offset description.
*
* @return the string
*/
@Dynamic(Field.Property.DESCRIPTION)
public String offsetDescription() {
return (offset() == 0) ? null : "" + offset() + " * 8 = " + (offset() * 8)
+ " bytes";
}
示例12: ssrcLength
import org.jnetpcap.packet.annotate.Dynamic; //导入依赖的package包/类
@Dynamic(field = "ssrc", value = Field.Property.LENGTH)
public int ssrcLength() {
return sc() * (4 * BYTE);
}
示例13: code_CopyDescription
import org.jnetpcap.packet.annotate.Dynamic; //导入依赖的package包/类
/**
* Code_ copy description.
*
* @return the string
*/
@Dynamic(Field.Property.DESCRIPTION)
public String code_CopyDescription() {
return (code_Copy() > 0) ? "copy to all fragments"
: "do not copy to fragments";
}
示例14: code_CopyDescription
import org.jnetpcap.packet.annotate.Dynamic; //导入依赖的package包/类
/**
* Code_ copy description.
*
* @return the string
*/
@Dynamic(Field.Property.DESCRIPTION)
public String code_CopyDescription() {
return (code_Copy() > 0) ? "copy to all fragments"
: "do not copy to fragments";
}
示例15: codeDescription
import org.jnetpcap.packet.annotate.Dynamic; //导入依赖的package包/类
@Dynamic(Field.Property.DESCRIPTION)
public String codeDescription() {
return codeEnum().toString();
}