You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by te...@apache.org on 2008/11/21 17:42:48 UTC

svn commit: r719634 - in /harmony/enhanced/classlib/trunk/modules/luni/src/main: java/org/apache/harmony/luni/platform/ native/luni/shared/ native/luni/unix/ native/luni/windows/

Author: tellison
Date: Fri Nov 21 08:42:48 2008
New Revision: 719634

URL: http://svn.apache.org/viewvc?rev=719634&view=rev
Log:
Start to tidy up the network interface.
First part of removing redundant methods and adopting sensible names.

Modified:
    harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/platform/OSNetworkSystem.java
    harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/OSNetworkSystem.c
    harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/OSNetworkSystem.h
    harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/OSNetworkSystemLinux.c
    harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/exports.txt
    harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/windows/OSNetworkSystemWin32.c

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/platform/OSNetworkSystem.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/platform/OSNetworkSystem.java?rev=719634&r1=719633&r2=719634&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/platform/OSNetworkSystem.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/platform/OSNetworkSystem.java Fri Nov 21 08:42:48 2008
@@ -53,57 +53,36 @@
         return ref;
     }
 
-    public void createSocket(FileDescriptor fd, boolean preferIPv4Stack)
-            throws IOException {
-        createSocketImpl(fd, preferIPv4Stack);
-    }
+    public native void createSocket(FileDescriptor fd, boolean preferIPv4Stack)
+            throws IOException;
 
-    public void createDatagramSocket(FileDescriptor fd, boolean preferIPv4Stack)
-            throws SocketException {
-        createDatagramSocketImpl(fd, preferIPv4Stack);
-    }
+    public native void createDatagramSocket(FileDescriptor fd, boolean preferIPv4Stack)
+            throws SocketException;
 
-    public int read(FileDescriptor aFD, byte[] data, int offset, int count,
-            int timeout) throws IOException {
-        return readSocketImpl(aFD, data, offset, count, timeout);
-    }
+    public native int read(FileDescriptor fd, byte[] data, int offset, int count,
+            int timeout) throws IOException;
 
-    public int readDirect(FileDescriptor aFD, long address, int count,
-            int timeout) throws IOException {
-        return readSocketDirectImpl(aFD, address, count, timeout);
-    }
+    public native int readDirect(FileDescriptor fd, long address, int count,
+            int timeout) throws IOException;
 
-    public int write(FileDescriptor aFD, byte[] data, int offset, int count)
-            throws IOException {
-        return writeSocketImpl(aFD, data, offset, count);
-    }
+    public native int write(FileDescriptor fd, byte[] data, int offset, int count)
+            throws IOException;
 
-    public int writeDirect(FileDescriptor aFD, long address, int count)
-            throws IOException {
-        return writeSocketDirectImpl(aFD, address, count);
-    }
+    public native int writeDirect(FileDescriptor fd, long address, int count)
+            throws IOException;
 
-    public void setNonBlocking(FileDescriptor aFD, boolean block)
-            throws IOException {
-        setNonBlockingImpl(aFD, block);
-    }
+    public native void setNonBlocking(FileDescriptor fd, boolean block)
+            throws IOException;
 
-    public void connectDatagram(FileDescriptor aFD, int port, int trafficClass,
-            InetAddress inetAddress) throws SocketException {
-        connectDatagramImpl2(aFD, port, trafficClass, inetAddress);
-    }
+    public native void connectDatagram(FileDescriptor fd, int port, int trafficClass,
+            InetAddress inetAddress) throws SocketException;
 
-    public int connect(FileDescriptor aFD, int trafficClass,
-            InetAddress inetAddress, int port) throws IOException {
-        return connectSocketImpl(aFD, trafficClass, inetAddress, port);
-    }
+    public native int connect(FileDescriptor fd, int trafficClass,
+            InetAddress inetAddress, int port) throws IOException;
 
-    public int connectWithTimeout(FileDescriptor aFD, int timeout,
+    public native int connectWithTimeout(FileDescriptor fd, int timeout,
             int trafficClass, InetAddress inetAddress, int port, int step,
-            Long context) throws IOException {
-        return connectWithTimeoutSocketImpl(aFD, timeout, trafficClass,
-                inetAddress, port, step, context);
-    }
+            Long context) throws IOException;
 
     public void connectStreamWithTimeoutSocket(FileDescriptor aFD, int aport,
             int timeout, int trafficClass, InetAddress inetAddress)
@@ -112,10 +91,8 @@
                 inetAddress);
     }
 
-    public void bind(FileDescriptor aFD, int port, InetAddress inetAddress)
-            throws SocketException {
-        socketBindImpl(aFD, port, inetAddress);
-    }
+    public native void bind(FileDescriptor aFD, int port, InetAddress inetAddress)
+            throws SocketException;
 
     public boolean bind2(FileDescriptor aFD, int port, boolean bindToDevice,
             InetAddress inetAddress) throws SocketException {
@@ -230,9 +207,7 @@
         sendUrgentDataImpl(fd, value);
     }
 
-    public int availableStream(FileDescriptor aFD) throws SocketException {
-        return availableStreamImpl(aFD);
-    }
+    public native int available(FileDescriptor fd) throws SocketException;
 
     public void acceptStreamSocket(FileDescriptor fdServer,
             SocketImpl newSocket, FileDescriptor fdnewSocket, int timeout)
@@ -399,57 +374,13 @@
         setInetAddressImpl(sender, address);
     }
 
-    static native void createSocketImpl(FileDescriptor fd,
-            boolean preferIPv4Stack);
-
-    /**
-     * Allocate a datagram socket in the IP stack. The socket is associated with
-     * the <code>aFD</code>.
-     * 
-     * @param aFD
-     *            the FileDescriptor to associate with the socket @param
-     *            preferIPv4Stack IP stack preference if underlying platform is
-     *            V4/V6
-     * @exception SocketException
-     *                upon an allocation error
-     */
-    static native void createDatagramSocketImpl(FileDescriptor aFD,
-            boolean preferIPv4Stack) throws SocketException;
-
-    static native int readSocketImpl(FileDescriptor aFD, byte[] data,
-            int offset, int count, int timeout) throws IOException;
-
-    static native int readSocketDirectImpl(FileDescriptor aFD, long address,
-            int count, int timeout) throws IOException;
-
-    static native int writeSocketImpl(FileDescriptor fd, byte[] data,
-            int offset, int count) throws IOException;
-
-    static native int writeSocketDirectImpl(FileDescriptor fd, long address,
-            int count) throws IOException;
-
-    static native void setNonBlockingImpl(FileDescriptor aFD, boolean block);
-
-    static native int connectSocketImpl(FileDescriptor aFD, int trafficClass,
-            InetAddress inetAddress, int port);
-
-    static native int connectWithTimeoutSocketImpl(FileDescriptor aFD,
-            int timeout, int trafficClass, InetAddress hostname, int port,
-            int step, Long context);
-
     static native void connectStreamWithTimeoutSocketImpl(FileDescriptor aFD,
             int aport, int timeout, int trafficClass, InetAddress inetAddress)
             throws IOException;
 
-    static native void socketBindImpl(FileDescriptor aFD, int port,
-            InetAddress inetAddress) throws SocketException;
-
     static native void listenStreamSocketImpl(FileDescriptor aFD, int backlog)
             throws SocketException;
 
-    static native int availableStreamImpl(FileDescriptor aFD)
-            throws SocketException;
-
     static native void acceptSocketImpl(FileDescriptor fdServer,
             SocketImpl newSocket, FileDescriptor fdnewSocket, int timeout)
             throws IOException;
@@ -463,8 +394,10 @@
      * 
      * @param aFD
      *            the FileDescriptor to associate with the socket @param port
-     *            the port to connect to @param trafficClass the traffic Class
-     *            to be used then the connection is made @param inetAddress
+     *            the port to connect to
+     * @param trafficClass the traffic Class
+     *            to be used then the connection is made
+     * @param inetAddress
      *            address to connect to.
      * 
      * @exception SocketException

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/OSNetworkSystem.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/OSNetworkSystem.c?rev=719634&r1=719633&r2=719634&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/OSNetworkSystem.c (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/OSNetworkSystem.c Fri Nov 21 08:42:48 2008
@@ -297,37 +297,37 @@
 
 /*
  * Class:     org_apache_harmony_luni_platform_OSNetworkSystem
- * Method:    createSocketImpl
+ * Method:    createSocket
  * Signature: (Ljava/io/FileDescriptor;Z)V
  */
 JNIEXPORT void JNICALL
-Java_org_apache_harmony_luni_platform_OSNetworkSystem_createSocketImpl
-  (JNIEnv * env, jclass thisClz, jobject thisObjFD, jboolean preferIPv4Stack)
+Java_org_apache_harmony_luni_platform_OSNetworkSystem_createSocket
+  (JNIEnv * env, jobject thiz, jobject fileDescriptor, jboolean preferIPv4Stack)
 {
-  createSocket(env, thisObjFD, HYSOCK_STREAM, preferIPv4Stack);
+  createSocket(env, fileDescriptor, HYSOCK_STREAM, preferIPv4Stack);
 }
 
 /*
  * Class:     org_apache_harmony_luni_platform_OSNetworkSystem
- * Method:    createDatagramImpl
+ * Method:    createDatagram
  * Signature: (Ljava/io/FileDescriptor;Z)V
  */
 JNIEXPORT void JNICALL
-Java_org_apache_harmony_luni_platform_OSNetworkSystem_createDatagramSocketImpl
-  (JNIEnv * env, jclass thisClz, jobject thisObjFD, jboolean preferIPv4Stack)
+Java_org_apache_harmony_luni_platform_OSNetworkSystem_createDatagramSocket
+  (JNIEnv * env, jobject thiz, jobject fileDescriptor, jboolean preferIPv4Stack)
 {
-  createSocket(env, thisObjFD, HYSOCK_DGRAM, preferIPv4Stack);
+  createSocket(env, fileDescriptor, HYSOCK_DGRAM, preferIPv4Stack);
 }
 
 /*
  * Class:     org_apache_harmony_luni_platform_OSNetworkSystem
- * Method:    readSocketImpl
+ * Method:    read
  * Signature: (Ljava/io/FileDescriptor;[BIII)I
  */
 JNIEXPORT jint JNICALL
-Java_org_apache_harmony_luni_platform_OSNetworkSystem_readSocketImpl
-  (JNIEnv * env, jclass thisClz, jobject fileDescriptor, jbyteArray data,
-   jint offset, jint count, jint timeout)
+Java_org_apache_harmony_luni_platform_OSNetworkSystem_read
+  (JNIEnv * env, jobject thiz, jobject fileDescriptor, jbyteArray data, jint offset,
+   jint count, jint timeout)
 {
   PORT_ACCESS_FROM_ENV(env);
   jbyte *message;
@@ -351,8 +351,8 @@
   }
 
   result =
-    Java_org_apache_harmony_luni_platform_OSNetworkSystem_readSocketDirectImpl
-    (env, thisClz, fileDescriptor, (jlong) (IDATA)message, count, timeout);
+    Java_org_apache_harmony_luni_platform_OSNetworkSystem_readDirect
+    (env, thiz, fileDescriptor, (jlong) (IDATA)message, count, timeout);
 
   if (result > 0) {
     (*env)->SetByteArrayRegion(env, data, offset, result, (jbyte *) message);
@@ -367,12 +367,12 @@
 
 /*
  * Class:     org_apache_harmony_luni_platform_OSNetworkSystem
- * Method:    readSocketDirectImpl
+ * Method:    readDirect
  * Signature: (Ljava/io/FileDescriptor;JII)I
  */
 JNIEXPORT jint JNICALL
-Java_org_apache_harmony_luni_platform_OSNetworkSystem_readSocketDirectImpl
-  (JNIEnv * env, jclass thisClz, jobject fileDescriptor, jlong address,
+Java_org_apache_harmony_luni_platform_OSNetworkSystem_readDirect
+  (JNIEnv * env, jobject thiz, jobject fileDescriptor, jlong address,
    jint count, jint timeout)
 {
   PORT_ACCESS_FROM_ENV(env);
@@ -413,12 +413,12 @@
 
 /*
  * Class:     org_apache_harmony_luni_platform_OSNetworkSystem
- * Method:    writeSocketImpl
+ * Method:    write
  * Signature: (Ljava/io/FileDescriptor;[BII)I
  */
 JNIEXPORT jint JNICALL
-Java_org_apache_harmony_luni_platform_OSNetworkSystem_writeSocketImpl
-  (JNIEnv * env, jclass thisClz, jobject fileDescriptor, jbyteArray data,
+Java_org_apache_harmony_luni_platform_OSNetworkSystem_write
+  (JNIEnv * env, jobject thiz, jobject fileDescriptor, jbyteArray data,
    jint offset, jint count)
 {
   PORT_ACCESS_FROM_ENV(env);
@@ -445,8 +445,8 @@
   }
 
   result =
-    Java_org_apache_harmony_luni_platform_OSNetworkSystem_writeSocketDirectImpl
-    (env, thisClz, fileDescriptor, (jlong)(IDATA) message, count);
+    Java_org_apache_harmony_luni_platform_OSNetworkSystem_writeDirect
+    (env, thiz, fileDescriptor, (jlong)(IDATA) message, count);
 
 out:
   if ((U_8 *) message != internalBuffer) {
@@ -458,12 +458,12 @@
 
 /*
  * Class:     org_apache_harmony_luni_platform_OSNetworkSystem
- * Method:    writeSocketDirectImpl
+ * Method:    writeDirect
  * Signature: (Ljava/io/FileDescriptor;JII)I
  */
 JNIEXPORT jint JNICALL
-Java_org_apache_harmony_luni_platform_OSNetworkSystem_writeSocketDirectImpl
-  (JNIEnv * env, jclass thisClz, jobject fileDescriptor, jlong address,
+Java_org_apache_harmony_luni_platform_OSNetworkSystem_writeDirect
+  (JNIEnv * env, jobject thiz, jobject fileDescriptor, jlong address,
    jint count)
 {
   PORT_ACCESS_FROM_ENV(env);
@@ -506,17 +506,18 @@
 
 /*
  * Class:     org_apache_harmony_luni_platform_OSNetworkSystem
- * Method:    setNonBlockingImpl
+ * Method:    setNonBlocking
  * Signature: (Ljava/io/FileDescriptor;Z)V
  */
 JNIEXPORT void JNICALL
-Java_org_apache_harmony_luni_platform_OSNetworkSystem_setNonBlockingImpl
-  (JNIEnv * env, jclass fileDescriptor, jobject afd, jboolean nonblocking)
+Java_org_apache_harmony_luni_platform_OSNetworkSystem_setNonBlocking
+  (JNIEnv * env, jobject thiz, jobject fileDescriptor, jboolean nonblocking)
 {
   PORT_ACCESS_FROM_ENV(env);
   hysocket_t socketP;
   int result;
-  socketP = getJavaIoFileDescriptorContentsAsAPointer(env, afd);
+
+  socketP = getJavaIoFileDescriptorContentsAsAPointer(env, fileDescriptor);
   if (!hysock_socketIsValid(socketP)) {
     // return silently, leave validation in real I/O operation
     return;
@@ -530,12 +531,12 @@
 
 /*
  * Class:     org_apache_harmony_luni_platform_OSNetworkSystem
- * Method:    connectSocketImpl
+ * Method:    connect
  * Signature: (Ljava/io/FileDescriptor;ILjava/net/InetAddress;I)I
  */
 JNIEXPORT jint JNICALL
-Java_org_apache_harmony_luni_platform_OSNetworkSystem_connectSocketImpl
-  (JNIEnv * env, jclass thisClz, jobject fileDescriptor, jint trafficClass,
+Java_org_apache_harmony_luni_platform_OSNetworkSystem_connect
+  (JNIEnv * env, jobject thiz, jobject fileDescriptor, jint trafficClass,
    jobject inetAddress, jint remotePort)
 {
   PORT_ACCESS_FROM_ENV(env);
@@ -578,12 +579,12 @@
 
 /*
  * Class:     org_apache_harmony_luni_platform_OSNetworkSystem
- * Method:    connectWithTimeoutSocketImpl
+ * Method:    connectWithTimeout
  * Signature: (Ljava/io/FileDescriptor;IILjava/net/InetAddress;IILjava/lang/Long;)I
  */
 JNIEXPORT jint JNICALL
-Java_org_apache_harmony_luni_platform_OSNetworkSystem_connectWithTimeoutSocketImpl
-  (JNIEnv * env, jclass thisClz, jobject fileDescriptor, jint timeout,
+Java_org_apache_harmony_luni_platform_OSNetworkSystem_connectWithTimeout
+  (JNIEnv * env, jobject thiz, jobject fileDescriptor, jint timeout,
    jint trafficClass, jobject inetAddr, jint port, jint step,
    jobject passContext)
 {
@@ -630,7 +631,7 @@
       break;
     }
 
-    /* set connext for        next call */
+    /* set connext for next call */
     setConnectContext(env, passContext, context);
 
     if (0 == result) {
@@ -664,12 +665,12 @@
 
 /*
  * Class:     org_apache_harmony_luni_platform_OSNetworkSystem
- * Method:    socketBindImpl
+ * Method:    bind
  * Signature: (Ljava/io/FileDescriptor;ILjava/net/InetAddress;)V
  */
 JNIEXPORT void JNICALL
-Java_org_apache_harmony_luni_platform_OSNetworkSystem_socketBindImpl
-  (JNIEnv * env, jclass thisClz, jobject fileDescriptor,
+Java_org_apache_harmony_luni_platform_OSNetworkSystem_bind
+  (JNIEnv * env, jobject thiz, jobject fileDescriptor,
    jint localPort, jobject inetAddress)
 {
   PORT_ACCESS_FROM_ENV(env);
@@ -832,12 +833,12 @@
 
 /*
  * Class:     org_apache_harmony_luni_platform_OSNetworkSystem
- * Method:    connectDatagramImpl2
+ * Method:    connectDatagram
  * Signature: (Ljava/io/FileDescriptor;IILjava/net/InetAddress;)V
  */
 JNIEXPORT void JNICALL
-Java_org_apache_harmony_luni_platform_OSNetworkSystem_connectDatagramImpl2
-  (JNIEnv * env, jclass thisClz, jobject fileDescriptor, jint remotePort,
+Java_org_apache_harmony_luni_platform_OSNetworkSystem_connectDatagram
+  (JNIEnv * env, jobject thiz, jobject fileDescriptor, jint remotePort,
    jint trafficClass, jobject inetAddress)
 {
   PORT_ACCESS_FROM_ENV(env);

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/OSNetworkSystem.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/OSNetworkSystem.h?rev=719634&r1=719633&r2=719634&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/OSNetworkSystem.h (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/OSNetworkSystem.h Fri Nov 21 08:42:48 2008
@@ -79,75 +79,75 @@
 
 /*
  * Class:     org_apache_harmony_luni_platform_OSNetworkSystem
- * Method:    createSocketImpl
+ * Method:    createSocket
  * Signature: (Ljava/io/FileDescriptor;Z)V
  */
-JNIEXPORT void JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_createSocketImpl
-  (JNIEnv *, jclass, jobject, jboolean);
+JNIEXPORT void JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_createSocket
+  (JNIEnv *, jobject, jobject, jboolean);
 
 /*
  * Class:     org_apache_harmony_luni_platform_OSNetworkSystem
- * Method:    createDatagramSocketImpl
+ * Method:    createDatagramSocket
  * Signature: (Ljava/io/FileDescriptor;Z)V
  */
-JNIEXPORT void JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_createDatagramSocketImpl
-  (JNIEnv *, jclass, jobject, jboolean);
+JNIEXPORT void JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_createDatagramSocket
+  (JNIEnv *, jobject, jobject, jboolean);
 
 /*
  * Class:     org_apache_harmony_luni_platform_OSNetworkSystem
- * Method:    readSocketImpl
+ * Method:    read
  * Signature: (Ljava/io/FileDescriptor;[BIII)I
  */
-JNIEXPORT jint JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_readSocketImpl
-  (JNIEnv *, jclass, jobject, jbyteArray, jint, jint, jint);
+JNIEXPORT jint JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_read
+  (JNIEnv *, jobject, jobject, jbyteArray, jint, jint, jint);
 
 /*
  * Class:     org_apache_harmony_luni_platform_OSNetworkSystem
- * Method:    readSocketDirectImpl
+ * Method:    readDirect
  * Signature: (Ljava/io/FileDescriptor;JII)I
  */
-JNIEXPORT jint JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_readSocketDirectImpl
-  (JNIEnv *, jclass, jobject, jlong, jint, jint);
+JNIEXPORT jint JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_readDirect
+  (JNIEnv *, jobject, jobject, jlong, jint, jint);
 
 /*
  * Class:     org_apache_harmony_luni_platform_OSNetworkSystem
- * Method:    writeSocketImpl
+ * Method:    write
  * Signature: (Ljava/io/FileDescriptor;[BII)I
  */
-JNIEXPORT jint JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_writeSocketImpl
-  (JNIEnv *, jclass, jobject, jbyteArray, jint, jint);
+JNIEXPORT jint JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_write
+  (JNIEnv *, jobject, jobject, jbyteArray, jint, jint);
 
 /*
  * Class:     org_apache_harmony_luni_platform_OSNetworkSystem
- * Method:    writeSocketDirectImpl
+ * Method:    writeDirect
  * Signature: (Ljava/io/FileDescriptor;JI)I
  */
-JNIEXPORT jint JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_writeSocketDirectImpl
-  (JNIEnv *, jclass, jobject, jlong, jint);
+JNIEXPORT jint JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_writeDirect
+  (JNIEnv *, jobject, jobject, jlong, jint);
 
 /*
  * Class:     org_apache_harmony_luni_platform_OSNetworkSystem
  * Method:    setNonBlockingImpl
  * Signature: (Ljava/io/FileDescriptor;Z)V
  */
-JNIEXPORT void JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_setNonBlockingImpl
-  (JNIEnv *, jclass, jobject, jboolean);
+JNIEXPORT void JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_setNonBlocking
+  (JNIEnv *, jobject, jobject, jboolean);
 
 /*
  * Class:     org_apache_harmony_luni_platform_OSNetworkSystem
  * Method:    connectSocketImpl
  * Signature: (Ljava/io/FileDescriptor;ILjava/net/InetAddress;I)I
  */
-JNIEXPORT jint JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_connectSocketImpl
-  (JNIEnv *, jclass, jobject, jint, jobject, jint);
+JNIEXPORT jint JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_connect
+  (JNIEnv *, jobject, jobject, jint, jobject, jint);
 
 /*
  * Class:     org_apache_harmony_luni_platform_OSNetworkSystem
- * Method:    connectWithTimeoutSocketImpl
+ * Method:    connectWithTimeout
  * Signature: (Ljava/io/FileDescriptor;IILjava/net/InetAddress;IILjava/lang/Long;)I
  */
-JNIEXPORT jint JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_connectWithTimeoutSocketImpl
-  (JNIEnv *, jclass, jobject, jint, jint, jobject, jint, jint, jobject);
+JNIEXPORT jint JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_connectWithTimeout
+  (JNIEnv *, jobject, jobject, jint, jint, jobject, jint, jint, jobject);
 
 /*
  * Class:     org_apache_harmony_luni_platform_OSNetworkSystem
@@ -159,11 +159,11 @@
 
 /*
  * Class:     org_apache_harmony_luni_platform_OSNetworkSystem
- * Method:    socketBindImpl
+ * Method:    bind
  * Signature: (Ljava/io/FileDescriptor;ILjava/net/InetAddress;)V
  */
-JNIEXPORT void JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_socketBindImpl
-  (JNIEnv *, jclass, jobject, jint, jobject);
+JNIEXPORT void JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_bind
+  (JNIEnv *, jobject, jobject, jint, jobject);
 
 /*
  * Class:     org_apache_harmony_luni_platform_OSNetworkSystem
@@ -175,11 +175,11 @@
 
 /*
  * Class:     org_apache_harmony_luni_platform_OSNetworkSystem
- * Method:    availableStreamImpl
+ * Method:    available
  * Signature: (Ljava/io/FileDescriptor;)I
  */
-JNIEXPORT jint JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_availableStreamImpl
-  (JNIEnv *, jclass, jobject);
+JNIEXPORT jint JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_available
+  (JNIEnv *, jobject, jobject);
 
 /*
  * Class:     org_apache_harmony_luni_platform_OSNetworkSystem
@@ -207,11 +207,11 @@
 
 /*
  * Class:     org_apache_harmony_luni_platform_OSNetworkSystem
- * Method:    connectDatagramImpl2
+ * Method:    connectDatagram
  * Signature: (Ljava/io/FileDescriptor;IILjava/net/InetAddress;)V
  */
-JNIEXPORT void JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_connectDatagramImpl2
-  (JNIEnv *, jclass, jobject, jint, jint, jobject);
+JNIEXPORT void JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_connectDatagram
+  (JNIEnv *, jobject, jobject, jint, jint, jobject);
 
 /*
  * Class:     org_apache_harmony_luni_platform_OSNetworkSystem

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/OSNetworkSystemLinux.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/OSNetworkSystemLinux.c?rev=719634&r1=719633&r2=719634&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/OSNetworkSystemLinux.c (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/OSNetworkSystemLinux.c Fri Nov 21 08:42:48 2008
@@ -483,12 +483,12 @@
  * which is similar to, but different to the call on other platforms.
  *
  * Class:     org_apache_harmony_luni_platform_OSNetworkSystem
- * Method:    availableStreamImpl
+ * Method:    available
  * Signature: (Ljava/io/FileDescriptor;)I
  */
 JNIEXPORT jint JNICALL
-Java_org_apache_harmony_luni_platform_OSNetworkSystem_availableStreamImpl
-  (JNIEnv * env, jclass thisClz, jobject fileDescriptor)
+Java_org_apache_harmony_luni_platform_OSNetworkSystem_available
+  (JNIEnv * env, jobject thiz, jobject fileDescriptor)
 {
   PORT_ACCESS_FROM_ENV(env);
   hysocket_t hysocketP;

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/exports.txt
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/exports.txt?rev=719634&r1=719633&r2=719634&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/exports.txt (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/exports.txt Fri Nov 21 08:42:48 2008
@@ -185,23 +185,23 @@
 Java_org_apache_harmony_luni_platform_OSMemory_setFloat
 Java_org_apache_harmony_luni_platform_OSMemory_getDouble
 Java_org_apache_harmony_luni_platform_OSMemory_setDouble
-Java_org_apache_harmony_luni_platform_OSNetworkSystem_createSocketImpl
-Java_org_apache_harmony_luni_platform_OSNetworkSystem_createDatagramSocketImpl
-Java_org_apache_harmony_luni_platform_OSNetworkSystem_readSocketImpl
-Java_org_apache_harmony_luni_platform_OSNetworkSystem_readSocketDirectImpl
-Java_org_apache_harmony_luni_platform_OSNetworkSystem_writeSocketImpl
-Java_org_apache_harmony_luni_platform_OSNetworkSystem_writeSocketDirectImpl
-Java_org_apache_harmony_luni_platform_OSNetworkSystem_setNonBlockingImpl
-Java_org_apache_harmony_luni_platform_OSNetworkSystem_connectSocketImpl
-Java_org_apache_harmony_luni_platform_OSNetworkSystem_connectWithTimeoutSocketImpl
+Java_org_apache_harmony_luni_platform_OSNetworkSystem_createSocket
+Java_org_apache_harmony_luni_platform_OSNetworkSystem_createDatagramSocket
+Java_org_apache_harmony_luni_platform_OSNetworkSystem_read
+Java_org_apache_harmony_luni_platform_OSNetworkSystem_readSocketDirect
+Java_org_apache_harmony_luni_platform_OSNetworkSystem_writeSocket
+Java_org_apache_harmony_luni_platform_OSNetworkSystem_writeSocketDirect
+Java_org_apache_harmony_luni_platform_OSNetworkSystem_setNonBlocking
+Java_org_apache_harmony_luni_platform_OSNetworkSystem_connect
+Java_org_apache_harmony_luni_platform_OSNetworkSystem_connectWithTimeout
 Java_org_apache_harmony_luni_platform_OSNetworkSystem_connectStreamWithTimeoutSocketImpl
-Java_org_apache_harmony_luni_platform_OSNetworkSystem_socketBindImpl
+Java_org_apache_harmony_luni_platform_OSNetworkSystem_bind
 Java_org_apache_harmony_luni_platform_OSNetworkSystem_listenStreamSocketImpl
-Java_org_apache_harmony_luni_platform_OSNetworkSystem_availableStreamImpl
+Java_org_apache_harmony_luni_platform_OSNetworkSystem_available
 Java_org_apache_harmony_luni_platform_OSNetworkSystem_acceptSocketImpl
 Java_org_apache_harmony_luni_platform_OSNetworkSystem_supportsUrgentDataImpl
 Java_org_apache_harmony_luni_platform_OSNetworkSystem_sendUrgentDataImpl
-Java_org_apache_harmony_luni_platform_OSNetworkSystem_connectDatagramImpl2
+Java_org_apache_harmony_luni_platform_OSNetworkSystem_connectDatagram
 Java_org_apache_harmony_luni_platform_OSNetworkSystem_disconnectDatagramImpl
 Java_org_apache_harmony_luni_platform_OSNetworkSystem_socketBindImpl2
 Java_org_apache_harmony_luni_platform_OSNetworkSystem_peekDatagramImpl

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/windows/OSNetworkSystemWin32.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/windows/OSNetworkSystemWin32.c?rev=719634&r1=719633&r2=719634&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/windows/OSNetworkSystemWin32.c (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/windows/OSNetworkSystemWin32.c Fri Nov 21 08:42:48 2008
@@ -340,12 +340,12 @@
  * which is similar to, but different to the call on other platforms.
  *
  * Class:     org_apache_harmony_luni_platform_OSNetworkSystem
- * Method:    availableStreamImpl
+ * Method:    available
  * Signature: (Ljava/io/FileDescriptor;)I
  */
 JNIEXPORT jint JNICALL
-Java_org_apache_harmony_luni_platform_OSNetworkSystem_availableStreamImpl
-  (JNIEnv * env, jclass thisClz, jobject fileDescriptor)
+Java_org_apache_harmony_luni_platform_OSNetworkSystem_available
+  (JNIEnv * env, jobject thiz, jobject fileDescriptor)
 {
   PORT_ACCESS_FROM_ENV(env);
   hysocket_t hysocketP;



Re: [classlib][luni] Tidying up OSNetworkSystem

Posted by Tim Ellison <t....@gmail.com>.
I have cleaned up socket read and write code in the OSNetworkSystem natives.

Things are working ok for java.net code, but the NIO SocketChannel stuff
breaks if I switch it from the current hokey receiveStream
implementation - so I've left it in there as deprecated for a while
while the NIO code is fixed up.

It looks like the SocketChannel impl needs some review.  Some simple
examples are not working, and there are strange assumptions (e.g.
timeout values for blocking and non-blocking?! sockets).

I feel like I'm pulling a thread here that could unravel all sorts ;-)

Regards,
Tim


Jimmy,Jing Lv wrote:
> Hi,
> 
>     That's cool Tim, I am interested and I'd like to a volunteer to
> review/refactor the codes if needed  :)
>     Please tell me anything I can help.
> 
> 2008/11/22 Tim Ellison <t....@gmail.com>:
>> I've started to tidy up the Java APIs in OSNetworkSystem that, for some
>> inexplicable reason, seems to have two method calls for each API method
>> (the public instance method dispatches to a package static method ?!)
>> and other junk.
>>
>> There is a motley set of APIs accumulated in there too, which I'll go
>> back and rationalize once I'm through the grunt work.
>>
>> I'll be committing it in steps since there is a good chance for typos to
>>  creep in.  Everything should stay working at all times, so let me know
>> if things break.
>>
>> Regards,
>> Tim
>>
>> tellison@apache.org wrote:
>>> Author: tellison
>>> Date: Fri Nov 21 08:42:48 2008
>>> New Revision: 719634
>>>
>>> URL: http://svn.apache.org/viewvc?rev=719634&view=rev
>>> Log:
>>> Start to tidy up the network interface.
>>> First part of removing redundant methods and adopting sensible names.
>>>
>>> Modified:
>>>     harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/platform/OSNetworkSystem.java
>>>     harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/OSNetworkSystem.c
>>>     harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/OSNetworkSystem.h
>>>     harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/OSNetworkSystemLinux.c
>>>     harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/exports.txt
>>>     harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/windows/OSNetworkSystemWin32.c
> 
> 
> 

Re: [classlib][luni] Tidying up OSNetworkSystem

Posted by Tim Ellison <t....@gmail.com>.
Jimmy,Jing Lv wrote:
>     That's cool Tim, I am interested and I'd like to a volunteer to
> review/refactor the codes if needed  :)
>     Please tell me anything I can help.

Thanks Jimmy.  For now I'm just tidying up, so regular builds to check
I'm not breaking anything would be useful.  When I get to refactoring
the methods I'll discuss it here for all to see.

Regards,
Tim


> 2008/11/22 Tim Ellison <t....@gmail.com>:
>> I've started to tidy up the Java APIs in OSNetworkSystem that, for some
>> inexplicable reason, seems to have two method calls for each API method
>> (the public instance method dispatches to a package static method ?!)
>> and other junk.
>>
>> There is a motley set of APIs accumulated in there too, which I'll go
>> back and rationalize once I'm through the grunt work.
>>
>> I'll be committing it in steps since there is a good chance for typos to
>>  creep in.  Everything should stay working at all times, so let me know
>> if things break.
>>
>> Regards,
>> Tim
>>
>> tellison@apache.org wrote:
>>> Author: tellison
>>> Date: Fri Nov 21 08:42:48 2008
>>> New Revision: 719634
>>>
>>> URL: http://svn.apache.org/viewvc?rev=719634&view=rev
>>> Log:
>>> Start to tidy up the network interface.
>>> First part of removing redundant methods and adopting sensible names.
>>>
>>> Modified:
>>>     harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/platform/OSNetworkSystem.java
>>>     harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/OSNetworkSystem.c
>>>     harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/OSNetworkSystem.h
>>>     harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/OSNetworkSystemLinux.c
>>>     harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/exports.txt
>>>     harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/windows/OSNetworkSystemWin32.c
> 
> 
> 

Re: [classlib][luni] Tidying up OSNetworkSystem

Posted by "Jimmy,Jing Lv" <fi...@gmail.com>.
Hi,

    That's cool Tim, I am interested and I'd like to a volunteer to
review/refactor the codes if needed  :)
    Please tell me anything I can help.

2008/11/22 Tim Ellison <t....@gmail.com>:
> I've started to tidy up the Java APIs in OSNetworkSystem that, for some
> inexplicable reason, seems to have two method calls for each API method
> (the public instance method dispatches to a package static method ?!)
> and other junk.
>
> There is a motley set of APIs accumulated in there too, which I'll go
> back and rationalize once I'm through the grunt work.
>
> I'll be committing it in steps since there is a good chance for typos to
>  creep in.  Everything should stay working at all times, so let me know
> if things break.
>
> Regards,
> Tim
>
> tellison@apache.org wrote:
>> Author: tellison
>> Date: Fri Nov 21 08:42:48 2008
>> New Revision: 719634
>>
>> URL: http://svn.apache.org/viewvc?rev=719634&view=rev
>> Log:
>> Start to tidy up the network interface.
>> First part of removing redundant methods and adopting sensible names.
>>
>> Modified:
>>     harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/platform/OSNetworkSystem.java
>>     harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/OSNetworkSystem.c
>>     harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/OSNetworkSystem.h
>>     harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/OSNetworkSystemLinux.c
>>     harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/exports.txt
>>     harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/windows/OSNetworkSystemWin32.c
>



-- 

Best Regards!

Jimmy, Jing Lv
China Software Development Lab, IBM

[classlib][luni] Tidying up OSNetworkSystem

Posted by Tim Ellison <t....@gmail.com>.
I've started to tidy up the Java APIs in OSNetworkSystem that, for some
inexplicable reason, seems to have two method calls for each API method
(the public instance method dispatches to a package static method ?!)
and other junk.

There is a motley set of APIs accumulated in there too, which I'll go
back and rationalize once I'm through the grunt work.

I'll be committing it in steps since there is a good chance for typos to
 creep in.  Everything should stay working at all times, so let me know
if things break.

Regards,
Tim

tellison@apache.org wrote:
> Author: tellison
> Date: Fri Nov 21 08:42:48 2008
> New Revision: 719634
> 
> URL: http://svn.apache.org/viewvc?rev=719634&view=rev
> Log:
> Start to tidy up the network interface.
> First part of removing redundant methods and adopting sensible names.
> 
> Modified:
>     harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/platform/OSNetworkSystem.java
>     harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/OSNetworkSystem.c
>     harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/OSNetworkSystem.h
>     harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/OSNetworkSystemLinux.c
>     harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/exports.txt
>     harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/windows/OSNetworkSystemWin32.c