Skip to content
Commits on Source (25)
# Set the default behavior, in case people don't have core.autocrlf set.
* text=auto
......@@ -27,3 +27,5 @@
# Mac-specific directory that no other operating system needs.
.DS_Store
# Do not include stuff in the static modules as this is generated during the build
*-static/src
The Netty Project
=================
Please visit the Netty web site for more information:
* http://netty.io/
Copyright 2016 The Netty Project
The Netty Project licenses this file to you under the Apache License,
version 2.0 (the "License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at:
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations
under the License.
-------------------------------------------------------------------------------
This product contains a forked and modified version of Tomcat Native
* LICENSE:
* ASL2
* HOMEPAGE:
* http://tomcat.apache.org/native-doc/
* https://svn.apache.org/repos/asf/tomcat/native/
This product contains the Maven wrapper scripts from 'Maven Wrapper', that provides an easy way to ensure a user has everything necessary to run the Maven build.
* LICENSE:
* license/LICENSE.mvn-wrapper.txt (Apache License 2.0)
* HOMEPAGE:
* https://github.com/takari/maven-wrapper
......@@ -19,7 +19,7 @@
<parent>
<groupId>io.netty</groupId>
<artifactId>netty-tcnative-parent</artifactId>
<version>1.1.33.Fork26</version>
<version>2.0.15.Final</version>
</parent>
<artifactId>netty-tcnative-boringssl-static</artifactId>
<packaging>jar</packaging>
......@@ -141,26 +141,35 @@
<equals arg1="${os.detected.name}" arg2="windows" />
<then>
<!-- On Windows, build with /MT for static linking -->
<exec executable="cmake" failonerror="true" dir="${boringsslBuildDir}" resolveexecutable="true">
<arg value="-DCMAKE_POSITION_INDEPENDENT_CODE=TRUE" />
<arg value="-DCMAKE_BUILD_TYPE=Release" />
<arg value="-DCMAKE_C_FLAGS_RELEASE=/MT" />
<arg value="-DCMAKE_CXX_FLAGS_RELEASE=/MT" />
<arg value="-GNinja" />
<arg value=".." />
</exec>
<property name="cmakeAsmFlags" value="" />
<property name="cmakeCFlags" value="/MT" />
<property name="cmakeCxxFlags" value="/MT" />
</then>
<elseif>
<equals arg1="${os.detected.name}" arg2="linux" />
<then>
<!-- On *nix, add ASM flags to disable executable stack -->
<property name="cmakeAsmFlags" value="-Wa,--noexecstack" />
<property name="cmakeCFlags" value="-std=c99 -O3 -fno-omit-frame-pointer" />
<property name="cmakeCxxFlags" value="-O3 -fno-omit-frame-pointer -Wno-error=maybe-uninitialized" />
</then>
</elseif>
<else>
<!-- On *nix, add ASM flags to disable executable stack -->
<property name="cmakeAsmFlags" value="-Wa,--noexecstack" />
<property name="cmakeCFlags" value="-std=c99 -O3 -fno-omit-frame-pointer" />
<property name="cmakeCxxFlags" value="-O3 -fno-omit-frame-pointer" />
</else>
</if>
<exec executable="cmake" failonerror="true" dir="${boringsslBuildDir}" resolveexecutable="true">
<arg value="-DCMAKE_POSITION_INDEPENDENT_CODE=TRUE" />
<arg value="-DCMAKE_BUILD_TYPE=Release" />
<arg value="-DCMAKE_ASM_FLAGS=-Wa,--noexecstack" />
<arg value="-DCMAKE_ASM_FLAGS=${cmakeAsmFlags}" />
<arg value="-DCMAKE_C_FLAGS_RELEASE=${cmakeCFlags}" />
<arg value="-DCMAKE_CXX_FLAGS_RELEASE=${cmakeCxxFlags}" />
<arg value="-GNinja" />
<arg value=".." />
</exec>
</else>
</if>
<exec executable="ninja" failonerror="true" dir="${boringsslBuildDir}" resolveexecutable="true" />
</target>
</configuration>
......@@ -180,10 +189,14 @@
<!-- Strip on linux. See https://github.com/netty/netty-tcnative/issues/129 -->
<if>
<and>
<equals arg1="${os.detected.name}" arg2="linux" />
<equals arg1="${strip.skip}" arg2="false" />
</and>
<then>
<exec executable="strip" failonerror="true" dir="${nativeLibOnlyDir}/META-INF/native/linux${archBits}/" resolveexecutable="true">
<arg value="libnetty-tcnative.so" />
<arg value="--strip-debug" />
<arg value="libnetty_tcnative.so" />
</exec>
</then>
</if>
......@@ -216,7 +229,7 @@
</goals>
<phase>compile</phase>
<configuration>
<name>netty-tcnative</name>
<name>netty_tcnative</name>
<nativeSourceDirectory>${project.basedir}/src/main/c</nativeSourceDirectory>
<libDirectory>${nativeLibOnlyDir}</libDirectory>
<forceAutogen>${forceAutogen}</forceAutogen>
......@@ -226,6 +239,8 @@
<configureArgs>
<configureArg>--with-ssl=no</configureArg>
<configureArg>--with-apr=${aprHome}</configureArg>
<configureArg>--with-static-libs</configureArg>
<configureArg>CFLAGS=-O3 -Werror -fno-omit-frame-pointer -fvisibility=hidden -Wunused-variable</configureArg>
<configureArg>CPPFLAGS=-DHAVE_OPENSSL -I${boringsslCheckoutDir}/include</configureArg>
<configureArg>LDFLAGS=-L${boringsslBuildDir}/ssl -L${boringsslBuildDir}/crypto -L${boringsslBuildDir}/decrepit -ldecrepit -lssl -lcrypto</configureArg>
</configureArgs>
......@@ -245,24 +260,20 @@
without a classifier).
To build from the top level, run:
mvn clean deploy -pl boringssl-static -P uber -DstagingRepositoryId={repoId}
mvn clean deploy -pl boringssl-static -P uber-staging -DstagingRepositoryId={repoId}
The repoId is necessary to allow the build to download the platform-specific jars from
the nexus staging repository.
-->
<profile>
<id>uber</id>
<activation>
<property>
<name>moduleSelector</name>
<value>uber</value>
</property>
</activation>
<id>uber-staging</id>
<properties>
<unpackDir>${project.build.directory}/unpack</unpackDir>
<libDir>${project.build.directory}/lib</libDir>
<nativeDir>${project.build.outputDirectory}/META-INF/native</nativeDir>
<skipTests>true</skipTests>
<uberArch>${os.detected.arch}</uberArch>
</properties>
<repositories>
......@@ -291,25 +302,25 @@
<groupId>io.netty</groupId>
<artifactId>netty-tcnative-boringssl-static</artifactId>
<version>${project.version}</version>
<classifier>osx-x86_64</classifier>
<classifier>osx-${uberArch}</classifier>
<type>jar</type>
<outputDirectory>${unpackDir}/osx-x86_64</outputDirectory>
<outputDirectory>${unpackDir}/osx-${uberArch}</outputDirectory>
</artifactItem>
<artifactItem>
<groupId>io.netty</groupId>
<artifactId>netty-tcnative-boringssl-static</artifactId>
<version>${project.version}</version>
<classifier>linux-x86_64</classifier>
<classifier>linux-${uberArch}</classifier>
<type>jar</type>
<outputDirectory>${unpackDir}/linux-x86_64</outputDirectory>
<outputDirectory>${unpackDir}/linux-${uberArch}</outputDirectory>
</artifactItem>
<artifactItem>
<groupId>io.netty</groupId>
<artifactId>netty-tcnative-boringssl-static</artifactId>
<version>${project.version}</version>
<classifier>windows-x86_64</classifier>
<classifier>windows-${uberArch}</classifier>
<type>jar</type>
<outputDirectory>${unpackDir}/windows-x86_64</outputDirectory>
<outputDirectory>${unpackDir}/windows-${uberArch}</outputDirectory>
</artifactItem>
<!-- Now unpack all of the Java classes and the original MANIFEST.MF -->
......@@ -340,16 +351,129 @@
<target name="copy-jni-libs">
<mkdir dir="${nativeDir}" />
<copy todir="${nativeDir}" flatten="true">
<fileset dir="${unpackDir}/osx-x86_64/META-INF/native" />
<globmapper from="libnetty-tcnative.*" to="libnetty-tcnative-osx-x86_64.*" />
<fileset dir="${unpackDir}/osx-${uberArch}/META-INF/native" />
<globmapper from="libnetty_tcnative.*" to="libnetty_tcnative_osx_${uberArch}.*" />
</copy>
<copy todir="${nativeDir}" flatten="true">
<fileset dir="${unpackDir}/linux-${uberArch}/META-INF/native" />
<globmapper from="libnetty_tcnative.*" to="libnetty_tcnative_linux_${uberArch}.*" />
</copy>
<copy todir="${nativeDir}" flatten="true">
<fileset dir="${unpackDir}/linux-x86_64/META-INF/native" />
<globmapper from="libnetty-tcnative.*" to="libnetty-tcnative-linux-x86_64.*" />
<fileset dir="${unpackDir}/windows-${uberArch}/META-INF/native" />
<globmapper from="netty_tcnative.*" to="netty_tcnative_windows_${uberArch}.*" />
</copy>
</target>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<executions>
<execution>
<id>generate-manifest</id>
<phase>process-classes</phase>
<goals>
<goal>manifest</goal>
</goals>
<configuration>
<supportedProjectTypes>
<supportedProjectType>jar</supportedProjectType>
</supportedProjectTypes>
<instructions>
<Export-Package>io.netty.internal.tcnative.*</Export-Package>
<Bundle-NativeCode>
META-INF/native/libnetty_tcnative_osx_${uberArch}.jnilib;osname=macos;osname=macosx;processor=${uberArch},
META-INF/native/libnetty_tcnative_linux_${uberArch}.so;osname=linux;processor=${uberArch},
META-INF/native/netty_tcnative_windows_${uberArch}.dll;osname=win32;processor=${uberArch}
</Bundle-NativeCode>
</instructions>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>uber-snapshot</id>
<properties>
<unpackDir>${project.build.directory}/unpack</unpackDir>
<libDir>${project.build.directory}/lib</libDir>
<nativeDir>${project.build.outputDirectory}/META-INF/native</nativeDir>
<skipTests>true</skipTests>
<uberArch>${os.detected.arch}</uberArch>
</properties>
<build>
<plugins>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack</id>
<phase>generate-resources</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<!-- Unpack just the native libraries (windows excluded as we not publish snapshots for it yet) -->
<artifactItem>
<groupId>io.netty</groupId>
<artifactId>netty-tcnative-boringssl-static</artifactId>
<version>${project.version}</version>
<classifier>osx-${uberArch}</classifier>
<type>jar</type>
<outputDirectory>${unpackDir}/osx-${uberArch}</outputDirectory>
</artifactItem>
<artifactItem>
<groupId>io.netty</groupId>
<artifactId>netty-tcnative-boringssl-static</artifactId>
<version>${project.version}</version>
<classifier>linux-${uberArch}</classifier>
<type>jar</type>
<outputDirectory>${unpackDir}/linux-${uberArch}</outputDirectory>
</artifactItem>
<!-- Now unpack all of the Java classes and the original MANIFEST.MF -->
<artifactItem>
<groupId>io.netty</groupId>
<artifactId>netty-tcnative-boringssl-static</artifactId>
<version>${project.version}</version>
<type>jar</type>
<outputDirectory>${project.build.outputDirectory}</outputDirectory>
<includes>**/*.class,**/MANIFEST.MF</includes>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>copy-jni-libs</id>
<phase>generate-resources</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<!-- Windows excluded as we not publish snapshots for it yet -->
<target name="copy-jni-libs">
<mkdir dir="${nativeDir}" />
<copy todir="${nativeDir}" flatten="true">
<fileset dir="${unpackDir}/osx-${uberArch}/META-INF/native" />
<globmapper from="libnetty_tcnative.*" to="libnetty_tcnative_osx_${uberArch}.*" />
</copy>
<copy todir="${nativeDir}" flatten="true">
<fileset dir="${unpackDir}/windows-x86_64/META-INF/native" />
<globmapper from="netty-tcnative.*" to="netty-tcnative-windows-x86_64.*" />
<fileset dir="${unpackDir}/linux-${uberArch}/META-INF/native" />
<globmapper from="libnetty_tcnative.*" to="libnetty_tcnative_linux_${uberArch}.*" />
</copy>
</target>
</configuration>
......@@ -372,11 +496,11 @@
<supportedProjectType>jar</supportedProjectType>
</supportedProjectTypes>
<instructions>
<Export-Package>org.apache.tomcat.jni.*</Export-Package>
<Export-Package>io.netty.internal.tcnative.*</Export-Package>
<Bundle-NativeCode>
META-INF/native/libnetty-tcnative-osx-x86_64.jnilib;osname=macos;osname=macosx;processor=x86_64,
META-INF/native/libnetty-tcnative-linux-x86_64.so;osname=linux;processor=x86_64,
META-INF/native/netty-tcnative-windows-x86_64.dll;osname=win32;processor=x86_64
META-INF/native/libnetty_tcnative_osx_${uberArch}.jnilib;osname=macos;osname=macosx;processor=${uberArch},
META-INF/native/libnetty_tcnative_linux_${uberArch}.so;osname=linux;processor=${uberArch},
META-INF/native/netty_tcnative_windows_${uberArch}.dll;osname=win32;processor=${uberArch}
</Bundle-NativeCode>
</instructions>
</configuration>
......
netty-tcnative (1.1.33.Fork26-2) UNRELEASED; urgency=medium
netty-tcnative (2.0.15-1) unstable; urgency=medium
* Team upload.
* New upstream release
- Depend on libssl-dev instead of libssl1.0-dev (Closes: #828451)
- Refreshed debian/native-build/Makefile.am
- Adapted the build to run the unit tests
- Removed the docker files and the Maven wrapper from the upstream tarball
- Removed the --has-package-version flag
* Modified debian/watch to track the 2.x tags
* Removed the unused lintian overrides
* Standards-Version updated to 4.2.1
* Switch to debhelper level 11
* Use salsa.debian.org Vcs-* URLs
-- Emmanuel Bourg <ebourg@apache.org> Wed, 21 Jun 2017 11:05:00 +0200
-- Emmanuel Bourg <ebourg@apache.org> Mon, 03 Sep 2018 14:40:10 +0200
netty-tcnative (1.1.33.Fork26-1) unstable; urgency=medium
......
......@@ -4,17 +4,18 @@ Priority: optional
Maintainer: Debian Java Maintainers <pkg-java-maintainers@lists.alioth.debian.org>
Uploaders: Emmanuel Bourg <ebourg@apache.org>
Build-Depends: automake,
debhelper (>= 10),
debhelper (>= 11~),
default-jdk,
junit4,
libapr1-dev,
libmaven-antrun-plugin-java,
libmaven-bundle-plugin-java,
libssl1.0-dev,
libssl-dev,
libtool,
maven-debian-helper (>= 1.5)
Standards-Version: 3.9.8
Vcs-Git: https://anonscm.debian.org/git/pkg-java/netty-tcnative.git
Vcs-Browser: https://anonscm.debian.org/cgit/pkg-java/netty-tcnative.git
Standards-Version: 4.2.1
Vcs-Git: https://salsa.debian.org/java-team/netty-tcnative.git
Vcs-Browser: https://salsa.debian.org/java-team/netty-tcnative
Homepage: https://github.com/netty/netty-tcnative/
Package: libnetty-tcnative-java
......
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: Netty Tomcat Native
Source: https://github.com/netty/netty-tcnative/
Files-Excluded: docker/*
.mvn
mvnw*
Files: *
Copyright: 2004-2014, The Apache Software Foundation
2014-2017, The Netty Project
2014-2018, The Netty Project
License: Apache-2.0
Files: debian/*
Copyright: 2015-2017, Emmanuel Bourg <ebourg@apache.org>
Copyright: 2015-2018, Emmanuel Bourg <ebourg@apache.org>
License: Apache-2.0
Files: debian/native-build/m4/jni.m4
......
......@@ -26,7 +26,7 @@
# Empty by default. [mh_install]
#
pom.xml --no-parent
openssl-dynamic/pom.xml --has-package-version
openssl-dynamic/pom.xml
openssl-static/pom.xml --ignore
boringssl-static/pom.xml --ignore
libressl-static/pom.xml --ignore
io.netty netty-tcnative jar s/.*/debian/ * *
junit junit jar s/.*/4.x/ * *
......@@ -21,33 +21,17 @@ lib_LTLIBRARIES = libnetty-tcnative.la
# libnetty_tcnative_la_CFLAGS =
#libnetty_tcnative_la_LDFLAGS =
libnetty_tcnative_la_SOURCES = src/sslinfo.c\
src/shm.c\
src/misc.c\
src/dir.c\
src/lock.c\
src/stdlib.c\
src/multicast.c\
src/os_win32_system.c\
src/network.c\
libnetty_tcnative_la_SOURCES = \
src/bb.c\
src/os.c\
src/file.c\
src/address.c\
src/user.c\
src/thread.c\
src/bb.h\
src/error.c\
src/proc.c\
src/poll.c\
src/sslcontext.c\
src/jnilib.c\
src/native_constants.c\
src/native_constants.h\
src/ssl.c\
src/sslcontext.c\
src/sslcontext.h\
src/ssl.h\
src/ssl_private.h\
src/sslutils.c\
src/sslnetwork.c\
src/os_win32_ntpipe.c\
src/mmap.c\
src/info.c\
src/os_win32_registry.c\
src/jnilib.c\
src/pool.c\
src/os_unix_uxpipe.c\
src/os_unix_system.c
src/tcn.h
Description: Add the missing junit dependency (inherited from the ignored parent pom)
Author: Emmanuel Bourg <ebourg@pache.org>
Forwarded: not-needed
--- a/openssl-dynamic/pom.xml
+++ b/openssl-dynamic/pom.xml
@@ -183,4 +183,13 @@
</build>
</profile>
</profiles>
+
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.12</version>
+ </dependency>
+ </dependencies>
+
</project>
01-add-junit-dependency.patch
......@@ -12,11 +12,12 @@ override_dh_auto_build-arch:
cp -Rvp debian/native-build/* openssl-dynamic/target/native-build/
cd openssl-dynamic/target/native-build/ ; autoreconf --force --install -I m4 ; ./configure ; make
# copy the native library to the location expected by the unit tests
mkdir -p openssl-dynamic/target/test-classes/META-INF/native/debian
cp openssl-dynamic/target/native-build/.libs/libnetty-tcnative.so openssl-dynamic/target/test-classes/META-INF/native/debian/libnetty_tcnative.so
override_dh_auto_test-arch:
override_dh_auto_install-arch:
mv openssl-dynamic/target/native-build/.libs/libnetty-tcnative-@VERSION@.so openssl-dynamic/target/native-build/.libs/libnetty-tcnative.so
dh_install -p libnetty-tcnative-jni openssl-dynamic/target/native-build/.libs/libnetty-tcnative.so usr/lib/${DEB_HOST_MULTIARCH}/jni
get-orig-source:
uscan --download-current-version --force-download --no-symlink
version=3
https://github.com/netty/netty-tcnative/tags .*/netty-tcnative-(?:parent-)?(.*).tar.gz
version=4
opts="repack,compression=xz" \
https://github.com/netty/netty-tcnative/tags .*/netty-tcnative-(?:parent-)?([\d\.]+\d)(?:\.Final)?.tar.gz
......@@ -19,7 +19,7 @@
<parent>
<groupId>io.netty</groupId>
<artifactId>netty-tcnative-parent</artifactId>
<version>1.1.33.Fork26</version>
<version>2.0.15.Final</version>
</parent>
<artifactId>netty-tcnative-libressl-static</artifactId>
<packaging>jar</packaging>
......@@ -54,7 +54,7 @@
</goals>
<phase>compile</phase>
<configuration>
<name>netty-tcnative</name>
<name>netty_tcnative</name>
<nativeSourceDirectory>${project.basedir}/src/main/c</nativeSourceDirectory>
<libDirectory>${nativeLibOnlyDir}</libDirectory>
<forceAutogen>${forceAutogen}</forceAutogen>
......@@ -63,6 +63,7 @@
<configureArgs>
<configureArg>--with-ssl=${sslHome}</configureArg>
<configureArg>--with-apr=${aprHome}</configureArg>
<configureArg>--with-static-libs</configureArg>
</configureArgs>
</configuration>
</execution>
......@@ -149,8 +150,9 @@
</plugins>
</build>
</profile>
<profile>
<id>build-libressl-linux-mac</id>
<id>build-libressl-non-windows</id>
<activation>
<os>
<family>!windows</family>
......@@ -163,7 +165,7 @@
<executions>
<!-- Download and build LibreSSL -->
<execution>
<id>build-libressl-linux-mac</id>
<id>build-libressl-non-windows</id>
<phase>generate-sources</phase>
<goals>
<goal>run</goal>
......@@ -178,7 +180,7 @@
</exec>
<mkdir dir="${sslHome}" />
<exec executable="configure" failonerror="true" dir="${libresslCheckoutDir}" resolveexecutable="true">
<arg line="--disable-shared --prefix=${sslHome} CFLAGS=-fPIC" />
<arg line="--disable-shared --prefix=${sslHome} CFLAGS='-O3 -fno-omit-frame-pointer -fPIC'" />
</exec>
<exec executable="make" failonerror="true" dir="${libresslCheckoutDir}" resolveexecutable="true" />
<exec executable="make" failonerror="true" dir="${libresslCheckoutDir}" resolveexecutable="true">
......
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
......@@ -19,7 +19,7 @@
<parent>
<groupId>io.netty</groupId>
<artifactId>netty-tcnative-parent</artifactId>
<version>1.1.33.Fork26</version>
<version>2.0.15.Final</version>
</parent>
<artifactId>netty-tcnative</artifactId>
<packaging>jar</packaging>
......@@ -80,7 +80,7 @@
<execution>
<id>build-native-lib</id>
<configuration>
<name>netty-tcnative</name>
<name>netty_tcnative</name>
<nativeSourceDirectory>${project.basedir}/src/main/c</nativeSourceDirectory>
<libDirectory>${nativeLibOnlyDir}</libDirectory>
<forceAutogen>${forceAutogen}</forceAutogen>
......@@ -107,6 +107,10 @@
<family>windows</family>
</os>
</activation>
<properties>
<!-- Skip tests on windows as its not easy to load the openssl library we link against in the tests -->
<skipTests>true</skipTests>
</properties>
<build>
<plugins>
<plugin>
......@@ -158,7 +162,7 @@
<execution>
<id>build-native-lib</id>
<configuration>
<name>netty-tcnative</name>
<name>netty_tcnative</name>
<nativeSourceDirectory>${project.basedir}/src/main/c</nativeSourceDirectory>
<libDirectory>${nativeLibOnlyDir}</libDirectory>
<forceAutogen>${forceAutogen}</forceAutogen>
......
/* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
*
* @author Mladen Turk
* @version $Id: address.c 1442587 2013-02-05 13:49:48Z rjung $
*/
#include "tcn.h"
TCN_IMPLEMENT_CALL(jlong, Address, info)(TCN_STDARGS,
jstring hostname,
jint family, jint port,
jint flags, jlong pool)
{
apr_pool_t *p = J2P(pool, apr_pool_t *);
TCN_ALLOC_CSTRING(hostname);
char *sp = NULL;
int scope_id = 0;
apr_sockaddr_t *sa = NULL;
apr_sockaddr_t *sl = NULL;
apr_int32_t f;
UNREFERENCED(o);
GET_S_FAMILY(f, family);
#if APR_HAVE_IPV6
if (hostname) {
/* XXX: This only works for real scope_id's
*/
if ((sp = strchr(J2S(hostname), '%'))) {
*sp++ = '\0';
scope_id = atoi(sp);
}
}
#endif
TCN_THROW_IF_ERR(apr_sockaddr_info_get(&sa,
J2S(hostname), f, (apr_port_t)port,
(apr_int32_t)flags, p), sa);
sl = sa;
/*
* apr_sockaddr_info_get may return several address so this is not
* go to work in some cases (but as least it works for Linux)
* XXX: with AP_ENABLE_V4_MAPPED it is going to work otherwise it won't.
*/
#if APR_HAVE_IPV6
if (hostname == NULL) {
/* Try all address using IPV6 one */
while (sl) {
if (sl->family == APR_INET6)
break; /* Done */
sl = sl->next;
}
/* If we don't find an IPv6 address, use the original one */
if (sl == NULL) {
sl = sa;
}
}
if (sp) {
/* Set the provided scope id
* APR lack the api for setting this directly so lets presume
* the sin6_scope_id is present everywhere
*/
sl->sa.sin6.sin6_scope_id = scope_id;
}
#endif
cleanup:
TCN_FREE_CSTRING(hostname);
return P2J(sl);
}
TCN_IMPLEMENT_CALL(jstring, Address, getnameinfo)(TCN_STDARGS,
jlong sa, jint flags)
{
apr_sockaddr_t *s = J2P(sa, apr_sockaddr_t *);
char *hostname;
UNREFERENCED(o);
if (apr_getnameinfo(&hostname, s, (apr_int32_t)flags) == APR_SUCCESS)
return AJP_TO_JSTRING(hostname);
else
return NULL;
}
TCN_IMPLEMENT_CALL(jstring, Address, getip)(TCN_STDARGS, jlong sa)
{
apr_sockaddr_t *s = J2P(sa, apr_sockaddr_t *);
char *ipaddr;
UNREFERENCED(o);
if (apr_sockaddr_ip_get(&ipaddr, s) == APR_SUCCESS)
return AJP_TO_JSTRING(ipaddr);
else
return NULL;
}
TCN_IMPLEMENT_CALL(jlong, Address, get)(TCN_STDARGS, jint which,
jlong sock)
{
tcn_socket_t *s = J2P(sock, tcn_socket_t *);
apr_sockaddr_t *sa = NULL;
UNREFERENCED(o);
TCN_THROW_IF_ERR(apr_socket_addr_get(&sa,
(apr_interface_e)which, s->sock), sa);
cleanup:
return P2J(sa);
}
TCN_IMPLEMENT_CALL(jboolean, Address, equal)(TCN_STDARGS,
jlong a, jlong b)
{
apr_sockaddr_t *sa = J2P(a, apr_sockaddr_t *);
apr_sockaddr_t *sb = J2P(b, apr_sockaddr_t *);
UNREFERENCED_STDARGS;
return apr_sockaddr_equal(sa, sb) ? JNI_TRUE : JNI_FALSE;
}
TCN_IMPLEMENT_CALL(jint, Address, getservbyname)(TCN_STDARGS,
jlong sa, jstring servname)
{
apr_sockaddr_t *s = J2P(sa, apr_sockaddr_t *);
TCN_ALLOC_CSTRING(servname);
apr_status_t rv;
UNREFERENCED(o);
rv = apr_getservbyname(s, J2S(servname));
TCN_FREE_CSTRING(servname);
return (jint)rv;
}