2002-01-18 18:23:23 +01:00
|
|
|
/* Copyright (C) 1998, 1999, 2000, 2002 Free Software Foundation
|
1999-04-07 16:42:40 +02:00
|
|
|
|
|
|
|
This file is part of libgcj.
|
|
|
|
|
|
|
|
This software is copyrighted work licensed under the terms of the
|
|
|
|
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
|
|
|
|
details. */
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
2000-03-15 23:03:19 +01:00
|
|
|
|
1999-10-04 23:37:30 +02:00
|
|
|
#ifndef DISABLE_JAVA_NET
|
2000-03-15 23:03:19 +01:00
|
|
|
#ifdef USE_WINSOCK
|
|
|
|
#include <windows.h>
|
|
|
|
#include <winsock.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#include <string.h>
|
|
|
|
#ifndef ENOPROTOOPT
|
|
|
|
#define ENOPROTOOPT 109
|
|
|
|
#endif
|
|
|
|
#else /* USE_WINSOCK */
|
2000-08-02 23:54:04 +02:00
|
|
|
#include "posix.h"
|
1999-04-07 16:42:40 +02:00
|
|
|
#include <sys/socket.h>
|
|
|
|
#include <netinet/in.h>
|
1999-05-26 19:00:06 +02:00
|
|
|
#include <netinet/tcp.h>
|
1999-04-07 16:42:40 +02:00
|
|
|
#include <errno.h>
|
|
|
|
#include <string.h>
|
2000-03-15 23:03:19 +01:00
|
|
|
#endif /* USE_WINSOCK */
|
1999-10-04 23:37:30 +02:00
|
|
|
#endif /* DISABLE_JAVA_NET */
|
1999-04-07 16:42:40 +02:00
|
|
|
|
1999-08-02 01:39:53 +02:00
|
|
|
#if HAVE_BSTRING_H
|
|
|
|
// Needed for bzero, implicitly used by FD_ZERO on IRIX 5.2
|
|
|
|
#include <bstring.h>
|
|
|
|
#endif
|
|
|
|
|
2001-08-01 19:53:00 +02:00
|
|
|
#ifndef HAVE_SOCKLEN_T
|
|
|
|
typedef int socklen_t;
|
|
|
|
#endif
|
|
|
|
|
2001-07-31 03:59:44 +02:00
|
|
|
// Avoid macro definitions of bind, connect from system headers, e.g. on
|
|
|
|
// Solaris 7 with _XOPEN_SOURCE. FIXME
|
|
|
|
static inline int
|
|
|
|
_Jv_bind (int fd, struct sockaddr *addr, int addrlen)
|
|
|
|
{
|
|
|
|
return ::bind (fd, addr, addrlen);
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef bind
|
|
|
|
#undef bind
|
|
|
|
#endif
|
|
|
|
|
|
|
|
static inline int
|
|
|
|
_Jv_connect (int fd, struct sockaddr *addr, int addrlen)
|
|
|
|
{
|
|
|
|
return ::connect (fd, addr, addrlen);
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef connect
|
|
|
|
#undef connect
|
|
|
|
#endif
|
|
|
|
|
2001-08-01 19:53:00 +02:00
|
|
|
// Same problem with accept on Tru64 UNIX with _POSIX_PII_SOCKET
|
|
|
|
static inline int
|
|
|
|
_Jv_accept (int fd, struct sockaddr *addr, socklen_t *addrlen)
|
|
|
|
{
|
|
|
|
return ::accept (fd, addr, addrlen);
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef accept
|
|
|
|
#undef accept
|
|
|
|
#endif
|
|
|
|
|
2002-01-18 18:23:23 +01:00
|
|
|
// A wrapper for recv so we don't have to do configure tests.
|
2002-01-30 23:22:36 +01:00
|
|
|
template <typename T_ret, typename T_fd, typename T_buf,
|
|
|
|
typename T_len, typename T_flags>
|
2002-01-20 17:34:07 +01:00
|
|
|
static inline ssize_t
|
2002-01-30 23:22:36 +01:00
|
|
|
_Jv_recv (T_ret (*recv_func) (T_fd s, T_buf buf, T_len len, T_flags flags),
|
2002-01-18 18:23:23 +01:00
|
|
|
int s, void *buf, size_t len, int flags)
|
|
|
|
{
|
|
|
|
return recv_func ((T_fd) s, (T_buf) buf, (T_len) len, (T_flags) flags);
|
|
|
|
}
|
|
|
|
|
1999-09-11 00:03:10 +02:00
|
|
|
#include <gcj/cni.h>
|
|
|
|
#include <gcj/javaprims.h>
|
1999-04-07 16:42:40 +02:00
|
|
|
#include <java/io/IOException.h>
|
|
|
|
#include <java/io/FileDescriptor.h>
|
1999-05-28 21:29:53 +02:00
|
|
|
#include <java/io/InterruptedIOException.h>
|
1999-05-12 03:51:23 +02:00
|
|
|
#include <java/net/BindException.h>
|
|
|
|
#include <java/net/ConnectException.h>
|
1999-04-07 16:42:40 +02:00
|
|
|
#include <java/net/PlainSocketImpl.h>
|
|
|
|
#include <java/net/InetAddress.h>
|
1999-05-26 19:00:06 +02:00
|
|
|
#include <java/net/SocketException.h>
|
|
|
|
#include <java/lang/InternalError.h>
|
|
|
|
#include <java/lang/Object.h>
|
|
|
|
#include <java/lang/Boolean.h>
|
|
|
|
#include <java/lang/Class.h>
|
|
|
|
#include <java/lang/Integer.h>
|
2002-01-08 22:14:58 +01:00
|
|
|
#include <java/lang/Thread.h>
|
|
|
|
#include <java/lang/NullPointerException.h>
|
|
|
|
#include <java/lang/ArrayIndexOutOfBoundsException.h>
|
2002-01-18 18:23:23 +01:00
|
|
|
#include <java/lang/IllegalArgumentException.h>
|
1999-12-17 06:11:28 +01:00
|
|
|
|
1999-10-02 02:19:01 +02:00
|
|
|
#ifdef DISABLE_JAVA_NET
|
|
|
|
|
|
|
|
void
|
|
|
|
java::net::PlainSocketImpl::create (jboolean)
|
|
|
|
{
|
2000-09-05 23:57:23 +02:00
|
|
|
throw new java::io::IOException (
|
|
|
|
JvNewStringLatin1 ("SocketImpl.create: unimplemented"));
|
1999-10-02 02:19:01 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
java::net::PlainSocketImpl::bind (java::net::InetAddress *, jint)
|
|
|
|
{
|
2000-09-05 23:57:23 +02:00
|
|
|
throw new BindException (
|
|
|
|
JvNewStringLatin1 ("SocketImpl.bind: unimplemented"));
|
1999-10-02 02:19:01 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
java::net::PlainSocketImpl::connect (java::net::InetAddress *, jint)
|
|
|
|
{
|
2000-09-05 23:57:23 +02:00
|
|
|
throw new ConnectException (
|
|
|
|
JvNewStringLatin1 ("SocketImpl.connect: unimplemented"));
|
1999-10-02 02:19:01 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
java::net::PlainSocketImpl::listen (jint)
|
|
|
|
{
|
2000-09-05 23:57:23 +02:00
|
|
|
throw new java::io::IOException (
|
|
|
|
JvNewStringLatin1 ("SocketImpl.listen: unimplemented"));
|
1999-10-02 02:19:01 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
java::net::PlainSocketImpl::accept (java::net::PlainSocketImpl *)
|
|
|
|
{
|
2000-09-05 23:57:23 +02:00
|
|
|
throw new java::io::IOException (
|
|
|
|
JvNewStringLatin1 ("SocketImpl.accept: unimplemented"));
|
1999-10-02 02:19:01 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
java::net::PlainSocketImpl::setOption (jint, java::lang::Object *)
|
|
|
|
{
|
2000-09-05 23:57:23 +02:00
|
|
|
throw new SocketException (
|
|
|
|
JvNewStringLatin1 ("SocketImpl.setOption: unimplemented"));
|
1999-10-02 02:19:01 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
java::lang::Object *
|
|
|
|
java::net::PlainSocketImpl::getOption (jint)
|
|
|
|
{
|
2000-09-05 23:57:23 +02:00
|
|
|
throw new SocketException (
|
|
|
|
JvNewStringLatin1 ("SocketImpl.getOption: unimplemented"));
|
1999-10-02 02:19:01 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#else /* DISABLE_JAVA_NET */
|
|
|
|
|
1999-04-07 16:42:40 +02:00
|
|
|
union SockAddr
|
|
|
|
{
|
|
|
|
struct sockaddr_in address;
|
|
|
|
#ifdef HAVE_INET6
|
|
|
|
struct sockaddr_in6 address6;
|
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
|
|
|
void
|
|
|
|
java::net::PlainSocketImpl::create (jboolean stream)
|
|
|
|
{
|
|
|
|
int sock = ::socket (AF_INET, stream ? SOCK_STREAM : SOCK_DGRAM, 0);
|
|
|
|
if (sock < 0)
|
|
|
|
{
|
|
|
|
char* strerr = strerror (errno);
|
2000-09-05 23:57:23 +02:00
|
|
|
throw new java::io::IOException (JvNewStringUTF (strerr));
|
1999-04-07 16:42:40 +02:00
|
|
|
}
|
|
|
|
fnum = sock;
|
|
|
|
fd = new java::io::FileDescriptor (sock);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
java::net::PlainSocketImpl::bind (java::net::InetAddress *host, jint lport)
|
|
|
|
{
|
|
|
|
union SockAddr u;
|
|
|
|
struct sockaddr *ptr = (struct sockaddr *) &u.address;
|
2000-11-03 08:43:06 +01:00
|
|
|
jbyteArray haddress = host->addr;
|
1999-08-03 02:30:53 +02:00
|
|
|
jbyte *bytes = elements (haddress);
|
|
|
|
int len = haddress->length;
|
1999-11-23 12:40:26 +01:00
|
|
|
int i = 1;
|
1999-06-17 02:21:26 +02:00
|
|
|
|
1999-04-07 16:42:40 +02:00
|
|
|
if (len == 4)
|
|
|
|
{
|
|
|
|
u.address.sin_family = AF_INET;
|
1999-06-17 02:21:26 +02:00
|
|
|
if (host != NULL)
|
|
|
|
memcpy (&u.address.sin_addr, bytes, len);
|
|
|
|
else
|
|
|
|
u.address.sin_addr.s_addr = htonl (INADDR_ANY);
|
1999-04-07 16:42:40 +02:00
|
|
|
len = sizeof (struct sockaddr_in);
|
|
|
|
u.address.sin_port = htons (lport);
|
|
|
|
}
|
|
|
|
#ifdef HAVE_INET6
|
|
|
|
else if (len == 16)
|
|
|
|
{
|
|
|
|
u.address6.sin6_family = AF_INET6;
|
|
|
|
memcpy (&u.address6.sin6_addr, bytes, len);
|
|
|
|
len = sizeof (struct sockaddr_in6);
|
|
|
|
u.address6.sin6_port = htons (lport);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
else
|
2000-08-11 05:07:59 +02:00
|
|
|
throw new java::net::SocketException (JvNewStringUTF ("invalid length"));
|
1999-11-23 12:40:26 +01:00
|
|
|
|
|
|
|
// Enable SO_REUSEADDR, so that servers can reuse ports left in TIME_WAIT.
|
1999-12-17 06:11:28 +01:00
|
|
|
::setsockopt(fnum, SOL_SOCKET, SO_REUSEADDR, (char *) &i, sizeof(i));
|
1999-11-23 12:40:26 +01:00
|
|
|
|
2001-07-31 03:59:44 +02:00
|
|
|
if (_Jv_bind (fnum, ptr, len) == 0)
|
1999-04-07 16:42:40 +02:00
|
|
|
{
|
|
|
|
address = host;
|
1999-05-28 21:29:53 +02:00
|
|
|
socklen_t addrlen = sizeof(u);
|
|
|
|
if (lport != 0)
|
|
|
|
localport = lport;
|
|
|
|
else if (::getsockname (fnum, (sockaddr*) &u, &addrlen) == 0)
|
|
|
|
localport = ntohs (u.address.sin_port);
|
|
|
|
else
|
|
|
|
goto error;
|
1999-04-07 16:42:40 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
error:
|
|
|
|
char* strerr = strerror (errno);
|
2000-09-05 23:57:23 +02:00
|
|
|
throw new java::net::BindException (JvNewStringUTF (strerr));
|
1999-04-07 16:42:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
java::net::PlainSocketImpl::connect (java::net::InetAddress *host, jint rport)
|
|
|
|
{
|
|
|
|
union SockAddr u;
|
1999-05-26 19:00:06 +02:00
|
|
|
socklen_t addrlen = sizeof(u);
|
2000-11-03 08:43:06 +01:00
|
|
|
jbyteArray haddress = host->addr;
|
1999-04-07 16:42:40 +02:00
|
|
|
jbyte *bytes = elements (haddress);
|
|
|
|
int len = haddress->length;
|
|
|
|
struct sockaddr *ptr = (struct sockaddr *) &u.address;
|
|
|
|
if (len == 4)
|
|
|
|
{
|
|
|
|
u.address.sin_family = AF_INET;
|
|
|
|
memcpy (&u.address.sin_addr, bytes, len);
|
|
|
|
len = sizeof (struct sockaddr_in);
|
|
|
|
u.address.sin_port = htons (rport);
|
|
|
|
}
|
|
|
|
#ifdef HAVE_INET6
|
|
|
|
else if (len == 16)
|
|
|
|
{
|
|
|
|
u.address6.sin6_family = AF_INET6;
|
|
|
|
memcpy (&u.address6.sin6_addr, bytes, len);
|
|
|
|
len = sizeof (struct sockaddr_in6);
|
|
|
|
u.address6.sin6_port = htons (rport);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
else
|
2000-08-11 05:07:59 +02:00
|
|
|
throw new java::net::SocketException (JvNewStringUTF ("invalid length"));
|
|
|
|
|
2001-07-31 03:59:44 +02:00
|
|
|
if (_Jv_connect (fnum, ptr, len) != 0)
|
1999-05-26 19:00:06 +02:00
|
|
|
goto error;
|
|
|
|
address = host;
|
|
|
|
port = rport;
|
1999-05-28 21:29:53 +02:00
|
|
|
// A bind may not have been done on this socket; if so, set localport now.
|
|
|
|
if (localport == 0)
|
2000-08-11 05:07:59 +02:00
|
|
|
{
|
|
|
|
if (::getsockname (fnum, (sockaddr*) &u, &addrlen) == 0)
|
|
|
|
localport = ntohs (u.address.sin_port);
|
|
|
|
else
|
|
|
|
goto error;
|
|
|
|
}
|
1999-05-26 19:00:06 +02:00
|
|
|
return;
|
1999-04-07 16:42:40 +02:00
|
|
|
error:
|
|
|
|
char* strerr = strerror (errno);
|
2000-09-05 23:57:23 +02:00
|
|
|
throw new java::net::ConnectException (JvNewStringUTF (strerr));
|
1999-04-07 16:42:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
java::net::PlainSocketImpl::listen (jint backlog)
|
|
|
|
{
|
|
|
|
if (::listen (fnum, backlog) != 0)
|
|
|
|
{
|
|
|
|
char* strerr = strerror (errno);
|
2000-09-05 23:57:23 +02:00
|
|
|
throw new java::io::IOException (JvNewStringUTF (strerr));
|
1999-04-07 16:42:40 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
java::net::PlainSocketImpl::accept (java::net::PlainSocketImpl *s)
|
|
|
|
{
|
|
|
|
union SockAddr u;
|
|
|
|
socklen_t addrlen = sizeof(u);
|
1999-05-28 21:29:53 +02:00
|
|
|
int new_socket = 0;
|
|
|
|
|
|
|
|
// Do timeouts via select since SO_RCVTIMEO is not always available.
|
|
|
|
if (timeout > 0)
|
|
|
|
{
|
|
|
|
fd_set rset;
|
|
|
|
struct timeval tv;
|
|
|
|
FD_ZERO(&rset);
|
|
|
|
FD_SET(fnum, &rset);
|
|
|
|
tv.tv_sec = timeout / 1000;
|
|
|
|
tv.tv_usec = (timeout % 1000) * 1000;
|
|
|
|
int retval;
|
2000-08-02 23:54:04 +02:00
|
|
|
if ((retval = _Jv_select (fnum + 1, &rset, NULL, NULL, &tv)) < 0)
|
1999-05-28 21:29:53 +02:00
|
|
|
goto error;
|
|
|
|
else if (retval == 0)
|
2000-09-05 23:57:23 +02:00
|
|
|
throw new java::io::InterruptedIOException (
|
|
|
|
JvNewStringUTF("Accept timed out"));
|
1999-05-28 21:29:53 +02:00
|
|
|
}
|
|
|
|
|
2001-08-01 19:53:00 +02:00
|
|
|
new_socket = _Jv_accept (fnum, (sockaddr*) &u, &addrlen);
|
1999-04-07 16:42:40 +02:00
|
|
|
if (new_socket < 0)
|
|
|
|
goto error;
|
|
|
|
jbyteArray raddr;
|
|
|
|
jint rport;
|
|
|
|
if (u.address.sin_family == AF_INET)
|
|
|
|
{
|
|
|
|
raddr = JvNewByteArray (4);
|
|
|
|
memcpy (elements (raddr), &u.address.sin_addr, 4);
|
|
|
|
rport = ntohs (u.address.sin_port);
|
|
|
|
}
|
|
|
|
#ifdef HAVE_INET6
|
1999-04-08 15:22:59 +02:00
|
|
|
else if (u.address.sin_family == AF_INET6)
|
1999-04-07 16:42:40 +02:00
|
|
|
{
|
|
|
|
raddr = JvNewByteArray (16);
|
|
|
|
memcpy (elements (raddr), &u.address6.sin6_addr, 16);
|
|
|
|
rport = ntohs (u.address6.sin6_port);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
else
|
2000-08-11 05:07:59 +02:00
|
|
|
throw new java::net::SocketException (JvNewStringUTF ("invalid family"));
|
|
|
|
|
1999-04-07 16:42:40 +02:00
|
|
|
s->fnum = new_socket;
|
|
|
|
s->localport = localport;
|
|
|
|
s->address = new InetAddress (raddr, NULL);
|
|
|
|
s->port = rport;
|
|
|
|
s->fd = new java::io::FileDescriptor (new_socket);
|
|
|
|
return;
|
|
|
|
error:
|
|
|
|
char* strerr = strerror (errno);
|
2000-09-05 23:57:23 +02:00
|
|
|
throw new java::io::IOException (JvNewStringUTF (strerr));
|
1999-04-07 16:42:40 +02:00
|
|
|
}
|
1999-05-26 19:00:06 +02:00
|
|
|
|
2002-01-08 22:14:58 +01:00
|
|
|
// Close(shutdown) the socket.
|
|
|
|
void
|
|
|
|
java::net::PlainSocketImpl::close()
|
|
|
|
{
|
|
|
|
// should we use shutdown here? how would that effect so_linger?
|
|
|
|
int res = ::close (fnum);
|
|
|
|
|
|
|
|
if (res == -1)
|
|
|
|
{
|
|
|
|
// These three errors are not errors according to tests performed
|
|
|
|
// on the reference implementation.
|
|
|
|
if (errno != ENOTCONN && errno != ECONNRESET && errno != EBADF)
|
|
|
|
throw new java::io::IOException (JvNewStringUTF (strerror (errno)));
|
|
|
|
}
|
|
|
|
// Safe place to reset the file pointer.
|
|
|
|
fnum = -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Write a byte to the socket.
|
|
|
|
void
|
|
|
|
java::net::PlainSocketImpl::write(jint b)
|
|
|
|
{
|
|
|
|
jbyte d =(jbyte) b;
|
|
|
|
int r = 0;
|
|
|
|
|
|
|
|
while (r != 1)
|
|
|
|
{
|
|
|
|
r = ::write (fnum, &d, 1);
|
|
|
|
if (r == -1)
|
|
|
|
{
|
|
|
|
if (java::lang::Thread::interrupted())
|
|
|
|
{
|
|
|
|
java::io::InterruptedIOException *iioe
|
|
|
|
= new java::io::InterruptedIOException
|
|
|
|
(JvNewStringLatin1 (strerror (errno)));
|
|
|
|
iioe->bytesTransferred = 0;
|
|
|
|
throw iioe;
|
|
|
|
}
|
|
|
|
// Some errors should not cause exceptions.
|
|
|
|
if (errno != ENOTCONN && errno != ECONNRESET && errno != EBADF)
|
|
|
|
throw new java::io::IOException (JvNewStringUTF (strerror (errno)));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Write some bytes to the socket.
|
|
|
|
void
|
|
|
|
java::net::PlainSocketImpl::write(jbyteArray b, jint offset, jint len)
|
|
|
|
{
|
|
|
|
if (! b)
|
|
|
|
throw new java::lang::NullPointerException;
|
|
|
|
if (offset < 0 || len < 0 || offset + len > JvGetArrayLength (b))
|
|
|
|
throw new java::lang::ArrayIndexOutOfBoundsException;
|
|
|
|
|
|
|
|
jbyte *bytes = elements (b) + offset;
|
|
|
|
int written = 0;
|
|
|
|
while (len > 0)
|
|
|
|
{
|
|
|
|
int r = ::write (fnum, bytes, len);
|
|
|
|
if (r == -1)
|
|
|
|
{
|
|
|
|
if (java::lang::Thread::interrupted())
|
|
|
|
{
|
|
|
|
java::io::InterruptedIOException *iioe
|
|
|
|
= new java::io::InterruptedIOException
|
|
|
|
(JvNewStringLatin1 (strerror (errno)));
|
|
|
|
iioe->bytesTransferred = written;
|
|
|
|
throw iioe;
|
|
|
|
}
|
|
|
|
// Some errors should not cause exceptions.
|
|
|
|
if (errno != ENOTCONN && errno != ECONNRESET && errno != EBADF)
|
|
|
|
throw new java::io::IOException (JvNewStringUTF (strerror (errno)));
|
|
|
|
}
|
|
|
|
written += r;
|
|
|
|
len -= r;
|
|
|
|
bytes += r;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Read a single byte from the socket.
|
|
|
|
jint
|
|
|
|
java::net::PlainSocketImpl::read(void)
|
|
|
|
{
|
|
|
|
jbyte b;
|
|
|
|
|
|
|
|
// Do timeouts via select.
|
|
|
|
if (timeout > 0)
|
|
|
|
{
|
|
|
|
// Create the file descriptor set.
|
|
|
|
fd_set read_fds;
|
|
|
|
FD_ZERO (&read_fds);
|
|
|
|
FD_SET (fnum,&read_fds);
|
|
|
|
// Create the timeout struct based on our internal timeout value.
|
|
|
|
struct timeval timeout_value;
|
|
|
|
timeout_value.tv_sec = timeout / 1000;
|
|
|
|
timeout_value.tv_usec = (timeout % 1000) * 1000;
|
|
|
|
// Select on the fds.
|
|
|
|
int sel_retval = _Jv_select (fnum + 1, &read_fds, NULL, NULL, &timeout_value);
|
|
|
|
// If select returns 0 we've waited without getting data...
|
|
|
|
// that means we've timed out.
|
|
|
|
if (sel_retval == 0)
|
|
|
|
throw new java::io::InterruptedIOException
|
|
|
|
(JvNewStringUTF ("read timed out") );
|
|
|
|
// If select returns ok we know we either got signalled or read some data...
|
|
|
|
// either way we need to try to read.
|
|
|
|
}
|
|
|
|
int r = ::read (fnum, &b, 1);
|
|
|
|
|
|
|
|
if (r == 0)
|
|
|
|
return -1;
|
|
|
|
if (java::lang::Thread::interrupted())
|
|
|
|
{
|
|
|
|
java::io::InterruptedIOException *iioe =
|
|
|
|
new java::io::InterruptedIOException
|
|
|
|
(JvNewStringUTF("read interrupted"));
|
|
|
|
iioe->bytesTransferred = r == -1 ? 0 : r;
|
|
|
|
throw iioe;
|
|
|
|
}
|
|
|
|
else if (r == -1)
|
|
|
|
{
|
|
|
|
// Some errors cause us to return end of stream...
|
|
|
|
if (errno == ENOTCONN)
|
|
|
|
return -1;
|
|
|
|
// Other errors need to be signalled.
|
|
|
|
throw new java::io::IOException (JvNewStringUTF (strerror (errno)));
|
|
|
|
}
|
|
|
|
return b & 0xFF;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Read count bytes into the buffer, starting at offset.
|
|
|
|
jint
|
|
|
|
java::net::PlainSocketImpl::read(jbyteArray buffer, jint offset, jint count)
|
|
|
|
{
|
|
|
|
if (! buffer)
|
|
|
|
throw new java::lang::NullPointerException;
|
|
|
|
jsize bsize = JvGetArrayLength (buffer);
|
|
|
|
if (offset < 0 || count < 0 || offset + count > bsize)
|
|
|
|
throw new java::lang::ArrayIndexOutOfBoundsException;
|
|
|
|
jbyte *bytes = elements (buffer) + offset;
|
|
|
|
|
|
|
|
// Do timeouts via select.
|
|
|
|
if (timeout > 0)
|
|
|
|
{
|
|
|
|
// Create the file descriptor set.
|
|
|
|
fd_set read_fds;
|
|
|
|
FD_ZERO (&read_fds);
|
|
|
|
FD_SET (fnum, &read_fds);
|
|
|
|
// Create the timeout struct based on our internal timeout value.
|
|
|
|
struct timeval timeout_value;
|
|
|
|
timeout_value.tv_sec = timeout / 1000;
|
|
|
|
timeout_value.tv_usec =(timeout % 1000) * 1000;
|
|
|
|
// Select on the fds.
|
|
|
|
int sel_retval = _Jv_select (fnum + 1, &read_fds, NULL, NULL, &timeout_value);
|
|
|
|
// We're only interested in the 0 return.
|
|
|
|
// error returns still require us to try to read
|
|
|
|
// the socket to see what happened.
|
|
|
|
if (sel_retval == 0)
|
|
|
|
{
|
|
|
|
java::io::InterruptedIOException *iioe =
|
|
|
|
new java::io::InterruptedIOException
|
|
|
|
(JvNewStringUTF ("read interrupted"));
|
|
|
|
iioe->bytesTransferred = 0;
|
|
|
|
throw iioe;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Read the socket.
|
2002-01-18 18:23:23 +01:00
|
|
|
int r = _Jv_recv (::recv, fnum, (void *) bytes, count, 0);
|
2002-01-08 22:14:58 +01:00
|
|
|
if (r == 0)
|
|
|
|
return -1;
|
|
|
|
if (java::lang::Thread::interrupted())
|
|
|
|
{
|
|
|
|
java::io::InterruptedIOException *iioe =
|
|
|
|
new java::io::InterruptedIOException
|
|
|
|
(JvNewStringUTF ("read interrupted"));
|
|
|
|
iioe->bytesTransferred = r == -1 ? 0 : r;
|
|
|
|
throw iioe;
|
|
|
|
}
|
|
|
|
else if (r == -1)
|
|
|
|
{
|
|
|
|
// Some errors cause us to return end of stream...
|
|
|
|
if (errno == ENOTCONN)
|
|
|
|
return -1;
|
|
|
|
// Other errors need to be signalled.
|
|
|
|
throw new java::io::IOException (JvNewStringUTF (strerror (errno)));
|
|
|
|
}
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
|
|
|
// How many bytes are available?
|
|
|
|
jint
|
|
|
|
java::net::PlainSocketImpl::available(void)
|
|
|
|
{
|
|
|
|
#if defined(FIONREAD) || defined(HAVE_SELECT)
|
|
|
|
long num = 0;
|
|
|
|
int r = 0;
|
|
|
|
bool num_set = false;
|
|
|
|
|
|
|
|
#if defined(FIONREAD)
|
|
|
|
r = ::ioctl (fnum, FIONREAD, &num);
|
|
|
|
if (r == -1 && errno == ENOTTY)
|
|
|
|
{
|
|
|
|
// If the ioctl doesn't work, we don't care.
|
|
|
|
r = 0;
|
|
|
|
num = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
num_set = true;
|
|
|
|
#elif defined(HAVE_SELECT)
|
|
|
|
if (fnum < 0)
|
|
|
|
{
|
|
|
|
errno = EBADF;
|
|
|
|
r = -1;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if (r == -1)
|
|
|
|
{
|
|
|
|
posix_error:
|
|
|
|
throw new java::io::IOException(JvNewStringUTF(strerror(errno)));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// If we didn't get anything we can use select.
|
|
|
|
|
|
|
|
#if defined(HAVE_SELECT)
|
|
|
|
if (! num_set)
|
|
|
|
{
|
|
|
|
fd_set rd;
|
|
|
|
FD_ZERO (&rd);
|
|
|
|
FD_SET (fnum, &rd);
|
|
|
|
struct timeval tv;
|
|
|
|
tv.tv_sec = 0;
|
|
|
|
tv.tv_usec = 0;
|
|
|
|
r = _Jv_select (fnum + 1, &rd, NULL, NULL, &tv);
|
|
|
|
if(r == -1)
|
|
|
|
goto posix_error;
|
|
|
|
num = r == 0 ? 0 : 1;
|
|
|
|
}
|
|
|
|
#endif /* HAVE_SELECT */
|
|
|
|
|
|
|
|
return (jint) num;
|
|
|
|
#else
|
|
|
|
throw new java::io::IOException (JvNewStringUTF ("unimplemented"));
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1999-05-26 19:00:06 +02:00
|
|
|
void
|
|
|
|
java::net::PlainSocketImpl::setOption (jint optID, java::lang::Object *value)
|
|
|
|
{
|
|
|
|
int val;
|
|
|
|
socklen_t val_len = sizeof (val);
|
|
|
|
|
2002-01-18 18:23:23 +01:00
|
|
|
if (_Jv_IsInstanceOf (value, &java::lang::Boolean::class$))
|
1999-05-26 19:00:06 +02:00
|
|
|
{
|
|
|
|
java::lang::Boolean *boolobj =
|
|
|
|
static_cast<java::lang::Boolean *> (value);
|
|
|
|
if (boolobj->booleanValue())
|
|
|
|
val = 1;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (optID == _Jv_SO_LINGER_)
|
|
|
|
val = -1;
|
|
|
|
else
|
|
|
|
val = 0;
|
|
|
|
}
|
|
|
|
}
|
2002-01-18 18:23:23 +01:00
|
|
|
else if (_Jv_IsInstanceOf (value, &java::lang::Integer::class$))
|
1999-05-26 19:00:06 +02:00
|
|
|
{
|
|
|
|
java::lang::Integer *intobj =
|
|
|
|
static_cast<java::lang::Integer *> (value);
|
|
|
|
val = (int) intobj->intValue();
|
|
|
|
}
|
2002-01-18 18:23:23 +01:00
|
|
|
else
|
|
|
|
{
|
|
|
|
throw new java::lang::IllegalArgumentException (JvNewStringLatin1 ("`value' must be Boolean or Integer"));
|
|
|
|
}
|
1999-05-26 19:00:06 +02:00
|
|
|
|
|
|
|
switch (optID)
|
|
|
|
{
|
|
|
|
case _Jv_TCP_NODELAY_ :
|
|
|
|
#ifdef TCP_NODELAY
|
|
|
|
if (::setsockopt (fnum, IPPROTO_TCP, TCP_NODELAY, (char *) &val,
|
|
|
|
val_len) != 0)
|
|
|
|
goto error;
|
|
|
|
#else
|
2000-09-05 23:57:23 +02:00
|
|
|
throw new java::lang::InternalError (
|
|
|
|
JvNewStringUTF ("TCP_NODELAY not supported"));
|
1999-05-26 19:00:06 +02:00
|
|
|
#endif /* TCP_NODELAY */
|
|
|
|
return;
|
|
|
|
case _Jv_SO_LINGER_ :
|
|
|
|
#ifdef SO_LINGER
|
|
|
|
struct linger l_val;
|
|
|
|
l_val.l_onoff = (val != -1);
|
|
|
|
l_val.l_linger = val;
|
|
|
|
if (::setsockopt (fnum, SOL_SOCKET, SO_LINGER, (char *) &l_val,
|
|
|
|
sizeof(l_val)) != 0)
|
|
|
|
goto error;
|
|
|
|
#else
|
2000-09-05 23:57:23 +02:00
|
|
|
throw new java::lang::InternalError (
|
|
|
|
JvNewStringUTF ("SO_LINGER not supported"));
|
1999-05-26 19:00:06 +02:00
|
|
|
#endif /* SO_LINGER */
|
|
|
|
return;
|
|
|
|
case _Jv_SO_SNDBUF_ :
|
|
|
|
case _Jv_SO_RCVBUF_ :
|
|
|
|
#if defined(SO_SNDBUF) && defined(SO_RCVBUF)
|
|
|
|
int opt;
|
|
|
|
optID == _Jv_SO_SNDBUF_ ? opt = SO_SNDBUF : opt = SO_RCVBUF;
|
|
|
|
if (::setsockopt (fnum, SOL_SOCKET, opt, (char *) &val, val_len) != 0)
|
|
|
|
goto error;
|
|
|
|
#else
|
2000-09-05 23:57:23 +02:00
|
|
|
throw new java::lang::InternalError (
|
|
|
|
JvNewStringUTF ("SO_RCVBUF/SO_SNDBUF not supported"));
|
1999-05-26 19:00:06 +02:00
|
|
|
#endif
|
|
|
|
return;
|
|
|
|
case _Jv_SO_BINDADDR_ :
|
2000-09-05 23:57:23 +02:00
|
|
|
throw new java::net::SocketException (
|
|
|
|
JvNewStringUTF ("SO_BINDADDR: read only option"));
|
1999-05-26 19:00:06 +02:00
|
|
|
return;
|
|
|
|
case _Jv_IP_MULTICAST_IF_ :
|
2000-09-05 23:57:23 +02:00
|
|
|
throw new java::net::SocketException (
|
|
|
|
JvNewStringUTF ("IP_MULTICAST_IF: not valid for TCP"));
|
1999-05-26 19:00:06 +02:00
|
|
|
return;
|
|
|
|
case _Jv_SO_REUSEADDR_ :
|
2000-09-05 23:57:23 +02:00
|
|
|
throw new java::net::SocketException (
|
|
|
|
JvNewStringUTF ("SO_REUSEADDR: not valid for TCP"));
|
1999-05-26 19:00:06 +02:00
|
|
|
return;
|
|
|
|
case _Jv_SO_TIMEOUT_ :
|
1999-05-28 21:29:53 +02:00
|
|
|
timeout = val;
|
1999-05-26 19:00:06 +02:00
|
|
|
return;
|
|
|
|
default :
|
|
|
|
errno = ENOPROTOOPT;
|
|
|
|
}
|
|
|
|
|
|
|
|
error:
|
|
|
|
char* strerr = strerror (errno);
|
2000-09-05 23:57:23 +02:00
|
|
|
throw new java::net::SocketException (JvNewStringUTF (strerr));
|
1999-05-26 19:00:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
java::lang::Object *
|
|
|
|
java::net::PlainSocketImpl::getOption (jint optID)
|
|
|
|
{
|
|
|
|
int val;
|
|
|
|
socklen_t val_len = sizeof(val);
|
|
|
|
union SockAddr u;
|
|
|
|
socklen_t addrlen = sizeof(u);
|
|
|
|
struct linger l_val;
|
|
|
|
socklen_t l_val_len = sizeof(l_val);
|
|
|
|
|
|
|
|
switch (optID)
|
|
|
|
{
|
|
|
|
#ifdef TCP_NODELAY
|
|
|
|
case _Jv_TCP_NODELAY_ :
|
|
|
|
if (::getsockopt (fnum, IPPROTO_TCP, TCP_NODELAY, (char *) &val,
|
|
|
|
&val_len) != 0)
|
|
|
|
goto error;
|
|
|
|
else
|
|
|
|
return new java::lang::Boolean (val != 0);
|
|
|
|
#else
|
2000-09-05 23:57:23 +02:00
|
|
|
throw new java::lang::InternalError (
|
|
|
|
JvNewStringUTF ("TCP_NODELAY not supported"));
|
1999-05-26 19:00:06 +02:00
|
|
|
#endif
|
|
|
|
break;
|
|
|
|
|
|
|
|
case _Jv_SO_LINGER_ :
|
|
|
|
#ifdef SO_LINGER
|
|
|
|
if (::getsockopt (fnum, SOL_SOCKET, SO_LINGER, (char *) &l_val,
|
|
|
|
&l_val_len) != 0)
|
|
|
|
goto error;
|
|
|
|
if (l_val.l_onoff)
|
|
|
|
return new java::lang::Integer (l_val.l_linger);
|
|
|
|
else
|
[multiple changes]
1999-08-09 Anthony Green <green@cygnus.com>
* gij.cc: New file.
* include/config.h.in: Rebuilt.
* acconfig.h: Add INTERPRETER.
* configure: Rebuilt.
* Makefile.in: Rebuilt.
* Makefile.am (libffi_files): Identify the libffi object files for
inclusion in libgcj.
(LIBFFIINCS): Define.
* interpret.cc (gnu::gcj::runtime::MethodInvocation::continue1):
Dummy definition for configurations without an interpreter.
* java/net/natPlainSocketImpl.cc (getOption): Disamiguate call to
java::lang::Boolean constructor.
* include/java-interp.h: Always include java-cpool.h.
* java/lang/natClassLoader.cc (getVMClassLoader0): Always return 0
when INTERPRETER not defined.
* java/lang/Class.h (finalize): Define.
* gnu/gcj/util/path/DirectoryPathEntry.java (getURL): Catch
IOException from File.getCanonicalPath.
(getStream): Likewise.
* NEWS: More news.
* THANKS: More thanks.
1999-08-09 Kresten Krab Thorup <krab@gnu.org>
* resolve.cc (get_ffi_type_from_signature): Generate uint16 for
jchar type.
(_Jv_PrepareClass): Allow non-abstract classes to
have abstract subclasses.
(_Jv_ResolvePoolEntry): Revert subclass check for protected
fields and methods.
* interpret.cc (continue1/perform_invoke): Don't sign extend
uint16 return val.
(continue1/lshl,lshr): Push long, not int.
(continue1/ulshr): Use UINT64, not long long.
* defineclass.cc (handleFieldsEnd): Handle case when all fields
are static.
* java/lang/natClass.cc (forName): Add call to _Jv_InitClass.
* java/lang/FirstThread.java (run): Add top-level exception
handler.
(run0): Renamed from run.
1999-08-08 Kresten Krab Thorup <krab@gnu.org>
* configure.in (--with-interpreter): Added.
* include/config.h.in (INTERPRETER): Added.
* java/lang/ClassLoader.java: File replaced.
* java/lang/VMClassLoader.java: New file.
* java/lang/natClassLoader.cc: New file.
* gnu/gcj/runtime/MethodInvocation.java: New file.
* gnu/gcj/util/path/SearchPath.java: New file.
* gnu/gcj/util/path/PathEntry.java: New file.
* gnu/gcj/util/path/DirectoryPathEntry.java: New file.
* gnu/gcj/util/path/ZipPathEntry.java: New file.
* gnu/gcj/util/path/URLPathEntry.java: New file.
* gnu/gcj/util/path/CacheEntry.java: New file.
* include/java-interp.h: New file.
* include/java-cpool.h: New file.
* include/java-insns.h: New file.
* defineclass.cc: New file.
* interpret.cc: New file.
* resolve.cc: New file.
* java/lang/natClass.cc (loaded_classes, _Jv_RegisterClass,
_Jv_RegisterClasses, _Jv_FindClassInCache, _Jv_FindClass,
_Jv_NewClass, _Jv_FindArrayClass): Moved to natClassLoader.cc.
(finalize): New.
(STATE_NOTHING, STATE_RESOLVED, STATE_IN_PROGRESS, STATE_DONE,
STATE_ERROR): Moved to java/lang/Class.h and renamed with JV_
prefix.
(initializeClass): Use new JV_ prefixed names. Also, call
ClassLoader::resolveClass instead of _Jv_ResolveClass.
* java/lang/Class.h (JV_STATE_PRELOADING, JV_STATE_LOADING,
JV_STATE_LOADED, JV_STATE_COMPILED, JV_STATE_PREPARED,
JV_STATE_LINKED): New.
(_Jv_WaitForState, _Jv_RegisterInitiatingLoader,
_Jv_UnregisterClass, _Jv_InternClassStrings): New friends.
(_Jv_IsInterpretedClass, _Jv_InitField, _Jv_LookupDeclaredMethod,
_Jv_DetermineVTableIndex, _Jv_ResolvePoolEntry, _Jv_PrepareClass,
_Jv_ClassReader, _Jv_InterpClass, _Jv_InterpMethod,
_Jv_InterpMethodInvocation): New friends for interpreter.
(finalize): New.
(CONSTANT_Class, CONSTANT_String, etc.): Moved to
include/java-cpool.h and renamed with JV_ prefix.
* include/jvm.h (_Jv_makeUtf8Const, _Jv_makeUtf8TypeConst): New
decls.
(_Jv_UnregisterClass): New decl.
* java/lang/natClassLoader.cc (_Jv_FindArrayClass): Added
class loader argument.
(_Jv_FindClass): Use class loader.
* prims.cc (_Jv_makeUtf8Const): New function.
(_Jv_NewObjectArray): Change use of _Jv_FindArrayClass.
(_Jv_NewPrimArray): Ditto.
(_Jv_FindClassFromSignature): Ditto.
* java/lang/reflect/natArray.cc (newInstance): Ditto.
* java/lang/reflect/natMethod.cc (getType): Ditto.
* include/java-field.h (_Jv_Field::isRef): Make robust for
non-resolved contexts.
* boehm.cc (_Jv_MarkObj): Mark interpreter-related fields.
Also, don't mark class->next field.
* java/lang/VirtualMachineError.java: Added FIXME note.
* configure.in (INTERPSPEC): New spec.
* libgcj.spec.in: Added INTERPSPEC.
* Makefile.am: Added gcjh friends for java/lang/VMClassLoader and
gnu/gcj/runtime/MethodInvocation.
(libgcj_la_SOURCES): Added resolve.cc defineclass.cc interpret.cc.
(ordinary_java_source_files): Added above mentioned java classes.
* configure: Rebuilt.
* Makefile.in: Rebuilt.
From-SVN: r28597
1999-08-08 16:06:23 +02:00
|
|
|
return new java::lang::Boolean ((__java_boolean)false);
|
1999-05-26 19:00:06 +02:00
|
|
|
#else
|
2000-09-05 23:57:23 +02:00
|
|
|
throw new java::lang::InternalError (
|
|
|
|
JvNewStringUTF ("SO_LINGER not supported"));
|
1999-05-26 19:00:06 +02:00
|
|
|
#endif
|
|
|
|
break;
|
|
|
|
case _Jv_SO_RCVBUF_ :
|
|
|
|
case _Jv_SO_SNDBUF_ :
|
|
|
|
#if defined(SO_SNDBUF) && defined(SO_RCVBUF)
|
|
|
|
int opt;
|
|
|
|
optID == _Jv_SO_SNDBUF_ ? opt = SO_SNDBUF : opt = SO_RCVBUF;
|
|
|
|
if (::getsockopt (fnum, SOL_SOCKET, opt, (char *) &val, &val_len) != 0)
|
|
|
|
goto error;
|
|
|
|
else
|
|
|
|
return new java::lang::Integer (val);
|
|
|
|
#else
|
2000-09-05 23:57:23 +02:00
|
|
|
throw new java::lang::InternalError (
|
|
|
|
JvNewStringUTF ("SO_RCVBUF/SO_SNDBUF not supported"));
|
1999-05-26 19:00:06 +02:00
|
|
|
#endif
|
|
|
|
break;
|
|
|
|
case _Jv_SO_BINDADDR_:
|
1999-06-17 02:21:26 +02:00
|
|
|
// cache the local address
|
|
|
|
if (localAddress == NULL)
|
1999-05-26 19:00:06 +02:00
|
|
|
{
|
1999-06-17 02:21:26 +02:00
|
|
|
jbyteArray laddr;
|
|
|
|
if (::getsockname (fnum, (sockaddr*) &u, &addrlen) != 0)
|
|
|
|
goto error;
|
|
|
|
if (u.address.sin_family == AF_INET)
|
|
|
|
{
|
|
|
|
laddr = JvNewByteArray (4);
|
|
|
|
memcpy (elements (laddr), &u.address.sin_addr, 4);
|
|
|
|
}
|
1999-05-26 19:00:06 +02:00
|
|
|
#ifdef HAVE_INET6
|
1999-06-17 02:21:26 +02:00
|
|
|
else if (u.address.sin_family == AF_INET6)
|
|
|
|
{
|
|
|
|
laddr = JvNewByteArray (16);
|
|
|
|
memcpy (elements (laddr), &u.address6.sin6_addr, 16);
|
|
|
|
}
|
1999-05-26 19:00:06 +02:00
|
|
|
#endif
|
1999-06-17 02:21:26 +02:00
|
|
|
else
|
2000-08-11 05:07:59 +02:00
|
|
|
throw
|
|
|
|
new java::net::SocketException (JvNewStringUTF ("invalid family"));
|
1999-06-17 02:21:26 +02:00
|
|
|
localAddress = new java::net::InetAddress (laddr, NULL);
|
|
|
|
}
|
|
|
|
return localAddress;
|
1999-05-26 19:00:06 +02:00
|
|
|
break;
|
|
|
|
case _Jv_IP_MULTICAST_IF_ :
|
2000-09-05 23:57:23 +02:00
|
|
|
throw new java::net::SocketException (
|
|
|
|
JvNewStringUTF ("IP_MULTICAST_IF: not valid for TCP"));
|
1999-05-26 19:00:06 +02:00
|
|
|
break;
|
|
|
|
case _Jv_SO_REUSEADDR_ :
|
2000-09-05 23:57:23 +02:00
|
|
|
throw new java::net::SocketException (
|
|
|
|
JvNewStringUTF ("SO_REUSEADDR: not valid for TCP"));
|
1999-05-26 19:00:06 +02:00
|
|
|
break;
|
|
|
|
case _Jv_SO_TIMEOUT_ :
|
1999-05-28 21:29:53 +02:00
|
|
|
return new java::lang::Integer (timeout);
|
1999-05-26 19:00:06 +02:00
|
|
|
break;
|
|
|
|
default :
|
|
|
|
errno = ENOPROTOOPT;
|
|
|
|
}
|
|
|
|
|
|
|
|
error:
|
|
|
|
char* strerr = strerror (errno);
|
2000-09-05 23:57:23 +02:00
|
|
|
throw new java::net::SocketException (JvNewStringUTF (strerr));
|
1999-05-26 19:00:06 +02:00
|
|
|
}
|
1999-10-02 02:19:01 +02:00
|
|
|
|
|
|
|
#endif /* DISABLE_JAVA_NET */
|