java.lang.Object
org.jnetpcap.internal.StandardPcapDispatcher
- All Implemented Interfaces:
AutoCloseable,PcapDispatcher,PcapHandler,PcapHandler.NativeCallback
A proxy PcapHandler, which receives packets from native pcap handle and
forwards all packets to the sink java PcapHandler.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.jnetpcap.PcapHandler
PcapHandler.NativeCallback, PcapHandler.OfArray<U>, PcapHandler.OfByteBuffer<U>, PcapHandler.OfMemorySegment<U> -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionStandardPcapDispatcher(MemorySegment pcapHandle, PcapHeaderABI abi, Runnable breakDispatch) Instantiates a new standard pcap dispatcher. -
Method Summary
Modifier and TypeMethodDescriptionintcaptureLength(MemorySegment headerAddress) Capture length.voidclose()Close.final intdispatchNative(int count, PcapHandler.NativeCallback handler, MemorySegment user) Dispatch native.final intdispatchRaw(int count, MemorySegment callbackFunc, MemorySegment userData) Dispatch raw.final Stringgeterr()Gets the last pcap error string.protected StringgetErrorString(int error) Dynamic non-pcap utility method to convert libpcap error code to a string, by various fallback methods with an active pcap handle.final RuntimeExceptionGets the uncaught exception.intheaderLength(MemorySegment headerAddress) Header length.final voidInterrupt.final intloopNative(int count, PcapHandler.NativeCallback handler, MemorySegment user) Loop native.final intloopRaw(int count, MemorySegment callbackFunc, MemorySegment userData) Loop raw.final voidnativeCallback(MemorySegment user, MemorySegment header, MemorySegment packet) Native callback.next()Next.nextEx()Next ex.final voidCalled on a native callback exception within the user handler.Pcap header ABI.final voidsetUncaughtExceptionHandler(Thread.UncaughtExceptionHandler exceptionHandler) Sets the uncaught exception handler.
-
Field Details
-
arena
The arena.
-
-
Constructor Details
-
StandardPcapDispatcher
Instantiates a new standard pcap dispatcher.- Parameters:
pcapHandle- the pcap handleabi- the abibreakDispatch- the break dispatch
-
-
Method Details
-
geterr
-
captureLength
Capture length.- Specified by:
captureLengthin interfacePcapDispatcher- Parameters:
headerAddress- the header address- Returns:
- the int
- See Also:
-
close
public void close()Close.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfacePcapDispatcher- See Also:
-
dispatchNative
Description copied from interface:PcapDispatcherDispatch native.- Specified by:
dispatchNativein interfacePcapDispatcher- Parameters:
count- the counthandler- the handleruser- the user- Returns:
- the int
- See Also:
-
dispatchRaw
Dispatch raw.- Specified by:
dispatchRawin interfacePcapDispatcher- Parameters:
count- the countcallbackFunc- the callback funcuserData- the user data- Returns:
- the int
-
getUncaughtException
Gets the uncaught exception.- Specified by:
getUncaughtExceptionin interfacePcapDispatcher- Returns:
- the uncaughtException
-
headerLength
Header length.- Specified by:
headerLengthin interfacePcapDispatcher- Parameters:
headerAddress- the header address- Returns:
- the int
- See Also:
-
interrupt
public final void interrupt()Description copied from interface:PcapDispatcherInterrupt.- Specified by:
interruptin interfacePcapDispatcher- See Also:
-
loopNative
Description copied from interface:PcapDispatcherLoop native.- Specified by:
loopNativein interfacePcapDispatcher- Parameters:
count- the counthandler- the handleruser- the user- Returns:
- the int
- See Also:
-
loopRaw
Loop raw.- Specified by:
loopRawin interfacePcapDispatcher- Parameters:
count- the countcallbackFunc- the callback funcuserData- the user data- Returns:
- the int
-
nativeCallback
Native callback.- Specified by:
nativeCallbackin interfacePcapHandler.NativeCallback- Parameters:
user- the userheader- the headerpacket- the packet- See Also:
-
onNativeCallbackException
Called on a native callback exception within the user handler.- Specified by:
onNativeCallbackExceptionin interfacePcapDispatcher- Parameters:
e- the exception
-
setUncaughtExceptionHandler
Description copied from interface:PcapDispatcherSets the uncaught exception handler.- Specified by:
setUncaughtExceptionHandlerin interfacePcapDispatcher- Parameters:
exceptionHandler- the new uncaught exception handler- See Also:
-
pcapHeaderABI
Pcap header ABI.- Specified by:
pcapHeaderABIin interfacePcapDispatcher- Returns:
- the pcap header ABI
- See Also:
-
getErrorString
Dynamic non-pcap utility method to convert libpcap error code to a string, by various fallback methods with an active pcap handle.- Parameters:
error- the code- Returns:
- the error string
-
nextEx
Next ex.- Specified by:
nextExin interfacePcapDispatcher- Returns:
- the pcap packet ref
- Throws:
PcapException- the pcap exceptionTimeoutException- the timeout exception- See Also:
-
next
Next.- Specified by:
nextin interfacePcapDispatcher- Returns:
- the pcap packet ref
- Throws:
PcapException- the pcap exception- See Also:
-