Module com.slytechs.jnet.jnetpcap
Class AbstractPacketReceiver
java.lang.Object
com.slytechs.jnet.jnetpcap.internal.AbstractPcapDispatcher
com.slytechs.jnet.jnetpcap.internal.AbstractPacketReceiver
- All Implemented Interfaces:
PacketReceiver,AutoCloseable,org.jnetpcap.internal.PcapDispatcher,org.jnetpcap.PcapHandler,org.jnetpcap.PcapHandler.NativeCallback
public abstract class AbstractPacketReceiver
extends AbstractPcapDispatcher
implements PacketReceiver
AbstractPacketReceiver relies on preview features of the Java platform:
AbstractPacketReceiverrefers to one or more preview APIs:Arena,MemorySegment.
Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.
The Class AbstractPacketReceiver.
- Author:
- Sly Technologies Inc, repos@slytechs.com
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceA factory for creating PacketDispatcher objects.Nested classes/interfaces inherited from class com.slytechs.jnet.jnetpcap.internal.AbstractPcapDispatcher
AbstractPcapDispatcher.PcapDispatcherFactoryNested classes/interfaces inherited from interface org.jnetpcap.PcapHandler
org.jnetpcap.PcapHandler.NativeCallback, org.jnetpcap.PcapHandler.OfArray<U>, org.jnetpcap.PcapHandler.OfByteBuffer<U>, org.jnetpcap.PcapHandler.OfMemorySegment<U> -
Constructor Summary
ConstructorsConstructorDescriptionAbstractPacketReceiver(PacketReceiver processedPacketSink, org.jnetpcap.internal.PcapDispatcher rawPacketsource) Instantiates a new abstract packet receiver. -
Method Summary
Modifier and TypeMethodDescriptionGets the capture statistics.com.slytechs.jnet.protocol.core.constants.PacketDescriptorTypeGets the descriptor type.com.slytechs.jnet.protocol.descriptor.PacketDissectorGets the dissector.com.slytechs.jnet.protocol.PacketGets the packet with next.com.slytechs.jnet.protocol.PacketGets the packet with next extended.voidonNativeCallbackException(Throwable e, int caplen, int wirelen) On native callback exception.<U> com.slytechs.jnet.protocol.PacketprocessPacket(MemorySegmentPREVIEW pcapHdr, MemorySegmentPREVIEW pktData, ArenaPREVIEW session) Process packet.<U> com.slytechs.jnet.protocol.PacketprocessPacket(ByteBuffer buffer, MemorySegmentPREVIEW mpacket, int caplen, int wirelen, long timestamp) Process packet.<U> intreceivePacketWithDispatch(int count, PcapProHandler.OfPacket<U> sink, U user) Receive packet with dispatch.<U> intreceivePacketWithDispatch(int count, PcapProHandler.OfPacket<U> sink, U user, Supplier<com.slytechs.jnet.protocol.Packet> packetFactory) Receive packet with dispatch.<U> intreceivePacketWithLoop(int count, PcapProHandler.OfPacket<U> sink, U user) Receive packet with loop.Methods inherited from class com.slytechs.jnet.jnetpcap.internal.AbstractPcapDispatcher
captureLength, close, dispatchNative, dispatchRaw, getUncaughtException, headerLength, interrupt, loopNative, loopRaw, nativeCallback, next, nextEx, onNativeCallbackException, pcapHeaderABI, setUncaughtExceptionHandlerMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.slytechs.jnet.jnetpcap.internal.PacketReceiver
activate, close
-
Constructor Details
-
AbstractPacketReceiver
public AbstractPacketReceiver(PacketReceiver processedPacketSink, org.jnetpcap.internal.PcapDispatcher rawPacketsource) Instantiates a new abstract packet receiver.- Parameters:
processedPacketSink- the processed packet sinkrawPacketsource- the raw packetsource
-
-
Method Details
-
getCaptureStatistics
Gets the capture statistics.- Specified by:
getCaptureStatisticsin interfacePacketReceiver- Returns:
- the capture statistics
- See Also:
-
getDescriptorType
public com.slytechs.jnet.protocol.core.constants.PacketDescriptorType getDescriptorType()Gets the descriptor type.- Specified by:
getDescriptorTypein interfacePacketReceiver- Returns:
- the descriptor type
- See Also:
-
getDissector
public com.slytechs.jnet.protocol.descriptor.PacketDissector getDissector()Gets the dissector.- Specified by:
getDissectorin interfacePacketReceiver- Returns:
- the dissector
- See Also:
-
getPacketWithNext
public com.slytechs.jnet.protocol.Packet getPacketWithNext() throws org.jnetpcap.PcapExceptionGets the packet with next.- Specified by:
getPacketWithNextin interfacePacketReceiver- Returns:
- the packet with next
- Throws:
org.jnetpcap.PcapException- the pcap exception- See Also:
-
getPacketWithNextExtended
public com.slytechs.jnet.protocol.Packet getPacketWithNextExtended() throws org.jnetpcap.PcapException, TimeoutExceptionGets the packet with next extended.- Specified by:
getPacketWithNextExtendedin interfacePacketReceiver- Returns:
- the packet with next extended
- Throws:
org.jnetpcap.PcapException- the pcap exceptionTimeoutException- the timeout exception- See Also:
-
onNativeCallbackException
On native callback exception.- Specified by:
onNativeCallbackExceptionin interfacePacketReceiver- Parameters:
e- the ecaplen- the caplenwirelen- the wirelen- See Also:
-
processPacket
public <U> com.slytechs.jnet.protocol.Packet processPacket(ByteBuffer buffer, MemorySegmentPREVIEW mpacket, int caplen, int wirelen, long timestamp) Process packet.- Specified by:
processPacketin interfacePacketReceiver- Type Parameters:
U- the generic type- Parameters:
buffer- the buffermpacket- the mpacketcaplen- the caplenwirelen- the wirelentimestamp- the timestamp- Returns:
- the packet
- See Also:
-
processPacket
public <U> com.slytechs.jnet.protocol.Packet processPacket(MemorySegmentPREVIEW pcapHdr, MemorySegmentPREVIEW pktData, ArenaPREVIEW session) Process packet.- Specified by:
processPacketin interfacePacketReceiver- Type Parameters:
U- the generic type- Parameters:
pcapHdr- the pcap hdrpktData- the pkt datasession- the session- Returns:
- the packet
- See Also:
-
receivePacketWithDispatch
Receive packet with dispatch.- Specified by:
receivePacketWithDispatchin interfacePacketReceiver- Type Parameters:
U- the generic type- Parameters:
count- the countsink- the sinkuser- the user- Returns:
- the int
- See Also:
-
receivePacketWithDispatch
public <U> int receivePacketWithDispatch(int count, PcapProHandler.OfPacket<U> sink, U user, Supplier<com.slytechs.jnet.protocol.Packet> packetFactory) Receive packet with dispatch.- Specified by:
receivePacketWithDispatchin interfacePacketReceiver- Type Parameters:
U- the generic type- Parameters:
count- the countsink- the sinkuser- the userpacketFactory- the packet factory- Returns:
- the int
- See Also:
-
receivePacketWithLoop
Receive packet with loop.- Specified by:
receivePacketWithLoopin interfacePacketReceiver- Type Parameters:
U- the generic type- Parameters:
count- the countsink- the sinkuser- the user- Returns:
- the int
- See Also:
-
AbstractPacketReceiverwhen preview features are enabled.