Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/OSNetworkSystem.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/OSNetworkSystem.c?rev=727683&r1=727682&r2=727683&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/OSNetworkSystem.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/OSNetworkSystem.c Thu Dec 18 01:46:12 2008
@@ -163,9 +163,8 @@
jfieldID descriptorFID;
descriptorCLS = (*env)->FindClass(env, "java/lang/Long");
descriptorFID = (*env)->GetFieldID(env, descriptorCLS, "value", "J");
- (*env)->SetLongField(env, longclass, descriptorFID,
- (jlong) ((IDATA) context));
-};
+ (*env)->SetLongField(env, longclass, descriptorFID, (jlong) (IDATA) context);
+}
/**
* A helper method, to get the connect context.
@@ -180,9 +179,8 @@
jfieldID descriptorFID;
descriptorCLS = (*env)->FindClass(env, "java/lang/Long");
descriptorFID = (*env)->GetFieldID(env, descriptorCLS, "value", "J");
- return (void
- *) ((IDATA) ((*env)->GetLongField(env, longclass, descriptorFID)));
-};
+ return (void *) (IDATA) ((*env)->GetLongField(env, longclass, descriptorFID));
+}
/**
* A helper method, to set the remote address into the socketImpl.
@@ -295,228 +293,186 @@
HARMONY_CACHE_SET(env, FID_java_net_DatagramPacket_port, fid);
}
+
/*
* Class: org_apache_harmony_luni_platform_OSNetworkSystem
- * Method: createSocketImpl
+ * Method: createStreamSocket
* 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_createStreamSocket
+ (JNIEnv * env, jobject thiz, jobject thisObjFD, jboolean preferIPv4Stack)
{
createSocket(env, thisObjFD, HYSOCK_STREAM, preferIPv4Stack);
}
+
/*
* Class: org_apache_harmony_luni_platform_OSNetworkSystem
- * Method: createDatagramImpl
+ * Method: createDatagramSocket
* 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 fd, jboolean preferIPv4Stack)
{
- createSocket(env, thisObjFD, HYSOCK_DGRAM, preferIPv4Stack);
+ createSocket(env, fd, 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 fd, jbyteArray data, jint offset,
+ jint count, jint timeout)
{
- PORT_ACCESS_FROM_ENV(env);
jbyte *message;
- I_32 localCount;
+ jboolean isCopy = JNI_FALSE;
jint result;
-/* TODO: ARRAY PINNING */
-#define INTERNAL_RECEIVE_BUFFER_MAX 2048
- U_8 internalBuffer[INTERNAL_RECEIVE_BUFFER_MAX];
-
- localCount = (count < 65536) ? count : 65536;
-
- if (localCount > INTERNAL_RECEIVE_BUFFER_MAX) {
- message = hymem_allocate_memory(localCount);
- if (message == NULL) {
- throwNewOutOfMemoryError(env, "");
- return 0;
- }
- } else {
- message = (jbyte *) internalBuffer;
- }
+ /* Get a pointer to the start of the bytearray */
+ message = (*env)->GetByteArrayElements (env, data, &isCopy);
+ /* Read directly into the byte array */
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, fd, (jlong) (IDATA)(message + offset), count, timeout);
- if (result > 0) {
- (*env)->SetByteArrayRegion(env, data, offset, result, (jbyte *) message);
+ /* If the pointer was to a copy it needs to be released */
+ if (isCopy == JNI_TRUE) {
+ /* Only copy back if we modified the bytearray data */
+ if (0 < result) {
+ (*env)->ReleaseByteArrayElements (env, data, message, 0);
+ } else {
+ (*env)->ReleaseByteArrayElements (env, data, message, JNI_ABORT);
+ }
}
- if (((U_8 *) message) != internalBuffer) {
- hymem_free_memory((U_8 *) message);
- }
-#undef INTERNAL_MAX
return result;
}
/*
* 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 fd, jlong address,
jint count, jint timeout)
{
PORT_ACCESS_FROM_ENV(env);
hysocket_t hysocketP;
- jbyte *message = (jbyte *) (IDATA)address;
+ U_8 *message = (U_8 *)(IDATA)address;
I_32 result, localCount;
- hysocketP = getJavaIoFileDescriptorContentsAsAPointer(env, fileDescriptor);
+ hysocketP = getJavaIoFileDescriptorContentsAsAPointer(env, fd);
- /*----------------the older form,nearly the same with below------------
- //result = pollSelectRead (env, fileDescriptor, timeout, TRUE);
- */
- result = selectRead(env, hysocketP, timeout * 1000, FALSE);
- if (0 >= result)
- return (jint) 0;
-
-
- if (!hysock_socketIsValid(hysocketP)) {
- throwJavaNetSocketException(env, HYPORT_ERROR_SOCKET_BADSOCKET);
- return (jint) 0;
+ /* A non-zero timeout will first check, and potentially wait, to see if any
+ * bytes are available
+ */
+ if (timeout != 0) {
+ result = selectRead(env, hysocketP, timeout * 1000, FALSE);
+ if (0 > result) {
+ if (result == HYPORT_ERROR_SOCKET_TIMEOUT) {
+ return (jint) 0; // return zero bytes to indicate timeout
+ }
+ throwJavaNetSocketException(env, result);
+ return (jint) 0; // Unused, exception takes precedence
+ }
}
+ /* Limit size of read to 64k bytes */
localCount = (count < 65536) ? count : 65536;
-
- result =
- hysock_read(hysocketP, (U_8 *) message, localCount, HYSOCK_NOFLAGS);
-
- /* If no bytes are read, return -1 to signal 'endOfFile' to the Java input stream */
- if (0 < result) {
- return (jint) result;
- } else if (0 == result) {
- return (jint) - 1;
- } else {
+ result = hysock_read(hysocketP, message, localCount, HYSOCK_NOFLAGS);
+ if (0 > result) {
+ if (HYPORT_ERROR_SOCKET_WOULDBLOCK == result) {
+ /* We were asked to read on a nonblocking socket and there is no data available */
+ return (jint) 0;
+ }
throwJavaNetSocketException(env, result);
return (jint) 0;
}
+
+ /* If no bytes are read, return -1 to signal 'endOfFile' to the Java input stream */
+ return (0 == result) ? (jint) -1 : (jint) result;
}
+
/*
* 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 fd, jbyteArray data,
jint offset, jint count)
{
- PORT_ACCESS_FROM_ENV(env);
jbyte *message;
- jint result = 0;
-
-/* TODO: ARRAY PINNING */
-#define INTERNAL_SEND_BUFFER_MAX 512
- U_8 internalBuffer[INTERNAL_SEND_BUFFER_MAX];
-
- if (count > INTERNAL_SEND_BUFFER_MAX) {
- message = hymem_allocate_memory(count);
- if (message == NULL) {
- throwNewOutOfMemoryError(env, "");
- return 0;
- }
- } else {
- message = (jbyte *) internalBuffer;
- }
+ jboolean isCopy = JNI_FALSE;
+ jint result;
- (*env)->GetByteArrayRegion(env, data, offset, count, message);
- if ((*env)->ExceptionCheck(env)) {
- goto out;
- }
+ /* Get a pointer to the start of the bytearray */
+ message = (*env)->GetByteArrayElements (env, data, &isCopy);
+ /* Write directly from the byte array */
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, fd, (jlong) (IDATA)(message + offset), count);
-out:
- if ((U_8 *) message != internalBuffer) {
- hymem_free_memory(message);
+
+ /* If the pointer was to a copy it needs to be released */
+ if (isCopy == JNI_TRUE) {
+ (*env)->ReleaseByteArrayElements (env, data, message, JNI_ABORT);
}
-#undef INTERNAL_SEND_BUFFER_MAX
+
return result;
}
/*
* 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,
- jint count)
+Java_org_apache_harmony_luni_platform_OSNetworkSystem_writeDirect
+ (JNIEnv * env, jobject thiz, jobject fd, jlong address, jint count)
{
PORT_ACCESS_FROM_ENV(env);
jbyte *message = (jbyte *) (IDATA)address;
- I_32 result = 0, sent = 0;
-
- if (sent < count) {
- hysocket_t socketP =
- getJavaIoFileDescriptorContentsAsAPointer(env, fileDescriptor);
- if (!hysock_socketIsValid(socketP)) {
- throwJavaNetSocketException(env,
- sent ==0 ?
- HYPORT_ERROR_SOCKET_BADSOCKET :
- HYPORT_ERROR_SOCKET_INTERRUPTED);
- return (jint) 0;
- }
+ I_32 result;
- while (sent < count) {
- result =
- hysock_write(socketP, (U_8 *) message + sent, (I_32) count - sent,
- HYSOCK_NOFLAGS);
- if (result < 0) {
- break;
- }
- sent += result;
- }
- }
+ hysocket_t socketP = getJavaIoFileDescriptorContentsAsAPointer(env, fd);
- /**
- * We should always throw an exception if all the data cannot be sent because Java methods
- * assume all the data will be sent or an error occurs.
- */
- if (result < 0) {
+ result = hysock_write(socketP, (U_8 *) message, (I_32) count, HYSOCK_NOFLAGS);
+ if (0 > result) {
throwJavaNetSocketException(env, result);
- return (jint) 0;
- } else {
- return (jint) sent;
+ return (jint) 0; // Ignored, exception takes precedence
}
+
+ return (jint) result;
}
+
/*
* 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,60 +486,62 @@
/*
* 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 fd, jint trafficClass,
jobject inetAddress, jint remotePort)
{
PORT_ACCESS_FROM_ENV(env);
- jbyte nAddrBytes[HYSOCK_INADDR6_LEN];
- int length;
+ U_8 nAddrBytes[HYSOCK_INADDR6_LEN];
+ U_32 length = 0;
U_16 nPort;
I_32 result;
hysocket_t socketP;
hysockaddr_struct sockaddrP;
U_32 scope_id = 0;
- socketP = getJavaIoFileDescriptorContentsAsAPointer(env, fileDescriptor);
+ socketP = getJavaIoFileDescriptorContentsAsAPointer(env, fd);
if (!hysock_socketIsValid(socketP)) {
throwJavaNetSocketException(env, HYPORT_ERROR_SOCKET_BADSOCKET);
return -1;
- } else {
- netGetJavaNetInetAddressValue(env, inetAddress, (U_8 *) nAddrBytes,
- (U_32 *) & length);
+ }
- nPort = hysock_htons((U_16) remotePort);
- if (length == HYSOCK_INADDR_LEN) {
- hysock_sockaddr_init6(&sockaddrP, (U_8 *) nAddrBytes, length,
- HYADDR_FAMILY_AFINET4, nPort, 0, scope_id,
- socketP);
- } else {
- netGetJavaNetInetAddressScopeId(env, inetAddress, &scope_id);
- hysock_sockaddr_init6(&sockaddrP, (U_8 *) nAddrBytes, length,
- HYADDR_FAMILY_AFINET6, nPort,
- (trafficClass & 0xFF) << 20, scope_id, socketP);
- }
+ netGetJavaNetInetAddressValue(env, inetAddress, nAddrBytes, &length);
+ nPort = hysock_htons((U_16) remotePort);
- result = hysock_connect(socketP, &sockaddrP);
- if (0 != result) {
- throwJavaNetConnectException(env, result);
- return result;
- }
+ if (length == HYSOCK_INADDR_LEN) {
+ // IPv4
+ hysock_sockaddr_init6(&sockaddrP, nAddrBytes, length,
+ HYADDR_FAMILY_AFINET4, nPort, 0, 0, socketP);
+ } else {
+ // IPv6
+ netGetJavaNetInetAddressScopeId(env, inetAddress, &scope_id);
+ hysock_sockaddr_init6(&sockaddrP, nAddrBytes, length,
+ HYADDR_FAMILY_AFINET6, nPort,
+ (trafficClass & 0xFF) << 20, scope_id, socketP);
}
+
+ result = hysock_connect(socketP, &sockaddrP);
+ if (0 != result) {
+ throwJavaNetConnectException(env, result);
+ return result;
+ }
+
return result;
}
+
/*
* 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 +588,7 @@
break;
}
- /* set connext for next call */
+ /* set connext for next call */
setConnectContext(env, passContext, context);
if (0 == result) {
@@ -664,13 +622,13 @@
/*
* Class: org_apache_harmony_luni_platform_OSNetworkSystem
- * Method: socketBindImpl
- * Signature: (Ljava/io/FileDescriptor;ILjava/net/InetAddress;)V
+ * Method: bind
+ * Signature: (Ljava/io/FileDescriptor;Ljava/net/InetAddress;I)V
*/
JNIEXPORT void JNICALL
-Java_org_apache_harmony_luni_platform_OSNetworkSystem_socketBindImpl
- (JNIEnv * env, jclass thisClz, jobject fileDescriptor,
- jint localPort, jobject inetAddress)
+Java_org_apache_harmony_luni_platform_OSNetworkSystem_bind
+ (JNIEnv * env, jobject thiz, jobject fileDescriptor,
+ jobject inetAddress, jint localPort)
{
PORT_ACCESS_FROM_ENV(env);
jbyte nlocalAddrBytes[HYSOCK_INADDR6_LEN];
@@ -711,12 +669,12 @@
/*
* Class: org_apache_harmony_luni_platform_OSNetworkSystem
- * Method: listenStreamSocketImpl
+ * Method: listenStreamSocket
* Signature: (Ljava/io/FileDescriptor;I)V
*/
JNIEXPORT void JNICALL
-Java_org_apache_harmony_luni_platform_OSNetworkSystem_listenStreamSocketImpl
- (JNIEnv * env, jclass thisClz, jobject fileDescriptor, jint backlog)
+Java_org_apache_harmony_luni_platform_OSNetworkSystem_listenStreamSocket
+ (JNIEnv * env, jobject thiz, jobject fileDescriptor, jint backlog)
{
PORT_ACCESS_FROM_ENV(env);
hysocket_t socketP;
@@ -726,73 +684,24 @@
if (!hysock_socketIsValid(socketP)) {
throwJavaNetSocketException(env, HYPORT_ERROR_SOCKET_BADSOCKET);
return;
- } else {
- result = hysock_listen(socketP, (I_32) backlog);
- if (result < 0) {
- throwJavaNetSocketException(env, result);
- }
- }
-}
-
-/*
- * Class: org_apache_harmony_luni_platform_OSNetworkSystem
- * Method: availableStreamImpl
- * Signature: (Ljava/io/FileDescriptor;)I
- */
-JNIEXPORT jint JNICALL
-Java_org_apache_harmony_luni_platform_OSNetworkSystem_availableStreamImpl
- (JNIEnv * env, jclass thisClz, jobject fileDescriptor)
-{
-#define MSGLEN 2048 /* This could be replaced by the default stack buffer size */
- PORT_ACCESS_FROM_ENV(env);
- hysocket_t hysocketP;
- char message[MSGLEN];
-
- I_32 result, flags = 0;
-
- hysocketP = getJavaIoFileDescriptorContentsAsAPointer(env, fileDescriptor);
- if (!hysock_socketIsValid(hysocketP)) {
- throwJavaNetSocketException(env, HYPORT_ERROR_SOCKET_BADSOCKET);
- return (jint) 0;
- }
-
- do {
- result = hysock_select_read(hysocketP, 0, 1, FALSE);
-
- if (HYPORT_ERROR_SOCKET_TIMEOUT == result) {
- return (jint) 0; /* The read operation timed out, so answer 0 bytes available */
- } else if (HYPORT_ERROR_SOCKET_INTERRUPTED == result) {
- continue;
- } else if (0 > result) {
- throwJavaNetSocketException(env, result);
- return (jint) 0;
- }
- } while (HYPORT_ERROR_SOCKET_INTERRUPTED == result);
-
- result = hysock_setflag(HYSOCK_MSG_PEEK, &flags); /* Create a 'peek' flag argument for the read operation */
- if (0 > result) {
- throwJavaNetSocketException(env, result);
- return (jint) 0;
}
- result = hysock_read(hysocketP, (U_8 *) message, MSGLEN, flags);
-
- if (0 > result) {
+ result = hysock_listen(socketP, (I_32) backlog);
+ if (result < 0) {
throwJavaNetSocketException(env, result);
- return (jint) 0;
- } else {
- return (jint) result;
+ return;
}
}
+
/*
* Class: org_apache_harmony_luni_platform_OSNetworkSystem
- * Method: acceptSocketImpl
+ * Method: accept
* Signature: (Ljava/io/FileDescriptor;Ljava/net/SocketImpl;Ljava/io/FileDescriptor;I)V
*/
JNIEXPORT void JNICALL
Java_org_apache_harmony_luni_platform_OSNetworkSystem_acceptSocketImpl
- (JNIEnv * env, jclass thisClz, jobject fileDescriptorServer,
+ (JNIEnv * env, jobject thiz, jobject fileDescriptorServer,
jobject socketImpl, jobject fileDescriptorSocketImpl, jint timeout)
{
PORT_ACCESS_FROM_ENV(env);
@@ -829,12 +738,12 @@
/*
* Class: org_apache_harmony_luni_platform_OSNetworkSystem
- * Method: supportsUrgentDataImpl
+ * Method: supportsUrgentData
* Signature: (Ljava/io/FileDescriptor;)Z
*/
JNIEXPORT jboolean JNICALL
-Java_org_apache_harmony_luni_platform_OSNetworkSystem_supportsUrgentDataImpl
- (JNIEnv * env, jclass thisClz, jobject fileDescriptor)
+Java_org_apache_harmony_luni_platform_OSNetworkSystem_supportsUrgentData
+ (JNIEnv * env, jobject thiz, jobject fileDescriptor)
{
PORT_ACCESS_FROM_ENV(env);
hysocket_t socketP;
@@ -851,12 +760,12 @@
/*
* Class: org_apache_harmony_luni_platform_OSNetworkSystem
- * Method: sendUrgentDataImpl
+ * Method: sendUrgentData
* Signature: (Ljava/io/FileDescriptor;B)Z
*/
JNIEXPORT void JNICALL
-Java_org_apache_harmony_luni_platform_OSNetworkSystem_sendUrgentDataImpl
- (JNIEnv * env, jclass thisClz, jobject fileDescriptor, jbyte data)
+Java_org_apache_harmony_luni_platform_OSNetworkSystem_sendUrgentData
+ (JNIEnv * env, jobject thiz, jobject fileDescriptor, jbyte data)
{
PORT_ACCESS_FROM_ENV(env);
hysocket_t socketP;
@@ -878,17 +787,18 @@
*/
if (result < 0) {
throwJavaNetSocketException(env, result);
+ return;
}
}
/*
* 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);
@@ -929,12 +839,12 @@
/*
* Class: org_apache_harmony_luni_platform_OSNetworkSystem
- * Method: disconnectDatagramImpl
+ * Method: disconnectDatagram
* Signature: (Ljava/io/FileDescriptor;)V
*/
JNIEXPORT void JNICALL
-Java_org_apache_harmony_luni_platform_OSNetworkSystem_disconnectDatagramImpl
- (JNIEnv * env, jclass thisClz, jobject fileDescriptor)
+Java_org_apache_harmony_luni_platform_OSNetworkSystem_disconnectDatagram
+ (JNIEnv * env, jobject thiz, jobject fileDescriptor)
{
PORT_ACCESS_FROM_ENV(env);
jbyte nAddrBytes[HYSOCK_INADDR6_LEN];
@@ -949,8 +859,9 @@
return;
}
- /* the address itself should not matter as the protocol family is AF_UNSPEC. This tells connect to
- disconnect the Datagram */
+ /* the address itself should not matter as the protocol family is AF_UNSPEC.
+ * This tells connect to disconnect the Datagram
+ */
memset(nAddrBytes, 0, HYSOCK_INADDR6_LEN);
hysock_sockaddr_init6(&sockaddrP, (U_8 *) nAddrBytes, HYSOCK_INADDR_LEN,
HYADDR_FAMILY_UNSPEC, nPort, 0, 0, socketP);
@@ -958,7 +869,9 @@
/* there is the possiblity of an exception here */
result = hysock_connect(socketP, &sockaddrP);
- /* will likely need to eat the correct exception here. Leave as is until we figure out what that exception will be */
+ /* will likely need to eat the correct exception here. Leave as is until we
+ * figure out what that exception will be
+ */
if (0 != result) {
throwJavaNetSocketException(env, result);
return;
@@ -968,64 +881,12 @@
/*
* Class: org_apache_harmony_luni_platform_OSNetworkSystem
- * Method: socketBindImpl2
- * Signature: (Ljava/io/FileDescriptor;IZLjava/net/InetAddress;)Z
- */
-JNIEXPORT jboolean JNICALL
-Java_org_apache_harmony_luni_platform_OSNetworkSystem_socketBindImpl2
- (JNIEnv * env, jclass thisClz, jobject fileDescriptor, jint localPort,
- jboolean doDevice, jobject inetAddress)
-{
- PORT_ACCESS_FROM_ENV(env);
- jbyte nlocalAddrBytes[HYSOCK_INADDR6_LEN];
- int length;
- U_16 nPort;
- I_32 result;
- hysocket_t socketP;
- hysockaddr_struct sockaddrP;
- U_32 scope_id = 0;
-
- /* This method still needs work for IPv6 support */
-
- socketP = getJavaIoFileDescriptorContentsAsAPointer(env, fileDescriptor);
- if (!hysock_socketIsValid(socketP)) {
- throwJavaNetSocketException(env, HYPORT_ERROR_SOCKET_BADSOCKET);
- return 0;
- }
-
- netGetJavaNetInetAddressValue(env, inetAddress, (U_8 *) nlocalAddrBytes,
- (U_32 *) & length);
-
- nPort = hysock_htons((U_16) localPort);
- if (length == HYSOCK_INADDR6_LEN) {
- netGetJavaNetInetAddressScopeId(env, inetAddress, &scope_id);
- hysock_sockaddr_init6(&sockaddrP, (U_8 *) nlocalAddrBytes, length,
- HYADDR_FAMILY_AFINET6, nPort, 0, scope_id, socketP);
- } else {
- hysock_sockaddr_init6(&sockaddrP, (U_8 *) nlocalAddrBytes, length,
- HYADDR_FAMILY_AFINET4, nPort, 0, scope_id, socketP);
- }
- result = hysock_bind(socketP, &sockaddrP);
- if (0 != result) {
- throwJavaNetBindException(env, result);
- return 0;
- }
-
- /* TOFIX: This matches the windows behaviour but it doesn't look right
- result must be zero so the return code is zero from all paths.
- */
- return result;
-}
-
-
-/*
- * Class: org_apache_harmony_luni_platform_OSNetworkSystem
- * Method: peekDatagramImpl
+ * Method: peekDatagram
* Signature: (Ljava/io/FileDescriptor;Ljava/net/InetAddress;I)I
*/
JNIEXPORT jint JNICALL
-Java_org_apache_harmony_luni_platform_OSNetworkSystem_peekDatagramImpl
- (JNIEnv * env, jclass thisClz, jobject fileDescriptor,
+Java_org_apache_harmony_luni_platform_OSNetworkSystem_peekDatagram
+ (JNIEnv * env, jobject thiz, jobject fileDescriptor,
jobject senderAddress, jint timeout)
{
PORT_ACCESS_FROM_ENV(env);
@@ -1060,26 +921,27 @@
}
result = hysock_readfrom(hysocketP, (U_8 *) msg, msgLen, flags, &sockaddrP);
-/* Note, the msgsize error is acceptable as the read buffer was set to a nominal length.
- Updating sockaddrP is the purpose of this call. */
+ /* Note, the msgsize error is acceptable as the read buffer was set to a nominal length.
+ * Updating sockaddrP is the purpose of this call.
+ */
if (result < 0 && result != HYPORT_ERROR_SOCKET_MSGSIZE) {
throwJavaNetSocketException(env, result);
return (jint) 0;
- } else {
- updateAddress(env, &sockaddrP, senderAddress);
- hport = (jint) hysock_ntohs(hysock_sockaddr_port(&sockaddrP));
- return hport;
}
+
+ updateAddress(env, &sockaddrP, senderAddress);
+ hport = (jint) hysock_ntohs(hysock_sockaddr_port(&sockaddrP));
+ return hport;
}
/*
* Class: org_apache_harmony_luni_platform_OSNetworkSystem
- * Method: receiveDatagramImpl
+ * Method: receiveDatagram
* Signature: (Ljava/io/FileDescriptor;Ljava/net/DatagramPacket;[BIIIZ)I
*/
JNIEXPORT jint JNICALL
-Java_org_apache_harmony_luni_platform_OSNetworkSystem_receiveDatagramImpl
- (JNIEnv * env, jclass thisClz, jobject fileDescriptor,
+Java_org_apache_harmony_luni_platform_OSNetworkSystem_receiveDatagram
+ (JNIEnv * env, jobject thiz, jobject fileDescriptor,
jobject datagramPacket, jbyteArray data, jint offset, jint msgLength,
jint timeout, jboolean peek)
{
@@ -1096,8 +958,8 @@
}
result =
- Java_org_apache_harmony_luni_platform_OSNetworkSystem_receiveDatagramDirectImpl
- (env, thisClz, fileDescriptor, datagramPacket, (jlong)(IDATA)message, offset,
+ Java_org_apache_harmony_luni_platform_OSNetworkSystem_receiveDatagramDirect
+ (env, thiz, fileDescriptor, datagramPacket, (jlong)(IDATA)message, offset,
localCount, timeout, peek);
if (result > 0) {
@@ -1109,12 +971,12 @@
/*
* Class: org_apache_harmony_luni_platform_OSNetworkSystem
- * Method: receiveDatagramDirectImpl
+ * Method: receiveDatagramDirect
* Signature: (Ljava/io/FileDescriptor;Ljava/net/DatagramPacket;JIIIZ)I
*/
JNIEXPORT jint JNICALL
-Java_org_apache_harmony_luni_platform_OSNetworkSystem_receiveDatagramDirectImpl
- (JNIEnv * env, jclass thisClz, jobject fileDescriptor,
+Java_org_apache_harmony_luni_platform_OSNetworkSystem_receiveDatagramDirect
+ (JNIEnv * env, jobject thiz, jobject fileDescriptor,
jobject datagramPacket, jlong address, jint offset, jint msgLength,
jint timeout, jboolean peek)
{
@@ -1158,22 +1020,22 @@
if (result < 0) {
throwJavaNetSocketException(env, result);
return (jint) 0;
- } else {
- if (datagramPacket != NULL) {
- updatePacket(env, &sockaddrP, datagramPacket, result);
- }
- return (jint) result;
}
+
+ if (datagramPacket != NULL) {
+ updatePacket(env, &sockaddrP, datagramPacket, result);
+ }
+ return (jint) result;
}
/*
* Class: org_apache_harmony_luni_platform_OSNetworkSystem
- * Method: recvConnectedDatagramImpl
+ * Method: recvConnectedDatagram
* Signature: (Ljava/io/FileDescriptor;Ljava/net/DatagramPacket;[BIIIZ)I
*/
JNIEXPORT jint JNICALL
-Java_org_apache_harmony_luni_platform_OSNetworkSystem_recvConnectedDatagramImpl
- (JNIEnv * env, jclass thisClz, jobject fileDescriptor,
+Java_org_apache_harmony_luni_platform_OSNetworkSystem_recvConnectedDatagram
+ (JNIEnv * env, jobject thiz, jobject fileDescriptor,
jobject datagramPacket, jbyteArray data, jint offset, jint msgLength,
jint timeout, jboolean peek)
{
@@ -1191,8 +1053,8 @@
}
result =
- Java_org_apache_harmony_luni_platform_OSNetworkSystem_recvConnectedDatagramDirectImpl
- (env, thisClz, fileDescriptor, datagramPacket, (jlong)(IDATA)message, offset,
+ Java_org_apache_harmony_luni_platform_OSNetworkSystem_recvConnectedDatagramDirect
+ (env, thiz, fileDescriptor, datagramPacket, (jlong)(IDATA)message, offset,
localCount, timeout, peek);
if (result > 0) {
@@ -1206,12 +1068,12 @@
/*
* Class: org_apache_harmony_luni_platform_OSNetworkSystem
- * Method: recvConnectedDatagramDirectImpl
+ * Method: recvConnectedDatagramDirect
* Signature: (Ljava/io/FileDescriptor;Ljava/net/DatagramPacket;JIIIZ)I
*/
JNIEXPORT jint JNICALL
-Java_org_apache_harmony_luni_platform_OSNetworkSystem_recvConnectedDatagramDirectImpl
- (JNIEnv * env, jclass thisClz, jobject fileDescriptor,
+Java_org_apache_harmony_luni_platform_OSNetworkSystem_recvConnectedDatagramDirect
+ (JNIEnv * env, jobject thiz, jobject fileDescriptor,
jobject datagramPacket, jlong address, jint offset, jint msgLength,
jint timeout, jboolean peek)
{
@@ -1254,30 +1116,31 @@
|| (HYPORT_ERROR_SOCKET_CONNECTION_REFUSED == result)) {
throwJavaNetPortUnreachableException(env, result);
return (jint) 0;
- } else {
- throwJavaNetSocketException(env, result);
- return (jint) 0;
}
- } else {
- /* update the packet with the length of data received.
- Since we are connected we did not get back an address. This
- address is cached within the PlainDatagramSocket java object and is filled in at
- the java level */
- if (datagramPacket != NULL) {
- setDatagramPacketLength(env, datagramPacket, result);
- }
- return (jint) result;
+ throwJavaNetSocketException(env, result);
+ return (jint) 0;
+ }
+
+ /* Update the packet with the length of data received. Since we are connected
+ * we did not get back an address. This address is cached within the
+ * PlainDatagramSocket java object and is filled in at the java level.
+ */
+ if (datagramPacket != NULL) {
+ setDatagramPacketLength(env, datagramPacket, result);
}
+
+ return (jint) result;
}
+
/*
* Class: org_apache_harmony_luni_platform_OSNetworkSystem
- * Method: sendDatagramImpl
+ * Method: sendDatagram
* Signature: (Ljava/io/FileDescriptor;[BIIIZILjava/net/InetAddress;)I
*/
JNIEXPORT jint JNICALL
-Java_org_apache_harmony_luni_platform_OSNetworkSystem_sendDatagramImpl
- (JNIEnv * env, jclass thisClz, jobject fileDescriptor, jbyteArray data,
+Java_org_apache_harmony_luni_platform_OSNetworkSystem_sendDatagram
+ (JNIEnv * env, jobject thiz, jobject fileDescriptor, jbyteArray data,
jint offset, jint msgLength, jint targetPort, jboolean bindToDevice,
jint trafficClass, jobject inetAddress)
{
@@ -1292,21 +1155,22 @@
}
(*env)->GetByteArrayRegion(env, data, offset, msgLength, message);
result =
- Java_org_apache_harmony_luni_platform_OSNetworkSystem_sendDatagramDirectImpl
- (env, thisClz, fileDescriptor, (jlong) (IDATA)message, offset, msgLength,
+ Java_org_apache_harmony_luni_platform_OSNetworkSystem_sendDatagramDirect
+ (env, thiz, fileDescriptor, (jlong) (IDATA)message, offset, msgLength,
targetPort, bindToDevice, trafficClass, inetAddress);
+
hymem_free_memory(message);
return result;
}
/*
* Class: org_apache_harmony_luni_platform_OSNetworkSystem
- * Method: sendDatagramDirectImpl
+ * Method: sendDatagramDirect
* Signature: (Ljava/io/FileDescriptor;JIIIZILjava/net/InetAddress;)I
*/
JNIEXPORT jint JNICALL
-Java_org_apache_harmony_luni_platform_OSNetworkSystem_sendDatagramDirectImpl
- (JNIEnv * env, jclass thisClz, jobject fileDescriptor, jlong address,
+Java_org_apache_harmony_luni_platform_OSNetworkSystem_sendDatagramDirect
+ (JNIEnv * env, jobject thiz, jobject fileDescriptor, jlong address,
jint offset, jint msgLength, jint targetPort, jboolean bindToDevice,
jint trafficClass, jobject inetAddress)
{
@@ -1367,18 +1231,18 @@
/*
* Class: org_apache_harmony_luni_platform_OSNetworkSystem
- * Method: sendConnectedDatagramImpl
+ * Method: sendConnectedDatagram
* Signature: (Ljava/io/FileDescriptor;[BIIZ)I
*/
JNIEXPORT jint JNICALL
-Java_org_apache_harmony_luni_platform_OSNetworkSystem_sendConnectedDatagramImpl
- (JNIEnv * env, jclass thisClz, jobject fileDescriptor, jbyteArray data,
+Java_org_apache_harmony_luni_platform_OSNetworkSystem_sendConnectedDatagram
+ (JNIEnv * env, jobject thiz, jobject fileDescriptor, jbyteArray data,
jint offset, jint msgLength, jboolean bindToDevice)
{
PORT_ACCESS_FROM_ENV(env);
jbyte *message;
jint result;
- /* allocate a local buffer into which we will copy the data to be sent and which we will use
+ /* allocate a local buffer into which we will copy the data to be sent and which we will use
for the write call */
message = hymem_allocate_memory(msgLength);
if (message == NULL) {
@@ -1387,22 +1251,22 @@
}
(*env)->GetByteArrayRegion(env, data, offset, msgLength, message);
result =
- Java_org_apache_harmony_luni_platform_OSNetworkSystem_sendConnectedDatagramDirectImpl
- (env, thisClz, fileDescriptor, (jlong) (IDATA)message, offset, msgLength,
+ Java_org_apache_harmony_luni_platform_OSNetworkSystem_sendConnectedDatagramDirect
+ (env, thiz, fileDescriptor, (jlong) (IDATA)message, offset, msgLength,
bindToDevice);
- /* ok free the buffer and return the length sent */
+ /* ok free the buffer and return the length sent */
hymem_free_memory(message);
return result;
}
/*
* Class: org_apache_harmony_luni_platform_OSNetworkSystem
- * Method: sendConnectedDatagramDirectImpl
+ * Method: sendConnectedDatagramDirect
* Signature: (Ljava/io/FileDescriptor;JIIZ)I
*/
JNIEXPORT jint JNICALL
-Java_org_apache_harmony_luni_platform_OSNetworkSystem_sendConnectedDatagramDirectImpl
- (JNIEnv * env, jclass thisClz, jobject fileDescriptor, jlong address,
+Java_org_apache_harmony_luni_platform_OSNetworkSystem_sendConnectedDatagramDirect
+ (JNIEnv * env, jobject thiz, jobject fileDescriptor, jlong address,
jint offset, jint msgLength, jboolean bindToDevice)
{
PORT_ACCESS_FROM_ENV(env);
@@ -1463,45 +1327,15 @@
}
}
-/*
- * Class: org_apache_harmony_luni_platform_OSNetworkSystem
- * Method: createServerStreamSocketImpl
- * Signature: (Ljava/io/FileDescriptor;Z)V
- */
-JNIEXPORT void JNICALL
-Java_org_apache_harmony_luni_platform_OSNetworkSystem_createServerStreamSocketImpl
- (JNIEnv * env, jclass thisClz, jobject thisObjFD, jboolean preferIPv4Stack)
-{
- hysocket_t socketP;
- createSocket(env, thisObjFD, HYSOCK_STREAM, preferIPv4Stack);
- socketP =
- (hysocket_t) getJavaIoFileDescriptorContentsAsAPointer(env, thisObjFD);
- setDefaultServerSocketOptions(env, socketP);
-}
/*
* Class: org_apache_harmony_luni_platform_OSNetworkSystem
- * Method: createMulticastSocketImpl
- * Signature: (Ljava/io/FileDescriptor;Z)V
+ * Method: connectStreamWithTimeoutSocket
+ * Signature: (Ljava/io/FileDescriptor;IIILjava/net/InetAddress;)V
*/
JNIEXPORT void JNICALL
-Java_org_apache_harmony_luni_platform_OSNetworkSystem_createMulticastSocketImpl
- (JNIEnv * env, jclass thisClz, jobject thisObjFD, jboolean preferIPv4Stack)
-{
- PORT_ACCESS_FROM_ENV(env);
- BOOLEAN value = TRUE;
- hysocket_t socketP;
- createSocket(env, thisObjFD, HYSOCK_DGRAM, preferIPv4Stack);
- socketP =
- (hysocket_t) getJavaIoFileDescriptorContentsAsAPointer(env, thisObjFD);
-
- hysock_setopt_bool(socketP, HY_SOL_SOCKET, HY_SO_REUSEPORT, &value);
- hysock_setopt_bool(socketP, HY_SOL_SOCKET, HY_SO_REUSEADDR, &value);
-}
-
-JNIEXPORT void JNICALL
-Java_org_apache_harmony_luni_platform_OSNetworkSystem_connectStreamWithTimeoutSocketImpl
- (JNIEnv * env, jclass thisClz, jobject fileDescriptor, jint remotePort,
+Java_org_apache_harmony_luni_platform_OSNetworkSystem_connectStreamWithTimeoutSocket
+ (JNIEnv * env, jobject thisClz, jobject fileDescriptor, jint remotePort,
jint timeout, jint trafficClass, jobject inetAddress)
{
PORT_ACCESS_FROM_ENV(env);
@@ -1636,9 +1470,10 @@
}
}
+
JNIEXPORT jint JNICALL
-Java_org_apache_harmony_luni_platform_OSNetworkSystem_sendDatagramImpl2
- (JNIEnv * env, jclass thisClz, jobject fileDescriptor, jbyteArray data,
+Java_org_apache_harmony_luni_platform_OSNetworkSystem_sendDatagram2
+ (JNIEnv * env, jclass thiz, jobject fileDescriptor, jbyteArray data,
jint offset, jint msgLength, jint targetPort, jobject inetAddress)
{
PORT_ACCESS_FROM_ENV(env);
@@ -1708,9 +1543,12 @@
}
}
+/*
+ * Deprecated. Use Java_org_apache_harmony_luni_platform_OSNetworkSystem_read
+ */
JNIEXPORT jint JNICALL
-Java_org_apache_harmony_luni_platform_OSNetworkSystem_receiveStreamImpl
- (JNIEnv * env, jclass thisClz, jobject fileDescriptor, jbyteArray data,
+Java_org_apache_harmony_luni_platform_OSNetworkSystem_receiveStream
+ (JNIEnv * env, jobject thiz, jobject fileDescriptor, jbyteArray data,
jint offset, jint count, jint timeout)
{
PORT_ACCESS_FROM_ENV(env);
@@ -1759,95 +1597,28 @@
if (0 < result) {
return (jint) result;
} else if (0 == result) {
- return (jint) - 1;
+ return (jint) -1;
} else {
throwJavaNetSocketException(env, result);
return (jint) 0;
}
}
-JNIEXPORT jint JNICALL
-Java_org_apache_harmony_luni_platform_OSNetworkSystem_sendStreamImpl
- (JNIEnv * env, jclass thisClz, jobject fileDescriptor, jbyteArray data,
- jint offset, jint count)
-{
- PORT_ACCESS_FROM_ENV(env);
- hysocket_t socketP;
- jbyte *message;
- I_32 result = 0, sent = 0;
-
-/* TODO: ARRAY PINNING */
-#define INTERNAL_SEND_BUFFER_MAX 512
- U_8 internalBuffer[INTERNAL_SEND_BUFFER_MAX];
-
- if (count > INTERNAL_SEND_BUFFER_MAX) {
- message = hymem_allocate_memory(count);
- if (message == NULL) {
- throwNewOutOfMemoryError(env, "");
- return 0;
- }
- } else {
- message = (jbyte *) internalBuffer;
- }
-
- (*env)->GetByteArrayRegion(env, data, offset, count, message);
- while (sent < count) {
- socketP = getJavaIoFileDescriptorContentsAsAPointer(env, fileDescriptor);
-
- if (!hysock_socketIsValid(socketP)) {
- if (((U_8 *) message) != internalBuffer) {
- hymem_free_memory(message);
- }
-
- throwJavaNetSocketException(env,
- sent == 0 ?
- HYPORT_ERROR_SOCKET_BADSOCKET :
- HYPORT_ERROR_SOCKET_INTERRUPTED);
- return (jint) 0;
- }
-
- result =
- hysock_write(socketP, (U_8 *) message + sent, (I_32) count - sent,
- HYSOCK_NOFLAGS);
- if (result < 0) {
- break;
- }
- sent += result;
- }
-
- if (((U_8 *) message) != internalBuffer) {
- hymem_free_memory(message);
- }
-#undef INTERNAL_MAX
-
- /**
- * We should always throw an exception if all the data cannot be sent because Java methods
- * assume all the data will be sent or an error occurs.
- */
- if (result < 0) {
- throwJavaNetSocketException(env, result);
- return (jint) 0;
- } else {
- return (jint) sent;
- }
-}
/*
* Class: org_apache_harmony_luni_platform_OSNetworkSystem
- * Method: shutdownInputImpl
+ * Method: shutdownInput
* Signature: (Ljava/io/FileDescriptor;)V
*/
JNIEXPORT void JNICALL
-Java_org_apache_harmony_luni_platform_OSNetworkSystem_shutdownInputImpl
- (JNIEnv * env, jclass thisClz, jobject fileDescriptor)
+Java_org_apache_harmony_luni_platform_OSNetworkSystem_shutdownInput
+ (JNIEnv * env, jobject thiz, jobject fd)
{
PORT_ACCESS_FROM_ENV(env);
I_32 result;
hysocket_t socketP;
- socketP =
- (hysocket_t) getJavaIoFileDescriptorContentsAsAPointer(env,
- fileDescriptor);
+ socketP = (hysocket_t) getJavaIoFileDescriptorContentsAsAPointer(env, fd);
if (!hysock_socketIsValid(socketP)) {
throwJavaNetSocketException(env, HYPORT_ERROR_SOCKET_BADSOCKET);
return;
@@ -1859,21 +1630,21 @@
}
}
+
/*
* Class: org_apache_harmony_luni_platform_OSNetworkSystem
- * Method: shutdownOutputImpl
+ * Method: shutdownOutput
* Signature: (Ljava/io/FileDescriptor;)V
*/
JNIEXPORT void JNICALL
-Java_org_apache_harmony_luni_platform_OSNetworkSystem_shutdownOutputImpl
- (JNIEnv * env, jclass thisClz, jobject fileDescriptor)
+Java_org_apache_harmony_luni_platform_OSNetworkSystem_shutdownOutput
+ (JNIEnv * env, jobject thiz, jobject fd)
{
PORT_ACCESS_FROM_ENV(env);
I_32 result;
hysocket_t socketP;
- socketP =
- (hysocket_t) getJavaIoFileDescriptorContentsAsAPointer(env, fileDescriptor);
+ socketP = (hysocket_t) getJavaIoFileDescriptorContentsAsAPointer(env, fd);
if (!hysock_socketIsValid(socketP)) {
throwJavaNetSocketException(env, HYPORT_ERROR_SOCKET_BADSOCKET);
return;
@@ -1885,15 +1656,16 @@
}
}
+
/*
* Class: org_apache_harmony_luni_platform_OSNetworkSystem
- * Method: acceptStreamSocketImpl
+ * Method: acceptStreamSocket
* Signature: (Ljava/io/FileDescriptor;Ljava/net/SocketImpl;Ljava/io/FileDescriptor;I)V
*/
JNIEXPORT void JNICALL
-Java_org_apache_harmony_luni_platform_OSNetworkSystem_acceptStreamSocketImpl
- (JNIEnv * env, jclass thisClz, jobject fileDescriptorServer,
- jobject socketImpl, jobject fileDescriptorSocketImpl, jint timeout)
+Java_org_apache_harmony_luni_platform_OSNetworkSystem_acceptStreamSocket
+ (JNIEnv * env, jobject thiz, jobject fdServer, jobject socketImpl,
+ jobject fdSocketImpl, jint timeout)
{
PORT_ACCESS_FROM_ENV(env);
I_32 result;
@@ -1901,12 +1673,12 @@
hysockaddr_struct sockaddrP;
jbyte nlocalAddrBytes[HYSOCK_INADDR6_LEN];
- result = pollSelectRead(env, fileDescriptorServer, timeout, TRUE);
- if (0 > result)
+ result = pollSelectRead(env, fdServer, timeout, TRUE);
+ if (0 > result) {
return;
+ }
- socketS =
- getJavaIoFileDescriptorContentsAsAPointer(env, fileDescriptorServer);
+ socketS = getJavaIoFileDescriptorContentsAsAPointer(env, fdServer);
if (!hysock_socketIsValid(socketS)) {
throwJavaNetSocketException(env, HYPORT_ERROR_SOCKET_BADSOCKET);
return;
@@ -1919,37 +1691,21 @@
result = hysock_accept(socketS, &sockaddrP, &socketNew);
if (0 != result) {
throwJavaNetBindException(env, result);
- } else {
- updateSocket(env, &sockaddrP, socketNew, socketImpl,
- fileDescriptorSocketImpl);
+ return;
}
-}
-/*
- * Class: org_apache_harmony_luni_platform_OSNetworkSystem
- * Method: createStreamSocketImpl
- * Signature: (Ljava/io/FileDescriptor;Z)V
- */
-JNIEXPORT void JNICALL
-Java_org_apache_harmony_luni_platform_OSNetworkSystem_createStreamSocketImpl
- (JNIEnv * env, jclass thisClz, jobject thisObjFD, jboolean preferIPv4Stack)
-{
- hysocket_t socketP;
- createSocket(env, thisObjFD, HYSOCK_STREAM, preferIPv4Stack);
- socketP =
- (hysocket_t) getJavaIoFileDescriptorContentsAsAPointer(env, thisObjFD);
- setPlatformBindOptions(env, socketP);
+ updateSocket(env, &sockaddrP, socketNew, socketImpl, fdSocketImpl);
}
/*
* Class: org_apache_harmony_luni_platform_OSNetworkSystem
- * Method: getSocketLocalAddressImpl
+ * Method: getSocketLocalAddress
* Signature: (Ljava/io/FileDescriptor;Z)Ljava/net/InetAddress;
*/
JNIEXPORT jobject JNICALL
-Java_org_apache_harmony_luni_platform_OSNetworkSystem_getSocketLocalAddressImpl
- (JNIEnv * env, jclass thisClz, jobject fileDescriptor,
+Java_org_apache_harmony_luni_platform_OSNetworkSystem_getSocketLocalAddress
+ (JNIEnv * env, jobject thiz, jobject fileDescriptor,
jboolean preferIPv6Addresses)
{
PORT_ACCESS_FROM_ENV(env);
@@ -1976,12 +1732,12 @@
/*
* Class: org_apache_harmony_luni_platform_OSNetworkSystem
- * Method: getSocketLocalPortImpl
+ * Method: getSocketLocalPort
* Signature: (Ljava/io/FileDescriptor;Z)I
*/
JNIEXPORT jint JNICALL
-Java_org_apache_harmony_luni_platform_OSNetworkSystem_getSocketLocalPortImpl
- (JNIEnv * env, jclass thisClz, jobject fileDescriptor,
+Java_org_apache_harmony_luni_platform_OSNetworkSystem_getSocketLocalPort
+ (JNIEnv * env, jobject thiz, jobject fileDescriptor,
jboolean preferIPv6Addresses)
{
PORT_ACCESS_FROM_ENV(env);
@@ -1992,22 +1748,23 @@
result =
netGetSockAddr(env, fileDescriptor, &sockaddrP, preferIPv6Addresses);
if (0 != result) {
- return (jint) 0; /* The java spec does not indicate any exceptions on this call */
- } else {
- nPort = hysock_sockaddr_port(&sockaddrP);
- hPort = hysock_ntohs(nPort);
- return (jint) hPort;
+ /* The java spec does not indicate any exceptions on this call */
+ return (jint) 0;
}
+
+ nPort = hysock_sockaddr_port(&sockaddrP);
+ hPort = hysock_ntohs(nPort);
+ return (jint) hPort;
}
/*
* Class: org_apache_harmony_luni_platform_OSNetworkSystem
- * Method: getSocketOptionImpl
+ * Method: getSocketOption
* Signature: (Ljava/io/FileDescriptor;I)Ljava/lang/Object;
*/
JNIEXPORT jobject JNICALL
-Java_org_apache_harmony_luni_platform_OSNetworkSystem_getSocketOptionImpl
- (JNIEnv * env, jclass thisClz, jobject aFileDescriptor, jint anOption)
+Java_org_apache_harmony_luni_platform_OSNetworkSystem_getSocketOption
+ (JNIEnv * env, jobject thiz, jobject aFileDescriptor, jint anOption)
{
PORT_ACCESS_FROM_ENV(env);
hysocket_t hysocketP;
@@ -2062,11 +1819,11 @@
/*
* Class: org_apache_harmony_luni_platform_OSNetworkSystem
- * Method: setSocketOptionImpl
+ * Method: setSocketOption
* Signature: (Ljava/io/FileDescriptor;ILjava/lang/Object;)V
*/
JNIEXPORT void JNICALL
-Java_org_apache_harmony_luni_platform_OSNetworkSystem_setSocketOptionImpl
+Java_org_apache_harmony_luni_platform_OSNetworkSystem_setSocketOption
(JNIEnv * env, jclass thisClz, jobject aFileDescriptor, jint anOption,
jobject aValue)
{
@@ -2157,8 +1914,8 @@
* Signature: ()I
*/
JNIEXPORT jint JNICALL
- Java_org_apache_harmony_luni_platform_OSNetworkSystem_getSocketFlagsImpl
- (JNIEnv * env, jclass thisClz)
+ Java_org_apache_harmony_luni_platform_OSNetworkSystem_getSocketFlags
+ (JNIEnv * env, jobject thiz)
{
/* Return the flags indicating the socket state to save in the class library. */
/* 1 - Multicast interface */
@@ -2171,12 +1928,12 @@
/*
* Class: org_apache_harmony_luni_platform_OSNetworkSystem
- * Method: socketCloseImpl
+ * Method: socketClose
* Signature: (Ljava/io/FileDescriptor;)V
*/
JNIEXPORT void JNICALL
-Java_org_apache_harmony_luni_platform_OSNetworkSystem_socketCloseImpl
- (JNIEnv * env, jclass thisClz, jobject fileDescriptor)
+Java_org_apache_harmony_luni_platform_OSNetworkSystem_socketClose
+ (JNIEnv * env, jobject thiz, jobject fileDescriptor)
{
PORT_ACCESS_FROM_ENV(env);
hysocket_t socketP;
@@ -2192,8 +1949,8 @@
}
JNIEXPORT jobject JNICALL
-Java_org_apache_harmony_luni_platform_OSNetworkSystem_getHostByAddrImpl
- (JNIEnv * env, jclass clazz, jbyteArray addr)
+Java_org_apache_harmony_luni_platform_OSNetworkSystem_getHostByAddr
+ (JNIEnv * env, jobject thiz, jbyteArray addr)
{
PORT_ACCESS_FROM_ENV(env);
I_32 result = 0;
@@ -2226,8 +1983,8 @@
}
JNIEXPORT jobject JNICALL
-Java_org_apache_harmony_luni_platform_OSNetworkSystem_getHostByNameImpl
- (JNIEnv * env, jclass clazz, jstring aName, jboolean preferIPv6Addresses)
+Java_org_apache_harmony_luni_platform_OSNetworkSystem_getHostByName
+ (JNIEnv * env, jobject thiz, jstring aName, jboolean preferIPv6Addresses)
{
PORT_ACCESS_FROM_ENV(env);
I_32 result;
@@ -2297,12 +2054,12 @@
/*
* Class: org_apache_harmony_luni_platform_OSNetworkSystem
- * Method: setInetAddressImpl
+ * Method: setInetAddress
* Signature: (Ljava/net/InetAddress;[B)V
*/
JNIEXPORT void JNICALL
- Java_org_apache_harmony_luni_platform_OSNetworkSystem_setInetAddressImpl
- (JNIEnv * env, jobject thisClz, jobject sender, jbyteArray address)
+Java_org_apache_harmony_luni_platform_OSNetworkSystem_setInetAddress
+ (JNIEnv * env, jobject thiz, jobject sender, jbyteArray address)
{
I_8 *passAddr = NULL;
jbyteArray addr_array =
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/OSNetworkSystem.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/OSNetworkSystem.h?rev=727683&r1=727682&r2=727683&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/OSNetworkSystem.h (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/OSNetworkSystem.h Thu Dec 18 01:46:12 2008
@@ -61,402 +61,401 @@
#ifdef __cplusplus
extern "C" {
#endif
+
/*
- * Class: org_apache_harmony_luni_platform_OSNetworkSystem
- * Method: oneTimeInitializationDatagram
- * Signature: (Z)V
+ * Class: org.apache.harmony.luni.platform.OSNetworkSystem
+ * Method: accept
+ * Signature: (Ljava/io/FileDescriptor;Ljava/net/SocketImpl;Ljava/io/FileDescriptor;I)V
+ * Throws: java.io.IOException
*/
-JNIEXPORT void JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_oneTimeInitializationDatagram
- (JNIEnv *, jclass, jboolean);
+JNIEXPORT void JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_accept
+ (JNIEnv *, jobject, jobject, jobject, jobject, jint);
/*
- * Class: org_apache_harmony_luni_platform_OSNetworkSystem
- * Method: oneTimeInitializationSocket
- * Signature: (Z)V
+ * Class: org.apache.harmony.luni.platform.OSNetworkSystem
+ * Method: acceptStreamSocket
+ * Signature: (Ljava/io/FileDescriptor;Ljava/net/SocketImpl;Ljava/io/FileDescriptor;I)V
+ * Throws: java.io.IOException
*/
-JNIEXPORT void JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_oneTimeInitializationSocket
- (JNIEnv *, jclass, jboolean);
+JNIEXPORT void JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_acceptStreamSocket
+ (JNIEnv *, jobject, jobject, jobject, jobject, jint);
/*
- * Class: org_apache_harmony_luni_platform_OSNetworkSystem
- * Method: createSocketImpl
- * Signature: (Ljava/io/FileDescriptor;Z)V
+ * Class: org.apache.harmony.luni.platform.OSNetworkSystem
+ * Method: availableStream
+ * Signature: (Ljava/io/FileDescriptor;)I
+ * Throws: java.net.SocketException
*/
-JNIEXPORT void JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_createSocketImpl
- (JNIEnv *, jclass, jobject, jboolean);
+JNIEXPORT jint JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_availableStream
+ (JNIEnv *, jobject, jobject);
/*
- * Class: org_apache_harmony_luni_platform_OSNetworkSystem
- * Method: createDatagramSocketImpl
- * Signature: (Ljava/io/FileDescriptor;Z)V
+ * Class: org.apache.harmony.luni.platform.OSNetworkSystem
+ * Method: bind
+ * Signature: (Ljava/io/FileDescriptor;Ljava/net/InetAddress;I)V
+ * Throws: java.net.SocketException
*/
-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_bind
+ (JNIEnv *, jobject, jobject, jobject, jint);
/*
- * Class: org_apache_harmony_luni_platform_OSNetworkSystem
- * Method: readSocketImpl
- * Signature: (Ljava/io/FileDescriptor;[BIII)I
+ * Class: org.apache.harmony.luni.platform.OSNetworkSystem
+ * Method: connect
+ * Signature: (Ljava/io/FileDescriptor;ILjava/net/InetAddress;I)I
+ * Throws: java.io.IOException
*/
-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_connect
+ (JNIEnv *, jobject, jobject, jint, jobject, jint);
/*
- * Class: org_apache_harmony_luni_platform_OSNetworkSystem
- * Method: readSocketDirectImpl
- * Signature: (Ljava/io/FileDescriptor;JII)I
+ * Class: org.apache.harmony.luni.platform.OSNetworkSystem
+ * Method: connectDatagram
+ * Signature: (Ljava/io/FileDescriptor;IILjava/net/InetAddress;)V
+ * Throws: java.net.SocketException
*/
-JNIEXPORT jint JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_readSocketDirectImpl
- (JNIEnv *, jclass, jobject, jlong, jint, jint);
+JNIEXPORT void JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_connectDatagram
+ (JNIEnv *, jobject, jobject, jint, jint, jobject);
/*
- * Class: org_apache_harmony_luni_platform_OSNetworkSystem
- * Method: writeSocketImpl
- * Signature: (Ljava/io/FileDescriptor;[BII)I
+ * Class: org.apache.harmony.luni.platform.OSNetworkSystem
+ * Method: connectStreamWithTimeoutSocket
+ * Signature: (Ljava/io/FileDescriptor;IIILjava/net/InetAddress;)V
+ * Throws: java.io.IOException
*/
-JNIEXPORT jint JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_writeSocketImpl
- (JNIEnv *, jclass, jobject, jbyteArray, jint, jint);
+JNIEXPORT void JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_connectStreamWithTimeoutSocket
+ (JNIEnv *, jobject, jobject, jint, jint, jint, jobject);
/*
- * Class: org_apache_harmony_luni_platform_OSNetworkSystem
- * Method: writeSocketDirectImpl
- * Signature: (Ljava/io/FileDescriptor;JI)I
+ * Class: org.apache.harmony.luni.platform.OSNetworkSystem
+ * Method: connectWithTimeout
+ * Signature: (Ljava/io/FileDescriptor;IILjava/net/InetAddress;IILjava/lang/Long;)I
+ * Throws: java.io.IOException
*/
-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_connectWithTimeout
+ (JNIEnv *, jobject, jobject, jint, jint, jobject, jint, jint, jobject);
/*
- * Class: org_apache_harmony_luni_platform_OSNetworkSystem
- * Method: setNonBlockingImpl
+ * Class: org.apache.harmony.luni.platform.OSNetworkSystem
+ * Method: createDatagramSocket
* Signature: (Ljava/io/FileDescriptor;Z)V
+ * Throws: java.net.SocketException
*/
-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_createDatagramSocket
+ (JNIEnv *, jobject, jobject, jboolean);
/*
- * Class: org_apache_harmony_luni_platform_OSNetworkSystem
- * Method: connectSocketImpl
- * Signature: (Ljava/io/FileDescriptor;ILjava/net/InetAddress;I)I
+ * Class: org.apache.harmony.luni.platform.OSNetworkSystem
+ * Method: createStreamSocket
+ * Signature: (Ljava/io/FileDescriptor;Z)V
+ * Throws: java.net.SocketException
*/
-JNIEXPORT jint JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_connectSocketImpl
- (JNIEnv *, jclass, jobject, jint, jobject, jint);
+JNIEXPORT void JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_createStreamSocket
+ (JNIEnv *, jobject, jobject, jboolean);
/*
- * Class: org_apache_harmony_luni_platform_OSNetworkSystem
- * Method: connectWithTimeoutSocketImpl
- * Signature: (Ljava/io/FileDescriptor;IILjava/net/InetAddress;IILjava/lang/Long;)I
+ * Class: org.apache.harmony.luni.platform.OSNetworkSystem
+ * Method: disconnectDatagram
+ * Signature: (Ljava/io/FileDescriptor;)V
+ * Throws: java.net.SocketException
*/
-JNIEXPORT jint JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_connectWithTimeoutSocketImpl
- (JNIEnv *, jclass, jobject, jint, jint, jobject, jint, jint, jobject);
+JNIEXPORT void JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_disconnectDatagram
+ (JNIEnv *, jobject, jobject);
/*
- * Class: org_apache_harmony_luni_platform_OSNetworkSystem
- * Method: connectStreamWithTimeoutSocketImpl
- * Signature: (Ljava/io/FileDescriptor;IIILjava/net/InetAddress;)V
+ * Class: org.apache.harmony.luni.platform.OSNetworkSystem
+ * Method: getHostByAddr
+ * Signature: ([B)Ljava/net/InetAddress;
+ * Throws: java.net.UnknownHostException
*/
-JNIEXPORT void JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_connectStreamWithTimeoutSocketImpl
- (JNIEnv *, jclass, jobject, jint, jint, jint, jobject);
+JNIEXPORT jobject JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_getHostByAddr
+ (JNIEnv *, jobject, jbyteArray);
/*
- * Class: org_apache_harmony_luni_platform_OSNetworkSystem
- * Method: socketBindImpl
- * Signature: (Ljava/io/FileDescriptor;ILjava/net/InetAddress;)V
+ * Class: org.apache.harmony.luni.platform.OSNetworkSystem
+ * Method: getHostByName
+ * Signature: (Ljava/lang/String;Z)Ljava/net/InetAddress;
+ * Throws: java.net.UnknownHostException
*/
-JNIEXPORT void JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_socketBindImpl
- (JNIEnv *, jclass, jobject, jint, jobject);
+JNIEXPORT jobject JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_getHostByName
+ (JNIEnv *, jobject, jstring, jboolean);
/*
- * Class: org_apache_harmony_luni_platform_OSNetworkSystem
- * Method: listenStreamSocketImpl
- * Signature: (Ljava/io/FileDescriptor;I)V
+ * Class: org.apache.harmony.luni.platform.OSNetworkSystem
+ * Method: getSocketFlags
+ * Signature: ()I
*/
-JNIEXPORT void JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_listenStreamSocketImpl
- (JNIEnv *, jclass, jobject, jint);
+JNIEXPORT jint JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_getSocketFlags
+ (JNIEnv *, jobject);
/*
- * Class: org_apache_harmony_luni_platform_OSNetworkSystem
- * Method: availableStreamImpl
- * Signature: (Ljava/io/FileDescriptor;)I
+ * Class: org.apache.harmony.luni.platform.OSNetworkSystem
+ * Method: getSocketLocalAddress
+ * Signature: (Ljava/io/FileDescriptor;Z)Ljava/net/InetAddress;
*/
-JNIEXPORT jint JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_availableStreamImpl
- (JNIEnv *, jclass, jobject);
+JNIEXPORT jobject JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_getSocketLocalAddress
+ (JNIEnv *, jobject, jobject, jboolean);
/*
- * Class: org_apache_harmony_luni_platform_OSNetworkSystem
- * Method: acceptSocketImpl
- * Signature: (Ljava/io/FileDescriptor;Ljava/net/SocketImpl;Ljava/io/FileDescriptor;I)V
+ * Class: org.apache.harmony.luni.platform.OSNetworkSystem
+ * Method: getSocketLocalPort
+ * Signature: (Ljava/io/FileDescriptor;Z)I
*/
-JNIEXPORT void JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_acceptSocketImpl
- (JNIEnv *, jclass, jobject, jobject, jobject, jint);
+JNIEXPORT jint JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_getSocketLocalPort
+ (JNIEnv *, jobject, jobject, jboolean);
/*
- * Class: org_apache_harmony_luni_platform_OSNetworkSystem
- * Method: supportsUrgentDataImpl
- * Signature: (Ljava/io/FileDescriptor;)Z
+ * Class: org.apache.harmony.luni.platform.OSNetworkSystem
+ * Method: getSocketOption
+ * Signature: (Ljava/io/FileDescriptor;I)Ljava/lang/Object;
+ * Throws: java.net.SocketException
*/
-JNIEXPORT jboolean JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_supportsUrgentDataImpl
- (JNIEnv *, jclass, jobject);
+JNIEXPORT jobject JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_getSocketOption
+ (JNIEnv *, jobject, jobject, jint);
/*
- * Class: org_apache_harmony_luni_platform_OSNetworkSystem
- * Method: sendUrgentDataImpl
- * Signature: (Ljava/io/FileDescriptor;B)V
+ * Class: org.apache.harmony.luni.platform.OSNetworkSystem
+ * Method: inheritedChannel
+ * Signature: ()Ljava/nio/channels/Channel;
*/
-JNIEXPORT void JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_sendUrgentDataImpl
- (JNIEnv *, jclass, jobject, jbyte);
+JNIEXPORT jobject JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_inheritedChannel
+ (JNIEnv *, jobject);
/*
- * Class: org_apache_harmony_luni_platform_OSNetworkSystem
- * Method: connectDatagramImpl2
- * Signature: (Ljava/io/FileDescriptor;IILjava/net/InetAddress;)V
+ * Class: org.apache.harmony.luni.platform.OSNetworkSystem
+ * Method: isReachableByICMPImpl
+ * Signature: (Ljava/net/InetAddress;Ljava/net/InetAddress;II)I
*/
-JNIEXPORT void JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_connectDatagramImpl2
- (JNIEnv *, jclass, jobject, jint, jint, jobject);
+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: disconnectDatagramImpl
- * Signature: (Ljava/io/FileDescriptor;)V
+ * Class: org.apache.harmony.luni.platform.OSNetworkSystem
+ * Method: listenStreamSocket
+ * Signature: (Ljava/io/FileDescriptor;I)V
+ * Throws: java.net.SocketException
*/
-JNIEXPORT void JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_disconnectDatagramImpl
- (JNIEnv *, jclass, jobject);
+JNIEXPORT void JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_listenStreamSocket
+ (JNIEnv *, jobject, jobject, jint);
/*
- * Class: org_apache_harmony_luni_platform_OSNetworkSystem
- * Method: socketBindImpl2
- * Signature: (Ljava/io/FileDescriptor;IZLjava/net/InetAddress;)Z
+ * Class: org.apache.harmony.luni.platform.OSNetworkSystem
+ * Method: oneTimeInitializationImpl
+ * Signature: (Z)V
*/
-JNIEXPORT jboolean JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_socketBindImpl2
- (JNIEnv *, jclass, jobject, jint, jboolean, jobject);
+JNIEXPORT void JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_oneTimeInitializationImpl
+ (JNIEnv *, jobject, jboolean);
/*
- * Class: org_apache_harmony_luni_platform_OSNetworkSystem
- * Method: peekDatagramImpl
+ * Class: org.apache.harmony.luni.platform.OSNetworkSystem
+ * Method: peekDatagram
* Signature: (Ljava/io/FileDescriptor;Ljava/net/InetAddress;I)I
+ * Throws: java.io.IOException
*/
-JNIEXPORT jint JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_peekDatagramImpl
- (JNIEnv *, jclass, jobject, jobject, jint);
+JNIEXPORT jint JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_peekDatagram
+ (JNIEnv *, jobject, jobject, jobject, jint);
/*
- * Class: org_apache_harmony_luni_platform_OSNetworkSystem
- * Method: receiveDatagramImpl
- * Signature: (Ljava/io/FileDescriptor;Ljava/net/DatagramPacket;[BIIIZ)I
+ * Class: org.apache.harmony.luni.platform.OSNetworkSystem
+ * Method: read
+ * Signature: (Ljava/io/FileDescriptor;[BIII)I
+ * Throws: java.io.IOException
*/
-JNIEXPORT jint JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_receiveDatagramImpl
- (JNIEnv *, jclass, jobject, jobject, jbyteArray, jint, jint, jint, jboolean);
+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: receiveDatagramDirectImpl
- * Signature: (Ljava/io/FileDescriptor;Ljava/net/DatagramPacket;JIIIZ)I
+ * Class: org.apache.harmony.luni.platform.OSNetworkSystem
+ * Method: readDirect
+ * Signature: (Ljava/io/FileDescriptor;JII)I
+ * Throws: java.io.IOException
*/
-JNIEXPORT jint JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_receiveDatagramDirectImpl
- (JNIEnv *, jclass, jobject, jobject, jlong, jint, jint, jint, jboolean);
-
+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: recvConnectedDatagramImpl
+ * Class: org.apache.harmony.luni.platform.OSNetworkSystem
+ * Method: receiveDatagram
* Signature: (Ljava/io/FileDescriptor;Ljava/net/DatagramPacket;[BIIIZ)I
+ * Throws: java.io.IOException
*/
-JNIEXPORT jint JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_recvConnectedDatagramImpl
- (JNIEnv *, jclass, jobject, jobject, jbyteArray, jint, jint, jint, jboolean);
+JNIEXPORT jint JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_receiveDatagram
+ (JNIEnv *, jobject, jobject, jobject, jbyteArray, jint, jint, jint, jboolean);
/*
- * Class: org_apache_harmony_luni_platform_OSNetworkSystem
- * Method: recvConnectedDatagramDirectImpl
+ * Class: org.apache.harmony.luni.platform.OSNetworkSystem
+ * Method: receiveDatagramDirect
* Signature: (Ljava/io/FileDescriptor;Ljava/net/DatagramPacket;JIIIZ)I
+ * Throws: java.io.IOException
*/
-JNIEXPORT jint JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_recvConnectedDatagramDirectImpl
- (JNIEnv *, jclass, jobject, jobject, jlong, jint, jint, jint, jboolean);
-
+JNIEXPORT jint JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_receiveDatagramDirect
+ (JNIEnv *, jobject, jobject, jobject, jlong, jint, jint, jint, jboolean);
/*
- * Class: org_apache_harmony_luni_platform_OSNetworkSystem
- * Method: sendDatagramImpl
- * Signature: (Ljava/io/FileDescriptor;[BIIIZILjava/net/InetAddress;)I
+ * Class: org.apache.harmony.luni.platform.OSNetworkSystem
+ * Method: receiveStream
+ * Signature: (Ljava/io/FileDescriptor;[BIII)I
+ * Throws: java.io.IOException
*/
-JNIEXPORT jint JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_sendDatagramImpl
- (JNIEnv *, jclass, jobject, jbyteArray, jint, jint, jint, jboolean, jint, jobject);
+JNIEXPORT jint JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_receiveStream
+ (JNIEnv *, jobject, jobject, jbyteArray, jint, jint, jint);
/*
- * Class: org_apache_harmony_luni_platform_OSNetworkSystem
- * Method: sendDatagramDirectImpl
- * Signature: (Ljava/io/FileDescriptor;JIIIZILjava/net/InetAddress;)I
+ * Class: org.apache.harmony.luni.platform.OSNetworkSystem
+ * Method: recvConnectedDatagram
+ * Signature: (Ljava/io/FileDescriptor;Ljava/net/DatagramPacket;[BIIIZ)I
+ * Throws: java.io.IOException
*/
-JNIEXPORT jint JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_sendDatagramDirectImpl
- (JNIEnv *, jclass, jobject, jlong, jint, jint, jint, jboolean, jint, jobject);
+JNIEXPORT jint JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_recvConnectedDatagram
+ (JNIEnv *, jobject, jobject, jobject, jbyteArray, jint, jint, jint, jboolean);
/*
- * Class: org_apache_harmony_luni_platform_OSNetworkSystem
- * Method: sendConnectedDatagramImpl
- * Signature: (Ljava/io/FileDescriptor;[BIIZ)I
+ * Class: org.apache.harmony.luni.platform.OSNetworkSystem
+ * Method: recvConnectedDatagramDirect
+ * Signature: (Ljava/io/FileDescriptor;Ljava/net/DatagramPacket;JIIIZ)I
+ * Throws: java.io.IOException
*/
-JNIEXPORT jint JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_sendConnectedDatagramImpl
- (JNIEnv *, jclass, jobject, jbyteArray, jint, jint, jboolean);
+JNIEXPORT jint JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_recvConnectedDatagramDirect
+ (JNIEnv *, jobject, jobject, jobject, jlong, jint, jint, jint, jboolean);
/*
- * Class: org_apache_harmony_luni_platform_OSNetworkSystem
- * Method: sendConnectedDatagramDirectImpl
- * Signature: (Ljava/io/FileDescriptor;JIIZ)I
+ * Class: org.apache.harmony.luni.platform.OSNetworkSystem
+ * Method: selectImpl
+ * Signature: ([Ljava/io/FileDescriptor;[Ljava/io/FileDescriptor;II[IJ)I
*/
-JNIEXPORT jint JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_sendConnectedDatagramDirectImpl
- (JNIEnv *, jclass, jobject, jlong, jint, jint, jboolean);
+JNIEXPORT jint JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_selectImpl
+ (JNIEnv *, jobject, jobjectArray, jobjectArray, jint, jint, jintArray, jlong);
/*
- * Class: org_apache_harmony_luni_platform_OSNetworkSystem
- * Method: createServerStreamSocketImpl
- * Signature: (Ljava/io/FileDescriptor;Z)V
+ * Class: org.apache.harmony.luni.platform.OSNetworkSystem
+ * Method: sendConnectedDatagram
+ * Signature: (Ljava/io/FileDescriptor;[BIIZ)I
+ * Throws: java.io.IOException
*/
-JNIEXPORT void JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_createServerStreamSocketImpl
- (JNIEnv *, jclass, jobject, jboolean);
+JNIEXPORT jint JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_sendConnectedDatagram
+ (JNIEnv *, jobject, jobject, jbyteArray, jint, jint, jboolean);
/*
- * Class: org_apache_harmony_luni_platform_OSNetworkSystem
- * Method: createMulticastSocketImpl
- * Signature: (Ljava/io/FileDescriptor;Z)V
+ * Class: org.apache.harmony.luni.platform.OSNetworkSystem
+ * Method: sendConnectedDatagramDirect
+ * Signature: (Ljava/io/FileDescriptor;JIIZ)I
+ * Throws: java.io.IOException
*/
-JNIEXPORT void JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_createMulticastSocketImpl
- (JNIEnv *, jclass, jobject, jboolean);
+JNIEXPORT jint JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_sendConnectedDatagramDirect
+ (JNIEnv *, jobject, jobject, jlong, jint, jint, jboolean);
/*
- * Class: org_apache_harmony_luni_platform_OSNetworkSystem
- * Method: receiveStreamImpl
- * Signature: (Ljava/io/FileDescriptor;[BIII)I
+ * Class: org.apache.harmony.luni.platform.OSNetworkSystem
+ * Method: sendDatagram
+ * Signature: (Ljava/io/FileDescriptor;[BIIIZILjava/net/InetAddress;)I
+ * Throws: java.io.IOException
*/
-JNIEXPORT jint JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_receiveStreamImpl
- (JNIEnv *, jclass, jobject, jbyteArray, jint, jint, jint);
+JNIEXPORT jint JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_sendDatagram
+ (JNIEnv *, jobject, jobject, jbyteArray, jint, jint, jint, jboolean, jint, jobject);
/*
- * Class: org_apache_harmony_luni_platform_OSNetworkSystem
- * Method: sendStreamImpl
- * Signature: (Ljava/io/FileDescriptor;[BII)I
+ * Class: org.apache.harmony.luni.platform.OSNetworkSystem
+ * Method: sendDatagram2
+ * Signature: (Ljava/io/FileDescriptor;[BIIILjava/net/InetAddress;)I
+ * Throws: java.io.IOException
*/
-JNIEXPORT jint JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_sendStreamImpl
- (JNIEnv *, jclass, jobject, jbyteArray, jint, jint);
+JNIEXPORT jint JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_sendDatagram2
+ (JNIEnv *, jobject, jobject, jbyteArray, jint, jint, jint, jobject);
/*
- * Class: org_apache_harmony_luni_platform_OSNetworkSystem
- * Method: shutdownInputImpl
- * Signature: (Ljava/io/FileDescriptor;)V
+ * Class: org.apache.harmony.luni.platform.OSNetworkSystem
+ * Method: sendDatagramDirect
+ * Signature: (Ljava/io/FileDescriptor;JIIIZILjava/net/InetAddress;)I
+ * Throws: java.io.IOException
*/
-JNIEXPORT void JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_shutdownInputImpl
- (JNIEnv *, jobject, jobject);
+JNIEXPORT jint JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_sendDatagramDirect
+ (JNIEnv *, jobject, jobject, jlong, jint, jint, jint, jboolean, jint, jobject);
/*
- * Class: org_apache_harmony_luni_platform_OSNetworkSystem
- * Method: shutdownOutputImpl
- * Signature: (Ljava/io/FileDescriptor;)V
+ * Class: org.apache.harmony.luni.platform.OSNetworkSystem
+ * Method: sendUrgentData
+ * Signature: (Ljava/io/FileDescriptor;B)V
*/
-JNIEXPORT void JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_shutdownOutputImpl
- (JNIEnv *, jobject, jobject);
+JNIEXPORT void JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_sendUrgentData
+ (JNIEnv *, jobject, jobject, jbyte);
/*
- * Class: org_apache_harmony_luni_platform_OSNetworkSystem
- * Method: acceptStreamSocketImpl
- * Signature: (Ljava/io/FileDescriptor;Ljava/net/SocketImpl;Ljava/io/FileDescriptor;I)V
+ * Class: org.apache.harmony.luni.platform.OSNetworkSystem
+ * Method: setInetAddress
+ * Signature: (Ljava/net/InetAddress;[B)V
*/
-JNIEXPORT void JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_acceptStreamSocketImpl
- (JNIEnv *, jclass, jobject, jobject, jobject, jint);
+JNIEXPORT void JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_setInetAddress
+ (JNIEnv *, jobject, jobject, jbyteArray);
/*
- * Class: org_apache_harmony_luni_platform_OSNetworkSystem
- * Method: createStreamSocketImpl
+ * Class: org.apache.harmony.luni.platform.OSNetworkSystem
+ * Method: setNonBlocking
* Signature: (Ljava/io/FileDescriptor;Z)V
+ * Throws: java.io.IOException
*/
-JNIEXPORT void JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_createStreamSocketImpl
- (JNIEnv *, jclass, jobject, jboolean);
-
-/*
- * Class: org_apache_harmony_luni_platform_OSNetworkSystem
- * Method: sendDatagramImpl2
- * Signature: (Ljava/io/FileDescriptor;[BIIILjava/net/InetAddress;)I
- */
-JNIEXPORT jint JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_sendDatagramImpl2
- (JNIEnv *, jclass, jobject, jbyteArray, jint, jint, jint, jobject);
+JNIEXPORT void JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_setNonBlocking
+ (JNIEnv *, jobject, jobject, jboolean);
/*
- * Class: org_apache_harmony_luni_platform_OSNetworkSystem
- * Method: selectImpl
- * Signature: ([Ljava/io/FileDescriptor;[Ljava/io/FileDescriptor;II[IJ)I
- */
-JNIEXPORT jint JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_selectImpl
- (JNIEnv *, jclass, jobjectArray, jobjectArray, jint, jint, jintArray, jlong);
-
- /*
- * Class: org_apache_harmony_luni_platform_OSNetworkSystem
- * Method: getSocketLocalAddressImpl
- * Signature: (Ljava/io/FileDescriptor;Z)Ljava/net/InetAddress;
- */
-JNIEXPORT jobject JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_getSocketLocalAddressImpl
- (JNIEnv *, jclass, jobject, jboolean);
-
-/*
- * Class: org_apache_harmony_luni_platform_OSNetworkSystem
- * Method: getSocketLocalPortImpl
- * Signature: (Ljava/io/FileDescriptor;Z)I
- */
-JNIEXPORT jint JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_getSocketLocalPortImpl
- (JNIEnv *, jclass, jobject, jboolean);
-
-/*
- * Class: org_apache_harmony_luni_platform_OSNetworkSystem
- * Method: getSocketOptionImpl
- * Signature: (Ljava/io/FileDescriptor;I)Ljava/lang/Object;
+ * Class: org.apache.harmony.luni.platform.OSNetworkSystem
+ * Method: setSocketOption
+ * Signature: (Ljava/io/FileDescriptor;ILjava/lang/Object;)V
+ * Throws: java.net.SocketException
*/
-JNIEXPORT jobject JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_getSocketOptionImpl
- (JNIEnv *, jclass, jobject, jint);
+JNIEXPORT void JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_setSocketOption
+ (JNIEnv *, jobject, jobject, jint, jobject);
/*
- * Class: org_apache_harmony_luni_platform_OSNetworkSystem
- * Method: setSocketOptionImpl
- * Signature: (Ljava/io/FileDescriptor;ILjava/lang/Object;)V
+ * Class: org.apache.harmony.luni.platform.OSNetworkSystem
+ * Method: shutdownInput
+ * Signature: (Ljava/io/FileDescriptor;)V
+ * Throws: java.io.IOException
*/
-JNIEXPORT void JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_setSocketOptionImpl
- (JNIEnv *, jclass, jobject, jint, jobject);
+JNIEXPORT void JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_shutdownInput
+ (JNIEnv *, jobject, jobject);
/*
- * Class: org_apache_harmony_luni_platform_OSNetworkSystem
- * Method: getSocketFlags
- * Signature: ()I
+ * Class: org.apache.harmony.luni.platform.OSNetworkSystem
+ * Method: shutdownOutput
+ * Signature: (Ljava/io/FileDescriptor;)V
+ * Throws: java.io.IOException
*/
-JNIEXPORT jint JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_getSocketFlagsImpl
- (JNIEnv *, jclass);
+JNIEXPORT void JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_shutdownOutput
+ (JNIEnv *, jobject, jobject);
/*
- * Class: org_apache_harmony_luni_platform_OSNetworkSystem
- * Method: socketCloseImpl
+ * Class: org.apache.harmony.luni.platform.OSNetworkSystem
+ * Method: socketClose
* Signature: (Ljava/io/FileDescriptor;)V
+ * Throws: java.io.IOException
*/
-JNIEXPORT void JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_socketCloseImpl
- (JNIEnv *, jclass, jobject);
+JNIEXPORT void JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_socketClose
+ (JNIEnv *, jobject, jobject);
/*
- * Class: org_apache_harmony_luni_platform_OSNetworkSystem
- * Method: getHostByAddrImpl
- * Signature: ([B)Ljava/net/InetAddress;
+ * Class: org.apache.harmony.luni.platform.OSNetworkSystem
+ * Method: supportsUrgentData
+ * Signature: (Ljava/io/FileDescriptor;)Z
*/
-JNIEXPORT jobject JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_getHostByAddrImpl
- (JNIEnv *, jclass, jbyteArray);
+JNIEXPORT jboolean JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_supportsUrgentData
+ (JNIEnv *, jobject, jobject);
-JNIEXPORT jobject JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_getHostByNameImpl
- (JNIEnv *, jclass,jstring,jboolean);
-
/*
- * Class: org_apache_harmony_luni_platform_OSNetworkSystem
- * Method: isReachableByICMPImpl
- * Signature: ([BII)I
+ * Class: org.apache.harmony.luni.platform.OSNetworkSystem
+ * Method: write
+ * Signature: (Ljava/io/FileDescriptor;[BII)I
+ * Throws: java.io.IOException
*/
-JNIEXPORT jint JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_isReachableByICMPImpl
- (JNIEnv *, jobject, jobject, jobject, 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: inheritedChannelImpl
- * Signature: ([BII)I
+ * Class: org.apache.harmony.luni.platform.OSNetworkSystem
+ * Method: writeDirect
+ * Signature: (Ljava/io/FileDescriptor;JI)I
+ * Throws: java.io.IOException
*/
-JNIEXPORT jobject JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_inheritedChannelImpl
- (JNIEnv *, jobject);
-
+JNIEXPORT jint JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_writeDirect
+ (JNIEnv *, jobject, jobject, jlong, jint);
#ifdef __cplusplus
}
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/nethelp.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/nethelp.c?rev=727683&r1=727682&r2=727683&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/nethelp.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/shared/nethelp.c Thu Dec 18 01:46:12 2008
@@ -665,17 +665,14 @@
* @param[in] anInetAddress the object to access the 'value' field of
* @param[out] buffer bytes from the address jbyte array
* @param[out] length length of the address in stored in buffer
- *
*/
-
void
-netGetJavaNetInetAddressValue (JNIEnv * env, jobject anInetAddress,
- U_8 * buffer, U_32 * length)
+netGetJavaNetInetAddressValue
+ (JNIEnv * env, jobject anInetAddress, U_8 * buffer, U_32 * length)
{
jbyteArray byte_array =
(jbyteArray) ((*env)->GetObjectField (env, anInetAddress,
- HARMONY_CACHE_GET (env,
- FID_java_net_InetAddress_address)));
+ HARMONY_CACHE_GET (env, FID_java_net_InetAddress_address)));
*length = (*env)->GetArrayLength (env, byte_array);
(*env)->GetByteArrayRegion (env, byte_array, 0, *length, (jbyte *)buffer);
}
Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/unix/OSNetworkSystemLinux.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/unix/OSNetworkSystemLinux.c?rev=727683&r1=727682&r2=727683&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/unix/OSNetworkSystemLinux.c (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/native/luni/unix/OSNetworkSystemLinux.c Thu Dec 18 01:46:12 2008
@@ -27,6 +27,8 @@
#include <poll.h>
#endif
+#include <sys/ioctl.h>
+
/* We do not get these header files "for free" on zOS, so we will use the
definitions for these structures defined in OSNetworkSystem.h */
#if !defined(ZOS)
@@ -56,7 +58,9 @@
// Alternative Select function
int
-selectRead (JNIEnv * env,hysocket_t hysocketP, I_32 uSecTime, BOOLEAN accept){
+selectRead
+(JNIEnv * env, hysocket_t hysocketP, I_32 uSecTime, BOOLEAN accept)
+{
I_32 result = 0;
I_32 timeout;
struct pollfd my_pollfd;
@@ -67,11 +71,19 @@
my_pollfd.revents = 0;
result = poll (&my_pollfd, 1, timeout);
+ if (result == 0)
+ return HYPORT_ERROR_SOCKET_TIMEOUT;
+
+ if (result == -1)
+ return HYPORT_ERROR_SOCKET_OPFAILED;
+
return result;
}
-JNIEXPORT jint JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_isReachableByICMPImpl
- (JNIEnv * env, jobject clz, jobject address, jobject localaddr, jint ttl, jint timeout){
+JNIEXPORT jint JNICALL
+Java_org_apache_harmony_luni_platform_OSNetworkSystem_isReachableByICMPImpl
+ (JNIEnv * env, jobject thiz, jobject address, jobject localaddr, jint ttl, jint timeout)
+{
PORT_ACCESS_FROM_ENV (env);
struct sockaddr_in dest,source,local;
#if !defined(ZOS)
@@ -242,9 +254,11 @@
* Signature: ([Ljava/io/FileDescriptor;[Ljava/io/FileDescriptor;II[IJ)I
* Assumption: outFlags is zeroed
*/
-JNIEXPORT jint JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_selectImpl
- (JNIEnv * env, jclass thisClz, jobjectArray readFDArray, jobjectArray writeFDArray,
- jint countReadC, jint countWriteC, jintArray outFlags, jlong timeout){
+JNIEXPORT jint JNICALL
+Java_org_apache_harmony_luni_platform_OSNetworkSystem_selectImpl
+ (JNIEnv * env, jobject thiz, jobjectArray readFDArray, jobjectArray writeFDArray,
+ jint countReadC, jint countWriteC, jintArray outFlags, jlong timeout)
+{
PORT_ACCESS_FROM_ENV (env);
I_32 result = 0;
hysocket_t hysocketP;
@@ -311,8 +325,11 @@
return result;
};
-JNIEXPORT jobject JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_inheritedChannelImpl
- (JNIEnv * env , jobject clz){
+
+JNIEXPORT jobject JNICALL
+Java_org_apache_harmony_luni_platform_OSNetworkSystem_inheritedChannel
+ (JNIEnv * env , jobject thiz)
+{
PORT_ACCESS_FROM_ENV (env);
int socket = 0;
int opt;
@@ -475,3 +492,35 @@
hymem_free_memory(localAddr);
return channel_object;
}
+
+/*
+ * Utilizes the ioctl call to get the available bytes pending on a socket
+ * which is similar to, but different to the call on other platforms.
+ *
+ * Class: org_apache_harmony_luni_platform_OSNetworkSystem
+ * Method: availableStream
+ * Signature: (Ljava/io/FileDescriptor;)I
+ */
+JNIEXPORT jint JNICALL
+Java_org_apache_harmony_luni_platform_OSNetworkSystem_availableStream
+ (JNIEnv * env, jobject thiz, jobject fileDescriptor)
+{
+ PORT_ACCESS_FROM_ENV(env);
+ hysocket_t hysocketP;
+ U_32 nbytes = 0;
+ I_32 result;
+
+ hysocketP = getJavaIoFileDescriptorContentsAsAPointer(env, fileDescriptor);
+ if (!hysock_socketIsValid(hysocketP)) {
+ throwJavaNetSocketException(env, HYPORT_ERROR_SOCKET_BADSOCKET);
+ return (jint) 0;
+ }
+
+ result = ioctl(hysocketP->sock, FIONREAD, &nbytes);
+ if (result != 0) {
+ throwJavaNetSocketException(env, result);
+ return (jint) 0;
+ }
+
+ return (jint) nbytes;
+}
|