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.
- Loading branch information
Showing
14 changed files
with
104 additions
and
113 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
1.5.5.RC2 | ||
1.5.5.RC3 |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,42 +15,44 @@ | |
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
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 <T> type. | ||
* Jxpacket handler. | ||
* | ||
* @author <a href="mailto:[email protected]">Ardika Rommy Sanjaya</a> | ||
* @since 1.5.3 | ||
* @since 1.4.9 | ||
*/ | ||
@ConditionalOnClass({ByteBuffer.class}) | ||
@Configuration(NIO_BUFFER_ASYNC_HANDLER_CONFIGURATION_BEAN_NAME) | ||
public class NioBufferAsyncHandlerConfiguration<T> extends HandlerConfigurer<T, Pair<PcapPktHdr, ByteBuffer>> implements PcapHandler<T> { | ||
@ConditionalOnClass({Packet.class, Memory.class}) | ||
@Configuration(JXPACKET_ASYNC_RAW_HANDLER_CONFIGURATION_BEAN_NAME) | ||
public class JxpacketAsyncRawHandlerConfiguration<T> extends HandlerConfigurer<T, Pair<PcapPktHdr, Packet>> implements RawPcapHandler<T> { | ||
|
||
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) { | ||
|
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
53 changes: 53 additions & 0 deletions
53
...va/com/ardikars/jxnet/spring/boot/autoconfigure/memory/MemoryConfigurationProperties.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,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 <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
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; | ||
} | ||
|
||
} |
63 changes: 0 additions & 63 deletions
63
.../java/com/ardikars/jxnet/spring/boot/autoconfigure/nio/NioBufferHandlerConfiguration.java
This file was deleted.
Oops, something went wrong.
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.