org.jnetpcap.nio
Class JStruct

java.lang.Object
  extended by org.jnetpcap.nio.JMemory
      extended by org.jnetpcap.nio.JStruct
Direct Known Subclasses:
JFlowKey, JHeader.State, JPacket.State, JReference, JScan, JScanner, PcapHeader, WinPcapSendQueue

public class JStruct
extends JMemory

Base class for peered pure structure classes. This class purposely does not extend JBuffer to allow structure fields to be read out generically as that is not portable accross platforms and architectures. Most structures are written specifically for local machine architecture and OS, unlike network protocols which can be usually read by use of generic JBuffer. Therefore as a general requirement each JStruct has to implement its own native methods to read and write fields into the structure.

As a convention, each subclass of JStruct implements a static method sizeof() which returns the length of the structure, if the structure is static in length. If not, then no requirement to implement the static method sizeof() exists.

Author:
Mark Bednarczyk, Sly Technologies, Inc.

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
JStruct(java.lang.String structName, java.nio.ByteBuffer peer)
           
JStruct(java.lang.String structName, int size)
           
JStruct(java.lang.String structName, JMemory.Type type)
           
JStruct(java.lang.String structName, JMemory peer)
           
 
Method Summary
 java.lang.String getStructName()
           
 java.lang.String toString()
           
 
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

JStruct

public JStruct(java.lang.String structName,
               JMemory.Type type)
Parameters:
type - TODO

JStruct

public JStruct(java.lang.String structName,
               java.nio.ByteBuffer peer)
Parameters:
peer -

JStruct

public JStruct(java.lang.String structName,
               int size)
Parameters:
size -

JStruct

public JStruct(java.lang.String structName,
               JMemory peer)
Parameters:
peer -
Method Detail

getStructName

public final java.lang.String getStructName()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object