From 8e6bc9127b5973fdb63ce54bf5197e829abb963b Mon Sep 17 00:00:00 2001 From: Ardika Rommy Sanjaya Date: Sat, 27 Apr 2019 10:13:53 +0700 Subject: [PATCH] Update lib version --- VERSION | 2 +- gradle/configure.gradle | 4 +- .../ardikars/jxnet/example/Application.java | 6 -- .../boot/autoconfigure/HandlerConfigurer.java | 8 ++- .../autoconfigure/JxnetAutoConfiguration.java | 4 +- .../constant/JxnetObjectName.java | 7 +-- .../constant/PacketHandlerType.java | 2 +- ...JxpacketAsyncRawHandlerConfiguration.java} | 30 ++++----- .../jxpacket/JxpacketAutoconfiguration.java | 14 +++-- .../memory/MemoryConfigurationProperties.java | 53 ++++++++++++++++ .../nio/NioBufferHandlerConfiguration.java | 63 ------------------- .../JxpacketConfigurationSelector.java | 16 ++--- ...itional-spring-configuration-metadata.json | 6 ++ .../src/main/resources/application.properties | 2 - 14 files changed, 104 insertions(+), 113 deletions(-) rename jxnet-spring-boot-autoconfigure/src/main/java/com/ardikars/jxnet/spring/boot/autoconfigure/{nio/NioBufferAsyncHandlerConfiguration.java => jxpacket/JxpacketAsyncRawHandlerConfiguration.java} (64%) create mode 100644 jxnet-spring-boot-autoconfigure/src/main/java/com/ardikars/jxnet/spring/boot/autoconfigure/memory/MemoryConfigurationProperties.java delete mode 100644 jxnet-spring-boot-autoconfigure/src/main/java/com/ardikars/jxnet/spring/boot/autoconfigure/nio/NioBufferHandlerConfiguration.java diff --git a/VERSION b/VERSION index 1f0b4cd1..d3219766 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.5.5.RC2 \ No newline at end of file +1.5.5.RC3 \ No newline at end of file diff --git a/gradle/configure.gradle b/gradle/configure.gradle index e5ccad40..ac376c52 100644 --- a/gradle/configure.gradle +++ b/gradle/configure.gradle @@ -31,8 +31,8 @@ ext { PMD_VERION = '6.10.0' JACOCO_VERSION = '0.8.2' - COMMON_VERSION = '1.2.7.RC2' - JXPACKET_VERSION = '1.2.3.RC' + COMMON_VERSION = '1.2.7.RC5' + JXPACKET_VERSION = '1.2.3.RC4' REACTOR_VERSION = 'Californium-RELEASE' JNR_VERSION = '2.1.9' diff --git a/jxnet-example/src/main/java/com/ardikars/jxnet/example/Application.java b/jxnet-example/src/main/java/com/ardikars/jxnet/example/Application.java index 8b647fcf..afdce359 100644 --- a/jxnet-example/src/main/java/com/ardikars/jxnet/example/Application.java +++ b/jxnet-example/src/main/java/com/ardikars/jxnet/example/Application.java @@ -26,15 +26,12 @@ import com.ardikars.common.net.MacAddress; import com.ardikars.common.tuple.Pair; import com.ardikars.common.tuple.Tuple; -import com.ardikars.common.util.CommonConsumer; -import com.ardikars.common.util.Hexs; import com.ardikars.common.util.Platforms; import com.ardikars.jxnet.DataLinkType; import com.ardikars.jxnet.ImmediateMode; import com.ardikars.jxnet.Jxnet; import com.ardikars.jxnet.Pcap; import com.ardikars.jxnet.PcapAddr; -import com.ardikars.jxnet.PcapHandler; import com.ardikars.jxnet.PcapIf; import com.ardikars.jxnet.PcapPktHdr; import com.ardikars.jxnet.PcapTimestampPrecision; @@ -46,13 +43,11 @@ import com.ardikars.jxnet.context.Context; import com.ardikars.jxnet.exception.DeviceNotFoundException; import com.ardikars.jxnet.exception.PlatformNotSupportedException; -import com.ardikars.jxpacket.common.AbstractPacket; import com.ardikars.jxpacket.common.Packet; import com.ardikars.jxpacket.common.UnknownPacket; import com.ardikars.jxpacket.common.layer.DataLinkLayer; import com.ardikars.jxpacket.common.layer.NetworkLayer; import com.ardikars.jxpacket.common.layer.TransportLayer; -import com.ardikars.jxpacket.common.util.PacketIterator; import com.ardikars.jxpacket.core.arp.Arp; import com.ardikars.jxpacket.core.ethernet.Ethernet; import com.ardikars.jxpacket.core.ethernet.Vlan; @@ -69,7 +64,6 @@ import com.ardikars.jxpacket.core.udp.Udp; import java.net.SocketException; -import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.Iterator; import java.util.List; diff --git a/jxnet-spring-boot-autoconfigure/src/main/java/com/ardikars/jxnet/spring/boot/autoconfigure/HandlerConfigurer.java b/jxnet-spring-boot-autoconfigure/src/main/java/com/ardikars/jxnet/spring/boot/autoconfigure/HandlerConfigurer.java index 257b58be..9e866cbe 100644 --- a/jxnet-spring-boot-autoconfigure/src/main/java/com/ardikars/jxnet/spring/boot/autoconfigure/HandlerConfigurer.java +++ b/jxnet-spring-boot-autoconfigure/src/main/java/com/ardikars/jxnet/spring/boot/autoconfigure/HandlerConfigurer.java @@ -23,6 +23,7 @@ import com.ardikars.jxnet.DataLinkType; import com.ardikars.jxnet.context.Context; import com.ardikars.jxnet.spring.boot.autoconfigure.constant.JxnetObjectName; +import com.ardikars.jxnet.spring.boot.autoconfigure.memory.MemoryConfigurationProperties; import com.ardikars.jxpacket.common.Packet; import com.ardikars.jxpacket.common.UnknownPacket; import com.ardikars.jxpacket.core.ethernet.Ethernet; @@ -55,13 +56,16 @@ public class HandlerConfigurer { @Autowired private Handler handler; + @Autowired + private MemoryConfigurationProperties memoryProperties; + /** * Decode buffer. * @param bytes direct byte buffer. * @return returns {@link Packet}. */ public Packet decode(ByteBuffer bytes) { - return processPacket(Memories.wrap(bytes, false)); + return processPacket(Memories.wrap(bytes, memoryProperties.getCheckBounds())); } /** @@ -71,7 +75,7 @@ public Packet decode(ByteBuffer bytes) { * @return returns {@link Packet}. */ public Packet decodeRawBuffer(long address, int length) { - return processPacket(Memories.wrap(address, length)); + return processPacket(Memories.wrap(address, length, memoryProperties.getCheckBounds())); } private Packet processPacket(Memory buf) { diff --git a/jxnet-spring-boot-autoconfigure/src/main/java/com/ardikars/jxnet/spring/boot/autoconfigure/JxnetAutoConfiguration.java b/jxnet-spring-boot-autoconfigure/src/main/java/com/ardikars/jxnet/spring/boot/autoconfigure/JxnetAutoConfiguration.java index abdede82..87674e51 100644 --- a/jxnet-spring-boot-autoconfigure/src/main/java/com/ardikars/jxnet/spring/boot/autoconfigure/JxnetAutoConfiguration.java +++ b/jxnet-spring-boot-autoconfigure/src/main/java/com/ardikars/jxnet/spring/boot/autoconfigure/JxnetAutoConfiguration.java @@ -50,6 +50,8 @@ import com.ardikars.jxnet.exception.NativeException; import com.ardikars.jxnet.exception.PlatformNotSupportedException; import com.ardikars.jxnet.exception.UnknownNetmaskException; +import com.ardikars.jxnet.spring.boot.autoconfigure.memory.MemoryConfigurationProperties; + import java.net.SocketException; import java.util.ArrayList; import java.util.Iterator; @@ -75,7 +77,7 @@ @Configuration(JXNET_AUTO_CONFIGURATION_BEAN_NAME) @ConditionalOnClass({Jxnet.class, Context.class}) @AutoConfigureOrder -@EnableConfigurationProperties(JxnetConfigurationProperties.class) +@EnableConfigurationProperties({JxnetConfigurationProperties.class, MemoryConfigurationProperties.class}) public class JxnetAutoConfiguration { private static final Logger LOGGER = LoggerFactory.getLogger(JxnetAutoConfiguration.class); diff --git a/jxnet-spring-boot-autoconfigure/src/main/java/com/ardikars/jxnet/spring/boot/autoconfigure/constant/JxnetObjectName.java b/jxnet-spring-boot-autoconfigure/src/main/java/com/ardikars/jxnet/spring/boot/autoconfigure/constant/JxnetObjectName.java index 34ea48a9..6dcafc9f 100644 --- a/jxnet-spring-boot-autoconfigure/src/main/java/com/ardikars/jxnet/spring/boot/autoconfigure/constant/JxnetObjectName.java +++ b/jxnet-spring-boot-autoconfigure/src/main/java/com/ardikars/jxnet/spring/boot/autoconfigure/constant/JxnetObjectName.java @@ -39,13 +39,8 @@ public final class JxnetObjectName { public static final String JXNET_AUTO_CONFIGURATION_BEAN_NAME = "com.ardikras.jxnet.jxnetAutoConfiguration"; public static final String JXPACKET_HANDLER_CONFIGURATION_BEAN_NAME = "com.ardikras.jxnet.jxpacketHandlerConfiguration"; public static final String JXPACKET_RAW_HANDLER_CONFIGURATION_BEAN_NAME = "com.ardikras.jxnet.jxpacketRawHandlerConfiguration"; + public static final String JXPACKET_ASYNC_RAW_HANDLER_CONFIGURATION_BEAN_NAME = "com.ardikras.jxnet.jxpacketAsyncRawHandlerConfiguration"; public static final String JXPACKET_ASYNC_HANDLER_CONFIGURATION_BEAN_NAME = "com.ardikras.jxnet.jxpacketAsyncHandlerConfiguration"; - public static final String NETTY_BUFFER_HANDLER_CONFIGURATION_BEAN_NAME = "com.ardikras.jxnet.nettyBufferHandlerConfiguration"; - public static final String NETTY_BUFFER_ASYCN_HANDLER_CONFIGURATION_BEAN_NAME = "com.ardikras.jxnet.nettyBufferAsycHandlerConfiguration"; - public static final String NETTY_RAW_BUFFER_HANDLER_CONFIGURATION_BEAN_NAME = "com.ardikras.jxnet.nettyRawBufferHandlerConfiguration"; - public static final String NETTY_RAW_BUFFER_ASYCN_HANDLER_CONFIGURATION_BEAN_NAME = "com.ardikras.jxnet.nettyRawBufferAsycHandlerConfiguration"; - public static final String NIO_BUFFER_HANDLER_CONFIGURATION_BEAN_NAME = "com.ardikras.jxnet.nioBufferHandlerConfiguration"; - public static final String NIO_BUFFER_ASYNC_HANDLER_CONFIGURATION_BEAN_NAME = "com.ardikras.jxnet.nioBufferAsyncHandlerConfiguration"; public static final String PCAP_BUILDER_BEAN_NAME = "com.ardikras.jxnet.pcapBuilder"; public static final String JVM_BEAN_NAME = "com.ardikras.jxnet.jvm"; diff --git a/jxnet-spring-boot-autoconfigure/src/main/java/com/ardikars/jxnet/spring/boot/autoconfigure/constant/PacketHandlerType.java b/jxnet-spring-boot-autoconfigure/src/main/java/com/ardikars/jxnet/spring/boot/autoconfigure/constant/PacketHandlerType.java index 1353625a..51180d47 100644 --- a/jxnet-spring-boot-autoconfigure/src/main/java/com/ardikars/jxnet/spring/boot/autoconfigure/constant/PacketHandlerType.java +++ b/jxnet-spring-boot-autoconfigure/src/main/java/com/ardikars/jxnet/spring/boot/autoconfigure/constant/PacketHandlerType.java @@ -25,6 +25,6 @@ */ public enum PacketHandlerType { - JXPACKET, JXPACKET_ASYNC, JXPACKET_RAW, NIO_BUFFER, NIO_BUFFER_ASYNC + JXPACKET, JXPACKET_ASYNC, JXPACKET_RAW, JXPACKET_RAW_ASYNC; } diff --git a/jxnet-spring-boot-autoconfigure/src/main/java/com/ardikars/jxnet/spring/boot/autoconfigure/nio/NioBufferAsyncHandlerConfiguration.java b/jxnet-spring-boot-autoconfigure/src/main/java/com/ardikars/jxnet/spring/boot/autoconfigure/jxpacket/JxpacketAsyncRawHandlerConfiguration.java similarity index 64% rename from jxnet-spring-boot-autoconfigure/src/main/java/com/ardikars/jxnet/spring/boot/autoconfigure/nio/NioBufferAsyncHandlerConfiguration.java rename to jxnet-spring-boot-autoconfigure/src/main/java/com/ardikars/jxnet/spring/boot/autoconfigure/jxpacket/JxpacketAsyncRawHandlerConfiguration.java index c176cc39..b3ab246b 100644 --- a/jxnet-spring-boot-autoconfigure/src/main/java/com/ardikars/jxnet/spring/boot/autoconfigure/nio/NioBufferAsyncHandlerConfiguration.java +++ b/jxnet-spring-boot-autoconfigure/src/main/java/com/ardikars/jxnet/spring/boot/autoconfigure/jxpacket/JxpacketAsyncRawHandlerConfiguration.java @@ -15,42 +15,44 @@ * along with this program. If not, see . */ -package com.ardikars.jxnet.spring.boot.autoconfigure.nio; +package com.ardikars.jxnet.spring.boot.autoconfigure.jxpacket; -import static com.ardikars.jxnet.spring.boot.autoconfigure.constant.JxnetObjectName.NIO_BUFFER_ASYNC_HANDLER_CONFIGURATION_BEAN_NAME; +import static com.ardikars.jxnet.spring.boot.autoconfigure.constant.JxnetObjectName.JXPACKET_ASYNC_RAW_HANDLER_CONFIGURATION_BEAN_NAME; import com.ardikars.common.logging.Logger; import com.ardikars.common.logging.LoggerFactory; +import com.ardikars.common.memory.Memory; import com.ardikars.common.tuple.Pair; import com.ardikars.common.tuple.Tuple; -import com.ardikars.jxnet.PcapHandler; import com.ardikars.jxnet.PcapPktHdr; +import com.ardikars.jxnet.RawPcapHandler; import com.ardikars.jxnet.spring.boot.autoconfigure.HandlerConfigurer; -import java.nio.ByteBuffer; +import com.ardikars.jxpacket.common.Packet; + import java.util.concurrent.ExecutionException; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.context.annotation.Configuration; /** - * Nio buffer async handler. - * @param type. + * Jxpacket handler. + * * @author Ardika Rommy Sanjaya - * @since 1.5.3 + * @since 1.4.9 */ -@ConditionalOnClass({ByteBuffer.class}) -@Configuration(NIO_BUFFER_ASYNC_HANDLER_CONFIGURATION_BEAN_NAME) -public class NioBufferAsyncHandlerConfiguration extends HandlerConfigurer> implements PcapHandler { +@ConditionalOnClass({Packet.class, Memory.class}) +@Configuration(JXPACKET_ASYNC_RAW_HANDLER_CONFIGURATION_BEAN_NAME) +public class JxpacketAsyncRawHandlerConfiguration extends HandlerConfigurer> implements RawPcapHandler { - private static final Logger LOGGER = LoggerFactory.getLogger(NioBufferAsyncHandlerConfiguration.class); + private static final Logger LOGGER = LoggerFactory.getLogger(JxpacketAsyncRawHandlerConfiguration.class); @Override - public void nextPacket(final T user, final PcapPktHdr h, final ByteBuffer bytes) { - executorService.submit(new Runnable() { + public void nextPacket(final T user, final int capLen, final int len, final int tvSec, final long tvUsec, final long memoryAddress) { + executorService.execute(new Runnable() { @Override public void run() { try { - getHandler().next(user, Tuple.of(h, bytes)); + getHandler().next(user, Tuple.of(PcapPktHdr.newInstance(capLen, len, tvSec, tvUsec), decodeRawBuffer(memoryAddress, len))); } catch (ExecutionException e) { LOGGER.warn(e); } catch (InterruptedException e) { diff --git a/jxnet-spring-boot-autoconfigure/src/main/java/com/ardikars/jxnet/spring/boot/autoconfigure/jxpacket/JxpacketAutoconfiguration.java b/jxnet-spring-boot-autoconfigure/src/main/java/com/ardikars/jxnet/spring/boot/autoconfigure/jxpacket/JxpacketAutoconfiguration.java index e7100e04..a41d8c7c 100644 --- a/jxnet-spring-boot-autoconfigure/src/main/java/com/ardikars/jxnet/spring/boot/autoconfigure/jxpacket/JxpacketAutoconfiguration.java +++ b/jxnet-spring-boot-autoconfigure/src/main/java/com/ardikars/jxnet/spring/boot/autoconfigure/jxpacket/JxpacketAutoconfiguration.java @@ -31,6 +31,7 @@ import com.ardikars.jxnet.DataLinkType; import com.ardikars.jxnet.PcapPktHdr; import com.ardikars.jxnet.context.Context; +import com.ardikars.jxnet.spring.boot.autoconfigure.memory.MemoryConfigurationProperties; import com.ardikars.jxpacket.common.Packet; import com.ardikars.jxpacket.common.UnknownPacket; import com.ardikars.jxpacket.common.layer.DataLinkLayer; @@ -76,6 +77,7 @@ public class JxpacketAutoconfiguration implements JxpacketContext { private static final Logger LOGGER = LoggerFactory.getLogger(JxpacketAutoconfiguration.class); private final Boolean autoRegister; + private final Boolean checkBounds; private final Context context; private final ExecutorService executorService; @@ -89,13 +91,16 @@ public class JxpacketAutoconfiguration implements JxpacketContext { * @param context application context. * @param executorService thread pool. * @param dataLinkType datalink type. - * @param properties jxpacket configuration properties. + * @param jxpacketProperties jxpacket configuration properties. + * @param memoryProperties memory configuration properties. */ public JxpacketAutoconfiguration(@Qualifier(CONTEXT_BEAN_NAME) Context context, @Qualifier(EXECUTOR_SERVICE_BEAN_NAME) ExecutorService executorService, @Qualifier(DATALINK_TYPE_BEAN_NAME) DataLinkType dataLinkType, - JxpacketConfigurationProperties properties) { - this.autoRegister = properties.getAutoRegister(); + JxpacketConfigurationProperties jxpacketProperties, + MemoryConfigurationProperties memoryProperties) { + this.autoRegister = jxpacketProperties.getAutoRegister(); + this.checkBounds = memoryProperties.getCheckBounds(); register(); this.context = context; this.executorService = executorService; @@ -138,8 +143,7 @@ public Pair call() throws Exception { while (bytes == null) { bytes = context.pcapNext(pktHdr); } - Memory buffer = Memories.allocator().allocate(bytes.capacity()); - buffer.setBytes(0, Memories.wrap(bytes, false)); + Memory buffer = Memories.wrap(bytes, checkBounds); Packet packet; if (rawDataLinkType == 1) { packet = Ethernet.newPacket(buffer); diff --git a/jxnet-spring-boot-autoconfigure/src/main/java/com/ardikars/jxnet/spring/boot/autoconfigure/memory/MemoryConfigurationProperties.java b/jxnet-spring-boot-autoconfigure/src/main/java/com/ardikars/jxnet/spring/boot/autoconfigure/memory/MemoryConfigurationProperties.java new file mode 100644 index 00000000..16ad659d --- /dev/null +++ b/jxnet-spring-boot-autoconfigure/src/main/java/com/ardikars/jxnet/spring/boot/autoconfigure/memory/MemoryConfigurationProperties.java @@ -0,0 +1,53 @@ +/** + * 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 . + */ + +package com.ardikars.jxnet.spring.boot.autoconfigure.memory; + +import com.ardikars.common.logging.Logger; +import com.ardikars.common.logging.LoggerFactory; +import com.ardikars.jxpacket.common.Packet; +import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; +import org.springframework.boot.context.properties.ConfigurationProperties; + + +@ConditionalOnClass(Packet.class) +@ConfigurationProperties(prefix = "jxnet.memory") +public class MemoryConfigurationProperties { + + private static final Logger LOGGER = LoggerFactory.getLogger(MemoryConfigurationProperties.class); + + private Boolean checkBounds; + + /** + * Initialize properties. + */ + public MemoryConfigurationProperties() { + if (checkBounds == null) { + this.checkBounds = false; + } + LOGGER.debug("Memory checkBounds: {}", checkBounds); + } + + public Boolean getCheckBounds() { + return checkBounds; + } + + public void setCheckBounds(Boolean checkBounds) { + this.checkBounds = checkBounds; + } + +} diff --git a/jxnet-spring-boot-autoconfigure/src/main/java/com/ardikars/jxnet/spring/boot/autoconfigure/nio/NioBufferHandlerConfiguration.java b/jxnet-spring-boot-autoconfigure/src/main/java/com/ardikars/jxnet/spring/boot/autoconfigure/nio/NioBufferHandlerConfiguration.java deleted file mode 100644 index 985381c4..00000000 --- a/jxnet-spring-boot-autoconfigure/src/main/java/com/ardikars/jxnet/spring/boot/autoconfigure/nio/NioBufferHandlerConfiguration.java +++ /dev/null @@ -1,63 +0,0 @@ -/** - * 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 . - */ - -package com.ardikars.jxnet.spring.boot.autoconfigure.nio; - -import static com.ardikars.jxnet.spring.boot.autoconfigure.constant.JxnetObjectName.NIO_BUFFER_HANDLER_CONFIGURATION_BEAN_NAME; - -import com.ardikars.common.logging.Logger; -import com.ardikars.common.logging.LoggerFactory; -import com.ardikars.common.tuple.Pair; -import com.ardikars.common.tuple.Tuple; -import com.ardikars.jxnet.PcapHandler; -import com.ardikars.jxnet.PcapPktHdr; -import com.ardikars.jxnet.spring.boot.autoconfigure.HandlerConfigurer; -import com.ardikars.jxpacket.common.Packet; -import java.nio.ByteBuffer; -import java.util.concurrent.Callable; -import java.util.concurrent.Future; -import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; -import org.springframework.context.annotation.Configuration; - -/** - * NIO buffer handler. - * - * @author Ardika Rommy Sanjaya - * @since 1.4.9 - */ -@ConditionalOnClass(Packet.class) -@Configuration(NIO_BUFFER_HANDLER_CONFIGURATION_BEAN_NAME) -public class NioBufferHandlerConfiguration extends HandlerConfigurer>> implements PcapHandler { - - private static final Logger LOGGER = LoggerFactory.getLogger(NioBufferHandlerConfiguration.class); - - @Override - public void nextPacket(final T user, final PcapPktHdr h, final ByteBuffer bytes) { - Future> packet = executorService.submit(new Callable>() { - @Override - public Pair call() throws Exception { - return Tuple.of(h, bytes); - } - }); - try { - getHandler().next(user, packet); - } catch (Exception e) { - LOGGER.warn(e.getMessage()); - } - } - -} diff --git a/jxnet-spring-boot-autoconfigure/src/main/java/com/ardikars/jxnet/spring/boot/autoconfigure/selector/JxpacketConfigurationSelector.java b/jxnet-spring-boot-autoconfigure/src/main/java/com/ardikars/jxnet/spring/boot/autoconfigure/selector/JxpacketConfigurationSelector.java index 561547a4..dd89d3e9 100644 --- a/jxnet-spring-boot-autoconfigure/src/main/java/com/ardikars/jxnet/spring/boot/autoconfigure/selector/JxpacketConfigurationSelector.java +++ b/jxnet-spring-boot-autoconfigure/src/main/java/com/ardikars/jxnet/spring/boot/autoconfigure/selector/JxpacketConfigurationSelector.java @@ -44,21 +44,17 @@ public String[] selectImports(AnnotationMetadata importingClassMetadata) { } PacketHandlerType type = attributes.getEnum("packetHandlerType"); switch (type) { - case NIO_BUFFER: - LOGGER.debug("Applying nio buffer handler configuration."); - return new String[] {"com.ardikars.jxnet.spring.boot.autoconfigure.nio.NioBufferHandlerConfiguration"}; - case NIO_BUFFER_ASYNC: - LOGGER.debug("Applying nio buffer async handler configuration."); - return new String[] {"com.ardikars.jxnet.spring.boot.autoconfigure.nio.NioBufferAsyncHandlerConfiguration"}; case JXPACKET_ASYNC: LOGGER.debug("Applying jxpacket async handler configuration."); return new String[] {"com.ardikars.jxnet.spring.boot.autoconfigure.jxpacket.JxpacketAsyncHandlerConfiguration"}; - case JXPACKET_RAW: - LOGGER.debug("Applying jxpacket raw handler configuration."); - return new String[] {"com.ardikars.jxnet.spring.boot.autoconfigure.jxpacket.JxpacketRawHandlerConfiguration"}; - default: + case JXPACKET: LOGGER.debug("Applying jxpacket handler configuration."); return new String[] {"com.ardikars.jxnet.spring.boot.autoconfigure.jxpacket.JxpacketHandlerConfiguration"}; + case JXPACKET_RAW_ASYNC: + return new String[] {"com.ardikars.jxnet.spring.boot.autoconfigure.jxpacket.JxpacketAsyncRawHandlerConfiguration"}; + default: + LOGGER.debug("Applying raw jxpacket handler configuration."); + return new String[] {"com.ardikars.jxnet.spring.boot.autoconfigure.jxpacket.JxpacketRawHandlerConfiguration"}; } } diff --git a/jxnet-spring-boot-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/jxnet-spring-boot-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json index c7bb1e5c..1976daf0 100644 --- a/jxnet-spring-boot-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json +++ b/jxnet-spring-boot-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -95,6 +95,12 @@ "type": "java.lang.Boolean", "description": "Register all supported packet by Jxpacket.", "defaultValue": false + }, + { + "name": "jxnet.memory.checkBounds", + "type": "java.lang.Boolean", + "description": "Check memory bounds.", + "defaultValue": false } ] } \ No newline at end of file diff --git a/jxnet-spring-boot-starter-example/src/main/resources/application.properties b/jxnet-spring-boot-starter-example/src/main/resources/application.properties index d686bbca..7bb1b637 100644 --- a/jxnet-spring-boot-starter-example/src/main/resources/application.properties +++ b/jxnet-spring-boot-starter-example/src/main/resources/application.properties @@ -1,7 +1,5 @@ spring.banner.location=classpath:/banner.txt jxnet.jxpacket.autoRegister=true -#jxnet.filter=icmp - logging.level.com.ardikars=debug logging.pattern.console=%clr(%m){faint}%n