org.jnetpcap.packet
Class JScan

java.lang.Object
  extended by org.jnetpcap.nio.JMemory
      extended by org.jnetpcap.nio.JStruct
          extended by org.jnetpcap.packet.JScan

public class JScan
extends JStruct

A inprogress working scan structure. Used by JScanner to pass around information between various scan routines. This class is peered with scan_t structure that is used to pass information both between native header scanners and java scanners.

Author:
Mark Bednarczyk, Sly Technologies, Inc.

Nested Class Summary
 
Nested classes/interfaces inherited from class org.jnetpcap.nio.JMemory
JMemory.Type
 
Field Summary
static int END_OF_HEADERS_ID
          Special header ID that when used with a scanner's next_id variable, indicates that this is the last header and scanner should exit its loop.
 
Fields inherited from class org.jnetpcap.nio.JMemory
JNETPCAP_LIBRARY_NAME, MAX_DIRECT_MEMORY_DEFAULT, POINTER
 
Constructor Summary
JScan()
          Alocates and creates scan_t structure in native memory.
JScan(JMemory.Type type)
          Creates an uninitialized scan structure.
 
Method Summary
 int record_header()
          Record_header.
 void record_header(int value)
          Record_header.
 void scan_buf_len(int size)
          Size of packet data.
 void scan_buf(JBuffer buffer)
          Gets the current packet data buffer.
 int scan_gap()
          Scan_gap.
 void scan_gap(int value)
          Scan_gap.
 int scan_id()
          Scan_id.
 void scan_id(int id)
          Scan_id.
 int scan_length()
          Scan_length.
 void scan_length(int length)
          Scan_length.
 int scan_next_id()
          Scan_next_id.
 void scan_next_id(int next_id)
          Scan_next_id.
 int scan_offset()
          Gets teh curren offset by the dscanner into the packet buffer.
 void scan_offset(int offset)
          Sets the current offset by the scanner into the packet buffer.
 JPacket scan_packet()
          Java packet that is being processed.
 int scan_payload()
          Scan_payload.
 void scan_payload(int value)
          Scan_payload.
 int scan_postix()
          Scan_postix.
 void scan_postix(int value)
          Scan_postix.
 int scan_prefix()
          Scan_prefix.
 void scan_prefix(int value)
          Scan_prefix.
 void scan_set_lengths(int prefix, int header, int gap, int payload, int postfix)
          Sets all the various lengths in the header structure all at once.
static int sizeof()
          Size in bytes of the native scan_t structure on this particular platform.
 
Methods inherited from class org.jnetpcap.nio.JStruct
getStructName, toString
 
Methods inherited from class org.jnetpcap.nio.JMemory
availableDirectMemory, check, cleanup, createReference, isInitialized, isJMemoryBasedOwner, isOwner, maxDirectMemory, peer, peer, peer, reservedDirectMemory, setSize, size, softDirectMemory, toDebugString, toHexdump, toHexdump, totalActiveAllocated, totalAllocateCalls, totalAllocated, totalAllocatedSegments0To255Bytes, totalAllocatedSegments256OrAbove, totalDeAllocateCalls, totalDeAllocated, transferFrom, transferFrom, transferFrom, transferFrom, transferFromDirect, transferOwnership, transferTo, transferTo, transferTo, transferTo, transferTo, transferTo, transferTo, transferTo0
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

END_OF_HEADERS_ID

public static final int END_OF_HEADERS_ID
Special header ID that when used with a scanner's next_id variable, indicates that this is the last header and scanner should exit its loop. The constant can be used both in java and in JNI code.

See Also:
Constant Field Values
Constructor Detail

JScan

public JScan()
Alocates and creates scan_t structure in native memory.


JScan

public JScan(JMemory.Type type)
Creates an uninitialized scan structure.

Parameters:
type - memory type
Method Detail

scan_id

public int scan_id()
Scan_id.

Returns:
the int

scan_next_id

public int scan_next_id()
Scan_next_id.

Returns:
the int

scan_length

public int scan_length()
Scan_length.

Returns:
the int

scan_id

public void scan_id(int id)
Scan_id.

Parameters:
id - the id

scan_next_id

public void scan_next_id(int next_id)
Scan_next_id.

Parameters:
next_id - the next_id

scan_length

public void scan_length(int length)
Scan_length.

Parameters:
length - the length

scan_prefix

public int scan_prefix()
Scan_prefix.

Returns:
the int

scan_gap

public int scan_gap()
Scan_gap.

Returns:
the int

scan_payload

public int scan_payload()
Scan_payload.

Returns:
the int

scan_postix

public int scan_postix()
Scan_postix.

Returns:
the int

record_header

public int record_header()
Record_header.

Returns:
the int

scan_prefix

public void scan_prefix(int value)
Scan_prefix.

Parameters:
value - the value

scan_gap

public void scan_gap(int value)
Scan_gap.

Parameters:
value - the value

scan_payload

public void scan_payload(int value)
Scan_payload.

Parameters:
value - the value

scan_postix

public void scan_postix(int value)
Scan_postix.

Parameters:
value - the value

record_header

public void record_header(int value)
Record_header.

Parameters:
value - the value

scan_set_lengths

public void scan_set_lengths(int prefix,
                             int header,
                             int gap,
                             int payload,
                             int postfix)
Sets all the various lengths in the header structure all at once.

Parameters:
prefix - prefix length in bytes before the header
header - length of the header (same as scan_length(int))
gap - length of the gap between header and payload
payload - length of payload
postfix - length of postfix after the payload

sizeof

public static int sizeof()
Size in bytes of the native scan_t structure on this particular platform.

Returns:
size in bytes

scan_buf

public void scan_buf(JBuffer buffer)
Gets the current packet data buffer.

Parameters:
buffer - packet data buffer

scan_buf_len

public void scan_buf_len(int size)
Size of packet data.

Parameters:
size - length in bytes

scan_offset

public void scan_offset(int offset)
Sets the current offset by the scanner into the packet buffer.

Parameters:
offset - offset in bytes

scan_packet

public JPacket scan_packet()
Java packet that is being processed.

Returns:
the packet instance being currently processed

scan_offset

public int scan_offset()
Gets teh curren offset by the dscanner into the packet buffer.

Returns:
offset in bytes