Commit bf5d810f by Michael Koch Committed by Michael Koch

2005-04-29 Michael Koch <konqueror@gmx.de>

	* java/net/NetworkInterface.java
	(static): Removed.
	(NetworkInterface(String,InetAddress)): Made package-private.
	(NetworkInterface(String,InetAddress[])): New constructor.
	(getRealNetworkInterfaces): Removed.
	(getByName): Use VMNetworkInterface.getInterfaces().
	(getByInetAddress): Likewise.
	(getNetworkInterfaces): Likewise.
	* java/net/VMNetworkInterface.java,
	java/net/natVMNetworkInterfaceNoNet.cc,
	java/net/natVMNetworkInterfacePosix.c,c
	java/net/natVMNetworkInterfaceWin32.cc: New files.
	* java/net/natNetworkInterfaceNoNet.cc,
	java/net/natNetworkInterfacePosix.cc,
	 java/net/natNetworkInterfaceWin32.cc: Removed.
	* configure.ac
	* Makefile.am
	* configure, Makefile.in: Regenerated.

From-SVN: r99021
parent 2d82317d
2005-04-29 Michael Koch <konqueror@gmx.de>
* java/net/NetworkInterface.java
(static): Removed.
(NetworkInterface(String,InetAddress)): Made package-private.
(NetworkInterface(String,InetAddress[])): New constructor.
(getRealNetworkInterfaces): Removed.
(getByName): Use VMNetworkInterface.getInterfaces().
(getByInetAddress): Likewise.
(getNetworkInterfaces): Likewise.
* java/net/VMNetworkInterface.java,
java/net/natVMNetworkInterfaceNoNet.cc,
java/net/natVMNetworkInterfacePosix.c,c
java/net/natVMNetworkInterfaceWin32.cc: New files.
* java/net/natNetworkInterfaceNoNet.cc,
java/net/natNetworkInterfacePosix.cc,
java/net/natNetworkInterfaceWin32.cc: Removed.
* configure.ac
* Makefile.am
* configure, Makefile.in: Regenerated.
2005-04-29 Andrew Haley <aph@redhat.com>
* java/lang/Class.h (_Jv_ResolvePoolEntry): Declare as friend.
......
......@@ -3555,6 +3555,7 @@ java/net/URLStreamHandler.java \
java/net/URLStreamHandlerFactory.java \
java/net/UnknownHostException.java \
java/net/UnknownServiceException.java \
java/net/VMNetworkInterface.java \
java/nio/Buffer.java \
java/nio/BufferOverflowException.java \
java/nio/BufferUnderflowException.java \
......@@ -3935,7 +3936,7 @@ java/lang/reflect/natConstructor.cc \
java/lang/reflect/natField.cc \
java/lang/reflect/natMethod.cc \
java/lang/reflect/natProxy.cc \
java/net/natNetworkInterface.cc \
java/net/natVMNetworkInterface.cc \
java/net/natInetAddress.cc \
java/nio/channels/natChannels.cc \
java/nio/natDirectByteBufferImpl.cc \
......
......@@ -79,7 +79,7 @@ CONFIG_HEADER = $(top_builddir)/include/config.h \
CONFIG_CLEAN_FILES = libgcj.pc libgcj.spec libgcj-test.spec \
gnu/classpath/Configuration.java java/io/natFile.cc \
java/lang/ConcreteProcess.java java/lang/natConcreteProcess.cc \
java/net/natInetAddress.cc java/net/natNetworkInterface.cc \
java/net/natInetAddress.cc java/net/natVMNetworkInterface.cc \
gnu/java/net/natPlainSocketImpl.cc \
gnu/java/net/natPlainDatagramSocketImpl.cc \
gnu/java/nio/natPipeImpl.cc gnu/java/nio/natSelectorImpl.cc \
......@@ -270,8 +270,9 @@ am__libgcj0_convenience_la_SOURCES_DIST = prims.cc jni.cc exception.cc \
java/lang/ref/natReference.cc java/lang/reflect/natArray.cc \
java/lang/reflect/natConstructor.cc \
java/lang/reflect/natField.cc java/lang/reflect/natMethod.cc \
java/lang/reflect/natProxy.cc java/net/natNetworkInterface.cc \
java/net/natInetAddress.cc java/nio/channels/natChannels.cc \
java/lang/reflect/natProxy.cc \
java/net/natVMNetworkInterface.cc java/net/natInetAddress.cc \
java/nio/channels/natChannels.cc \
java/nio/natDirectByteBufferImpl.cc java/text/natCollator.cc \
java/util/natResourceBundle.cc java/util/natVMTimeZone.cc \
java/util/logging/natLogger.cc java/util/zip/natDeflater.cc \
......@@ -846,7 +847,8 @@ am__libgcj0_convenience_la_SOURCES_DIST = prims.cc jni.cc exception.cc \
java/net/URLStreamHandler.java \
java/net/URLStreamHandlerFactory.java \
java/net/UnknownHostException.java \
java/net/UnknownServiceException.java java/nio/Buffer.java \
java/net/UnknownServiceException.java \
java/net/VMNetworkInterface.java java/nio/Buffer.java \
java/nio/BufferOverflowException.java \
java/nio/BufferUnderflowException.java \
java/nio/ByteBuffer.java java/nio/ByteBufferHelper.java \
......@@ -2316,8 +2318,9 @@ am__objects_5 = gnu/classpath/natSystemProperties.lo \
java/lang/ref/natReference.lo java/lang/reflect/natArray.lo \
java/lang/reflect/natConstructor.lo \
java/lang/reflect/natField.lo java/lang/reflect/natMethod.lo \
java/lang/reflect/natProxy.lo java/net/natNetworkInterface.lo \
java/net/natInetAddress.lo java/nio/channels/natChannels.lo \
java/lang/reflect/natProxy.lo \
java/net/natVMNetworkInterface.lo java/net/natInetAddress.lo \
java/nio/channels/natChannels.lo \
java/nio/natDirectByteBufferImpl.lo java/text/natCollator.lo \
java/util/natResourceBundle.lo java/util/natVMTimeZone.lo \
java/util/logging/natLogger.lo java/util/zip/natDeflater.lo \
......@@ -3968,7 +3971,8 @@ am__objects_14 = $(am__objects_8) gnu/classpath/ServiceFactory.lo \
java/net/URLStreamHandler.lo \
java/net/URLStreamHandlerFactory.lo \
java/net/UnknownHostException.lo \
java/net/UnknownServiceException.lo java/nio/Buffer.lo \
java/net/UnknownServiceException.lo \
java/net/VMNetworkInterface.lo java/nio/Buffer.lo \
java/nio/BufferOverflowException.lo \
java/nio/BufferUnderflowException.lo java/nio/ByteBuffer.lo \
java/nio/ByteBufferHelper.lo java/nio/ByteBufferImpl.lo \
......@@ -7349,6 +7353,7 @@ java/net/URLStreamHandler.java \
java/net/URLStreamHandlerFactory.java \
java/net/UnknownHostException.java \
java/net/UnknownServiceException.java \
java/net/VMNetworkInterface.java \
java/nio/Buffer.java \
java/nio/BufferOverflowException.java \
java/nio/BufferUnderflowException.java \
......@@ -7724,7 +7729,7 @@ java/lang/reflect/natConstructor.cc \
java/lang/reflect/natField.cc \
java/lang/reflect/natMethod.cc \
java/lang/reflect/natProxy.cc \
java/net/natNetworkInterface.cc \
java/net/natVMNetworkInterface.cc \
java/net/natInetAddress.cc \
java/nio/channels/natChannels.cc \
java/nio/natDirectByteBufferImpl.cc \
......@@ -8404,7 +8409,7 @@ java/net/$(am__dirstamp):
java/net/$(DEPDIR)/$(am__dirstamp):
@$(mkdir_p) java/net/$(DEPDIR)
@: > java/net/$(DEPDIR)/$(am__dirstamp)
java/net/natNetworkInterface.lo: java/net/$(am__dirstamp) \
java/net/natVMNetworkInterface.lo: java/net/$(am__dirstamp) \
java/net/$(DEPDIR)/$(am__dirstamp)
java/net/natInetAddress.lo: java/net/$(am__dirstamp) \
java/net/$(DEPDIR)/$(am__dirstamp)
......@@ -10358,6 +10363,8 @@ java/net/UnknownHostException.lo: java/net/$(am__dirstamp) \
java/net/$(DEPDIR)/$(am__dirstamp)
java/net/UnknownServiceException.lo: java/net/$(am__dirstamp) \
java/net/$(DEPDIR)/$(am__dirstamp)
java/net/VMNetworkInterface.lo: java/net/$(am__dirstamp) \
java/net/$(DEPDIR)/$(am__dirstamp)
java/nio/Buffer.lo: java/nio/$(am__dirstamp) \
java/nio/$(DEPDIR)/$(am__dirstamp)
java/nio/BufferOverflowException.lo: java/nio/$(am__dirstamp) \
......@@ -17450,10 +17457,12 @@ mostlyclean-compile:
-rm -f java/net/UnknownHostException.lo
-rm -f java/net/UnknownServiceException.$(OBJEXT)
-rm -f java/net/UnknownServiceException.lo
-rm -f java/net/VMNetworkInterface.$(OBJEXT)
-rm -f java/net/VMNetworkInterface.lo
-rm -f java/net/natInetAddress.$(OBJEXT)
-rm -f java/net/natInetAddress.lo
-rm -f java/net/natNetworkInterface.$(OBJEXT)
-rm -f java/net/natNetworkInterface.lo
-rm -f java/net/natVMNetworkInterface.$(OBJEXT)
-rm -f java/net/natVMNetworkInterface.lo
-rm -f java/nio/Buffer.$(OBJEXT)
-rm -f java/nio/Buffer.lo
-rm -f java/nio/BufferOverflowException.$(OBJEXT)
......@@ -21306,8 +21315,9 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@java/net/$(DEPDIR)/URLStreamHandlerFactory.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@java/net/$(DEPDIR)/UnknownHostException.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@java/net/$(DEPDIR)/UnknownServiceException.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@java/net/$(DEPDIR)/VMNetworkInterface.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@java/net/$(DEPDIR)/natInetAddress.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@java/net/$(DEPDIR)/natNetworkInterface.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@java/net/$(DEPDIR)/natVMNetworkInterface.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@java/nio/$(DEPDIR)/Buffer.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@java/nio/$(DEPDIR)/BufferOverflowException.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@java/nio/$(DEPDIR)/BufferUnderflowException.Plo@am__quote@
......@@ -456,10 +456,10 @@ test -d java/lang || mkdir java/lang
AC_CONFIG_LINKS(java/lang/ConcreteProcess.java:java/lang/${PLATFORM}Process.java)
AC_CONFIG_LINKS(java/lang/natConcreteProcess.cc:java/lang/nat${PLATFORM}Process.cc)
# Likewise for natInetAddress.cc and natNetworkInterface.cc.
# Likewise for natInetAddress.cc and natVMNetworkInterface.cc.
test -d java/net || mkdir java/net
AC_CONFIG_LINKS(java/net/natInetAddress.cc:java/net/natInetAddress${PLATFORMNET}.cc)
AC_CONFIG_LINKS(java/net/natNetworkInterface.cc:java/net/natNetworkInterface${PLATFORMNET}.cc)
AC_CONFIG_LINKS(java/net/natVMNetworkInterface.cc:java/net/natVMNetworkInterface${PLATFORMNET}.cc)
# Likewise for natPlainSocketImpl.cc and natPlainDatagramSocketImpl.cc.
test -d gnu/java || mkdir gnu/java
......
......@@ -38,8 +38,6 @@ exception statement from your version. */
package java.net;
import gnu.classpath.Configuration;
import java.util.Enumeration;
import java.util.Vector;
......@@ -55,24 +53,24 @@ import java.util.Vector;
*/
public final class NetworkInterface
{
static
{
if (Configuration.INIT_LOAD_LIBRARY)
System.loadLibrary("javanet");
}
private String name;
private Vector inetAddresses;
private NetworkInterface(String name, InetAddress address)
NetworkInterface(String name, InetAddress address)
{
this.name = name;
this.inetAddresses = new Vector(1, 1);
this.inetAddresses.add(address);
}
private static native Vector getRealNetworkInterfaces()
throws SocketException;
NetworkInterface(String name, InetAddress[] addresses)
{
this.name = name;
this.inetAddresses = new Vector(addresses.length, 1);
for (int i = 0; i < addresses.length; i++)
this.inetAddresses.add(addresses[i]);
}
/**
* Returns the name of the network interface
......@@ -145,7 +143,7 @@ public final class NetworkInterface
public static NetworkInterface getByName(String name)
throws SocketException
{
Vector networkInterfaces = getRealNetworkInterfaces();
Vector networkInterfaces = VMNetworkInterface.getInterfaces();
for (Enumeration e = networkInterfaces.elements(); e.hasMoreElements();)
{
......@@ -172,7 +170,7 @@ public final class NetworkInterface
public static NetworkInterface getByInetAddress(InetAddress addr)
throws SocketException
{
Vector networkInterfaces = getRealNetworkInterfaces();
Vector networkInterfaces = VMNetworkInterface.getInterfaces();
for (Enumeration interfaces = networkInterfaces.elements();
interfaces.hasMoreElements();)
......@@ -199,7 +197,7 @@ public final class NetworkInterface
*/
public static Enumeration getNetworkInterfaces() throws SocketException
{
Vector networkInterfaces = getRealNetworkInterfaces();
Vector networkInterfaces = VMNetworkInterface.getInterfaces();
if (networkInterfaces.isEmpty())
return null;
......
/* VMNetworkInterface.java --
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.net;
import gnu.classpath.Configuration;
import java.util.Enumeration;
import java.util.Vector;
/**
* This class models a network interface on the host computer. A network
* interface contains a name (typically associated with a specific
* hardware adapter) and a list of addresses that are bound to it.
* For example, an ethernet interface may be named "eth0" and have the
* address 192.168.1.101 assigned to it.
*
* @author Michael Koch (konqueror@gmx.de)
* @since 1.4
*/
final class VMNetworkInterface
{
static
{
if (Configuration.INIT_LOAD_LIBRARY)
System.loadLibrary("javanet");
}
public static native Vector getInterfaces()
throws SocketException;
}
/* Copyright (C) 2003 Free Software Foundation
/* Copyright (C) 2003, 2005 Free Software Foundation
This file is part of libgcj.
......@@ -9,13 +9,13 @@ details. */
#include <config.h>
#include <platform.h>
#include <java/net/NetworkInterface.h>
#include <java/net/SocketException.h>
#include <java/net/VMNetworkInterface.h>
#include <java/util/Vector.h>
::java::util::Vector*
java::net::NetworkInterface::getRealNetworkInterfaces ()
java::net::VMNetworkInterface::getInterfaces ()
{
throw new SocketException (
JvNewStringLatin1 ("NetworkInterface.getrealNetworkInterfaces: unimplemented"));
JvNewStringLatin1 ("VMNetworkInterface.getInterfaces: unimplemented"));
}
/* Copyright (C) 2003 Free Software Foundation
/* Copyright (C) 2003, 2005 Free Software Foundation
This file is part of libgcj.
......@@ -37,13 +37,14 @@ details. */
#include <gcj/cni.h>
#include <jvm.h>
#include <java/net/NetworkInterface.h>
#include <java/net/Inet4Address.h>
#include <java/net/NetworkInterface.h>
#include <java/net/SocketException.h>
#include <java/net/VMNetworkInterface.h>
#include <java/util/Vector.h>
::java::util::Vector*
java::net::NetworkInterface::getRealNetworkInterfaces ()
java::net::VMNetworkInterface::getInterfaces ()
{
int fd;
int num_interfaces = 0;
......
/* Copyright (C) 2003 Free Software Foundation
/* Copyright (C) 2003, 2005 Free Software Foundation
This file is part of libgcj.
......@@ -114,7 +114,7 @@ determineGetRealNetworkInterfacesFN ()
}
::java::util::Vector*
java::net::NetworkInterface::getRealNetworkInterfaces ()
java::net::VMNetworkInterface::getInterfaces ()
{
// This next declaration used to be a static local,
// but this introduced a dependency on libsupc++ due
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment