InetAddress.java: Removed.

2006-11-03  Gary Benson  <gbenson@redhat.com>

	* java/net/InetAddress.java: Removed.
	* java/net/natInetAddressNoNet.cc: Likewise.
	* java/net/natInetAddressPosix.cc: Likewise.
	* java/net/natInetAddressWin32.cc: Likewise.
	* java/net/VMInetAddress.java (getLocalHostname,
	lookupInaddrAny, getHostByAddr, getHostByName,
	aton): Replace glue methods with native ones.
	* java/net/natVMInetAddressNoNet.cc: New file.
	* java/net/natVMInetAddressPosix.cc: Likewise.
	* java/net/natVMInetAddressWin32.cc: Likewise.
	* Makefile.am, configure.ac: Reflect the above.
	* sources.am, Makefile.in, configure: Rebuilt.

	* java/net/natVMNetworkInterfaceWin32.cc
	(winsock2GetRealNetworkInterfaces): Create InetAddress
	objects using InetAddress.getByAddress.
	* gnu/java/net/natPlainSocketImplWin32.cc
	(accept, getOption): Likewise.
	* gnu/java/net/natPlainDatagramSocketImplWin32.cc
	(peekData, receive, getOption): Likewise.

From-SVN: r118451
This commit is contained in:
Gary Benson 2006-11-03 10:16:04 +00:00 committed by Gary Benson
parent 5d7de335d7
commit adefdaca2d
17 changed files with 506 additions and 1380 deletions

View file

@ -58,18 +58,12 @@ class VMInetAddress implements Serializable
*
* @return The local hostname.
*/
public static String getLocalHostname()
{
return InetAddress.getLocalHostname();
}
public static native String getLocalHostname();
/**
* Returns the value of the special address INADDR_ANY
*/
public static byte[] lookupInaddrAny() throws UnknownHostException
{
return new byte[] {0, 0, 0, 0};
}
public static native byte[] lookupInaddrAny() throws UnknownHostException;
/**
* This method returns the hostname for a given IP address. It will
@ -81,26 +75,15 @@ class VMInetAddress implements Serializable
*
* @exception UnknownHostException If the reverse lookup fails
*/
public static String getHostByAddr(byte[] ip) throws UnknownHostException
{
InetAddress addr = InetAddress.getByAddress(ip);
InetAddress.lookup(null, addr, false);
return addr.getHostName();
}
public static native String getHostByAddr(byte[] ip)
throws UnknownHostException;
/**
* Returns a list of all IP addresses for a given hostname. Will throw
* an UnknownHostException if the hostname cannot be resolved.
*/
public static byte[][] getHostByName(String hostname)
throws UnknownHostException
{
InetAddress[] iaddrs = InetAddress.lookup(hostname, null, true);
byte[][] addrs = new byte[iaddrs.length][];
for (int i = 0; i < iaddrs.length; i++)
addrs[i] = iaddrs[i].getAddress();
return addrs;
}
public static native byte[][] getHostByName(String hostname)
throws UnknownHostException;
/**
* Return the IP address represented by a literal address.
@ -110,8 +93,5 @@ class VMInetAddress implements Serializable
*
* @return The IP address as a byte array
*/
public static byte[] aton(String address)
{
return InetAddress.aton(address);
}
public static native byte[] aton(String address);
}