You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by py...@apache.org on 2006/07/25 07:19:02 UTC
svn commit: r425285 - in
/incubator/harmony/enhanced/classlib/trunk/modules/luni: ./
src/main/java/org/apache/harmony/luni/platform/ src/main/native/luni/linux/
src/main/native/luni/shared/ src/main/native/luni/windows/
Author: pyang
Date: Mon Jul 24 22:19:01 2006
New Revision: 425285
URL: http://svn.apache.org/viewvc?rev=425285&view=rev
Log:
Undo the unintended modification in r425277
Modified:
incubator/harmony/enhanced/classlib/trunk/modules/luni/.classpath
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/platform/INetworkSystem.java
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/linux/OSNetworkSystemLinux.c
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/linux/libhyluni.exp
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/OSNetworkSystem.h
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/nethelp.c
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/nethelp.h
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/windows/OSNetworkSystemWin32.c
incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/windows/hyluni.def
Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/.classpath
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/.classpath?rev=425285&r1=425284&r2=425285&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/.classpath (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/.classpath Mon Jul 24 22:19:01 2006
@@ -10,6 +10,5 @@
<classpathentry output="bin/test/impl.injected" kind="src" path="src/test/impl/java.injected"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry sourcepath="JUNIT_SRC_HOME/junitsrc.zip" kind="var" path="JUNIT_HOME/junit.jar"/>
- <classpathentry kind="lib" path="C:/harmonySVN/enhanced/classlib/trunk/deploy/jdk/jre/lib/boot/luni-kernel-stubs.jar"/>
<classpathentry kind="output" path="bin/main"/>
</classpath>
Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/platform/INetworkSystem.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/platform/INetworkSystem.java?rev=425285&r1=425284&r2=425285&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/platform/INetworkSystem.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/platform/INetworkSystem.java Mon Jul 24 22:19:01 2006
@@ -22,7 +22,6 @@
import java.net.SocketException;
import java.net.SocketImpl;
import java.net.UnknownHostException;
-import java.nio.channels.Channel;
import java.nio.channels.SelectableChannel;
/*
Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/linux/OSNetworkSystemLinux.c
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/linux/OSNetworkSystemLinux.c?rev=425285&r1=425284&r2=425285&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/linux/OSNetworkSystemLinux.c (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/linux/OSNetworkSystemLinux.c Mon Jul 24 22:19:01 2006
@@ -20,7 +20,6 @@
#include "jclglob.h"
#include "hysock.h"
#include "hyport.h"
-#include "jni.h"
#include "OSNetworkSystem.h"
#define NOPRIVILEGE -1
#define UNREACHABLE -2
@@ -264,155 +263,4 @@
/* return both correct and error result, let java code handle the exception*/
return result;
};
-
-JNIEXPORT jobject JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_inheritedChannelImpl
- (JNIEnv * env , jobject clz){
- PORT_ACCESS_FROM_ENV (env);
- int socket = 0;
- int opt;
- int length = sizeof(opt);
- int socket_type;
- struct sockaddr_in local_addr;
- struct sockaddr_in remote_addr;
- jclass channel_class,fd_class, addr_class, socketaddr_class,serverSocket_class,socketImpl_class;
- jobject channel_object, socketaddr_object, addr_object,localAddr_object, serverSocket_object,socketImpl_object;
- jfieldID port_field, addr_field, socketaddr_field,addrarray_field, localAddr_field, bound_field;
- jfieldID serverSocket_field,socketImpl_field;
- jmethodID addr_new,channel_new;
- hysocket_t sock;
- jbyte * address;
- jbyte * localAddr;
- jbyteArray addr_array;
- jboolean jtrue = TRUE;
-
- if(0 != getsockopt(socket,SOL_SOCKET,SO_TYPE,&opt,&length)){
- return NULL;
- }
- if(SOCK_STREAM !=opt && SOCK_DGRAM !=opt){
- return NULL;
- }
- socket_type = opt;
-
- length = sizeof(struct sockaddr);
- if(0 != getsockname(socket,(struct sockaddr *)&local_addr,&length)){
- return NULL;
- } else {
- if(AF_INET != local_addr.sin_family || length != sizeof(struct sockaddr)){
- return NULL;
- }
- localAddr = malloc(sizeof(jbyte)*4);
- if (NULL == localAddr){
- return NULL;
- }
- memcpy (localAddr, &(local_addr.sin_addr.s_addr), 4);
- }
- if(0 != getpeername(socket,(struct sockaddr *)&remote_addr,&length)) {
- remote_addr.sin_port = 0;
- remote_addr.sin_addr.s_addr = 0;
- address = malloc(sizeof(jbyte)*4);
- bzero(address,sizeof(jbyte)*4);
- } else {
- if(AF_INET != remote_addr.sin_family || length != sizeof(struct sockaddr)) {
- return NULL;
- }
- address = malloc(sizeof(jbyte)*4);
- memcpy (address, &(remote_addr.sin_addr.s_addr), 4);
- }
- sock = malloc(sizeof(hysocket_struct));
- sock->sock = socket;
- sock->family = AF_INET;
-
- // analysis end, begin pack to java
- if(SOCK_STREAM == opt)
- {
- if(remote_addr.sin_port!=0){
- //socket
- channel_class = (*env)->FindClass(env,"org/apache/harmony/nio/internal/SocketChannelImpl");
- if(NULL == channel_class) {
- goto clean;
- }
- channel_object = getJavaNioChannelsSocketChannelImplObj(env,channel_class);
- if(NULL == channel_object) {
- goto clean;
- }
- // new and set FileDescript
- setFDContent(env, channel_class, channel_object,&sock);
- // local port
- setJavaNioChannelsLocalPort(env,channel_class,channel_object,ntohs(local_addr.sin_port));
- // new and set remote addr
- setSocketAddressContent(env, channel_class,channel_object,address);
- // localAddr
- socketaddr_class = (*env)->FindClass(env,"java/net/InetSocketAddress");
- socketaddr_field = (*env)->GetFieldID(env,channel_class,"connectAddress","Ljava/net/InetSocketAddress;");
- socketaddr_object = (*env)->GetObjectField(env,channel_object,socketaddr_field);
- setSocketLocalAddressContent(env,channel_class,channel_object,localAddr);
- // set port
- port_field = (*env)->GetFieldID(env,socketaddr_class,"port","I");
- (*env)->SetIntField(env,socketaddr_object, port_field, ntohs(remote_addr.sin_port));
- // set bound
- if (0 != local_addr.sin_port){
- bound_field = (*env)->GetFieldID(env,channel_class,"isBound","Z");
- (*env)->SetBooleanField(env,channel_object, bound_field,jtrue);
- }
- } else {
- //serverSocket
- channel_class = (*env)->FindClass(env,"org/apache/harmony/nio/internal/ServerSocketChannelImpl");
- if(NULL == channel_class) {
- goto clean;
- }
- channel_object = getJavaNioChannelsSocketChannelImplObj(env,channel_class);
- if(NULL == channel_object) {
- goto clean;
- }
- serverSocket_field = (*env)->GetFieldID(env,channel_class,"socket","Ljava/net/ServerSocket;");
- serverSocket_class = (*env)->FindClass(env,"Ljava/net/ServerSocket;");
- serverSocket_object = (*env)->GetObjectField(env,channel_object,serverSocket_field);
- // set bound
- if (0 != local_addr.sin_port){
- bound_field = (*env)->GetFieldID(env,channel_class,"isBound","Z");
- (*env)->SetBooleanField(env,channel_object, bound_field,jtrue);
- bound_field = (*env)->GetFieldID(env,serverSocket_class,"isBound","Z");
- (*env)->SetBooleanField(env,serverSocket_object, bound_field,jtrue);
- }
- // localAddr
- socketImpl_class = (*env)->FindClass(env,"java/net/SocketImpl");
- socketImpl_field = (*env)->GetFieldID(env,channel_class,"impl","Ljava/net/SocketImpl;");
- socketImpl_object = (*env)->GetObjectField(env,channel_object,socketImpl_field);
- if(NULL == socketImpl_object) {
- goto clean;
- }
- setServerSocketLocalAddressContent(env, socketImpl_class, socketImpl_object, localAddr);
- // set port
- port_field = (*env)->GetFieldID(env,socketImpl_class,"localport","I");
- (*env)->SetIntField(env,socketImpl_object, port_field, ntohs(local_addr.sin_port));
- }
- }
- else
- {
- //Datagram Socket
- // new DatagramChannel
- channel_class = (*env)->FindClass(env,"org/apache/harmony/nio/internal/DatagramChannelImpl");
- if(NULL == channel_class) {
- goto clean;
- }
- channel_object = getJavaNioChannelsSocketChannelImplObj(env,channel_class);
- if(NULL == channel_object) {
- goto clean;
- }
- // new and set FileDescript
- setFDContent(env,channel_class,channel_object,&sock);
- setJavaNioChannelsLocalPort(env,channel_class,channel_object,ntohs(local_addr.sin_port));
- // new and set remote addr
- setSocketAddressContent(env, channel_class,channel_object,address);
- // set bound
- if (0 != local_addr.sin_port){
- bound_field = (*env)->GetFieldID(env,channel_class,"isBound","Z");
- (*env)->SetBooleanField(env,channel_object, bound_field,jtrue);
- }
- }
-clean:
- free(address);
- free(localAddr);
- return channel_object;
-}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/linux/libhyluni.exp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/linux/libhyluni.exp?rev=425285&r1=425284&r2=425285&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/linux/libhyluni.exp (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/linux/libhyluni.exp Mon Jul 24 22:19:01 2006
@@ -221,6 +221,5 @@
Java_org_apache_harmony_luni_platform_OSNetworkSystem_getHostByNameImpl;
Java_org_apache_harmony_luni_platform_OSNetworkSystem_setInetAddressImpl;
Java_org_apache_harmony_luni_platform_OSNetworkSystem_isReachableByICMPImpl;
- Java_org_apache_harmony_luni_platform_OSNetworkSystem_inheritedChannelImpl;
local : *;
};
Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/OSNetworkSystem.h
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/OSNetworkSystem.h?rev=425285&r1=425284&r2=425285&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/OSNetworkSystem.h (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/OSNetworkSystem.h Mon Jul 24 22:19:01 2006
@@ -398,15 +398,6 @@
JNIEXPORT jint JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_isReachableByICMPImpl
(JNIEnv *, jobject, jobject, jobject, jint, jint);
-/*
- * Class: org_apache_harmony_luni_platform_OSNetworkSystem
- * Method: inheritedChannelImpl
- * Signature: ([BII)I
- */
-JNIEXPORT jobject JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_inheritedChannelImpl
- (JNIEnv *, jobject);
-
-
#ifdef __cplusplus
}
#endif
Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/nethelp.c
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/nethelp.c?rev=425285&r1=425284&r2=425285&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/nethelp.c (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/nethelp.c Mon Jul 24 22:19:01 2006
@@ -1736,111 +1736,3 @@
return (void *) ((*env)->GetLongField (env, fd, descriptorFID));
}
-jobject getJavaNioChannelsSocketChannelImplObj(JNIEnv * env, jclass channel_class){
- jmethodID channel_new;
- jobject channel_object;
-
- if(NULL == channel_class) {
- return NULL;
- }
- channel_new = (*env)->GetMethodID(env, channel_class,"<init>","()V");
- if(NULL == channel_new) {
- return NULL;
- }
- channel_object = (*env)->NewObject(env,channel_class,channel_new);
- return channel_object;
-}
-
-void setJavaNioChannelsLocalPort(JNIEnv * env,jclass channel_class,jobject channel_object,int port){
- // set port
- jfieldID port_field = (*env)->GetFieldID(env,channel_class,"localPort","I");
- (*env)->SetIntField(env,channel_object,port_field,port);
-}
-
-void setFDContent(JNIEnv * env, jclass channel_class, jobject channel_object, void * sock){
- jobject fd_object;
- jfieldID fd_field = (*env)->GetFieldID(env,channel_class,"fd","Ljava/io/FileDescriptor;");
- jclass fd_class = (*env)->FindClass(env,"java/io/FileDescriptor");
- if(NULL == fd_class) {
- return;
- }
- fd_object = (*env)->GetObjectField(env,channel_object,fd_field);
- if(NULL == fd_object) {
- return;
- }
- setJavaIoFileDescriptorContents (env, fd_object,sock);
-}
-
-void setSocketAddressContent(JNIEnv * env, jclass channel_class, jobject channel_object,jbyte * address){
- jmethodID addr_new;
- jfieldID socketaddr_field,addrarray_field,addr_field;
- jobject addr_object,socketaddr_object;
- jclass addr_class,socketaddr_class ;
- jbyteArray addr_array;
- addr_class = (*env)->FindClass(env,"Ljava/net/InetAddress;");
- if(NULL == addr_class) {
- return;
- }
- addr_new = (*env)->GetMethodID(env,addr_class,"<init>","()V");
- addr_object = (*env)->NewObject(env,addr_class,addr_new);
- if(NULL == addr_object) {
- return;
- }
- socketaddr_class = (*env)->FindClass(env,"java/net/InetSocketAddress");
- socketaddr_field = (*env)->GetFieldID(env,channel_class,"connectAddress","Ljava/net/InetSocketAddress;");
- socketaddr_object = (*env)->GetObjectField(env,channel_object,socketaddr_field);
- if(NULL == socketaddr_object){
- return;
- }
- addr_field = (*env)->GetFieldID(env,socketaddr_class,"addr","Ljava/net/InetAddress;");
- (*env)->SetObjectField(env, socketaddr_object, addr_field, addr_object);
- addrarray_field = (*env)->GetFieldID(env,addr_class,"ipaddress","[B");
- addr_array = (*env)->NewByteArray(env,(jsize)4);
- (*env)->SetByteArrayRegion(env,addr_array,(jsize)0,(jsize)4,address);
- (*env)->SetObjectField(env, addr_object, addrarray_field, addr_array);
-}
-
-void setSocketLocalAddressContent(JNIEnv * env, jclass channel_class, jobject channel_object,jbyte * address){
- jfieldID addrarray_field;
- jfieldID localAddr_field = (*env)->GetFieldID(env,channel_class,"localAddress","Ljava/net/InetAddress;");
- jclass addr_class = (*env)->FindClass(env,"Ljava/net/InetAddress;");
- jmethodID addr_new = (*env)->GetMethodID(env,addr_class,"<init>","()V");
- jobject localAddr_object = (*env)->NewObject(env,addr_class,addr_new);
- jclass socketaddr_class = (*env)->FindClass(env,"java/net/InetSocketAddress");
- jfieldID socketaddr_field = (*env)->GetFieldID(env,channel_class,"connectAddress","Ljava/net/InetSocketAddress;");
- jobject socketaddr_object = (*env)->GetObjectField(env,channel_object,socketaddr_field);
- jbyteArray addr_array;
- if(NULL == addr_class) {
- return;
- }
- (*env)->SetObjectField(env, socketaddr_object, localAddr_field, localAddr_object);
- if(NULL == localAddr_object) {
- return;
- }
- addr_array = (*env)->NewByteArray(env,(jsize)4);
- (*env)->SetByteArrayRegion(env,addr_array,(jsize)0,(jsize)4,address);
- addrarray_field = (*env)->GetFieldID(env,addr_class,"ipaddress","[B");
- (*env)->SetObjectField(env, localAddr_object, addrarray_field, addr_array);
-}
-
-void setServerSocketLocalAddressContent(JNIEnv * env, jclass socketImpl_class, jobject socketImpl_object, jbyte * localAddr){
- jmethodID addr_new;
- jfieldID localAddr_field,addrarray_field;
- jobject localAddr_object;
- jbyteArray addr_array;
- jclass addr_class = (*env)->FindClass(env,"Ljava/net/InetAddress;");
- if(NULL == addr_class) {
- return;
- }
- addr_new = (*env)->GetMethodID(env,addr_class,"<init>","()V");
- localAddr_field = (*env)->GetFieldID(env,socketImpl_class,"address","Ljava/net/InetAddress;");
- localAddr_object = (*env)->NewObject(env,addr_class,addr_new);
- if(NULL == localAddr_object) {
- return;
- }
- (*env)->SetObjectField(env, socketImpl_object, localAddr_field, localAddr_object);
- addr_array = (*env)->NewByteArray(env,(jsize)4);
- (*env)->SetByteArrayRegion(env,addr_array,(jsize)0,(jsize)4,localAddr);
- addrarray_field = (*env)->GetFieldID(env,addr_class,"ipaddress","[B");
- (*env)->SetObjectField(env, localAddr_object, addrarray_field, addr_array);
-}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/nethelp.h
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/nethelp.h?rev=425285&r1=425284&r2=425285&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/nethelp.h (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/nethelp.h Mon Jul 24 22:19:01 2006
@@ -1,4 +1,4 @@
-/* Copyright 1998, 2006 The Apache Software Foundation or its licensors, as applicable
+/* Copyright 1998, 2005 The Apache Software Foundation or its licensors, as applicable
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -161,17 +161,4 @@
void
setJavaIoFileDescriptorContents (JNIEnv * env, jobject fd,
void *value);
-
-void setSocketAddressContent(JNIEnv * env, jclass channel_class, jobject channel_object,jbyte * address);
-
-void setFDContent(JNIEnv * env, jclass channel_class, jobject channel_object, void * sock);
-
-void setJavaNioChannelsLocalPort(JNIEnv * env,jclass channel_class,jobject channel_object,int port);
-
-jobject getJavaNioChannelsSocketChannelImplObj(JNIEnv * env, jclass channel_class);
-
-jobject getJavaNioChannelsDatagramChannelImplObj(JNIEnv * env);
-
-void setServerSocketLocalAddressContent(JNIEnv * env, jclass socketImpl_class, jobject socketImpl_object, jbyte * localAddr);
-
#endif /* nethelp_h */
Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/windows/OSNetworkSystemWin32.c
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/windows/OSNetworkSystemWin32.c?rev=425285&r1=425284&r2=425285&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/windows/OSNetworkSystemWin32.c (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/windows/OSNetworkSystemWin32.c Mon Jul 24 22:19:01 2006
@@ -335,9 +335,3 @@
icmp_hdr->checksum = ip_checksum((unsigned short *)icmp_hdr, packet_size);
}
-JNIEXPORT jobject JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_inheritedChannelImpl
- (JNIEnv * env , jobject clz)
-{
- //inheritedChannel is not supported on windows platform.
- return NULL;
-}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/windows/hyluni.def
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/windows/hyluni.def?rev=425285&r1=425284&r2=425285&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/windows/hyluni.def (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/windows/hyluni.def Mon Jul 24 22:19:01 2006
@@ -214,4 +214,3 @@
Java_org_apache_harmony_luni_util_FloatingPointParser_parseFltImpl
Java_org_apache_harmony_luni_util_NumberConverter_bigIntDigitGeneratorInstImpl
Java_org_apache_harmony_luni_platform_OSNetworkSystem_isReachableByICMPImpl
- Java_org_apache_harmony_luni_platform_OSNetworkSystem_inheritedChannelImpl