src/org/jnetpcap/packet/JHeaderScanner.java
protected void scanHeader(final JScan scan) {

		if (getScannerMethod() != null) {
			getScannerMethod().scan(scan);

		} else if (isDirect()) {
			nativeScan(scan);

		} else {
			/*
			 * Record this header's length
			 */
			final JPacket packet = scan.scan_packet();
			final int offset = scan.scan_offset();

			setAllLengths(scan, packet, offset);
		}

		if (scan.scan_length() == 0) {
			return;
		}

		if (scan.scan_next_id() == JProtocol.PAYLOAD_ID) {
			/*
			 * Because java bindings we are about to invoke, rely on the the current
			 * header being already recorded in packet_state_t structure, we call on
			 * the record_header method menually. Here are some major effects as a
			 * result of this call:
			 */
			/* 1 - payload is calculated if not set; */
			/* 2 - protocol record properties are truncated from their theoretical; */
			/*
			 * 3 - header state pointer is advanced to the next structure in the
			 * packet->header array;
			 */
			/* 4 - offset and length are untouched; */
			/*
			 * 5 - is_recorded flag in scan structure is set to true. Prevents
			 * multiple recordings of the same scan state.
			 */

			scan.record_header();

			final JPacket packet = scan.scan_packet();
			final int offset = scan.scan_offset();

			scan.scan_offset(offset);

			/*
			 * Now call on any custom bindings. If bindings fail, heuristic scanner
			 * can still match if its enabled. We need to advance the current offset
			 * manually past the header and the gap (between header and payload).
			 * Current header is already recorded and can be peered for binding
			 * invocation.
			 */
			final int next =
			    scanAllBindings(packet, offset + scan.scan_length() + scan.scan_gap());
			scan.scan_next_id(next);

			/*
			 * Native main scan loop implements heuristics. Both post and pre
			 * heuristic checks are supported. Post heuristic checks are done only
			 * after the direct binding checks fail. The above is a "direct binding
			 * check", inkoked through normally registered bindings. For pre, we still
			 * perform direct checks as normal here, the native scan method, overrides
			 * our results. For post, it just checks if we succeeded.
			 */
		}
	}
/**
	 * The main method that this header scanner is called on by the packet
	 * scanner, typically from native user space.
	 * 
	 * @param scan
	 *          scan state structure that is used to pass around state both in
	 *          java and native user space
	 */
The main method that this header scanner is called on by the packet
scanner, typically from native user space.

@param scan
scan state structure that is used to pass around state both in
java and native user space
The main method that this header scanner is called on by the packet scanner typically from native user space . @param scan scan state structure that is used to pass around state both in java and native user space
protected void scanHeader(final JScan scan) {
		if (getScannerMethod() != null) {
			getScannerMethod().scan(scan);
		} else if (isDirect()) {
			nativeScan(scan);
		} else {
			/*
			 * Record this header's length
			 */
			final JPacket packet = scan.scan_packet();
			final int offset = scan.scan_offset();
			setAllLengths(scan, packet, offset);
		}
		if (scan.scan_length() == 0) {
			return;
		}
		if (scan.scan_next_id() == JProtocol.PAYLOAD_ID) {
			/*
			 * Because java bindings we are about to invoke, rely on the the current
			 * header being already recorded in packet_state_t structure, we call on
			 * the record_header method menually. Here are some major effects as a
			 * result of this call:
			 */
			/* 1 - payload is calculated if not set; */
			/* 2 - protocol record properties are truncated from their theoretical; */
			/*
			 * 3 - header state pointer is advanced to the next structure in the
			 * packet->header array;
			 */
			/* 4 - offset and length are untouched; */
			/*
			 * 5 - is_recorded flag in scan structure is set to true. Prevents
			 * multiple recordings of the same scan state.
			 */
			scan.record_header();
			final JPacket packet = scan.scan_packet();
			final int offset = scan.scan_offset();
			scan.scan_offset(offset);
			/*
			 * Now call on any custom bindings. If bindings fail, heuristic scanner
			 * can still match if its enabled. We need to advance the current offset
			 * manually past the header and the gap (between header and payload).
			 * Current header is already recorded and can be peered for binding
			 * invocation.
			 */
			final int next =
			    scanAllBindings(packet, offset + scan.scan_length() + scan.scan_gap());
			scan.scan_next_id(next);
			/*
			 * Native main scan loop implements heuristics. Both post and pre
			 * heuristic checks are supported. Post heuristic checks are done only
			 * after the direct binding checks fail. The above is a "direct binding
			 * check", inkoked through normally registered bindings. For pre, we still
			 * perform direct checks as normal here, the native scan method, overrides
			 * our results. For post, it just checks if we succeeded.
			 */
		}
	}
protected void scanHeader ( final JScan scan ) { if ( getScannerMethod ( ) != null ) { getScannerMethod ( ) . scan ( scan ) ; } else if ( isDirect ( ) ) { nativeScan ( scan ) ; } else { /*
			 * Record this header's length
			 */ final JPacket packet = scan . scan_packet ( ) ; final int offset = scan . scan_offset ( ) ; setAllLengths ( scan , packet , offset ) ; } if ( scan . scan_length ( ) == 0 ) { return ; } if ( scan . scan_next_id ( ) == JProtocol . PAYLOAD_ID ) { /*
			 * Because java bindings we are about to invoke, rely on the the current
			 * header being already recorded in packet_state_t structure, we call on
			 * the record_header method menually. Here are some major effects as a
			 * result of this call:
			 */ /* 1 - payload is calculated if not set; */ /* 2 - protocol record properties are truncated from their theoretical; */ /*
			 * 3 - header state pointer is advanced to the next structure in the
			 * packet->header array;
			 */ /* 4 - offset and length are untouched; */ /*
			 * 5 - is_recorded flag in scan structure is set to true. Prevents
			 * multiple recordings of the same scan state.
			 */ scan . record_header ( ) ; final JPacket packet = scan . scan_packet ( ) ; final int offset = scan . scan_offset ( ) ; scan . scan_offset ( offset ) ; /*
			 * Now call on any custom bindings. If bindings fail, heuristic scanner
			 * can still match if its enabled. We need to advance the current offset
			 * manually past the header and the gap (between header and payload).
			 * Current header is already recorded and can be peered for binding
			 * invocation.
			 */ final int next = scanAllBindings ( packet , offset + scan . scan_length ( ) + scan . scan_gap ( ) ) ; scan . scan_next_id ( next ) ; /*
			 * Native main scan loop implements heuristics. Both post and pre
			 * heuristic checks are supported. Post heuristic checks are done only
			 * after the direct binding checks fail. The above is a "direct binding
			 * check", inkoked through normally registered bindings. For pre, we still
			 * perform direct checks as normal here, the native scan method, overrides
			 * our results. For post, it just checks if we succeeded.
			 */ } }
The main method that this header scanner is called on by the packet
 scanner, typically from native user space.
The main method that this header scanner is called on by the packet scanner typically from native user space .