|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.jnetpcap.nio.JMemory
org.jnetpcap.nio.JFunction
org.jnetpcap.packet.JHeaderScanner
public class JHeaderScanner
A header scanner, there is one per header, that is able to scan raw memory
buffer and determine the length of the header and the next header ID after
examining the current header's structure. The header scanner is bound to the
native direct scanner provided by the jNetPcap native implementation. The
header scanner can be overriden with a java implementation by simply
subclassing it and overriding the getHeaderLength and
getNextHeader methods. If either of the 2 types of methods are
overriden, then the user should also overriden the isDirect() method
and return false to indicate that this is not a native direct scanner.
The header scanner is natively peered directly with the appropriate function that performs the scan and determines the next protocol in chain of headers found in the data buffer. Another words this class is peered using a function pointer and dispatched appropriately when invoked to scan for length or next header id.
Here is a typedef definition and the function pointer signature.
typedef void (*native_protocol_func_t)(scan_t *scan);Note that scan_t structure is implemented by java class JScan which is peered with that structure.
JScan| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class org.jnetpcap.nio.JMemory |
|---|
JMemory.Type |
| Field Summary |
|---|
| Fields inherited from class org.jnetpcap.nio.JMemory |
|---|
JNETPCAP_LIBRARY_NAME |
| Constructor Summary | |
|---|---|
JHeaderScanner(java.lang.Class<? extends JHeader> c)
|
|
JHeaderScanner(JProtocol protocol)
A java scanner for headers out of a native packet buffer. |
|
| Method Summary | |
|---|---|
boolean |
addBindings(JBinding... bindings)
|
void |
clearBindings()
|
JBinding[] |
getBindings()
|
int |
getHeaderLength(JPacket packet,
int offset)
Returns the length of the header this scanner is registered for |
int |
getId()
Gets the protocol header's numerical ID as assigned by JRegistry |
boolean |
hasBindings()
|
boolean |
hasScanMethod()
|
boolean |
isDirect()
Checks if the scanner at the given ID is a direct or java scanner. |
boolean |
removeBindings(JBinding... bindings)
|
int |
scanAllBindings(JPacket packet,
int offset)
Calculates the next header in sequence of headers within the packet buffer |
protected void |
scanHeader(JScan scan)
The main method that this header scanner is called on by the packet scanner, typically from native user space |
void |
setScannerMethod(AnnotatedScannerMethod method)
|
java.lang.String |
toString()
|
| Methods inherited from class org.jnetpcap.nio.JFunction |
|---|
getName |
| Methods inherited from class org.jnetpcap.nio.JMemory |
|---|
check, cleanup, finalize, isInitialized, isJMemoryBasedOwner, isOwner, peer, peer, peer, setSize, size, toDebugString, toHexdump, toHexdump, totalActiveAllocated, totalAllocateCalls, totalAllocated, totalAllocatedSegments0To255Bytes, totalAllocatedSegments256OrAbove, totalDeAllocateCalls, totalDeAllocated, transferFrom, transferFrom, transferFrom, transferFrom, transferFromDirect, transferOwnership, transferTo, transferTo, transferTo, transferTo, transferTo, transferTo, transferTo |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public JHeaderScanner(java.lang.Class<? extends JHeader> c)
public JHeaderScanner(JProtocol protocol)
protocol - core protocol constant for which to override its default native
header scanner| Method Detail |
|---|
public boolean addBindings(JBinding... bindings)
public void clearBindings()
public boolean hasBindings()
public JBinding[] getBindings()
public int getHeaderLength(JPacket packet,
int offset)
packet - the packet object this header is bound tooffset - offset into the packet buffer in bytes of the start of this header
public final int getId()
public boolean isDirect()
public boolean removeBindings(JBinding... bindings)
public int scanAllBindings(JPacket packet,
int offset)
packet - the packet object this header is bound tooffset - offset into the packet buffer in bytes of the start of this header
protected void scanHeader(JScan scan)
scan - scan state structure that is used to pass around state both in
java and native user spacepublic void setScannerMethod(AnnotatedScannerMethod method)
public java.lang.String toString()
toString in class java.lang.Objectpublic boolean hasScanMethod()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||