This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 1.2.x in repository https://gitbox.apache.org/repos/asf/tomcat-native.git
The following commit(s) were added to refs/heads/1.2.x by this push: new 14f7c6871 Align with 9.0.x 14f7c6871 is described below commit 14f7c687121fba6848e9cce67550cc1991b6ad9c Author: Mark Thomas <ma...@apache.org> AuthorDate: Mon Jun 6 17:21:17 2022 +0100 Align with 9.0.x --- java/org/apache/tomcat/jni/BIOCallback.java | 3 ++ java/org/apache/tomcat/jni/Buffer.java | 29 +++++++++++-- java/org/apache/tomcat/jni/Error.java | 3 ++ java/org/apache/tomcat/jni/Library.java | 39 ++++++++++++++++- java/org/apache/tomcat/jni/OS.java | 7 ++++ java/org/apache/tomcat/jni/PasswordCallback.java | 3 ++ java/org/apache/tomcat/jni/Pool.java | 53 ++++++++++++++++++++---- java/org/apache/tomcat/jni/SSL.java | 48 +++++++++++++++++++-- java/org/apache/tomcat/jni/SSLContext.java | 31 ++++++++++++++ 9 files changed, 199 insertions(+), 17 deletions(-) diff --git a/java/org/apache/tomcat/jni/BIOCallback.java b/java/org/apache/tomcat/jni/BIOCallback.java index 7dfdce051..ea9ccff67 100644 --- a/java/org/apache/tomcat/jni/BIOCallback.java +++ b/java/org/apache/tomcat/jni/BIOCallback.java @@ -19,7 +19,10 @@ package org.apache.tomcat.jni; /** Open SSL BIO Callback Interface * * @author Mladen Turk + * + * @deprecated Unused. Will be removed in Tomcat 10.1 */ +@Deprecated public interface BIOCallback { /** diff --git a/java/org/apache/tomcat/jni/Buffer.java b/java/org/apache/tomcat/jni/Buffer.java index 9802b114a..a9d29edb1 100644 --- a/java/org/apache/tomcat/jni/Buffer.java +++ b/java/org/apache/tomcat/jni/Buffer.java @@ -18,9 +18,9 @@ package org.apache.tomcat.jni; import java.nio.ByteBuffer; -/** Buffer - * - * @author Mladen Turk +/** + * Provides utilities related to the use of directly allocated + * {@link ByteBuffer} instances with native code. */ public class Buffer { @@ -28,7 +28,10 @@ public class Buffer { * Allocate a new ByteBuffer from memory * @param size The amount of memory to allocate * @return The ByteBuffer with allocated memory + * + * @deprecated Unused. Will be removed in Tomcat 10.1 */ + @Deprecated public static native ByteBuffer malloc(int size); /** @@ -36,7 +39,10 @@ public class Buffer { * @param num Number of elements. * @param size Length in bytes of each element. * @return The ByteBuffer with allocated memory + * + * @deprecated Unused. Will be removed in Tomcat 10.1 */ + @Deprecated public static native ByteBuffer calloc(int num, int size); /** @@ -44,7 +50,10 @@ public class Buffer { * @param p The pool to allocate from * @param size The amount of memory to allocate * @return The ByteBuffer with allocated memory + * + * @deprecated Unused. Will be removed in Tomcat 10.1 */ + @Deprecated public static native ByteBuffer palloc(long p, int size); /** @@ -52,7 +61,10 @@ public class Buffer { * @param p The pool to allocate from * @param size The amount of memory to allocate * @return The ByteBuffer with allocated memory + * + * @deprecated Unused. Will be removed in Tomcat 10.1 */ + @Deprecated public static native ByteBuffer pcalloc(long p, int size); /** @@ -62,7 +74,10 @@ public class Buffer { * @param mem The memory to use * @param size The amount of memory to use * @return The ByteBuffer with attached memory + * + * @deprecated Unused. Will be removed in Tomcat 10.1 */ + @Deprecated public static native ByteBuffer create(long mem, int size); /** @@ -70,12 +85,17 @@ public class Buffer { * <br><b>Warning :</b> Call this method only on ByteBuffers * that were created by calling Buffer.alloc or Buffer.calloc. * @param buf Previously allocated ByteBuffer to be freed. + * + * @deprecated Unused. Will be removed in Tomcat 10.1 */ + @Deprecated public static native void free(ByteBuffer buf); /** * Returns the memory address of the ByteBuffer. + * * @param buf Previously allocated ByteBuffer. + * * @return the memory address */ public static native long address(ByteBuffer buf); @@ -84,7 +104,10 @@ public class Buffer { * Returns the allocated memory size of the ByteBuffer. * @param buf Previously allocated ByteBuffer. * @return the size + * + * @deprecated Unused. Will be removed in Tomcat 10.1 */ + @Deprecated public static native long size(ByteBuffer buf); } diff --git a/java/org/apache/tomcat/jni/Error.java b/java/org/apache/tomcat/jni/Error.java index bd3d87b39..a72cc15d5 100644 --- a/java/org/apache/tomcat/jni/Error.java +++ b/java/org/apache/tomcat/jni/Error.java @@ -19,7 +19,10 @@ package org.apache.tomcat.jni; /** Error * * @author Mladen Turk + * + * @deprecated Unused. Will be removed in Tomcat 10.1 */ +@Deprecated public class Error extends Exception { private static final long serialVersionUID = 1L; diff --git a/java/org/apache/tomcat/jni/Library.java b/java/org/apache/tomcat/jni/Library.java index 09fe13a01..b7febeb43 100644 --- a/java/org/apache/tomcat/jni/Library.java +++ b/java/org/apache/tomcat/jni/Library.java @@ -25,7 +25,7 @@ import java.io.File; public final class Library { /* Default library names */ - private static final String [] NAMES = {"tcnative-1", "libtcnative-1"}; + private static final String [] NAMES = {"tcnative-2", "libtcnative-2", "tcnative-1", "libtcnative-1"}; /* * A handle to the unique Library singleton instance. */ @@ -137,54 +137,85 @@ public final class Library { public static native String aprVersionString(); /* APR Feature Macros */ + @Deprecated public static boolean APR_HAVE_IPV6 = false; + @Deprecated public static boolean APR_HAS_SHARED_MEMORY = false; + @Deprecated public static boolean APR_HAS_THREADS = false; + @Deprecated public static boolean APR_HAS_SENDFILE = false; + @Deprecated public static boolean APR_HAS_MMAP = false; + @Deprecated public static boolean APR_HAS_FORK = false; + @Deprecated public static boolean APR_HAS_RANDOM = false; + @Deprecated public static boolean APR_HAS_OTHER_CHILD = false; + @Deprecated public static boolean APR_HAS_DSO = false; + @Deprecated public static boolean APR_HAS_SO_ACCEPTFILTER = false; + @Deprecated public static boolean APR_HAS_UNICODE_FS = false; + @Deprecated public static boolean APR_HAS_PROC_INVOKED = false; + @Deprecated public static boolean APR_HAS_USER = false; + @Deprecated public static boolean APR_HAS_LARGE_FILES = false; + @Deprecated public static boolean APR_HAS_XTHREAD_FILES = false; + @Deprecated public static boolean APR_HAS_OS_UUID = false; /* Are we big endian? */ + @Deprecated public static boolean APR_IS_BIGENDIAN = false; /* APR sets APR_FILES_AS_SOCKETS to 1 on systems where it is possible * to poll on files/pipes. */ + @Deprecated public static boolean APR_FILES_AS_SOCKETS = false; /* This macro indicates whether or not EBCDIC is the native character set. */ + @Deprecated public static boolean APR_CHARSET_EBCDIC = false; /* Is the TCP_NODELAY socket option inherited from listening sockets? */ + @Deprecated public static boolean APR_TCP_NODELAY_INHERITED = false; /* Is the O_NONBLOCK flag inherited from listening sockets? */ + @Deprecated public static boolean APR_O_NONBLOCK_INHERITED = false; /* Poll operations are interruptable by apr_pollset_wakeup(). */ + @Deprecated public static boolean APR_POLLSET_WAKEABLE = false; /* Support for Unix Domain Sockets. */ + @Deprecated public static boolean APR_HAVE_UNIX = false; + @Deprecated public static int APR_SIZEOF_VOIDP; + @Deprecated public static int APR_PATH_MAX; + @Deprecated public static int APRMAXHOSTLEN; + @Deprecated public static int APR_MAX_IOVEC_SIZE; + @Deprecated public static int APR_MAX_SECS_TO_LINGER; + @Deprecated public static int APR_MMAP_THRESHOLD; + @Deprecated public static int APR_MMAP_LIMIT; /* return global TCN's APR pool */ + @Deprecated public static native long globalPool(); /** @@ -268,7 +299,10 @@ public final class Library { * configurations), so that it can be loaded by multiple Webapps. * * @param filename - absolute path of the native library + * + * @deprecated Unused. Will be removed in Tomcat 10.1.x */ + @Deprecated public static void load(String filename){ System.load(filename); } @@ -286,7 +320,10 @@ public final class Library { * configurations), so that it can be loaded by multiple Webapps. * * @param libname - the name of the native library + * + * @deprecated Unused. Will be removed in Tomcat 10.1.x */ + @Deprecated public static void loadLibrary(String libname){ System.loadLibrary(libname); } diff --git a/java/org/apache/tomcat/jni/OS.java b/java/org/apache/tomcat/jni/OS.java index 15fdb8c4e..48f7192c9 100644 --- a/java/org/apache/tomcat/jni/OS.java +++ b/java/org/apache/tomcat/jni/OS.java @@ -51,6 +51,13 @@ public class OS { private static native boolean is(int type); public static final boolean IS_UNIX = is(UNIX); + /** + * @deprecated Hard-coded to false since there has not been a supported + * Netware platform for many years. + * This will be removed in Tomcat 10 onwards + */ + @Deprecated + public static final boolean IS_NETWARE = false; public static final boolean IS_WIN32 = is(WIN32); public static final boolean IS_WIN64 = is(WIN64); public static final boolean IS_LINUX = is(LINUX); diff --git a/java/org/apache/tomcat/jni/PasswordCallback.java b/java/org/apache/tomcat/jni/PasswordCallback.java index a15dc77e5..5c579ddd5 100644 --- a/java/org/apache/tomcat/jni/PasswordCallback.java +++ b/java/org/apache/tomcat/jni/PasswordCallback.java @@ -19,7 +19,10 @@ package org.apache.tomcat.jni; /** PasswordCallback Interface * * @author Mladen Turk + * + * @deprecated Unused. Will be removed in Tomcat 10.1 */ +@Deprecated public interface PasswordCallback { /** diff --git a/java/org/apache/tomcat/jni/Pool.java b/java/org/apache/tomcat/jni/Pool.java index c59cf8bc1..3668a508b 100644 --- a/java/org/apache/tomcat/jni/Pool.java +++ b/java/org/apache/tomcat/jni/Pool.java @@ -18,18 +18,20 @@ package org.apache.tomcat.jni; import java.nio.ByteBuffer; -/** Pool - * - * @author Mladen Turk +/** + * Provides access to APR memory pools which are used to manage memory + * allocations for natively created instances. */ public class Pool { /** * Create a new pool. - * @param parent The parent pool. If this is 0, the new pool is a root - * pool. If it is non-zero, the new pool will inherit all - * of its parent pool's attributes, except the apr_pool_t will - * be a sub-pool. + * + * @param parent The parent pool. If this is 0, the new pool is a root pool. + * If it is non-zero, the new pool will inherit all of its + * parent pool's attributes, except the apr_pool_t will be a + * sub-pool. + * * @return The pool we have just created. */ public static native long create(long parent); @@ -40,13 +42,16 @@ public class Pool { * @param pool The pool to clear * This does not actually free the memory, it just allows the pool * to re-use this memory for the next allocation. + * + * @deprecated Unused. Will be removed in Tomcat 10.1 */ + @Deprecated public static native void clear(long pool); /** * Destroy the pool. This takes similar action as apr_pool_clear() and then - * frees all the memory. - * This will actually free the memory + * frees all the memory. This will actually free the memory. + * * @param pool The pool to destroy */ public static native void destroy(long pool); @@ -55,7 +60,10 @@ public class Pool { * Get the parent pool of the specified pool. * @param pool The pool for retrieving the parent pool. * @return The parent of the given pool. + * + * @deprecated Unused. Will be removed in Tomcat 10.1 */ + @Deprecated public static native long parentGet(long pool); /** @@ -64,7 +72,10 @@ public class Pool { * @param b The pool to search for * @return True if a is an ancestor of b, NULL is considered an ancestor * of all pools. + * + * @deprecated Unused. Will be removed in Tomcat 10.1 */ + @Deprecated public static native boolean isAncestor(long a, long b); @@ -86,14 +97,20 @@ public class Pool { * @param o The object to call when the pool is cleared * or destroyed * @return The cleanup handler. + * + * @deprecated Unused. Will be removed in Tomcat 10.1 */ + @Deprecated public static native long cleanupRegister(long pool, Object o); /** * Remove a previously registered cleanup function * @param pool The pool remove the cleanup from * @param data The cleanup handler to remove from cleanup + * + * @deprecated Unused. Will be removed in Tomcat 10.1 */ + @Deprecated public static native void cleanupKill(long pool, long data); /** @@ -108,7 +125,10 @@ public class Pool { * APR_JUST_WAIT -- wait forever for the process to complete * APR_KILL_ONLY_ONCE -- send SIGTERM and then wait * </PRE> + * + * @deprecated Unused. Will be removed in Tomcat 10.1 */ + @Deprecated public static native void noteSubprocess(long a, long proc, int how); /** @@ -116,7 +136,10 @@ public class Pool { * @param p The pool to allocate from * @param size The amount of memory to allocate * @return The ByteBuffer with allocated memory + * + * @deprecated Unused. Will be removed in Tomcat 10.1 */ + @Deprecated public static native ByteBuffer alloc(long p, int size); /** @@ -124,7 +147,10 @@ public class Pool { * @param p The pool to allocate from * @param size The amount of memory to allocate * @return The ByteBuffer with allocated memory + * + * @deprecated Unused. Will be removed in Tomcat 10.1 */ + @Deprecated public static native ByteBuffer calloc(long p, int size); /* @@ -142,7 +168,10 @@ public class Pool { * Object attached to the pool will be globally referenced * until the pool is cleared or dataSet is called with the null data. * @return APR Status code. + * + * @deprecated Unused. Will be removed in Tomcat 10.1 */ + @Deprecated public static native int dataSet(long pool, String key, Object data); /** @@ -150,13 +179,19 @@ public class Pool { * @param key The key for the data to retrieve * @param pool The current pool. * @return the data + * + * @deprecated Unused. Will be removed in Tomcat 10.1 */ + @Deprecated public static native Object dataGet(long pool, String key); /** * Run all of the child_cleanups, so that any unnecessary files are * closed because we are about to exec a new program + * + * @deprecated Unused. Will be removed in Tomcat 10.1 */ + @Deprecated public static native void cleanupForExec(); } diff --git a/java/org/apache/tomcat/jni/SSL.java b/java/org/apache/tomcat/jni/SSL.java index 06b609011..652921bf6 100644 --- a/java/org/apache/tomcat/jni/SSL.java +++ b/java/org/apache/tomcat/jni/SSL.java @@ -306,7 +306,10 @@ public final class SSL { * In case both files are unavailable builtin * random seed generator is used. * @return <code>true</code> if the operation was successful + * + * @deprecated Unused. Will be removed in Tomcat 10.1 */ + @Deprecated public static native boolean randLoad(String filename); /** @@ -315,7 +318,10 @@ public final class SSL { * by calling randLoad in a later session. * @param filename Filename to save the data * @return <code>true</code> if the operation was successful + * + * @deprecated Unused. Will be removed in Tomcat 10.1 */ + @Deprecated public static native boolean randSave(String filename); /** @@ -324,12 +330,16 @@ public final class SSL { * @param len The length of random sequence in bytes * @param base64 Output the data in Base64 encoded format * @return <code>true</code> if the operation was successful + * + * @deprecated Unused. Will be removed in Tomcat 10.1 */ + @Deprecated public static native boolean randMake(String filename, int len, boolean base64); /** * Sets global random filename. + * * @param filename Filename to use. * If set it will be used for SSL initialization * and all contexts where explicitly not set. @@ -342,33 +352,48 @@ public final class SSL { * @param callback BIOCallback to use * @return New BIO handle * @throws Exception An error occurred + * + * @deprecated Unused. Will be removed in Tomcat 10.1 */ - public static native long newBIO(long pool, BIOCallback callback) + @Deprecated + public static native long newBIO(long pool, BIOCallback callback) throws Exception; /** * Close BIO and dereference callback object * @param bio BIO to close and destroy. * @return APR Status code + * + * @deprecated Unused. Will be removed in Tomcat 10.1 */ - public static native int closeBIO(long bio); + @Deprecated + public static native int closeBIO(long bio); /** * Set global Password callback for obtaining passwords. * @param callback PasswordCallback implementation to use. + * + * @deprecated Unused. Will be removed in Tomcat 10.1 */ - public static native void setPasswordCallback(PasswordCallback callback); + @Deprecated + public static native void setPasswordCallback(PasswordCallback callback); /** * Set global Password for decrypting certificates and keys. * @param password Password to use. + * + * @deprecated Unused. Will be removed in Tomcat 10.1 */ - public static native void setPassword(String password); + @Deprecated + public static native void setPassword(String password); /** * Return last SSL error string * @return the error string + * + * @deprecated Unused. Will be removed in Tomcat 10.1 */ + @Deprecated public static native String getLastError(); /** @@ -382,7 +407,10 @@ public final class SSL { * @param op Bitwise-OR of all SSL_OP_* to test. * * @return true if all SSL_OP_* are supported by OpenSSL library. + * + * @deprecated Unused. Will be removed in Tomcat 10.1 */ + @Deprecated public static native boolean hasOp(int op); /** @@ -423,7 +451,10 @@ public final class SSL { * @param ssl SSL pointer (SSL *) * @param rbio read BIO pointer (BIO *) * @param wbio write BIO pointer (BIO *) + * + * @deprecated Unused. Will be removed in Tomcat 10.1 */ + @Deprecated public static native void setBIO(long ssl, long rbio, long wbio); /** @@ -431,7 +462,10 @@ public final class SSL { * @param ssl SSL pointer (SSL *) * @param ret TLS/SSL I/O return value * @return the error status + * + * @deprecated Unused. Will be removed in Tomcat 10.1 */ + @Deprecated public static native int getError(long ssl, int ret); /** @@ -495,7 +529,10 @@ public final class SSL { * SSL_set_shutdown * @param ssl the SSL instance (SSL *) * @param mode Shutdown mode + * + * @deprecated Unused. Will be removed in Tomcat 10.1 */ + @Deprecated public static native void setShutdown(long ssl, int mode); /** @@ -597,7 +634,10 @@ public final class SSL { * SSL_get0_next_proto_negotiated * @param ssl the SSL instance (SSL *) * @return the NPN protocol negotiated + * + * @deprecated Unused. Will be removed in Tomcat 10.1.x */ + @Deprecated public static native String getNextProtoNegotiated(long ssl); /* diff --git a/java/org/apache/tomcat/jni/SSLContext.java b/java/org/apache/tomcat/jni/SSLContext.java index 3dd7830f7..1363aeaf4 100644 --- a/java/org/apache/tomcat/jni/SSLContext.java +++ b/java/org/apache/tomcat/jni/SSLContext.java @@ -69,7 +69,10 @@ public final class SSLContext { * Set Session context id. Usually host:port combination. * @param ctx Context to use. * @param id String that uniquely identifies this context. + * + * @deprecated Unused. Will be removed in Tomcat 10.1 */ + @Deprecated public static native void setContextId(long ctx, String id); /** @@ -90,7 +93,10 @@ public final class SSLContext { * @param ctx Server or Client context to use. * @param bio BIO handle to use, created with SSL.newBIO * @param dir BIO direction (1 for input 0 for output). + * + * @deprecated Unused. Will be removed in Tomcat 10.1 */ + @Deprecated public static native void setBIO(long ctx, long bio, int dir); /** @@ -139,7 +145,10 @@ public final class SSLContext { * The default is normal shutdown behaviour as described by the TLS standard. * @param ctx Server or Client context to use. * @param mode True to set the quiet shutdown. + * + * @deprecated Unused. Will be removed in Tomcat 10.1 */ + @Deprecated public static native void setQuietShutdown(long ctx, boolean mode); /** @@ -343,7 +352,10 @@ public final class SSLContext { * Set file for randomness * @param ctx Server or Client context to use. * @param file random file. + * + * @deprecated Unused. Will be removed in Tomcat 10.1 */ + @Deprecated public static native void setRandom(long ctx, String file); /** @@ -357,7 +369,10 @@ public final class SSLContext { * </PRE> * @param ctx Server or Client context to use. * @param type Shutdown type to use. + * + * @deprecated Unused. Will be removed in Tomcat 10.1 */ + @Deprecated public static native void setShutdownType(long ctx, int type); /** @@ -395,6 +410,7 @@ public final class SSLContext { */ public static native void setVerify(long ctx, int level, int depth); + @Deprecated public static native int setALPN(long ctx, byte[] proto, int len); /** @@ -444,7 +460,10 @@ public final class SSLContext { * via connections initiated using * <code>defaultSSLContext</code> to the correct OpenSSL * SSLContext + * + * @deprecated Unused. Will be removed in Tomcat 10.1 */ + @Deprecated public static void registerDefault(Long defaultSSLContext, SNICallBack sniCallBack) { sniCallBacks.put(defaultSSLContext, sniCallBack); @@ -456,7 +475,10 @@ public final class SSLContext { * * @param defaultSSLContext The Java representation of a pointer to the * OpenSSL SSLContext that will no longer be used + * + * @deprecated Unused. Will be removed in Tomcat 10.1 */ + @Deprecated public static void unregisterDefault(Long defaultSSLContext) { sniCallBacks.remove(defaultSSLContext); } @@ -510,7 +532,10 @@ public final class SSLContext { * @param nextProtos protocols in priority order * @param selectorFailureBehavior see {@link SSL#SSL_SELECTOR_FAILURE_NO_ADVERTISE} * and {@link SSL#SSL_SELECTOR_FAILURE_CHOOSE_MY_LAST_PROTOCOL} + * + * @deprecated Unused. Will be removed in Tomcat 10.1.x */ + @Deprecated public static native void setNpnProtos(long ctx, String[] nextProtos, int selectorFailureBehavior); /** @@ -528,7 +553,10 @@ public final class SSLContext { * @param cert DH param file (can be generated from e.g. {@code openssl dhparam -rand - 2048 > dhparam.pem} - * see the <a href="https://www.openssl.org/docs/apps/dhparam.html">OpenSSL documentation</a>). * @throws Exception An error occurred + * + * @deprecated Unused. Will be removed in Tomcat 10.1 */ + @Deprecated public static native void setTmpDH(long ctx, String cert) throws Exception; @@ -538,7 +566,10 @@ public final class SSLContext { * @param curveName the name of the elliptic curve to use * (available names can be obtained from {@code openssl ecparam -list_curves}). * @throws Exception An error occurred + * + * @deprecated Unused. Will be removed in Tomcat 10.1 */ + @Deprecated public static native void setTmpECDHByCurveName(long ctx, String curveName) throws Exception; --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org