This repository has been archived by the owner on Nov 26, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add reactor, netty, and nio packet handler
- Loading branch information
Showing
20 changed files
with
556 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
...figure/src/main/java/com/ardikars/jxnet/spring/boot/autoconfigure/NettyBufferHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/** | ||
* Copyright (C) 2015-2018 Jxnet | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package com.ardikars.jxnet.spring.boot.autoconfigure; | ||
|
||
import com.ardikars.jxnet.PcapPktHdr; | ||
import com.ardikars.jxpacket.common.Packet; | ||
import io.netty.buffer.ByteBuf; | ||
import java.util.concurrent.ExecutionException; | ||
import java.util.concurrent.Future; | ||
|
||
/** | ||
* Callback function used for capturing packets. | ||
* | ||
* @author <a href="mailto:[email protected]">Ardika Rommy Sanjaya</a> | ||
* @since 1.4.9 | ||
*/ | ||
public interface NettyBufferHandler<T> { | ||
|
||
/** | ||
* Next available packet. | ||
* @param argument user argument. | ||
* @param header pcap header. | ||
* @param packet {@link Packet} object. | ||
* @throws ExecutionException execution exception. | ||
* @throws InterruptedException interrupted exception. | ||
*/ | ||
void next(T argument, PcapPktHdr header, Future<ByteBuf> packet) throws ExecutionException, InterruptedException; | ||
|
||
} |
44 changes: 44 additions & 0 deletions
44
...onfigure/src/main/java/com/ardikars/jxnet/spring/boot/autoconfigure/NioBufferHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/** | ||
* Copyright (C) 2015-2018 Jxnet | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package com.ardikars.jxnet.spring.boot.autoconfigure; | ||
|
||
import com.ardikars.jxnet.PcapPktHdr; | ||
import com.ardikars.jxpacket.common.Packet; | ||
import java.nio.ByteBuffer; | ||
import java.util.concurrent.ExecutionException; | ||
import java.util.concurrent.Future; | ||
|
||
/** | ||
* Callback function used for capturing packets. | ||
* | ||
* @author <a href="mailto:[email protected]">Ardika Rommy Sanjaya</a> | ||
* @since 1.4.9 | ||
*/ | ||
public interface NioBufferHandler<T> { | ||
|
||
/** | ||
* Next available packet. | ||
* @param argument user argument. | ||
* @param header pcap header. | ||
* @param packet {@link Packet} object. | ||
* @throws ExecutionException execution exception. | ||
* @throws InterruptedException interrupted exception. | ||
*/ | ||
void next(T argument, PcapPktHdr header, Future<ByteBuffer> packet) throws ExecutionException, InterruptedException; | ||
|
||
} |
43 changes: 43 additions & 0 deletions
43
...gure/src/main/java/com/ardikars/jxnet/spring/boot/autoconfigure/ReactorPacketHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/** | ||
* Copyright (C) 2015-2018 Jxnet | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package com.ardikars.jxnet.spring.boot.autoconfigure; | ||
|
||
import com.ardikars.jxnet.PcapPktHdr; | ||
import com.ardikars.jxpacket.common.Packet; | ||
import java.util.concurrent.ExecutionException; | ||
import reactor.core.publisher.Mono; | ||
|
||
/** | ||
* Callback function used for capturing packets. | ||
* | ||
* @author <a href="mailto:[email protected]">Ardika Rommy Sanjaya</a> | ||
* @since 1.4.9 | ||
*/ | ||
public interface ReactorPacketHandler<T> { | ||
|
||
/** | ||
* Next available packet. | ||
* @param argument user argument. | ||
* @param header pcap header. | ||
* @param packet {@link Packet} object. | ||
* @throws ExecutionException execution exception. | ||
* @throws InterruptedException interrupted exception. | ||
*/ | ||
void next(T argument, PcapPktHdr header, Mono<Packet> packet) throws ExecutionException, InterruptedException; | ||
|
||
} |
45 changes: 45 additions & 0 deletions
45
...e/src/main/java/com/ardikars/jxnet/spring/boot/autoconfigure/annotation/EnablePacket.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/** | ||
* Copyright (C) 2015-2018 Jxnet | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package com.ardikars.jxnet.spring.boot.autoconfigure.annotation; | ||
|
||
import com.ardikars.jxnet.spring.boot.autoconfigure.constant.PacketHandlerType; | ||
import com.ardikars.jxnet.spring.boot.autoconfigure.selector.JxpacketConfigurationSelector; | ||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
import org.springframework.context.annotation.Import; | ||
|
||
/** | ||
* Enable packet handler configuration. | ||
* | ||
* @author <a href="mailto:[email protected]">Ardika Rommy Sanjaya</a> | ||
* @since 1.4.9 | ||
*/ | ||
@Retention(RetentionPolicy.RUNTIME) | ||
@Target(ElementType.TYPE) | ||
@Import(JxpacketConfigurationSelector.class) | ||
public @interface EnablePacket { | ||
|
||
/** | ||
* Packet handler type. | ||
* @return a {@link PacketHandlerType} object. | ||
*/ | ||
PacketHandlerType packetHandlerType() default PacketHandlerType.JXPACKET; | ||
|
||
} |
30 changes: 30 additions & 0 deletions
30
...rc/main/java/com/ardikars/jxnet/spring/boot/autoconfigure/constant/PacketHandlerType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/** | ||
* Copyright (C) 2015-2018 Jxnet | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package com.ardikars.jxnet.spring.boot.autoconfigure.constant; | ||
|
||
/** | ||
* Packet handler type. | ||
* | ||
* @author <a href="mailto:[email protected]">Ardika Rommy Sanjaya</a> | ||
* @since 1.4.9 | ||
*/ | ||
public enum PacketHandlerType { | ||
|
||
JXPACKET, NETTY_BUFFER, NIO_BUFFER, REACTOR, RXJAVA | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.