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


Java JScan类代码示例

本文整理汇总了Java中org.jnetpcap.packet.JScan的典型用法代码示例。如果您正苦于以下问题:Java JScan类的具体用法?Java JScan怎么用?Java JScan使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


JScan类属于org.jnetpcap.packet包,在下文中一共展示了JScan类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: validateSignature

import org.jnetpcap.packet.JScan; //导入依赖的package包/类
/**
 * Validate signature.
 * 
 * @param method
 *          the method
 * @see org.jnetpcap.packet.structure.AnnotatedMethod#validateSignature(java.lang.reflect.Method)
 */
@Override
protected void validateSignature(Method method) {
	final Class<?> declaringClass = method.getDeclaringClass();

	if (method.isAnnotationPresent(Scanner.class) == false) {
		throw new AnnotatedMethodException(declaringClass,
		    "@Scanner annotation missing for " + method.getName() + "()");
	}

	/*
	 * Now make sure it has the right signature of: <code>static int
	 * name(JBuffer, int)</code.
	 */
	final Class<?>[] sig = method.getParameterTypes();
	if (sig.length != 1 || sig[0] != JScan.class) {
		throw new AnnotatedMethodException(declaringClass,
		    "Invalid signature for " + method.getName() + "()");
	}

	if (object == null && (method.getModifiers() & Modifier.STATIC) == 0) {
		throw new AnnotatedMethodException(declaringClass, method.getName()
		    + "()" + " must be declared static");
	}
}
 
开发者ID:pvenne,项目名称:jgoose,代码行数:32,代码来源:AnnotatedScannerMethod.java

示例2: scanner

import org.jnetpcap.packet.JScan; //导入依赖的package包/类
/**
 * Scanner.
 * 
 * @param scan
 *          the scan
 */
@Scanner
public static void scanner(JScan scan) {

	/*
	 * Packet extends JBuffer. The packet object is the one that is already
	 * created for the scanner in the Pcap.loop call and is already peered. This
	 * is better approach than getting the buffer with: JBuffer b = new
	 * JBuffer(Type.POINTER); scan.scan_buf(b);
	 */
	JPacket packet = scan.scan_packet();

	/*
	 * Thats good
	 */
	int offset = scan.scan_offset();

	/*
	 * Should put this outside the method body as a private field. Do it once
	 * everytime the header is created.
	 */
	@SuppressWarnings("unused")
	int id = JRegistry.lookupId(IEEE802dot11_RADIOTAP.class);

	// JRegistry.lookupId(IEEE802dot11.class);

	/*
	 * Good. Exactly why @HeaderLength methods are static
	 */
	scan.scan_length(getHeaderLength(packet, offset));

	/*
	 * Now here the scan_id is already set, otherwise this @Scanner method would
	 * not be getting called. What you want to set is the next_id which is the
	 * ID of the next header or leave next at PAYLOAD_ID which will force the
	 * JHeaderScanner that called this @Scanner method to also check the reverse
	 * bindings. If you set the next_id to anything other than PAYLOAD or
	 * JScan.END_OF_HEADERS_ID, that id will be used as the next protocol in the
	 * header (another iteration of the loop will make it the current id)
	 */
	// scan.scan_id(id);
	// scan.scan_next_id(next_id);
}
 
开发者ID:pvenne,项目名称:jgoose,代码行数:49,代码来源:IEEE802dot11_RADIOTAP.java


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