Skip to content
This repository has been archived by the owner on Nov 26, 2020. It is now read-only.

Commit

Permalink
Merge pull request #44 from jxnet/development
Browse files Browse the repository at this point in the history
Add raw handler
  • Loading branch information
ardikars authored Apr 19, 2019
2 parents 1b8f284 + cd554af commit 54a0386
Show file tree
Hide file tree
Showing 83 changed files with 14,570 additions and 3,533 deletions.
70 changes: 38 additions & 32 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
.DS_Store
a.out
*.log
*~
*swp
*.o
*.a
*.so
*.so.a
*.dylib
*.status
*.deb
*.rpm
Expand All @@ -21,6 +26,9 @@ a.out
*.bz2
*.zip
*.rar
*.3pcap
*.manmisc
*.bottom
/.classpath
/.project
/.settings
Expand Down Expand Up @@ -108,8 +116,6 @@ a.out
/jxnet-native/.idea
/jxnet-native/test
/jxnet-native/build
/jxnet-native/libjxnet.so
/jxnet-native/libjxnet.so.a
/jxnet-native/jxnet.dll
/jxnet-native/CMakeFiles
/jxnet-native/CMakeCache.txt
Expand Down Expand Up @@ -143,36 +149,36 @@ a.out
/jxnet-native/libpcap/bpf_filter.c
/jxnet-native/libpcap/net
/jxnet-native/libpcap/Makefile
/jxnet-native/libpcap-latest/Makefile
/jxnet-native/libpcap-latest/config.log
/jxnet-native/libpcap-latest/config.cache
/jxnet-native/libpcap-latest/config.status
/jxnet-native/libpcap-latest/stamp-h
/jxnet-native/libpcap-latest/stamp-h.in
/jxnet-native/libpcap-latest/autom4te.cache/
/jxnet-native/libpcap-latest/.devel
/jxnet-native/libpcap-latest/filtertest
/jxnet-native/libpcap-latest/findalldevstest
/jxnet-native/libpcap-latest/pcap-config
/jxnet-native/libpcap-latest/pcap-filter.manmisc
/jxnet-native/libpcap-latest/pcap-linktype.manmisc
/jxnet-native/libpcap-latest/pcap-savefile.manfile
/jxnet-native/libpcap-latest/pcap-tstamp.manmisc
/jxnet-native/libpcap-latest/pcap.3pcap
/jxnet-native/libpcap-latest/pcap_compile.3pcap
/jxnet-native/libpcap-latest/pcap_datalink.3pcap
/jxnet-native/libpcap-latest/pcap_dump_open.3pcap
/jxnet-native/libpcap-latest/pcap_get_tstamp_precision.3pcap
/jxnet-native/libpcap-latest/pcap_list_datalinks.3pcap
/jxnet-native/libpcap-latest/pcap_list_tstamp_types.3pcap
/jxnet-native/libpcap-latest/pcap_open_dead.3pcap
/jxnet-native/libpcap-latest/pcap_open_offline.3pcap
/jxnet-native/libpcap-latest/pcap_set_tstamp_precision.3pcap
/jxnet-native/libpcap-latest/pcap_set_tstamp_type.3pcap
/jxnet-native/libpcap-latest/selpolltest
/jxnet-native/libpcap-latest/bpf_filter.c
/jxnet-native/libpcap-latest/net
/jxnet-native/libpcap-latest/libpcap.so.1.7.4
/jxnet-native/libpcap/Makefile
/jxnet-native/libpcap/config.log
/jxnet-native/libpcap/config.cache
/jxnet-native/libpcap/config.status
/jxnet-native/libpcap/stamp-h
/jxnet-native/libpcap/stamp-h.in
/jxnet-native/libpcap/autom4te.cache/
/jxnet-native/libpcap/.devel
/jxnet-native/libpcap/filtertest
/jxnet-native/libpcap/findalldevstest
/jxnet-native/libpcap/pcap-config
/jxnet-native/libpcap/pcap-filter.manmisc
/jxnet-native/libpcap/pcap-linktype.manmisc
/jxnet-native/libpcap/pcap-savefile.manfile
/jxnet-native/libpcap/pcap-tstamp.manmisc
/jxnet-native/libpcap/pcap.3pcap
/jxnet-native/libpcap/pcap_compile.3pcap
/jxnet-native/libpcap/pcap_datalink.3pcap
/jxnet-native/libpcap/pcap_dump_open.3pcap
/jxnet-native/libpcap/pcap_get_tstamp_precision.3pcap
/jxnet-native/libpcap/pcap_list_datalinks.3pcap
/jxnet-native/libpcap/pcap_list_tstamp_types.3pcap
/jxnet-native/libpcap/pcap_open_dead.3pcap
/jxnet-native/libpcap/pcap_open_offline.3pcap
/jxnet-native/libpcap/pcap_set_tstamp_precision.3pcap
/jxnet-native/libpcap/pcap_set_tstamp_type.3pcap
/jxnet-native/libpcap/selpolltest
/jxnet-native/libpcap/bpf_filter.c
/jxnet-native/libpcap/net
/jxnet-native/libpcap/libpcap.so.1.7.4
/jxnet-native/bin
/jxnet-native/.classpath
/jxnet-native/.project
Expand Down
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.5.4.RELEASE
58 changes: 58 additions & 0 deletions docker/Alpine_Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@

# alpine 3.5 base os
FROM alpine:3.5

# need root permission to install some development tools
USER root

# update local list of software from official repository
RUN apk update

# install required tools
RUN apk --no-cache add linux-headers \
bash \
gcc \
g++ \
make \
git

# required to build libpcap
RUN apk --no-cache add bison \
flex

# install autotools
RUN apk --no-cache add automake \
autoconf \
libtool

# install cmake
RUN apk --no-cache add cmake

# add Jxnet project into image
RUN mkdir -p ~/project/
RUN git clone https://github.com/jxnet/Jxnet ~/project/Jxnet

# checkout into jni branch as default
RUN cd ~/project/Jxnet && \
git checkout jni

# build and install libpcap
RUN cd ~/project/Jxnet/jxnet-native/libpcap && \
./configure && \
make

# build jxnet native library with cmake
RUN cd ~/project/Jxnet/jxnet-native/ && \
mkdir -p build && \
cd build && \
cmake ../ && \
make && \
make install

# build jxnet native library with autotools
RUN cd ~/project/Jxnet/jxnet-native/ && \
export JAVA_HOME=$(pwd) && \
./bootstrap.sh && \
./configure && \
make && \
make install
57 changes: 57 additions & 0 deletions docker/Centos_Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@

# centos 7 base os
FROM centos:7

# need root permission to install some development tools
USER root

# install required tools
RUN yum -y install bash \
gcc \
gcc-c++ \
make \
git

# required to build libpcap
RUN yum -y install bison \
flex

# install autotools
RUN yum -y install automake \
autoconf \
libtool

# install cmake
RUN yum -y install cmake

# clean cache
RUN yum clean all

# add Jxnet project into image
RUN mkdir -p ~/project/
RUN git clone https://github.com/jxnet/Jxnet ~/project/Jxnet

# checkout into jni branch as default
RUN cd ~/project/Jxnet && \
git checkout jni

# build and install libpcap
RUN cd ~/project/Jxnet/jxnet-native/libpcap && \
./configure && \
make

# build jxnet native library with cmake
RUN cd ~/project/Jxnet/jxnet-native/ && \
mkdir -p build && \
cd build && \
cmake ../ && \
make && \
make install

# build jxnet native library with autotools
RUN cd ~/project/Jxnet/jxnet-native/ && \
export JAVA_HOME=$(pwd) && \
./bootstrap.sh && \
./configure && \
make && \
make install
59 changes: 59 additions & 0 deletions docker/Debian_Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@

# debian jessie (8) base os
FROM debian:jessie

# need root permission to install some development tools
USER root

# update local list of software from official repository
RUN apt-get update

# install required tools
RUN apt-get -y install bash \
gcc \
g++ \
make \
git

# required to build libpcap
RUN apt-get -y install bison \
flex

# install autotools
RUN apt-get -y install automake \
autoconf \
libtool

# install cmake
RUN apt-get -y install cmake

RUN apt-get clean

# add Jxnet project into image
RUN mkdir -p ~/project/
RUN git clone https://github.com/jxnet/Jxnet ~/project/Jxnet

# checkout into jni branch as default
RUN cd ~/project/Jxnet && \
git checkout jni

# build and install libpcap
RUN cd ~/project/Jxnet/jxnet-native/libpcap && \
./configure && \
make

# build jxnet native library with cmake
RUN cd ~/project/Jxnet/jxnet-native/ && \
mkdir -p build && \
cd build && \
cmake ../ && \
make && \
make install

# build jxnet native library with autotools
RUN cd ~/project/Jxnet/jxnet-native/ && \
export JAVA_HOME=$(pwd) && \
./bootstrap.sh && \
./configure && \
make && \
make install
26 changes: 26 additions & 0 deletions docker/Toolchain
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@

# alpine 3.5 base os
FROM alpine:3.5

# need root permission to install some development tools
USER root

# install required tools
RUN apk --no-cache add linux-headers \
bash \
gcc \
g++ \
make \
git

# required to build libpcap
RUN apk --no-cache add bison \
flex

# install autotools
RUN apk --no-cache add automake \
autoconf \
libtool

# install cmake
RUN apk --no-cache add cmake
2 changes: 1 addition & 1 deletion gradle/configure.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ ext {

NAME = 'Jxnet'
GROUP = 'com.ardikars.jxnet'
VERSION = '1.5.4.RELEASE'
VERSION = '1.5.5.RC1'
DESCRIPTION = 'Jxnet is a java library for capturing and sending network packet.'

NDK_HOME = "${System.env.NDK_HOME}"
Expand Down
2 changes: 1 addition & 1 deletion gradle/resources/pmd/pmd.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
<rule ref="rulesets/java/strictexception.xml/AvoidThrowingRawExceptionTypes"/>
<!--<rule ref="rulesets/ecmascript/basic.xml/AvoidTrailingComma"/>-->
<rule ref="rulesets/java/basic.xml/AvoidUsingHardCodedIP"/>
<rule ref="rulesets/java/controversial.xml/AvoidUsingNativeCode"/>
<!--<rule ref="rulesets/java/controversial.xml/AvoidUsingNativeCode"/>-->
<rule ref="rulesets/java/basic.xml/AvoidUsingOctalValues"/>
<!--<rule ref="rulesets/java/controversial.xml/AvoidUsingShortType"/>-->
<!--<rule ref="rulesets/java/controversial.xml/AvoidUsingVolatile"/>-->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,22 @@ public class DefaultLibraryLoader implements Loader<Void> {

private final InternalNativeLibrary nativeLibrary = new InternalNativeLibrary();

private static final boolean USE_SYSTEM_LIBRARY;

/**
* Perform load native library.
*/
@Override
public void load(final Callback<Void> callback) {
if (USE_SYSTEM_LIBRARY) {
try {
System.loadLibrary("jxnet");
callback.onSuccess(null);
return;
} catch (Exception e) {
// use internal library
}
}
switch (Platforms.getName()) {
case LINUX:
if (Platforms.is64Bit()) {
Expand Down Expand Up @@ -98,4 +109,17 @@ public void onFailure(Throwable throwable) {
});
}

static {
boolean isUseSystemLibrary;
String useSystemLibrary = System.getProperty("jxnet.system.library", "false");
if ("yes".equalsIgnoreCase(useSystemLibrary)
|| "true".equalsIgnoreCase(useSystemLibrary)
|| "1".equalsIgnoreCase(useSystemLibrary)) {
isUseSystemLibrary = true;
} else {
isUseSystemLibrary = false;
}
USE_SYSTEM_LIBRARY = isUseSystemLibrary;
}

}
Binary file modified jxnet-core/src/main/resources/native/jxnet-windows-x64.dll
Binary file not shown.
Binary file modified jxnet-core/src/main/resources/native/jxnet-windows-x86.dll
Binary file not shown.
Binary file modified jxnet-core/src/main/resources/native/libjxnet-darwin-x64.dylib
Binary file not shown.
Binary file modified jxnet-core/src/main/resources/native/libjxnet-linux-x64.so
Binary file not shown.
Binary file modified jxnet-core/src/main/resources/native/libjxnet-linux-x86.so
Binary file not shown.
Loading

0 comments on commit 54a0386

Please sign in to comment.