tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rj...@apache.org
Subject svn commit: r730544 - in /tomcat/trunk/java/org/apache/tomcat/jni: Buffer.java File.java Registry.java SSL.java SSLContext.java Socket.java Stdlib.java Thread.java
Date Thu, 01 Jan 2009 13:37:40 GMT
Author: rjung
Date: Thu Jan  1 05:37:39 2009
New Revision: 730544

URL: http://svn.apache.org/viewvc?rev=730544&view=rev
Log:
Port r730523 from tcnative trunk to tc trunk.
Add Thread.java and Buffer.java.
Change SSL.randSet() javadoc to the tcnative one.
Add Socket.sendib() and Socket.sendibb from tcnative.

All renames methods and method signature changes
are compatible, because those methods are not used
by Tomcat.

Changes of return types are compatible, because
the return values have not been used.

Added:
    tomcat/trunk/java/org/apache/tomcat/jni/Buffer.java   (with props)
    tomcat/trunk/java/org/apache/tomcat/jni/Thread.java   (with props)
Modified:
    tomcat/trunk/java/org/apache/tomcat/jni/File.java
    tomcat/trunk/java/org/apache/tomcat/jni/Registry.java
    tomcat/trunk/java/org/apache/tomcat/jni/SSL.java
    tomcat/trunk/java/org/apache/tomcat/jni/SSLContext.java
    tomcat/trunk/java/org/apache/tomcat/jni/Socket.java
    tomcat/trunk/java/org/apache/tomcat/jni/Stdlib.java

Added: tomcat/trunk/java/org/apache/tomcat/jni/Buffer.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/jni/Buffer.java?rev=730544&view=auto
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/jni/Buffer.java (added)
+++ tomcat/trunk/java/org/apache/tomcat/jni/Buffer.java Thu Jan  1 05:37:39 2009
@@ -0,0 +1,91 @@
+/*
+ *  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.
+ */
+
+package org.apache.tomcat.jni;
+
+import java.nio.ByteBuffer;
+
+/** Buffer
+ *
+ * @author Mladen Turk
+ * @version $Revision$, $Date$
+ */
+
+public class Buffer {
+
+    /**
+     * Allocate a new ByteBuffer from memory
+     * @param size The amount of memory to allocate
+     * @return The ByteBuffer with allocated memory
+     */
+    public static native ByteBuffer malloc(int size);
+
+    /**
+     * Allocate a new ByteBuffer from memory and set all of the memory to 0
+     * @param num Number of elements.
+     * @param size Length in bytes of each element.
+     * @return The ByteBuffer with allocated memory
+     */
+    public static native ByteBuffer calloc(int num, int size);
+
+    /**
+     * Allocate a new ByteBuffer from a pool
+     * @param p The pool to allocate from
+     * @param size The amount of memory to allocate
+     * @return The ByteBuffer with allocated memory
+     */
+    public static native ByteBuffer palloc(long p, int size);
+
+    /**
+     * Allocate a new ByteBuffer from a pool and set all of the memory to 0
+     * @param p The pool to allocate from
+     * @param size The amount of memory to allocate
+     * @return The ByteBuffer with allocated memory
+     */
+    public static native ByteBuffer pcalloc(long p, int size);
+
+    /**
+     * Allocate a new ByteBuffer from already allocated memory.
+     * <br />Allocated memory must be provided from call to the
+     * Stdlib.alloc or Stdlib.calloc methods.
+     * @param mem The memory to use
+     * @param size The amount of memory to use
+     * @return The ByteBuffer with attached memory
+     */
+    public static native ByteBuffer create(long mem, int size);
+
+    /**
+     * Deallocates or frees a memory block used by ByteBuffer
+     * <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.
+     */
+    public static native void free(ByteBuffer buf);
+
+    /**
+     * Returns the memory address of the ByteBuffer.
+     * @param buf Previously allocated ByteBuffer.
+     */
+    public static native long address(ByteBuffer buf);
+
+    /**
+     * Returns the allocated memory size of the ByteBuffer.
+     * @param buf Previously allocated ByteBuffer.
+     */
+    public static native long size(ByteBuffer buf);
+
+}

Propchange: tomcat/trunk/java/org/apache/tomcat/jni/Buffer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tomcat/trunk/java/org/apache/tomcat/jni/Buffer.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: tomcat/trunk/java/org/apache/tomcat/jni/File.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/jni/File.java?rev=730544&r1=730543&r2=730544&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/jni/File.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/jni/File.java Thu Jan  1 05:37:39 2009
@@ -693,6 +693,16 @@
     public static native int stat(FileInfo finfo, String fname, int wanted, long pool);
 
     /**
+     * Get the specified file's stats.  The file is specified by filename,
+     * instead of using a pre-opened file.
+     * @param fname The name of the file to stat.
+     * @param wanted The desired apr_finfo_t fields, as a bit flag of APR_FINFO_ values
+     * @param pool the pool to use to allocate the new file.
+     * @return FileInfo object.
+     */
+    public static native FileInfo getStat(String fname, int wanted, long pool);
+
+    /**
      * Get the specified file's stats.
      * @param finfo Where to store the information about the file.
      * @param wanted The desired apr_finfo_t fields, as a bit flag of APR_FINFO_ values
@@ -700,4 +710,13 @@
      */
     public static native int infoGet(FileInfo finfo, int wanted, long thefile);
 
+
+    /**
+     * Get the specified file's stats.
+     * @param wanted The desired apr_finfo_t fields, as a bit flag of APR_FINFO_ values
+     * @param thefile The file to get information about.
+     * @return FileInfo object.
+     */
+    public static native FileInfo getInfo(int wanted, long thefile);
+
 }

Modified: tomcat/trunk/java/org/apache/tomcat/jni/Registry.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/jni/Registry.java?rev=730544&r1=730543&r2=730544&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/jni/Registry.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/jni/Registry.java Thu Jan  1 05:37:39 2009
@@ -156,7 +156,7 @@
      * @param val The the value to set
      * @return If the function succeeds, the return value is 0
      */
-    public static native int setValueJ(long key, String name, int val);
+    public static native int setValueJ(long key, String name, long val);
 
     /**
      * Set the Registry value for REG_SZ

Modified: tomcat/trunk/java/org/apache/tomcat/jni/SSL.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/jni/SSL.java?rev=730544&r1=730543&r2=730544&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/jni/SSL.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/jni/SSL.java Thu Jan  1 05:37:39 2009
@@ -227,12 +227,6 @@
     public static native int initialize(String engine);
 
     /**
-      * Set source of entropy to use in SSL
-      *  @param filename Filename containing random data
-      */
-    public static native boolean randSet(String filename);
-
-    /**
      * Add content of the file to the PRNG
      * @param filename Filename containing random data.
      *        If null the default file will be tested.
@@ -261,6 +255,14 @@
                                           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.
+     */
+    public static native void randSet(String filename);
+
+    /**
      * Initialize new BIO
      * @param pool The pool to use.
      * @param callback BIOCallback to use

Modified: tomcat/trunk/java/org/apache/tomcat/jni/SSLContext.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/jni/SSLContext.java?rev=730544&r1=730543&r2=730544&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/jni/SSLContext.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/jni/SSLContext.java Thu Jan  1 05:37:39 2009
@@ -226,6 +226,13 @@
         throws Exception;
 
     /**
+     * Set file for randomness
+     * @param ctx Server or Client context to use.
+     * @param file random file.
+     */
+    public static native void setRandom(long ctx, String file)
+
+    /**
      * Set SSL connection shutdown type
      * <br />
      * The following levels are available for level:
@@ -237,7 +244,7 @@
      * @param ctx Server or Client context to use.
      * @param type Shutdown type to use.
      */
-    public static native void setShutdowType(long ctx, int type);
+    public static native void setShutdownType(long ctx, int type);
 
     /**
      * Set Type of Client Certificate verification and Maximum depth of CA Certificates

Modified: tomcat/trunk/java/org/apache/tomcat/jni/Socket.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/jni/Socket.java?rev=730544&r1=730543&r2=730544&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/jni/Socket.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/jni/Socket.java Thu Jan  1 05:37:39 2009
@@ -170,6 +170,16 @@
      *          made the connection request.  This is the socket which should
      *          be used for all future communication.
      */
+    public static native long acceptx(long sock, long pool)
+        throws Exception;
+
+    /**
+     * Accept a new connection request
+     * @param sock The socket we are listening on.
+     * @return  A copy of the socket that is connected to the socket that
+     *          made the connection request.  This is the socket which should
+     *          be used for all future communication.
+     */
     public static native long accept(long sock)
         throws Exception;
 
@@ -241,6 +251,30 @@
      */
     public static native int sendb(long sock, ByteBuffer buf,
                                    int offset, int len);
+
+    /**
+     * Send data over a network without retry
+     * <PRE>
+     * This functions acts like a blocking write by default.  To change
+     * this behavior, use apr_socket_timeout_set() or the APR_SO_NONBLOCK
+     * socket option.
+     *
+     * It is possible for both bytes to be sent and an error to be returned.
+     *
+     * </PRE>
+     * @param sock The socket to send the data over.
+     * @param buf The Byte buffer which contains the data to be sent.
+     * @param offset The offset within the buffer array of the first buffer from
+     *               which bytes are to be retrieved; must be non-negative
+     *               and no larger than buf.length
+     * @param len The maximum number of buffers to be accessed; must be non-negative
+     *            and no larger than buf.length - offset
+     * @return The number of bytes send.
+     *
+     */
+    public static native int sendib(long sock, ByteBuffer buf,
+                                    int offset, int len);
+
     /**
      * Send data over a network using internally set ByteBuffer
      */
@@ -248,6 +282,13 @@
                                    int offset, int len);
 
     /**
+     * Send data over a network using internally set ByteBuffer
+     * without internal retry.
+     */
+    public static native int sendibb(long sock,
+                                     int offset, int len);
+
+    /**
      * Send multiple packets of data over a network.
      * <PRE>
      * This functions acts like a blocking write by default.  To change
@@ -526,4 +567,22 @@
      * @param buf The ByteBuffer
      */
     public static native void setrbb(long sock, ByteBuffer buf);
+
+    /**
+     * Set the data associated with the current socket.
+     * @param sock The currently open socket.
+     * @param data The user data to associate with the socket.
+     * @param key The key to associate with the data.
+     * @param cleanup The cleanup to call when the socket is destroyed.
+     */
+      public static native int dataSet(long sock, String key, Object data);
+
+    /**
+     * Return the data associated with the current socket
+     * @param data The user data associated with the socket.
+     * @param key The key to associate with the user data.
+     * @param sock The currently open socket.
+     * @return Data or null in case of error.
+     */
+     public static native Object dataGet(long sock, String key);
 }

Modified: tomcat/trunk/java/org/apache/tomcat/jni/Stdlib.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/jni/Stdlib.java?rev=730544&r1=730543&r2=730544&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/jni/Stdlib.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/jni/Stdlib.java Thu Jan  1 05:37:39 2009
@@ -67,7 +67,7 @@
      * @param num Number of elements.
      * @param sz Length in bytes of each element.
      */
-    public static native long calloc(long num, int sz);
+    public static native long calloc(int num, int sz);
 
     /**
      * Deallocates or frees a memory block.

Added: tomcat/trunk/java/org/apache/tomcat/jni/Thread.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/jni/Thread.java?rev=730544&view=auto
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/jni/Thread.java (added)
+++ tomcat/trunk/java/org/apache/tomcat/jni/Thread.java Thu Jan  1 05:37:39 2009
@@ -0,0 +1,33 @@
+/*
+ *  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.
+ */
+
+package org.apache.tomcat.jni;
+
+/** Thread
+ *
+ * @author Mladen Turk
+ * @version $Revision$, $Date$
+ */
+
+public class Thread {
+    
+    /**
+     * Get the current thread ID handle.
+     */
+    public static native long current();    
+
+}

Propchange: tomcat/trunk/java/org/apache/tomcat/jni/Thread.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tomcat/trunk/java/org/apache/tomcat/jni/Thread.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message