Class AbstractPcapDispatcher

java.lang.Object
com.slytechs.jnet.jnetpcap.internal.AbstractPcapDispatcher
All Implemented Interfaces:
AutoCloseable, org.jnetpcap.internal.PcapDispatcher, org.jnetpcap.PcapHandler, org.jnetpcap.PcapHandler.NativeCallback
Direct Known Subclasses:
AbstractPacketReceiver, PacketDelayPreProcessor, PacketPlayerPreProcessor, PacketRepeaterPreProcessor, ProxyPreProcessor

public class AbstractPcapDispatcher extends Object implements org.jnetpcap.internal.PcapDispatcher
AbstractPcapDispatcher relies on preview features of the Java platform:
  • AbstractPcapDispatcher refers to one or more preview APIs: MemorySegment.
Programs can only use AbstractPcapDispatcher when preview features are enabled.
Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.
The Class AbstractPcapDispatcher.
Author:
Sly Technologies Inc, repos@slytechs.com
  • Method Details

    • pcapHeaderABI

      public org.jnetpcap.internal.PcapHeaderABI pcapHeaderABI()
      Specified by:
      pcapHeaderABI in interface org.jnetpcap.internal.PcapDispatcher
      See Also:
      • PcapDispatcher.pcapHeaderABI()
    • captureLength

      public int captureLength(MemorySegmentPREVIEW address)
      Capture length.
      Specified by:
      captureLength in interface org.jnetpcap.internal.PcapDispatcher
      Parameters:
      address - the address
      Returns:
      the int
      See Also:
      • PcapDispatcher.captureLength(java.lang.foreign.MemorySegment)
    • close

      public void close()
      Close.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface org.jnetpcap.internal.PcapDispatcher
      See Also:
      • PcapDispatcher.close()
    • dispatchNative

      public int dispatchNative(int count, org.jnetpcap.PcapHandler.NativeCallback handler, MemorySegmentPREVIEW user)
      Dispatch native.
      Specified by:
      dispatchNative in interface org.jnetpcap.internal.PcapDispatcher
      Parameters:
      count - the count
      handler - the handler
      user - the user
      Returns:
      the int
      See Also:
      • PcapDispatcher.dispatchNative(int, org.jnetpcap.PcapHandler.NativeCallback, java.lang.foreign.MemorySegment)
    • dispatchRaw

      public int dispatchRaw(int count, MemorySegmentPREVIEW callbackFunc, MemorySegmentPREVIEW userData)
      Dispatch raw.
      Specified by:
      dispatchRaw in interface org.jnetpcap.internal.PcapDispatcher
      Parameters:
      count - the count
      callbackFunc - the callback func
      userData - the user data
      Returns:
      the int
      See Also:
      • PcapDispatcher.dispatchRaw(int, java.lang.foreign.MemorySegment, java.lang.foreign.MemorySegment)
    • getUncaughtException

      public RuntimeException getUncaughtException()
      Gets the uncaught exception.
      Specified by:
      getUncaughtException in interface org.jnetpcap.internal.PcapDispatcher
      Returns:
      the uncaught exception
      See Also:
      • PcapDispatcher.getUncaughtException()
    • headerLength

      public int headerLength(MemorySegmentPREVIEW address)
      Header length.
      Specified by:
      headerLength in interface org.jnetpcap.internal.PcapDispatcher
      Parameters:
      address - the address
      Returns:
      the int
      See Also:
      • PcapDispatcher.headerLength(java.lang.foreign.MemorySegment)
    • interrupt

      public void interrupt()
      Interrupt.
      Specified by:
      interrupt in interface org.jnetpcap.internal.PcapDispatcher
      See Also:
      • PcapDispatcher.interrupt()
    • loopNative

      public int loopNative(int count, org.jnetpcap.PcapHandler.NativeCallback handler, MemorySegmentPREVIEW user)
      Loop native.
      Specified by:
      loopNative in interface org.jnetpcap.internal.PcapDispatcher
      Parameters:
      count - the count
      handler - the handler
      user - the user
      Returns:
      the int
      See Also:
      • PcapDispatcher.loopNative(int, org.jnetpcap.PcapHandler.NativeCallback, java.lang.foreign.MemorySegment)
    • loopRaw

      public int loopRaw(int count, MemorySegmentPREVIEW callbackFunc, MemorySegmentPREVIEW userData)
      Loop raw.
      Specified by:
      loopRaw in interface org.jnetpcap.internal.PcapDispatcher
      Parameters:
      count - the count
      callbackFunc - the callback func
      userData - the user data
      Returns:
      the int
      See Also:
      • PcapDispatcher.loopRaw(int, java.lang.foreign.MemorySegment, java.lang.foreign.MemorySegment)
    • next

      public org.jnetpcap.util.PcapPacketRefPREVIEW next() throws org.jnetpcap.PcapException
      Specified by:
      next in interface org.jnetpcap.internal.PcapDispatcher
      Throws:
      org.jnetpcap.PcapException
      See Also:
      • PcapDispatcher.next()
    • nextEx

      public org.jnetpcap.util.PcapPacketRefPREVIEW nextEx() throws org.jnetpcap.PcapException, TimeoutException
      Specified by:
      nextEx in interface org.jnetpcap.internal.PcapDispatcher
      Throws:
      org.jnetpcap.PcapException
      TimeoutException
      See Also:
      • PcapDispatcher.nextEx()
    • onNativeCallbackException

      public void onNativeCallbackException(RuntimeException e)
      On native callback exception.
      Specified by:
      onNativeCallbackException in interface org.jnetpcap.internal.PcapDispatcher
      Parameters:
      e - the e
      See Also:
      • PcapDispatcher.onNativeCallbackException(java.lang.RuntimeException)
    • setUncaughtExceptionHandler

      public void setUncaughtExceptionHandler(Thread.UncaughtExceptionHandler exceptionHandler)
      Sets the uncaught exception handler.
      Specified by:
      setUncaughtExceptionHandler in interface org.jnetpcap.internal.PcapDispatcher
      Parameters:
      exceptionHandler - the new uncaught exception handler
      See Also:
      • PcapDispatcher.setUncaughtExceptionHandler(java.lang.Thread.UncaughtExceptionHandler)
    • nativeCallback

      public void nativeCallback(MemorySegmentPREVIEW user, MemorySegmentPREVIEW header, MemorySegmentPREVIEW packet)
      Specified by:
      nativeCallback in interface org.jnetpcap.PcapHandler.NativeCallback
      See Also:
      • PcapHandler.NativeCallback.nativeCallback(java.lang.foreign.MemorySegment, java.lang.foreign.MemorySegment, java.lang.foreign.MemorySegment)