7041778: Move SCTP implementation out of sun.nio.ch and into its own package
Reviewed-by: alanb
This commit is contained in:
parent
45569b3a65
commit
511e7438d7
@ -29,11 +29,11 @@
|
||||
|
||||
ifneq ($(PLATFORM), windows)
|
||||
FILES_export = \
|
||||
sun/nio/ch/SctpAssocChange.java \
|
||||
sun/nio/ch/SctpChannelImpl.java \
|
||||
sun/nio/ch/SctpNet.java \
|
||||
sun/nio/ch/SctpPeerAddrChange.java \
|
||||
sun/nio/ch/SctpResultContainer.java \
|
||||
sun/nio/ch/SctpServerChannelImpl.java \
|
||||
sun/nio/ch/SctpStdSocketOption.java
|
||||
sun/nio/ch/sctp/AssociationChange.java \
|
||||
sun/nio/ch/sctp/SctpChannelImpl.java \
|
||||
sun/nio/ch/sctp/SctpNet.java \
|
||||
sun/nio/ch/sctp/PeerAddrChange.java \
|
||||
sun/nio/ch/sctp/ResultContainer.java \
|
||||
sun/nio/ch/sctp/SctpServerChannelImpl.java \
|
||||
sun/nio/ch/sctp/SctpStdSocketOption.java
|
||||
endif
|
||||
|
@ -42,25 +42,25 @@ FILES_java = \
|
||||
com/sun/nio/sctp/SendFailedNotification.java \
|
||||
com/sun/nio/sctp/ShutdownNotification.java \
|
||||
\
|
||||
sun/nio/ch/SctpMessageInfoImpl.java \
|
||||
sun/nio/ch/SctpStdSocketOption.java
|
||||
sun/nio/ch/sctp/MessageInfoImpl.java \
|
||||
sun/nio/ch/sctp/SctpStdSocketOption.java
|
||||
|
||||
ifneq ($(PLATFORM), windows)
|
||||
FILES_java += \
|
||||
sun/nio/ch/SctpAssocChange.java \
|
||||
sun/nio/ch/SctpAssociationImpl.java \
|
||||
sun/nio/ch/SctpChannelImpl.java \
|
||||
sun/nio/ch/SctpMultiChannelImpl.java \
|
||||
sun/nio/ch/SctpNet.java \
|
||||
sun/nio/ch/SctpNotification.java \
|
||||
sun/nio/ch/SctpPeerAddrChange.java \
|
||||
sun/nio/ch/SctpResultContainer.java \
|
||||
sun/nio/ch/SctpSendFailed.java \
|
||||
sun/nio/ch/SctpServerChannelImpl.java \
|
||||
sun/nio/ch/SctpShutdown.java
|
||||
sun/nio/ch/sctp/AssociationChange.java \
|
||||
sun/nio/ch/sctp/AssociationImpl.java \
|
||||
sun/nio/ch/sctp/PeerAddrChange.java \
|
||||
sun/nio/ch/sctp/ResultContainer.java \
|
||||
sun/nio/ch/sctp/SctpChannelImpl.java \
|
||||
sun/nio/ch/sctp/SctpMultiChannelImpl.java \
|
||||
sun/nio/ch/sctp/SctpNet.java \
|
||||
sun/nio/ch/sctp/SctpNotification.java \
|
||||
sun/nio/ch/sctp/SctpServerChannelImpl.java \
|
||||
sun/nio/ch/sctp/SendFailed.java \
|
||||
sun/nio/ch/sctp/Shutdown.java
|
||||
else
|
||||
FILES_java += \
|
||||
sun/nio/ch/SctpChannelImpl.java \
|
||||
sun/nio/ch/SctpMultiChannelImpl.java \
|
||||
sun/nio/ch/SctpServerChannelImpl.java
|
||||
sun/nio/ch/sctp/SctpChannelImpl.java \
|
||||
sun/nio/ch/sctp/SctpMultiChannelImpl.java \
|
||||
sun/nio/ch/sctp/SctpServerChannelImpl.java
|
||||
endif
|
||||
|
@ -47,14 +47,16 @@ include $(BUILDDIR)/common/Library.gmk
|
||||
#
|
||||
# Find platform-specific C source files
|
||||
#
|
||||
vpath %.c $(PLATFORM_SRC)/native/sun/nio/ch
|
||||
vpath %.c $(PLATFORM_SRC)/native/sun/nio/ch/sctp
|
||||
|
||||
#
|
||||
# Include nio.h, net_util.h, sun_nio_ch_IOStatus.h, etc
|
||||
#
|
||||
OTHER_INCLUDES += \
|
||||
-I$(SHARE_SRC)/native/sun/nio/ch \
|
||||
-I$(SHARE_SRC)/native/sun/nio/ch/sctp \
|
||||
-I$(SHARE_SRC)/native/java/net \
|
||||
-I$(PLATFORM_SRC)/native/sun/nio/ch \
|
||||
-I$(PLATFORM_SRC)/native/java/net \
|
||||
-I$(CLASSHDRDIR)/../../../../java/java.nio/nio/CClassHeaders
|
||||
|
||||
@ -75,5 +77,5 @@ endif # ifneq windows
|
||||
|
||||
clean clobber::
|
||||
$(RM) -r $(CLASSDESTDIR)/com/sun/nio/sctp
|
||||
$(RM) -r $(CLASSDESTDIR)/sun/nio/ch
|
||||
$(RM) -r $(CLASSDESTDIR)/sun/nio/ch/sctp
|
||||
|
||||
|
@ -25,30 +25,30 @@
|
||||
|
||||
SUNWprivate_1.1 {
|
||||
global:
|
||||
Java_sun_nio_ch_SctpNet_init;
|
||||
Java_sun_nio_ch_SctpNet_socket0;
|
||||
Java_sun_nio_ch_SctpNet_bindx;
|
||||
Java_sun_nio_ch_SctpNet_branch0;
|
||||
Java_sun_nio_ch_SctpNet_listen0;
|
||||
Java_sun_nio_ch_SctpNet_connect0;
|
||||
Java_sun_nio_ch_SctpNet_close0;
|
||||
Java_sun_nio_ch_SctpNet_preClose0;
|
||||
Java_sun_nio_ch_SctpNet_getLocalAddresses0;
|
||||
Java_sun_nio_ch_SctpNet_getRemoteAddresses0;
|
||||
Java_sun_nio_ch_SctpNet_getPrimAddrOption0;
|
||||
Java_sun_nio_ch_SctpNet_setPrimAddrOption0;
|
||||
Java_sun_nio_ch_SctpNet_setPeerPrimAddrOption0;
|
||||
Java_sun_nio_ch_SctpNet_getInitMsgOption0;
|
||||
Java_sun_nio_ch_SctpNet_setInitMsgOption0;
|
||||
Java_sun_nio_ch_SctpNet_getIntOption0;
|
||||
Java_sun_nio_ch_SctpNet_setIntOption0;
|
||||
Java_sun_nio_ch_SctpNet_shutdown0;
|
||||
Java_sun_nio_ch_SctpChannelImpl_initIDs;
|
||||
Java_sun_nio_ch_SctpChannelImpl_checkConnect;
|
||||
Java_sun_nio_ch_SctpChannelImpl_receive0;
|
||||
Java_sun_nio_ch_SctpChannelImpl_send0;
|
||||
Java_sun_nio_ch_SctpServerChannelImpl_initIDs;
|
||||
Java_sun_nio_ch_SctpServerChannelImpl_accept0;
|
||||
Java_sun_nio_ch_sctp_SctpNet_init;
|
||||
Java_sun_nio_ch_sctp_SctpNet_socket0;
|
||||
Java_sun_nio_ch_sctp_SctpNet_bindx;
|
||||
Java_sun_nio_ch_sctp_SctpNet_branch0;
|
||||
Java_sun_nio_ch_sctp_SctpNet_listen0;
|
||||
Java_sun_nio_ch_sctp_SctpNet_connect0;
|
||||
Java_sun_nio_ch_sctp_SctpNet_close0;
|
||||
Java_sun_nio_ch_sctp_SctpNet_preClose0;
|
||||
Java_sun_nio_ch_sctp_SctpNet_getLocalAddresses0;
|
||||
Java_sun_nio_ch_sctp_SctpNet_getRemoteAddresses0;
|
||||
Java_sun_nio_ch_sctp_SctpNet_getPrimAddrOption0;
|
||||
Java_sun_nio_ch_sctp_SctpNet_setPrimAddrOption0;
|
||||
Java_sun_nio_ch_sctp_SctpNet_setPeerPrimAddrOption0;
|
||||
Java_sun_nio_ch_sctp_SctpNet_getInitMsgOption0;
|
||||
Java_sun_nio_ch_sctp_SctpNet_setInitMsgOption0;
|
||||
Java_sun_nio_ch_sctp_SctpNet_getIntOption0;
|
||||
Java_sun_nio_ch_sctp_SctpNet_setIntOption0;
|
||||
Java_sun_nio_ch_sctp_SctpNet_shutdown0;
|
||||
Java_sun_nio_ch_sctp_SctpChannelImpl_initIDs;
|
||||
Java_sun_nio_ch_sctp_SctpChannelImpl_checkConnect;
|
||||
Java_sun_nio_ch_sctp_SctpChannelImpl_receive0;
|
||||
Java_sun_nio_ch_sctp_SctpChannelImpl_send0;
|
||||
Java_sun_nio_ch_sctp_SctpServerChannelImpl_initIDs;
|
||||
Java_sun_nio_ch_sctp_SctpServerChannelImpl_accept0;
|
||||
JNI_OnLoad;
|
||||
local:
|
||||
*;
|
||||
|
@ -94,7 +94,7 @@ public abstract class MessageInfo {
|
||||
if (streamNumber < 0 || streamNumber > 65536)
|
||||
throw new IllegalArgumentException("Invalid stream number");
|
||||
|
||||
return new sun.nio.ch.SctpMessageInfoImpl(null, address, streamNumber);
|
||||
return new sun.nio.ch.sctp.MessageInfoImpl(null, address, streamNumber);
|
||||
}
|
||||
/**
|
||||
* Creates a {@code MessageInfo} instance suitable for use when
|
||||
@ -133,8 +133,8 @@ public abstract class MessageInfo {
|
||||
if (streamNumber < 0 || streamNumber > 65536)
|
||||
throw new IllegalArgumentException("Invalid stream number");
|
||||
|
||||
return new sun.nio.ch.SctpMessageInfoImpl(association, address,
|
||||
streamNumber);
|
||||
return new sun.nio.ch.sctp.MessageInfoImpl(association,
|
||||
address, streamNumber);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -162,7 +162,7 @@ public abstract class SctpChannel
|
||||
*/
|
||||
public static SctpChannel open() throws
|
||||
IOException {
|
||||
return new sun.nio.ch.SctpChannelImpl((SelectorProvider)null);
|
||||
return new sun.nio.ch.sctp.SctpChannelImpl((SelectorProvider)null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -162,7 +162,7 @@ public abstract class SctpMultiChannel
|
||||
*/
|
||||
public static SctpMultiChannel open() throws
|
||||
IOException {
|
||||
return new sun.nio.ch.SctpMultiChannelImpl((SelectorProvider)null);
|
||||
return new sun.nio.ch.sctp.SctpMultiChannelImpl((SelectorProvider)null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -98,7 +98,7 @@ public abstract class SctpServerChannel
|
||||
*/
|
||||
public static SctpServerChannel open() throws
|
||||
IOException {
|
||||
return new sun.nio.ch.SctpServerChannelImpl((SelectorProvider)null);
|
||||
return new sun.nio.ch.sctp.SctpServerChannelImpl((SelectorProvider)null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -25,7 +25,7 @@
|
||||
package com.sun.nio.sctp;
|
||||
|
||||
import java.net.SocketAddress;
|
||||
import sun.nio.ch.SctpStdSocketOption;
|
||||
import sun.nio.ch.sctp.SctpStdSocketOption;
|
||||
|
||||
/**
|
||||
* SCTP channels supports the socket options defined by this class
|
||||
@ -50,7 +50,7 @@ public class SctpStandardSocketOptions {
|
||||
*/
|
||||
public static final SctpSocketOption<Boolean> SCTP_DISABLE_FRAGMENTS = new
|
||||
SctpStdSocketOption<Boolean>("SCTP_DISABLE_FRAGMENTS", Boolean.class,
|
||||
sun.nio.ch.SctpStdSocketOption.SCTP_DISABLE_FRAGMENTS);
|
||||
sun.nio.ch.sctp.SctpStdSocketOption.SCTP_DISABLE_FRAGMENTS);
|
||||
|
||||
/**
|
||||
* Enables or disables explicit message completion.
|
||||
@ -69,7 +69,7 @@ public class SctpStandardSocketOptions {
|
||||
*/
|
||||
public static final SctpSocketOption<Boolean> SCTP_EXPLICIT_COMPLETE = new
|
||||
SctpStdSocketOption<Boolean>("SCTP_EXPLICIT_COMPLETE", Boolean.class,
|
||||
sun.nio.ch.SctpStdSocketOption.SCTP_EXPLICIT_COMPLETE);
|
||||
sun.nio.ch.sctp.SctpStdSocketOption.SCTP_EXPLICIT_COMPLETE);
|
||||
|
||||
/**
|
||||
* Fragmented interleave controls how the presentation of messages occur
|
||||
@ -120,7 +120,7 @@ public class SctpStandardSocketOptions {
|
||||
public static final SctpSocketOption<Integer> SCTP_FRAGMENT_INTERLEAVE =
|
||||
new SctpStdSocketOption<Integer>("SCTP_FRAGMENT_INTERLEAVE",
|
||||
Integer.class,
|
||||
sun.nio.ch.SctpStdSocketOption.SCTP_FRAGMENT_INTERLEAVE);
|
||||
sun.nio.ch.sctp.SctpStdSocketOption.SCTP_FRAGMENT_INTERLEAVE);
|
||||
|
||||
/**
|
||||
* The maximum number of streams requested by the local endpoint during
|
||||
@ -171,7 +171,7 @@ public class SctpStandardSocketOptions {
|
||||
*/
|
||||
public static final SctpSocketOption<Boolean> SCTP_NODELAY =
|
||||
new SctpStdSocketOption<Boolean>("SCTP_NODELAY", Boolean.class,
|
||||
sun.nio.ch.SctpStdSocketOption.SCTP_NODELAY);
|
||||
sun.nio.ch.sctp.SctpStdSocketOption.SCTP_NODELAY);
|
||||
|
||||
/**
|
||||
* Requests that the local SCTP stack use the given peer address as
|
||||
@ -246,7 +246,7 @@ public class SctpStandardSocketOptions {
|
||||
*/
|
||||
public static final SctpSocketOption<Integer> SO_SNDBUF =
|
||||
new SctpStdSocketOption<Integer>("SO_SNDBUF", Integer.class,
|
||||
sun.nio.ch.SctpStdSocketOption.SO_SNDBUF);
|
||||
sun.nio.ch.sctp.SctpStdSocketOption.SO_SNDBUF);
|
||||
|
||||
/**
|
||||
* The size of the socket receive buffer.
|
||||
@ -273,7 +273,7 @@ public class SctpStandardSocketOptions {
|
||||
*/
|
||||
public static final SctpSocketOption<Integer> SO_RCVBUF =
|
||||
new SctpStdSocketOption<Integer>("SO_RCVBUF", Integer.class,
|
||||
sun.nio.ch.SctpStdSocketOption.SO_RCVBUF);
|
||||
sun.nio.ch.sctp.SctpStdSocketOption.SO_RCVBUF);
|
||||
|
||||
/**
|
||||
* Linger on close if data is present.
|
||||
@ -304,7 +304,7 @@ public class SctpStandardSocketOptions {
|
||||
*/
|
||||
public static final SctpSocketOption<Integer> SO_LINGER =
|
||||
new SctpStdSocketOption<Integer>("SO_LINGER", Integer.class,
|
||||
sun.nio.ch.SctpStdSocketOption.SO_LINGER);
|
||||
sun.nio.ch.sctp.SctpStdSocketOption.SO_LINGER);
|
||||
|
||||
/**
|
||||
* This class is used to set the maximum number of inbound/outbound streams
|
||||
|
@ -35,15 +35,15 @@ import sun.misc.*;
|
||||
* @since 1.4
|
||||
*/
|
||||
|
||||
abstract class AbstractPollArrayWrapper {
|
||||
public abstract class AbstractPollArrayWrapper {
|
||||
|
||||
// Event masks
|
||||
static final short POLLIN = 0x0001;
|
||||
static final short POLLOUT = 0x0004;
|
||||
static final short POLLERR = 0x0008;
|
||||
static final short POLLHUP = 0x0010;
|
||||
static final short POLLNVAL = 0x0020;
|
||||
static final short POLLREMOVE = 0x0800;
|
||||
public static final short POLLIN = 0x0001;
|
||||
public static final short POLLOUT = 0x0004;
|
||||
public static final short POLLERR = 0x0008;
|
||||
public static final short POLLHUP = 0x0010;
|
||||
public static final short POLLNVAL = 0x0020;
|
||||
public static final short POLLREMOVE = 0x0800;
|
||||
|
||||
// Miscellaneous constants
|
||||
static final short SIZE_POLLFD = 8;
|
||||
|
@ -67,7 +67,7 @@ abstract class AbstractPollSelectorImpl
|
||||
this.channelOffset = offset;
|
||||
}
|
||||
|
||||
void putEventOps(SelectionKeyImpl sk, int ops) {
|
||||
public void putEventOps(SelectionKeyImpl sk, int ops) {
|
||||
synchronized (closeLock) {
|
||||
if (closed)
|
||||
throw new ClosedSelectorException();
|
||||
|
@ -28,16 +28,16 @@ package sun.nio.ch;
|
||||
|
||||
// Constants for reporting I/O status
|
||||
|
||||
final class IOStatus {
|
||||
public final class IOStatus {
|
||||
|
||||
private IOStatus() { }
|
||||
|
||||
static final int EOF = -1; // End of file
|
||||
static final int UNAVAILABLE = -2; // Nothing available (non-blocking)
|
||||
static final int INTERRUPTED = -3; // System call interrupted
|
||||
static final int UNSUPPORTED = -4; // Operation not supported
|
||||
static final int THROWN = -5; // Exception thrown in JNI code
|
||||
static final int UNSUPPORTED_CASE = -6; // This case not supported
|
||||
public static final int EOF = -1; // End of file
|
||||
public static final int UNAVAILABLE = -2; // Nothing available (non-blocking)
|
||||
public static final int INTERRUPTED = -3; // System call interrupted
|
||||
public static final int UNSUPPORTED = -4; // Operation not supported
|
||||
public static final int THROWN = -5; // Exception thrown in JNI code
|
||||
public static final int UNSUPPORTED_CASE = -6; // This case not supported
|
||||
|
||||
// The following two methods are for use in try/finally blocks where a
|
||||
// status value needs to be normalized before being returned to the invoker
|
||||
@ -55,28 +55,28 @@ final class IOStatus {
|
||||
// }
|
||||
//
|
||||
|
||||
static int normalize(int n) {
|
||||
public static int normalize(int n) {
|
||||
if (n == UNAVAILABLE)
|
||||
return 0;
|
||||
return n;
|
||||
}
|
||||
|
||||
static boolean check(int n) {
|
||||
public static boolean check(int n) {
|
||||
return (n >= UNAVAILABLE);
|
||||
}
|
||||
|
||||
static long normalize(long n) {
|
||||
public static long normalize(long n) {
|
||||
if (n == UNAVAILABLE)
|
||||
return 0;
|
||||
return n;
|
||||
}
|
||||
|
||||
static boolean check(long n) {
|
||||
public static boolean check(long n) {
|
||||
return (n >= UNAVAILABLE);
|
||||
}
|
||||
|
||||
// Return true iff n is not one of the IOStatus values
|
||||
static boolean checkAll(long n) {
|
||||
public static boolean checkAll(long n) {
|
||||
return ((n > EOF) || (n < UNSUPPORTED_CASE));
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ import java.nio.ByteBuffer;
|
||||
* File-descriptor based I/O utilities that are shared by NIO classes.
|
||||
*/
|
||||
|
||||
class IOUtil {
|
||||
public class IOUtil {
|
||||
|
||||
private IOUtil() { } // No instantiation
|
||||
|
||||
@ -309,7 +309,7 @@ class IOUtil {
|
||||
}
|
||||
}
|
||||
|
||||
static FileDescriptor newFD(int i) {
|
||||
public static FileDescriptor newFD(int i) {
|
||||
FileDescriptor fd = new FileDescriptor();
|
||||
setfdVal(fd, i);
|
||||
return fd;
|
||||
@ -326,10 +326,11 @@ class IOUtil {
|
||||
|
||||
static native boolean drain(int fd) throws IOException;
|
||||
|
||||
static native void configureBlocking(FileDescriptor fd, boolean blocking)
|
||||
public static native void configureBlocking(FileDescriptor fd,
|
||||
boolean blocking)
|
||||
throws IOException;
|
||||
|
||||
static native int fdVal(FileDescriptor fd);
|
||||
public static native int fdVal(FileDescriptor fd);
|
||||
|
||||
static native void setfdVal(FileDescriptor fd, int value);
|
||||
|
||||
|
@ -33,7 +33,7 @@ import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
|
||||
|
||||
class Net { // package-private
|
||||
public class Net {
|
||||
|
||||
private Net() { }
|
||||
|
||||
@ -75,7 +75,7 @@ class Net { // package-private
|
||||
return canJoin6WithIPv4Group0();
|
||||
}
|
||||
|
||||
static InetSocketAddress checkAddress(SocketAddress sa) {
|
||||
public static InetSocketAddress checkAddress(SocketAddress sa) {
|
||||
if (sa == null)
|
||||
throw new NullPointerException();
|
||||
if (!(sa instanceof InetSocketAddress))
|
||||
@ -330,7 +330,7 @@ class Net { // package-private
|
||||
// Due to oddities SO_REUSEADDR on windows reuse is ignored
|
||||
private static native int socket0(boolean preferIPv6, boolean stream, boolean reuse);
|
||||
|
||||
static void bind(FileDescriptor fd, InetAddress addr, int port)
|
||||
public static void bind(FileDescriptor fd, InetAddress addr, int port)
|
||||
throws IOException
|
||||
{
|
||||
bind(UNSPEC, fd, addr, port);
|
||||
@ -383,7 +383,7 @@ class Net { // package-private
|
||||
private static native InetAddress localInetAddress(FileDescriptor fd)
|
||||
throws IOException;
|
||||
|
||||
static InetSocketAddress localAddress(FileDescriptor fd)
|
||||
public static InetSocketAddress localAddress(FileDescriptor fd)
|
||||
throws IOException
|
||||
{
|
||||
return new InetSocketAddress(localInetAddress(fd), localPort(fd));
|
||||
|
@ -36,7 +36,7 @@ import java.io.IOException;
|
||||
* @since 1.4
|
||||
*/
|
||||
|
||||
interface SelChImpl extends Channel {
|
||||
public interface SelChImpl extends Channel {
|
||||
|
||||
FileDescriptor getFD();
|
||||
|
||||
|
@ -34,12 +34,12 @@ import java.nio.channels.spi.*;
|
||||
* An implementation of SelectionKey for Solaris.
|
||||
*/
|
||||
|
||||
class SelectionKeyImpl
|
||||
public class SelectionKeyImpl
|
||||
extends AbstractSelectionKey
|
||||
{
|
||||
|
||||
final SelChImpl channel; // package-private
|
||||
final SelectorImpl selector; // package-private
|
||||
public final SelectorImpl selector;
|
||||
|
||||
// Index for a pollfd array in Selector that this key is registered with
|
||||
private int index;
|
||||
@ -91,15 +91,15 @@ class SelectionKeyImpl
|
||||
// The nio versions of these operations do not care if a key
|
||||
// has been invalidated. They are for internal use by nio code.
|
||||
|
||||
void nioReadyOps(int ops) { // package-private
|
||||
public void nioReadyOps(int ops) {
|
||||
readyOps = ops;
|
||||
}
|
||||
|
||||
int nioReadyOps() { // package-private
|
||||
public int nioReadyOps() {
|
||||
return readyOps;
|
||||
}
|
||||
|
||||
SelectionKey nioInterestOps(int ops) { // package-private
|
||||
public SelectionKey nioInterestOps(int ops) {
|
||||
if ((ops & ~channel().validOps()) != 0)
|
||||
throw new IllegalArgumentException();
|
||||
channel.translateAndSetInterestOps(ops, this);
|
||||
@ -107,7 +107,7 @@ class SelectionKeyImpl
|
||||
return this;
|
||||
}
|
||||
|
||||
int nioInterestOps() { // package-private
|
||||
public int nioInterestOps() {
|
||||
return interestOps;
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@ import java.util.*;
|
||||
* Base Selector implementation class.
|
||||
*/
|
||||
|
||||
abstract class SelectorImpl
|
||||
public abstract class SelectorImpl
|
||||
extends AbstractSelector
|
||||
{
|
||||
|
||||
@ -118,7 +118,7 @@ abstract class SelectorImpl
|
||||
|
||||
protected abstract void implClose() throws IOException;
|
||||
|
||||
void putEventOps(SelectionKeyImpl sk, int ops) { }
|
||||
public void putEventOps(SelectionKeyImpl sk, int ops) { }
|
||||
|
||||
protected final SelectionKey register(AbstractSelectableChannel ch,
|
||||
int ops,
|
||||
|
@ -40,7 +40,7 @@ import sun.misc.Cleaner;
|
||||
import sun.security.action.GetPropertyAction;
|
||||
|
||||
|
||||
class Util {
|
||||
public class Util {
|
||||
|
||||
// -- Caches --
|
||||
|
||||
@ -158,7 +158,7 @@ class Util {
|
||||
/**
|
||||
* Returns a temporary buffer of at least the given size
|
||||
*/
|
||||
static ByteBuffer getTemporaryDirectBuffer(int size) {
|
||||
public static ByteBuffer getTemporaryDirectBuffer(int size) {
|
||||
BufferCache cache = bufferCache.get();
|
||||
ByteBuffer buf = cache.get(size);
|
||||
if (buf != null) {
|
||||
@ -178,7 +178,7 @@ class Util {
|
||||
/**
|
||||
* Releases a temporary buffer by returning to the cache or freeing it.
|
||||
*/
|
||||
static void releaseTemporaryDirectBuffer(ByteBuffer buf) {
|
||||
public static void releaseTemporaryDirectBuffer(ByteBuffer buf) {
|
||||
offerFirstTemporaryDirectBuffer(buf);
|
||||
}
|
||||
|
||||
@ -467,7 +467,7 @@ class Util {
|
||||
|
||||
private static boolean loaded = false;
|
||||
|
||||
static void load() {
|
||||
public static void load() {
|
||||
synchronized (Util.class) {
|
||||
if (loaded)
|
||||
return;
|
||||
|
@ -22,7 +22,7 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package sun.nio.ch;
|
||||
package sun.nio.ch.sctp;
|
||||
|
||||
import java.net.SocketAddress;
|
||||
import com.sun.nio.sctp.MessageInfo;
|
||||
@ -31,7 +31,7 @@ import com.sun.nio.sctp.Association;
|
||||
/**
|
||||
* An implementation of a MessageInfo.
|
||||
*/
|
||||
public class SctpMessageInfoImpl extends MessageInfo {
|
||||
public class MessageInfoImpl extends MessageInfo {
|
||||
private final SocketAddress address;
|
||||
private final int bytes; /* 0 */
|
||||
|
||||
@ -43,9 +43,9 @@ public class SctpMessageInfoImpl extends MessageInfo {
|
||||
private long timeToLive; /* 0L */
|
||||
private int ppid; /* 0 */
|
||||
|
||||
public SctpMessageInfoImpl(Association association,
|
||||
SocketAddress address,
|
||||
int streamNumber) {
|
||||
public MessageInfoImpl(Association association,
|
||||
SocketAddress address,
|
||||
int streamNumber) {
|
||||
this.association = association;
|
||||
this.address = address;
|
||||
this.streamNumber = streamNumber;
|
||||
@ -53,13 +53,13 @@ public class SctpMessageInfoImpl extends MessageInfo {
|
||||
}
|
||||
|
||||
/* Invoked from native */
|
||||
private SctpMessageInfoImpl(int assocId,
|
||||
SocketAddress address,
|
||||
int bytes,
|
||||
int streamNumber,
|
||||
boolean complete,
|
||||
boolean unordered,
|
||||
int ppid) {
|
||||
private MessageInfoImpl(int assocId,
|
||||
SocketAddress address,
|
||||
int bytes,
|
||||
int streamNumber,
|
||||
boolean complete,
|
||||
boolean unordered,
|
||||
int ppid) {
|
||||
this.assocId = assocId;
|
||||
this.address = address;
|
||||
this.bytes = bytes;
|
||||
@ -75,7 +75,7 @@ public class SctpMessageInfoImpl extends MessageInfo {
|
||||
}
|
||||
|
||||
/**
|
||||
* SctpMessageInfoImpl instances created from native will need to have their
|
||||
* MessageInfoImpl instances created from native will need to have their
|
||||
* association set from the channel.
|
||||
*/
|
||||
void setAssociation(Association association) {
|
@ -22,7 +22,7 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package sun.nio.ch;
|
||||
package sun.nio.ch.sctp;
|
||||
|
||||
import com.sun.nio.sctp.SctpSocketOption;
|
||||
|
@ -180,7 +180,7 @@ class DevPollSelectorImpl
|
||||
((SelChImpl)selch).kill();
|
||||
}
|
||||
|
||||
void putEventOps(SelectionKeyImpl sk, int ops) {
|
||||
public void putEventOps(SelectionKeyImpl sk, int ops) {
|
||||
if (closed)
|
||||
throw new ClosedSelectorException();
|
||||
int fd = IOUtil.fdVal(sk.channel.getFD());
|
||||
|
@ -181,7 +181,7 @@ class EPollSelectorImpl
|
||||
((SelChImpl)selch).kill();
|
||||
}
|
||||
|
||||
void putEventOps(SelectionKeyImpl sk, int ops) {
|
||||
public void putEventOps(SelectionKeyImpl sk, int ops) {
|
||||
if (closed)
|
||||
throw new ClosedSelectorException();
|
||||
pollWrapper.setInterest(sk.channel, ops);
|
||||
|
@ -37,21 +37,21 @@ package sun.nio.ch;
|
||||
// always returns -1 and the signal(long) method has no effect.
|
||||
|
||||
|
||||
class NativeThread {
|
||||
public class NativeThread {
|
||||
|
||||
// Returns an opaque token representing the native thread underlying the
|
||||
// invoking Java thread. On systems that do not require signalling, this
|
||||
// method always returns -1.
|
||||
//
|
||||
static native long current();
|
||||
public static native long current();
|
||||
|
||||
// Signals the given native thread so as to release it from a blocking I/O
|
||||
// operation. On systems that do not require signalling, this method has
|
||||
// no effect.
|
||||
//
|
||||
static native void signal(long nt);
|
||||
public static native void signal(long nt);
|
||||
|
||||
static native void init();
|
||||
private static native void init();
|
||||
|
||||
static {
|
||||
Util.load();
|
||||
|
@ -41,9 +41,9 @@ import sun.misc.*;
|
||||
* @since 1.4
|
||||
*/
|
||||
|
||||
class PollArrayWrapper extends AbstractPollArrayWrapper {
|
||||
public class PollArrayWrapper extends AbstractPollArrayWrapper {
|
||||
|
||||
static final short POLLCONN = POLLOUT;
|
||||
public static final short POLLCONN = POLLOUT;
|
||||
|
||||
// File descriptor to write for interrupt
|
||||
int interruptFD;
|
||||
|
@ -22,7 +22,7 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package sun.nio.ch;
|
||||
package sun.nio.ch.sctp;
|
||||
|
||||
import com.sun.nio.sctp.Association;
|
||||
import com.sun.nio.sctp.AssociationChangeNotification;
|
||||
@ -30,7 +30,7 @@ import com.sun.nio.sctp.AssociationChangeNotification;
|
||||
/**
|
||||
* An implementation of AssociationChangeNotification
|
||||
*/
|
||||
public class SctpAssocChange extends AssociationChangeNotification
|
||||
public class AssociationChange extends AssociationChangeNotification
|
||||
implements SctpNotification
|
||||
{
|
||||
/* static final ints so that they can be referenced from native */
|
||||
@ -50,10 +50,10 @@ public class SctpAssocChange extends AssociationChangeNotification
|
||||
private int maxInStreams;
|
||||
|
||||
/* Invoked from native */
|
||||
private SctpAssocChange(int assocId,
|
||||
int intEvent,
|
||||
int maxOutStreams,
|
||||
int maxInStreams) {
|
||||
private AssociationChange(int assocId,
|
||||
int intEvent,
|
||||
int maxOutStreams,
|
||||
int maxInStreams) {
|
||||
switch (intEvent) {
|
||||
case SCTP_COMM_UP :
|
||||
this.event = AssocChangeEvent.COMM_UP;
|
@ -22,17 +22,17 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package sun.nio.ch;
|
||||
package sun.nio.ch.sctp;
|
||||
|
||||
import com.sun.nio.sctp.Association;
|
||||
|
||||
/**
|
||||
* An implementation of Association
|
||||
*/
|
||||
public class SctpAssociationImpl extends Association {
|
||||
public SctpAssociationImpl(int associationID,
|
||||
int maxInStreams,
|
||||
int maxOutStreams) {
|
||||
public class AssociationImpl extends Association {
|
||||
public AssociationImpl(int associationID,
|
||||
int maxInStreams,
|
||||
int maxOutStreams) {
|
||||
super(associationID, maxInStreams, maxOutStreams);
|
||||
}
|
||||
|
@ -22,7 +22,7 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package sun.nio.ch;
|
||||
package sun.nio.ch.sctp;
|
||||
|
||||
import java.net.SocketAddress;
|
||||
import com.sun.nio.sctp.Association;
|
||||
@ -31,7 +31,7 @@ import com.sun.nio.sctp.PeerAddressChangeNotification;
|
||||
/**
|
||||
* An implementation of PeerAddressChangeNotification
|
||||
*/
|
||||
public class SctpPeerAddrChange extends PeerAddressChangeNotification
|
||||
public class PeerAddrChange extends PeerAddressChangeNotification
|
||||
implements SctpNotification
|
||||
{
|
||||
/* static final ints so that they can be referenced from native */
|
||||
@ -51,7 +51,7 @@ public class SctpPeerAddrChange extends PeerAddressChangeNotification
|
||||
private AddressChangeEvent event;
|
||||
|
||||
/* Invoked from native */
|
||||
private SctpPeerAddrChange(int assocId, SocketAddress address, int intEvent) {
|
||||
private PeerAddrChange(int assocId, SocketAddress address, int intEvent) {
|
||||
switch (intEvent) {
|
||||
case SCTP_ADDR_AVAILABLE :
|
||||
this.event = AddressChangeEvent.ADDR_AVAILABLE;
|
@ -22,13 +22,13 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package sun.nio.ch;
|
||||
package sun.nio.ch.sctp;
|
||||
|
||||
/**
|
||||
* Wraps the actual message or notification so that it can be
|
||||
* set and returned from the native receive implementation.
|
||||
*/
|
||||
public class SctpResultContainer {
|
||||
public class ResultContainer {
|
||||
/* static final ints so that they can be referenced from native */
|
||||
static final int NOTHING = 0;
|
||||
static final int MESSAGE = 1;
|
||||
@ -63,47 +63,47 @@ public class SctpResultContainer {
|
||||
return (SctpNotification) value;
|
||||
}
|
||||
|
||||
SctpMessageInfoImpl getMessageInfo() {
|
||||
MessageInfoImpl getMessageInfo() {
|
||||
assert type() == MESSAGE;
|
||||
|
||||
if (value instanceof SctpMessageInfoImpl)
|
||||
return (SctpMessageInfoImpl) value;
|
||||
if (value instanceof MessageInfoImpl)
|
||||
return (MessageInfoImpl) value;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
SctpSendFailed getSendFailed() {
|
||||
SendFailed getSendFailed() {
|
||||
assert type() == SEND_FAILED;
|
||||
|
||||
if (value instanceof SctpSendFailed)
|
||||
return (SctpSendFailed) value;
|
||||
if (value instanceof SendFailed)
|
||||
return (SendFailed) value;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
SctpAssocChange getAssociationChanged() {
|
||||
AssociationChange getAssociationChanged() {
|
||||
assert type() == ASSOCIATION_CHANGED;
|
||||
|
||||
if (value instanceof SctpAssocChange)
|
||||
return (SctpAssocChange) value;
|
||||
if (value instanceof AssociationChange)
|
||||
return (AssociationChange) value;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
SctpPeerAddrChange getPeerAddressChanged() {
|
||||
PeerAddrChange getPeerAddressChanged() {
|
||||
assert type() == PEER_ADDRESS_CHANGED;
|
||||
|
||||
if (value instanceof SctpPeerAddrChange)
|
||||
return (SctpPeerAddrChange) value;
|
||||
if (value instanceof PeerAddrChange)
|
||||
return (PeerAddrChange) value;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
SctpShutdown getShutdown() {
|
||||
Shutdown getShutdown() {
|
||||
assert type() == SHUTDOWN;
|
||||
|
||||
if (value instanceof SctpShutdown)
|
||||
return (SctpShutdown) value;
|
||||
if (value instanceof Shutdown)
|
||||
return (Shutdown) value;
|
||||
|
||||
return null;
|
||||
}
|
@ -22,7 +22,7 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package sun.nio.ch;
|
||||
package sun.nio.ch.sctp;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.net.SocketAddress;
|
||||
@ -53,11 +53,20 @@ import com.sun.nio.sctp.MessageInfo;
|
||||
import com.sun.nio.sctp.NotificationHandler;
|
||||
import com.sun.nio.sctp.SctpChannel;
|
||||
import com.sun.nio.sctp.SctpSocketOption;
|
||||
import sun.nio.ch.DirectBuffer;
|
||||
import sun.nio.ch.IOStatus;
|
||||
import sun.nio.ch.IOUtil;
|
||||
import sun.nio.ch.NativeThread;
|
||||
import sun.nio.ch.Net;
|
||||
import sun.nio.ch.PollArrayWrapper;
|
||||
import sun.nio.ch.SelChImpl;
|
||||
import sun.nio.ch.SelectionKeyImpl;
|
||||
import sun.nio.ch.Util;
|
||||
import static com.sun.nio.sctp.SctpStandardSocketOptions.*;
|
||||
import static sun.nio.ch.SctpResultContainer.SEND_FAILED;
|
||||
import static sun.nio.ch.SctpResultContainer.ASSOCIATION_CHANGED;
|
||||
import static sun.nio.ch.SctpResultContainer.PEER_ADDRESS_CHANGED;
|
||||
import static sun.nio.ch.SctpResultContainer.SHUTDOWN;
|
||||
import static sun.nio.ch.sctp.ResultContainer.SEND_FAILED;
|
||||
import static sun.nio.ch.sctp.ResultContainer.ASSOCIATION_CHANGED;
|
||||
import static sun.nio.ch.sctp.ResultContainer.PEER_ADDRESS_CHANGED;
|
||||
import static sun.nio.ch.sctp.ResultContainer.SHUTDOWN;
|
||||
|
||||
/**
|
||||
* An implementation of an SctpChannel
|
||||
@ -745,7 +754,7 @@ public class SctpChannelImpl extends SctpChannel
|
||||
receiveInvoked.set(Boolean.TRUE);
|
||||
|
||||
try {
|
||||
SctpResultContainer resultContainer = new SctpResultContainer();
|
||||
ResultContainer resultContainer = new ResultContainer();
|
||||
do {
|
||||
resultContainer.clear();
|
||||
synchronized (receiveLock) {
|
||||
@ -775,7 +784,7 @@ public class SctpChannelImpl extends SctpChannel
|
||||
/* message or nothing */
|
||||
if (resultContainer.hasSomething()) {
|
||||
/* Set the association before returning */
|
||||
SctpMessageInfoImpl info =
|
||||
MessageInfoImpl info =
|
||||
resultContainer.getMessageInfo();
|
||||
synchronized (stateLock) {
|
||||
assert association != null;
|
||||
@ -812,7 +821,7 @@ public class SctpChannelImpl extends SctpChannel
|
||||
|
||||
private int receive(int fd,
|
||||
ByteBuffer dst,
|
||||
SctpResultContainer resultContainer,
|
||||
ResultContainer resultContainer,
|
||||
boolean peek)
|
||||
throws IOException {
|
||||
int pos = dst.position();
|
||||
@ -837,7 +846,7 @@ public class SctpChannelImpl extends SctpChannel
|
||||
}
|
||||
|
||||
private int receiveIntoNativeBuffer(int fd,
|
||||
SctpResultContainer resultContainer,
|
||||
ResultContainer resultContainer,
|
||||
ByteBuffer bb,
|
||||
int rem,
|
||||
int pos,
|
||||
@ -854,7 +863,7 @@ public class SctpChannelImpl extends SctpChannel
|
||||
private InternalNotificationHandler internalNotificationHandler =
|
||||
new InternalNotificationHandler();
|
||||
|
||||
private void handleNotificationInternal(SctpResultContainer resultContainer)
|
||||
private void handleNotificationInternal(ResultContainer resultContainer)
|
||||
{
|
||||
invokeNotificationHandler(resultContainer,
|
||||
internalNotificationHandler, null);
|
||||
@ -869,8 +878,8 @@ public class SctpChannelImpl extends SctpChannel
|
||||
if (not.event().equals(
|
||||
AssociationChangeNotification.AssocChangeEvent.COMM_UP) &&
|
||||
association == null) {
|
||||
SctpAssocChange sac = (SctpAssocChange) not;
|
||||
association = new SctpAssociationImpl
|
||||
AssociationChange sac = (AssociationChange) not;
|
||||
association = new AssociationImpl
|
||||
(sac.assocId(), sac.maxInStreams(), sac.maxOutStreams());
|
||||
}
|
||||
return HandlerResult.CONTINUE;
|
||||
@ -878,7 +887,7 @@ public class SctpChannelImpl extends SctpChannel
|
||||
}
|
||||
|
||||
private <T> HandlerResult invokeNotificationHandler
|
||||
(SctpResultContainer resultContainer,
|
||||
(ResultContainer resultContainer,
|
||||
NotificationHandler<T> handler,
|
||||
T attachment) {
|
||||
SctpNotification notification = resultContainer.notification();
|
||||
@ -1078,7 +1087,7 @@ public class SctpChannelImpl extends SctpChannel
|
||||
/* Native */
|
||||
private static native void initIDs();
|
||||
|
||||
static native int receive0(int fd, SctpResultContainer resultContainer,
|
||||
static native int receive0(int fd, ResultContainer resultContainer,
|
||||
long address, int length, boolean peek) throws IOException;
|
||||
|
||||
static native int send0(int fd, long address, int length,
|
@ -22,7 +22,7 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package sun.nio.ch;
|
||||
package sun.nio.ch.sctp;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.net.SocketAddress;
|
||||
@ -53,8 +53,17 @@ import com.sun.nio.sctp.MessageInfo;
|
||||
import com.sun.nio.sctp.SctpChannel;
|
||||
import com.sun.nio.sctp.SctpMultiChannel;
|
||||
import com.sun.nio.sctp.SctpSocketOption;
|
||||
import sun.nio.ch.DirectBuffer;
|
||||
import sun.nio.ch.NativeThread;
|
||||
import sun.nio.ch.IOStatus;
|
||||
import sun.nio.ch.IOUtil;
|
||||
import sun.nio.ch.Net;
|
||||
import sun.nio.ch.PollArrayWrapper;
|
||||
import sun.nio.ch.SelChImpl;
|
||||
import sun.nio.ch.SelectionKeyImpl;
|
||||
import sun.nio.ch.Util;
|
||||
import static com.sun.nio.sctp.SctpStandardSocketOptions.*;
|
||||
import static sun.nio.ch.SctpResultContainer.*;
|
||||
import static sun.nio.ch.sctp.ResultContainer.*;
|
||||
|
||||
/**
|
||||
* An implementation of SctpMultiChannel
|
||||
@ -466,7 +475,7 @@ public class SctpMultiChannelImpl extends SctpMultiChannel
|
||||
receiveInvoked.set(Boolean.TRUE);
|
||||
|
||||
try {
|
||||
SctpResultContainer resultContainer = new SctpResultContainer();
|
||||
ResultContainer resultContainer = new ResultContainer();
|
||||
do {
|
||||
resultContainer.clear();
|
||||
synchronized (receiveLock) {
|
||||
@ -498,7 +507,7 @@ public class SctpMultiChannelImpl extends SctpMultiChannel
|
||||
/* message or nothing */
|
||||
if (resultContainer.hasSomething()) {
|
||||
/* Set the association before returning */
|
||||
SctpMessageInfoImpl info =
|
||||
MessageInfoImpl info =
|
||||
resultContainer.getMessageInfo();
|
||||
info.setAssociation(lookupAssociation(info.
|
||||
associationID()));
|
||||
@ -542,7 +551,7 @@ public class SctpMultiChannelImpl extends SctpMultiChannel
|
||||
|
||||
private int receive(int fd,
|
||||
ByteBuffer dst,
|
||||
SctpResultContainer resultContainer)
|
||||
ResultContainer resultContainer)
|
||||
throws IOException {
|
||||
int pos = dst.position();
|
||||
int lim = dst.limit();
|
||||
@ -566,7 +575,7 @@ public class SctpMultiChannelImpl extends SctpMultiChannel
|
||||
}
|
||||
|
||||
private int receiveIntoNativeBuffer(int fd,
|
||||
SctpResultContainer resultContainer,
|
||||
ResultContainer resultContainer,
|
||||
ByteBuffer bb,
|
||||
int rem,
|
||||
int pos)
|
||||
@ -580,7 +589,7 @@ public class SctpMultiChannelImpl extends SctpMultiChannel
|
||||
private InternalNotificationHandler internalNotificationHandler =
|
||||
new InternalNotificationHandler();
|
||||
|
||||
private void handleNotificationInternal(SctpResultContainer resultContainer)
|
||||
private void handleNotificationInternal(ResultContainer resultContainer)
|
||||
{
|
||||
invokeNotificationHandler(resultContainer,
|
||||
internalNotificationHandler, null);
|
||||
@ -592,12 +601,12 @@ public class SctpMultiChannelImpl extends SctpMultiChannel
|
||||
@Override
|
||||
public HandlerResult handleNotification(
|
||||
AssociationChangeNotification not, Object unused) {
|
||||
SctpAssocChange sac = (SctpAssocChange) not;
|
||||
AssociationChange sac = (AssociationChange) not;
|
||||
|
||||
/* Update map to reflect change in association */
|
||||
switch (not.event()) {
|
||||
case COMM_UP :
|
||||
Association newAssociation = new SctpAssociationImpl
|
||||
Association newAssociation = new AssociationImpl
|
||||
(sac.assocId(), sac.maxInStreams(), sac.maxOutStreams());
|
||||
addAssociation(newAssociation);
|
||||
break;
|
||||
@ -612,7 +621,7 @@ public class SctpMultiChannelImpl extends SctpMultiChannel
|
||||
}
|
||||
|
||||
private <T> HandlerResult invokeNotificationHandler(
|
||||
SctpResultContainer resultContainer,
|
||||
ResultContainer resultContainer,
|
||||
NotificationHandler<T> handler,
|
||||
T attachment) {
|
||||
HandlerResult result;
|
||||
@ -956,7 +965,7 @@ public class SctpMultiChannelImpl extends SctpMultiChannel
|
||||
/* Use common native implementation shared between
|
||||
* one-to-one and one-to-many */
|
||||
private static int receive0(int fd,
|
||||
SctpResultContainer resultContainer,
|
||||
ResultContainer resultContainer,
|
||||
long address,
|
||||
int length)
|
||||
throws IOException{
|
@ -22,7 +22,7 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package sun.nio.ch;
|
||||
package sun.nio.ch.sctp;
|
||||
|
||||
import java.io.FileDescriptor;
|
||||
import java.io.IOException;
|
||||
@ -34,6 +34,8 @@ import java.util.Set;
|
||||
import java.util.HashSet;
|
||||
import java.security.AccessController;
|
||||
import sun.security.action.GetPropertyAction;
|
||||
import sun.nio.ch.IOUtil;
|
||||
import sun.nio.ch.Net;
|
||||
import com.sun.nio.sctp.SctpSocketOption;
|
||||
import static com.sun.nio.sctp.SctpStandardSocketOptions.*;
|
||||
|
@ -22,7 +22,7 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package sun.nio.ch;
|
||||
package sun.nio.ch.sctp;
|
||||
|
||||
import com.sun.nio.sctp.Association;
|
||||
import com.sun.nio.sctp.Notification;
|
@ -22,7 +22,7 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package sun.nio.ch;
|
||||
package sun.nio.ch.sctp;
|
||||
|
||||
import java.net.SocketAddress;
|
||||
import java.net.InetSocketAddress;
|
||||
@ -41,6 +41,15 @@ import com.sun.nio.sctp.SctpChannel;
|
||||
import com.sun.nio.sctp.SctpServerChannel;
|
||||
import com.sun.nio.sctp.SctpSocketOption;
|
||||
import com.sun.nio.sctp.SctpStandardSocketOptions;
|
||||
import sun.nio.ch.DirectBuffer;
|
||||
import sun.nio.ch.NativeThread;
|
||||
import sun.nio.ch.IOStatus;
|
||||
import sun.nio.ch.IOUtil;
|
||||
import sun.nio.ch.Net;
|
||||
import sun.nio.ch.PollArrayWrapper;
|
||||
import sun.nio.ch.SelChImpl;
|
||||
import sun.nio.ch.SelectionKeyImpl;
|
||||
import sun.nio.ch.Util;
|
||||
|
||||
/**
|
||||
* An implementation of SctpServerChannel
|
@ -22,7 +22,7 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package sun.nio.ch;
|
||||
package sun.nio.ch.sctp;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.net.SocketAddress;
|
||||
@ -32,7 +32,7 @@ import com.sun.nio.sctp.SendFailedNotification;
|
||||
/**
|
||||
* An implementation of SendFailedNotification
|
||||
*/
|
||||
public class SctpSendFailed extends SendFailedNotification
|
||||
public class SendFailed extends SendFailedNotification
|
||||
implements SctpNotification
|
||||
{
|
||||
private Association association;
|
||||
@ -45,11 +45,11 @@ public class SctpSendFailed extends SendFailedNotification
|
||||
private int streamNumber;
|
||||
|
||||
/* Invoked from native */
|
||||
private SctpSendFailed(int assocId,
|
||||
SocketAddress address,
|
||||
ByteBuffer buffer,
|
||||
int errorCode,
|
||||
int streamNumber) {
|
||||
private SendFailed(int assocId,
|
||||
SocketAddress address,
|
||||
ByteBuffer buffer,
|
||||
int errorCode,
|
||||
int streamNumber) {
|
||||
this.assocId = assocId;
|
||||
this.errorCode = errorCode;
|
||||
this.streamNumber = streamNumber;
|
@ -22,7 +22,7 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package sun.nio.ch;
|
||||
package sun.nio.ch.sctp;
|
||||
|
||||
import com.sun.nio.sctp.Association;
|
||||
import com.sun.nio.sctp.ShutdownNotification;
|
||||
@ -30,7 +30,7 @@ import com.sun.nio.sctp.ShutdownNotification;
|
||||
/**
|
||||
* An implementation of ShutdownNotification
|
||||
*/
|
||||
public class SctpShutdown extends ShutdownNotification
|
||||
public class Shutdown extends ShutdownNotification
|
||||
implements SctpNotification
|
||||
{
|
||||
private Association association;
|
||||
@ -39,7 +39,7 @@ public class SctpShutdown extends ShutdownNotification
|
||||
private int assocId;
|
||||
|
||||
/* Invoked from native */
|
||||
private SctpShutdown(int assocId) {
|
||||
private Shutdown(int assocId) {
|
||||
this.assocId = assocId;
|
||||
}
|
||||
|
@ -32,21 +32,21 @@
|
||||
#include "nio.h"
|
||||
#include "net_util.h"
|
||||
#include "net_util_md.h"
|
||||
#include "sun_nio_ch_SctpNet.h"
|
||||
#include "sun_nio_ch_SctpChannelImpl.h"
|
||||
#include "sun_nio_ch_SctpAssocChange.h"
|
||||
#include "sun_nio_ch_SctpResultContainer.h"
|
||||
#include "sun_nio_ch_SctpPeerAddrChange.h"
|
||||
#include "sun_nio_ch_sctp_SctpNet.h"
|
||||
#include "sun_nio_ch_sctp_SctpChannelImpl.h"
|
||||
#include "sun_nio_ch_sctp_AssociationChange.h"
|
||||
#include "sun_nio_ch_sctp_ResultContainer.h"
|
||||
#include "sun_nio_ch_sctp_PeerAddrChange.h"
|
||||
|
||||
/* sizeof(union sctp_notification */
|
||||
#define NOTIFICATION_BUFFER_SIZE 280
|
||||
|
||||
#define MESSAGE_IMPL_CLASS "sun/nio/ch/SctpMessageInfoImpl"
|
||||
#define RESULT_CONTAINER_CLASS "sun/nio/ch/SctpResultContainer"
|
||||
#define SEND_FAILED_CLASS "sun/nio/ch/SctpSendFailed"
|
||||
#define ASSOC_CHANGE_CLASS "sun/nio/ch/SctpAssocChange"
|
||||
#define PEER_CHANGE_CLASS "sun/nio/ch/SctpPeerAddrChange"
|
||||
#define SHUTDOWN_CLASS "sun/nio/ch/SctpShutdown"
|
||||
#define MESSAGE_IMPL_CLASS "sun/nio/ch/sctp/MessageInfoImpl"
|
||||
#define RESULT_CONTAINER_CLASS "sun/nio/ch/sctp/ResultContainer"
|
||||
#define SEND_FAILED_CLASS "sun/nio/ch/sctp/SendFailed"
|
||||
#define ASSOC_CHANGE_CLASS "sun/nio/ch/sctp/AssociationChange"
|
||||
#define PEER_CHANGE_CLASS "sun/nio/ch/sctp/PeerAddrChange"
|
||||
#define SHUTDOWN_CLASS "sun/nio/ch/sctp/Shutdown"
|
||||
|
||||
struct controlData {
|
||||
int assocId;
|
||||
@ -55,38 +55,40 @@ struct controlData {
|
||||
unsigned int ppid;
|
||||
};
|
||||
|
||||
static jclass smi_class; /* sun.nio.ch.SctpMessageInfoImpl */
|
||||
static jmethodID smi_ctrID; /* sun.nio.ch.SctpMessageInfoImpl.<init> */
|
||||
static jfieldID src_valueID; /* sun.nio.ch.SctpResultContainer.value */
|
||||
static jfieldID src_typeID; /* sun.nio.ch.SctpResultContainer.type */
|
||||
static jclass ssf_class; /* sun.nio.ch.SctpSendFailed */
|
||||
static jmethodID ssf_ctrID; /* sun.nio.ch.SctpSendFailed.<init> */
|
||||
static jclass sac_class; /* sun.nio.ch.SctpAssociationChanged */
|
||||
static jmethodID sac_ctrID; /* sun.nio.ch.SctpAssociationChanged.<init> */
|
||||
static jclass spc_class; /* sun.nio.ch.SctpPeerAddressChanged */
|
||||
static jmethodID spc_ctrID; /* sun.nio.ch.SctpPeerAddressChanged.<init> */
|
||||
static jclass ss_class; /* sun.nio.ch.SctpShutdown */
|
||||
static jmethodID ss_ctrID; /* sun.nio.ch.SctpShutdown.<init> */
|
||||
static jfieldID isa_addrID; /* java.net.InetSocketAddress.addr */
|
||||
static jfieldID isa_portID; /* java.net.InetSocketAddress.port */
|
||||
static jclass smi_class; /* sun.nio.ch.sctp.MessageInfoImpl */
|
||||
static jmethodID smi_ctrID; /* sun.nio.ch.sctp.MessageInfoImpl.<init> */
|
||||
static jfieldID src_valueID; /* sun.nio.ch.sctp.ResultContainer.value */
|
||||
static jfieldID src_typeID; /* sun.nio.ch.sctp.ResultContainer.type */
|
||||
static jclass ssf_class; /* sun.nio.ch.sctp.SendFailed */
|
||||
static jmethodID ssf_ctrID; /* sun.nio.ch.sctp.SendFailed.<init> */
|
||||
static jclass sac_class; /* sun.nio.ch.sctp.AssociationChange */
|
||||
static jmethodID sac_ctrID; /* sun.nio.ch.sctp.AssociationChange.<init> */
|
||||
static jclass spc_class; /* sun.nio.ch.sctp.PeerAddressChanged */
|
||||
static jmethodID spc_ctrID; /* sun.nio.ch.sctp.PeerAddressChanged.<init> */
|
||||
static jclass ss_class; /* sun.nio.ch.sctp.Shutdown */
|
||||
static jmethodID ss_ctrID; /* sun.nio.ch.sctp.Shutdown.<init> */
|
||||
static jfieldID isa_addrID; /* java.net.InetSocketAddress.addr */
|
||||
static jfieldID isa_portID; /* java.net.InetSocketAddress.port */
|
||||
|
||||
/* defined in SctpNet.c */
|
||||
jobject SockAddrToInetSocketAddress(JNIEnv* env, struct sockaddr* addr);
|
||||
|
||||
jint handleSocketError(JNIEnv *env, jint errorValue);
|
||||
|
||||
/* use SocketChannelImpl's checkConnect implementation */
|
||||
extern jint Java_sun_nio_ch_SocketChannelImpl_checkConnect(JNIEnv* env,
|
||||
jobject this, jobject fdo, jboolean block, jboolean ready);
|
||||
|
||||
/*
|
||||
* Class: sun_nio_ch_SctpChannelImpl
|
||||
* Class: sun_nio_ch_sctp_SctpChannelImpl
|
||||
* Method: initIDs
|
||||
* Signature: ()V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_sun_nio_ch_SctpChannelImpl_initIDs
|
||||
JNIEXPORT void JNICALL Java_sun_nio_ch_sctp_SctpChannelImpl_initIDs
|
||||
(JNIEnv *env, jclass klass) {
|
||||
jclass cls;
|
||||
|
||||
/* SctpMessageInfoImpl */
|
||||
/* MessageInfoImpl */
|
||||
cls = (*env)->FindClass(env, MESSAGE_IMPL_CLASS);
|
||||
CHECK_NULL(cls);
|
||||
smi_class = (*env)->NewGlobalRef(env, cls);
|
||||
@ -95,7 +97,7 @@ JNIEXPORT void JNICALL Java_sun_nio_ch_SctpChannelImpl_initIDs
|
||||
"(ILjava/net/SocketAddress;IIZZI)V");
|
||||
CHECK_NULL(smi_ctrID);
|
||||
|
||||
/* SctpResultContainer */
|
||||
/* ResultContainer */
|
||||
cls = (*env)->FindClass(env, RESULT_CONTAINER_CLASS);
|
||||
CHECK_NULL(cls);
|
||||
src_valueID = (*env)->GetFieldID(env, cls, "value", "Ljava/lang/Object;");
|
||||
@ -103,7 +105,7 @@ JNIEXPORT void JNICALL Java_sun_nio_ch_SctpChannelImpl_initIDs
|
||||
src_typeID = (*env)->GetFieldID(env, cls, "type", "I");
|
||||
CHECK_NULL(src_typeID);
|
||||
|
||||
/* SctpSendFailed */
|
||||
/* SendFailed */
|
||||
cls = (*env)->FindClass(env, SEND_FAILED_CLASS);
|
||||
CHECK_NULL(cls);
|
||||
ssf_class = (*env)->NewGlobalRef(env, cls);
|
||||
@ -112,7 +114,7 @@ JNIEXPORT void JNICALL Java_sun_nio_ch_SctpChannelImpl_initIDs
|
||||
"(ILjava/net/SocketAddress;Ljava/nio/ByteBuffer;II)V");
|
||||
CHECK_NULL(ssf_ctrID);
|
||||
|
||||
/* SctpAssocChange */
|
||||
/* AssociationChange */
|
||||
cls = (*env)->FindClass(env, ASSOC_CHANGE_CLASS);
|
||||
CHECK_NULL(cls);
|
||||
sac_class = (*env)->NewGlobalRef(env, cls);
|
||||
@ -120,7 +122,7 @@ JNIEXPORT void JNICALL Java_sun_nio_ch_SctpChannelImpl_initIDs
|
||||
sac_ctrID = (*env)->GetMethodID(env, cls, "<init>", "(IIII)V");
|
||||
CHECK_NULL(sac_ctrID);
|
||||
|
||||
/* SctpPeerAddrChange */
|
||||
/* PeerAddrChange */
|
||||
cls = (*env)->FindClass(env, PEER_CHANGE_CLASS);
|
||||
CHECK_NULL(cls);
|
||||
spc_class = (*env)->NewGlobalRef(env, cls);
|
||||
@ -129,7 +131,7 @@ JNIEXPORT void JNICALL Java_sun_nio_ch_SctpChannelImpl_initIDs
|
||||
"(ILjava/net/SocketAddress;I)V");
|
||||
CHECK_NULL(spc_ctrID);
|
||||
|
||||
/* sun.nio.ch.SctpShutdown */
|
||||
/* Shutdown */
|
||||
cls = (*env)->FindClass(env, SHUTDOWN_CLASS);
|
||||
CHECK_NULL(cls);
|
||||
ss_class = (*env)->NewGlobalRef(env, cls);
|
||||
@ -266,13 +268,13 @@ void handleSendFailed
|
||||
}
|
||||
}
|
||||
|
||||
/* create SctpSendFailed */
|
||||
/* create SendFailed */
|
||||
resultObj = (*env)->NewObject(env, ssf_class, ssf_ctrID, ssf->ssf_assoc_id,
|
||||
isaObj, bufferObj, ssf->ssf_error, sri->sinfo_stream);
|
||||
CHECK_NULL(resultObj);
|
||||
(*env)->SetObjectField(env, resultContainerObj, src_valueID, resultObj);
|
||||
(*env)->SetIntField(env, resultContainerObj, src_typeID,
|
||||
sun_nio_ch_SctpResultContainer_SEND_FAILED);
|
||||
sun_nio_ch_sctp_ResultContainer_SEND_FAILED);
|
||||
}
|
||||
|
||||
void handleAssocChange
|
||||
@ -282,38 +284,38 @@ void handleAssocChange
|
||||
|
||||
switch (sac->sac_state) {
|
||||
case SCTP_COMM_UP :
|
||||
state = sun_nio_ch_SctpAssocChange_SCTP_COMM_UP;
|
||||
state = sun_nio_ch_sctp_AssociationChange_SCTP_COMM_UP;
|
||||
break;
|
||||
case SCTP_COMM_LOST :
|
||||
state = sun_nio_ch_SctpAssocChange_SCTP_COMM_LOST;
|
||||
state = sun_nio_ch_sctp_AssociationChange_SCTP_COMM_LOST;
|
||||
break;
|
||||
case SCTP_RESTART :
|
||||
state = sun_nio_ch_SctpAssocChange_SCTP_RESTART;
|
||||
state = sun_nio_ch_sctp_AssociationChange_SCTP_RESTART;
|
||||
break;
|
||||
case SCTP_SHUTDOWN_COMP :
|
||||
state = sun_nio_ch_SctpAssocChange_SCTP_SHUTDOWN;
|
||||
state = sun_nio_ch_sctp_AssociationChange_SCTP_SHUTDOWN;
|
||||
break;
|
||||
case SCTP_CANT_STR_ASSOC :
|
||||
state = sun_nio_ch_SctpAssocChange_SCTP_CANT_START;
|
||||
state = sun_nio_ch_sctp_AssociationChange_SCTP_CANT_START;
|
||||
}
|
||||
|
||||
/* create SctpAssociationChanged */
|
||||
/* create AssociationChange */
|
||||
resultObj = (*env)->NewObject(env, sac_class, sac_ctrID, sac->sac_assoc_id,
|
||||
state, sac->sac_outbound_streams, sac->sac_inbound_streams);
|
||||
CHECK_NULL(resultObj);
|
||||
(*env)->SetObjectField(env, resultContainerObj, src_valueID, resultObj);
|
||||
(*env)->SetIntField(env, resultContainerObj, src_typeID,
|
||||
sun_nio_ch_SctpResultContainer_ASSOCIATION_CHANGED);
|
||||
sun_nio_ch_sctp_ResultContainer_ASSOCIATION_CHANGED);
|
||||
}
|
||||
|
||||
void handleShutdown
|
||||
(JNIEnv* env, jobject resultContainerObj, struct sctp_shutdown_event* sse) {
|
||||
/* create SctpShutdown */
|
||||
/* create Shutdown */
|
||||
jobject resultObj = (*env)->NewObject(env, ss_class, ss_ctrID, sse->sse_assoc_id);
|
||||
CHECK_NULL(resultObj);
|
||||
(*env)->SetObjectField(env, resultContainerObj, src_valueID, resultObj);
|
||||
(*env)->SetIntField(env, resultContainerObj, src_typeID,
|
||||
sun_nio_ch_SctpResultContainer_SHUTDOWN);
|
||||
sun_nio_ch_sctp_ResultContainer_SHUTDOWN);
|
||||
}
|
||||
|
||||
void handlePeerAddrChange
|
||||
@ -324,35 +326,35 @@ void handlePeerAddrChange
|
||||
|
||||
switch (state) {
|
||||
case SCTP_ADDR_AVAILABLE :
|
||||
event = sun_nio_ch_SctpPeerAddrChange_SCTP_ADDR_AVAILABLE;
|
||||
event = sun_nio_ch_sctp_PeerAddrChange_SCTP_ADDR_AVAILABLE;
|
||||
break;
|
||||
case SCTP_ADDR_UNREACHABLE :
|
||||
event = sun_nio_ch_SctpPeerAddrChange_SCTP_ADDR_UNREACHABLE;
|
||||
event = sun_nio_ch_sctp_PeerAddrChange_SCTP_ADDR_UNREACHABLE;
|
||||
break;
|
||||
case SCTP_ADDR_REMOVED :
|
||||
event = sun_nio_ch_SctpPeerAddrChange_SCTP_ADDR_REMOVED;
|
||||
event = sun_nio_ch_sctp_PeerAddrChange_SCTP_ADDR_REMOVED;
|
||||
break;
|
||||
case SCTP_ADDR_ADDED :
|
||||
event = sun_nio_ch_SctpPeerAddrChange_SCTP_ADDR_ADDED;
|
||||
event = sun_nio_ch_sctp_PeerAddrChange_SCTP_ADDR_ADDED;
|
||||
break;
|
||||
case SCTP_ADDR_MADE_PRIM :
|
||||
event = sun_nio_ch_SctpPeerAddrChange_SCTP_ADDR_MADE_PRIM;
|
||||
event = sun_nio_ch_sctp_PeerAddrChange_SCTP_ADDR_MADE_PRIM;
|
||||
#ifdef __linux__ /* Solaris currently doesn't support SCTP_ADDR_CONFIRMED */
|
||||
break;
|
||||
case SCTP_ADDR_CONFIRMED :
|
||||
event = sun_nio_ch_SctpPeerAddrChange_SCTP_ADDR_CONFIRMED;
|
||||
event = sun_nio_ch_sctp_PeerAddrChange_SCTP_ADDR_CONFIRMED;
|
||||
#endif /* __linux__ */
|
||||
}
|
||||
|
||||
addressObj = SockAddrToInetSocketAddress(env, (struct sockaddr*)&spc->spc_aaddr);
|
||||
|
||||
/* create SctpPeerAddressChanged */
|
||||
/* create PeerAddressChanged */
|
||||
resultObj = (*env)->NewObject(env, spc_class, spc_ctrID, spc->spc_assoc_id,
|
||||
addressObj, event);
|
||||
CHECK_NULL(resultObj);
|
||||
(*env)->SetObjectField(env, resultContainerObj, src_valueID, resultObj);
|
||||
(*env)->SetIntField(env, resultContainerObj, src_typeID,
|
||||
sun_nio_ch_SctpResultContainer_PEER_ADDRESS_CHANGED);
|
||||
sun_nio_ch_sctp_ResultContainer_PEER_ADDRESS_CHANGED);
|
||||
}
|
||||
|
||||
void handleUninteresting
|
||||
@ -403,7 +405,7 @@ void handleMessage
|
||||
isa = SockAddrToInetSocketAddress(env, sap);
|
||||
getControlData(msg, cdata);
|
||||
|
||||
/* create SctpMessageInfoImpl */
|
||||
/* create MessageInfoImpl */
|
||||
resultObj = (*env)->NewObject(env, smi_class, smi_ctrID, cdata->assocId,
|
||||
isa, read, cdata->streamNumber,
|
||||
isEOR ? JNI_TRUE : JNI_FALSE,
|
||||
@ -411,15 +413,15 @@ void handleMessage
|
||||
CHECK_NULL(resultObj);
|
||||
(*env)->SetObjectField(env, resultContainerObj, src_valueID, resultObj);
|
||||
(*env)->SetIntField(env, resultContainerObj, src_typeID,
|
||||
sun_nio_ch_SctpResultContainer_MESSAGE);
|
||||
sun_nio_ch_sctp_ResultContainer_MESSAGE);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: sun_nio_ch_SctpChannelImpl
|
||||
* Class: sun_nio_ch_sctp_SctpChannelImpl
|
||||
* Method: receive0
|
||||
* Signature: (ILsun/nio/ch/SctpResultContainer;JIZ)I
|
||||
* Signature: (ILsun/nio/ch/sctp/ResultContainer;JIZ)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_sun_nio_ch_SctpChannelImpl_receive0
|
||||
JNIEXPORT jint JNICALL Java_sun_nio_ch_sctp_SctpChannelImpl_receive0
|
||||
(JNIEnv *env, jclass klass, jint fd, jobject resultContainerObj,
|
||||
jlong address, jint length, jboolean peek) {
|
||||
SOCKADDR sa;
|
||||
@ -505,11 +507,11 @@ JNIEXPORT jint JNICALL Java_sun_nio_ch_SctpChannelImpl_receive0
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: sun_nio_ch_SctpChannelImpl
|
||||
* Class: sun_nio_ch_sctp_SctpChannelImpl
|
||||
* Method: send0
|
||||
* Signature: (IJILjava/net/SocketAddress;IIZI)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_sun_nio_ch_SctpChannelImpl_send0
|
||||
JNIEXPORT jint JNICALL Java_sun_nio_ch_sctp_SctpChannelImpl_send0
|
||||
(JNIEnv *env, jclass klass, jint fd, jlong address, jint length,
|
||||
jobject saTarget, jint assocId, jint streamNumber, jboolean unordered,
|
||||
jint ppid) {
|
||||
@ -582,11 +584,11 @@ JNIEXPORT jint JNICALL Java_sun_nio_ch_SctpChannelImpl_send0
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: sun_nio_ch_SctpChannelImpl
|
||||
* Class: sun_nio_ch_sctp_SctpChannelImpl
|
||||
* Method: checkConnect
|
||||
* Signature: (Ljava/io/FileDescriptor;ZZ)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_sun_nio_ch_SctpChannelImpl_checkConnect
|
||||
JNIEXPORT jint JNICALL Java_sun_nio_ch_sctp_SctpChannelImpl_checkConnect
|
||||
(JNIEnv* env, jobject this, jobject fdo, jboolean block, jboolean ready) {
|
||||
return Java_sun_nio_ch_SocketChannelImpl_checkConnect(env, this,
|
||||
fdo, block, ready);
|
@ -34,8 +34,8 @@
|
||||
#include "nio.h"
|
||||
#include "net_util.h"
|
||||
#include "net_util_md.h"
|
||||
#include "sun_nio_ch_SctpNet.h"
|
||||
#include "sun_nio_ch_SctpStdSocketOption.h"
|
||||
#include "sun_nio_ch_sctp_SctpNet.h"
|
||||
#include "sun_nio_ch_sctp_SctpStdSocketOption.h"
|
||||
|
||||
static jclass isaCls = 0;
|
||||
static jmethodID isaCtrID = 0;
|
||||
@ -143,12 +143,12 @@ handleSocketError(JNIEnv *env, jint errorValue)
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: sun_nio_ch_SctpNet
|
||||
* Class: sun_nio_ch_sctp_SctpNet
|
||||
* Method: init
|
||||
* Signature: ()V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_sun_nio_ch_SctpNet_init
|
||||
Java_sun_nio_ch_sctp_SctpNet_init
|
||||
(JNIEnv *env, jclass cl) {
|
||||
int sp[2];
|
||||
if (socketpair(PF_UNIX, SOCK_STREAM, 0, sp) < 0) {
|
||||
@ -160,11 +160,11 @@ Java_sun_nio_ch_SctpNet_init
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: sun_nio_ch_SctpNet
|
||||
* Class: sun_nio_ch_sctp_SctpNet
|
||||
* Method: socket0
|
||||
* Signature: (Z)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_sun_nio_ch_SctpNet_socket0
|
||||
JNIEXPORT jint JNICALL Java_sun_nio_ch_sctp_SctpNet_socket0
|
||||
(JNIEnv *env, jclass klass, jboolean oneToOne) {
|
||||
int fd;
|
||||
struct sctp_event_subscribe event;
|
||||
@ -202,11 +202,11 @@ JNIEXPORT jint JNICALL Java_sun_nio_ch_SctpNet_socket0
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: sun_nio_ch_SctpNet
|
||||
* Class: sun_nio_ch_sctp_SctpNet
|
||||
* Method: bindx
|
||||
* Signature: (I[Ljava/net/InetAddress;IIZ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_sun_nio_ch_SctpNet_bindx
|
||||
JNIEXPORT void JNICALL Java_sun_nio_ch_sctp_SctpNet_bindx
|
||||
(JNIEnv *env, jclass klass, jint fd, jobjectArray addrs, jint port,
|
||||
jint addrsLength, jboolean add, jboolean preferIPv6) {
|
||||
SOCKADDR *sap, *tmpSap;
|
||||
@ -241,24 +241,24 @@ JNIEXPORT void JNICALL Java_sun_nio_ch_SctpNet_bindx
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: sun_nio_ch_SctpNet
|
||||
* Class: sun_nio_ch_sctp_SctpNet
|
||||
* Method: listen0
|
||||
* Signature: (II)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_sun_nio_ch_SctpNet_listen0
|
||||
Java_sun_nio_ch_sctp_SctpNet_listen0
|
||||
(JNIEnv *env, jclass cl, jint fd, jint backlog) {
|
||||
if (listen(fd, backlog) < 0)
|
||||
handleSocketError(env, errno);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: sun_nio_ch_SctpNet
|
||||
* Class: sun_nio_ch_sctp_SctpNet
|
||||
* Method: connect0
|
||||
* Signature: (ILjava/net/InetAddress;I)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_sun_nio_ch_SctpNet_connect0
|
||||
Java_sun_nio_ch_sctp_SctpNet_connect0
|
||||
(JNIEnv *env, jclass clazz, int fd, jobject iao, jint port) {
|
||||
SOCKADDR sa;
|
||||
int sa_len = SOCKADDR_LEN;
|
||||
@ -282,12 +282,12 @@ Java_sun_nio_ch_SctpNet_connect0
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: sun_nio_ch_SctpNet
|
||||
* Class: sun_nio_ch_sctp_SctpNet
|
||||
* Method: close0
|
||||
* Signature: (I)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_sun_nio_ch_SctpNet_close0
|
||||
Java_sun_nio_ch_sctp_SctpNet_close0
|
||||
(JNIEnv *env, jclass clazz, jint fd) {
|
||||
if (fd != -1) {
|
||||
int rv = close(fd);
|
||||
@ -297,12 +297,12 @@ Java_sun_nio_ch_SctpNet_close0
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: sun_nio_ch_SctpNet
|
||||
* Class: sun_nio_ch_sctp_SctpNet
|
||||
* Method: preClose0
|
||||
* Signature: (I)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_sun_nio_ch_SctpNet_preClose0
|
||||
Java_sun_nio_ch_sctp_SctpNet_preClose0
|
||||
(JNIEnv *env, jclass clazz, jint fd) {
|
||||
if (preCloseFD >= 0) {
|
||||
if (dup2(preCloseFD, fd) < 0)
|
||||
@ -340,11 +340,11 @@ jobject SockAddrToInetSocketAddress
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: sun_nio_ch_SctpNet
|
||||
* Class: sun_nio_ch_sctp_SctpNet
|
||||
* Method: getLocalAddresses0
|
||||
* Signature: (I)[Ljava/net/SocketAddress;
|
||||
*/
|
||||
JNIEXPORT jobjectArray JNICALL Java_sun_nio_ch_SctpNet_getLocalAddresses0
|
||||
JNIEXPORT jobjectArray JNICALL Java_sun_nio_ch_sctp_SctpNet_getLocalAddresses0
|
||||
(JNIEnv *env, jclass klass, jint fd) {
|
||||
void *addr_buf, *laddr;
|
||||
struct sockaddr* sap;
|
||||
@ -448,11 +448,11 @@ jobjectArray getRemoteAddresses
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: sun_nio_ch_SctpNet
|
||||
* Class: sun_nio_ch_sctp_SctpNet
|
||||
* Method: getRemoteAddresses0
|
||||
* Signature: (II)[Ljava/net/SocketAddress;
|
||||
*/
|
||||
JNIEXPORT jobjectArray JNICALL Java_sun_nio_ch_SctpNet_getRemoteAddresses0
|
||||
JNIEXPORT jobjectArray JNICALL Java_sun_nio_ch_sctp_SctpNet_getRemoteAddresses0
|
||||
(JNIEnv *env, jclass klass, jint fd, jint assocId) {
|
||||
return getRemoteAddresses(env, fd, assocId);
|
||||
}
|
||||
@ -465,13 +465,13 @@ int mapSocketOption
|
||||
int level;
|
||||
int optname;
|
||||
} const opts[] = {
|
||||
{ sun_nio_ch_SctpStdSocketOption_SCTP_DISABLE_FRAGMENTS, IPPROTO_SCTP, SCTP_DISABLE_FRAGMENTS },
|
||||
{ sun_nio_ch_SctpStdSocketOption_SCTP_EXPLICIT_COMPLETE, IPPROTO_SCTP, SCTP_EXPLICIT_EOR },
|
||||
{ sun_nio_ch_SctpStdSocketOption_SCTP_FRAGMENT_INTERLEAVE, IPPROTO_SCTP, SCTP_FRAGMENT_INTERLEAVE },
|
||||
{ sun_nio_ch_SctpStdSocketOption_SCTP_NODELAY, IPPROTO_SCTP, SCTP_NODELAY },
|
||||
{ sun_nio_ch_SctpStdSocketOption_SO_SNDBUF, SOL_SOCKET, SO_SNDBUF },
|
||||
{ sun_nio_ch_SctpStdSocketOption_SO_RCVBUF, SOL_SOCKET, SO_RCVBUF },
|
||||
{ sun_nio_ch_SctpStdSocketOption_SO_LINGER, SOL_SOCKET, SO_LINGER } };
|
||||
{ sun_nio_ch_sctp_SctpStdSocketOption_SCTP_DISABLE_FRAGMENTS, IPPROTO_SCTP, SCTP_DISABLE_FRAGMENTS },
|
||||
{ sun_nio_ch_sctp_SctpStdSocketOption_SCTP_EXPLICIT_COMPLETE, IPPROTO_SCTP, SCTP_EXPLICIT_EOR },
|
||||
{ sun_nio_ch_sctp_SctpStdSocketOption_SCTP_FRAGMENT_INTERLEAVE, IPPROTO_SCTP, SCTP_FRAGMENT_INTERLEAVE },
|
||||
{ sun_nio_ch_sctp_SctpStdSocketOption_SCTP_NODELAY, IPPROTO_SCTP, SCTP_NODELAY },
|
||||
{ sun_nio_ch_sctp_SctpStdSocketOption_SO_SNDBUF, SOL_SOCKET, SO_SNDBUF },
|
||||
{ sun_nio_ch_sctp_SctpStdSocketOption_SO_RCVBUF, SOL_SOCKET, SO_RCVBUF },
|
||||
{ sun_nio_ch_sctp_SctpStdSocketOption_SO_LINGER, SOL_SOCKET, SO_LINGER } };
|
||||
|
||||
int i;
|
||||
for (i=0; i<(int)(sizeof(opts) / sizeof(opts[0])); i++) {
|
||||
@ -487,11 +487,11 @@ int mapSocketOption
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: sun_nio_ch_SctpNet
|
||||
* Class: sun_nio_ch_sctp_SctpNet
|
||||
* Method: setIntOption0
|
||||
* Signature: (III)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_sun_nio_ch_SctpNet_setIntOption0
|
||||
JNIEXPORT void JNICALL Java_sun_nio_ch_sctp_SctpNet_setIntOption0
|
||||
(JNIEnv *env, jclass klass, jint fd, jint opt, int arg) {
|
||||
int klevel, kopt;
|
||||
int result;
|
||||
@ -505,7 +505,7 @@ JNIEXPORT void JNICALL Java_sun_nio_ch_SctpNet_setIntOption0
|
||||
return;
|
||||
}
|
||||
|
||||
if (opt == sun_nio_ch_SctpStdSocketOption_SO_LINGER) {
|
||||
if (opt == sun_nio_ch_sctp_SctpStdSocketOption_SO_LINGER) {
|
||||
parg = (void *)&linger;
|
||||
arglen = sizeof(linger);
|
||||
if (arg >= 0) {
|
||||
@ -522,16 +522,16 @@ JNIEXPORT void JNICALL Java_sun_nio_ch_SctpNet_setIntOption0
|
||||
|
||||
if (NET_SetSockOpt(fd, klevel, kopt, parg, arglen) < 0) {
|
||||
JNU_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException",
|
||||
"sun_nio_ch_SctpNet.setIntOption0");
|
||||
"sun_nio_ch_sctp_SctpNet.setIntOption0");
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: sun_nio_ch_SctpNet
|
||||
* Class: sun_nio_ch_sctp_SctpNet
|
||||
* Method: getIntOption0
|
||||
* Signature: (II)I
|
||||
*/
|
||||
JNIEXPORT int JNICALL Java_sun_nio_ch_SctpNet_getIntOption0
|
||||
JNIEXPORT int JNICALL Java_sun_nio_ch_sctp_SctpNet_getIntOption0
|
||||
(JNIEnv *env, jclass klass, jint fd, jint opt) {
|
||||
int klevel, kopt;
|
||||
int result;
|
||||
@ -545,7 +545,7 @@ JNIEXPORT int JNICALL Java_sun_nio_ch_SctpNet_getIntOption0
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (opt == sun_nio_ch_SctpStdSocketOption_SO_LINGER) {
|
||||
if (opt == sun_nio_ch_sctp_SctpStdSocketOption_SO_LINGER) {
|
||||
arg = (void *)&linger;
|
||||
arglen = sizeof(linger);
|
||||
} else {
|
||||
@ -559,18 +559,18 @@ JNIEXPORT int JNICALL Java_sun_nio_ch_SctpNet_getIntOption0
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (opt == sun_nio_ch_SctpStdSocketOption_SO_LINGER)
|
||||
if (opt == sun_nio_ch_sctp_SctpStdSocketOption_SO_LINGER)
|
||||
return linger.l_onoff ? linger.l_linger : -1;
|
||||
else
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: sun_nio_ch_SctpNet
|
||||
* Class: sun_nio_ch_sctp_SctpNet
|
||||
* Method: getPrimAddrOption0
|
||||
* Signature: (II)Ljava/net/SocketAddress;
|
||||
*/
|
||||
JNIEXPORT jobject JNICALL Java_sun_nio_ch_SctpNet_getPrimAddrOption0
|
||||
JNIEXPORT jobject JNICALL Java_sun_nio_ch_sctp_SctpNet_getPrimAddrOption0
|
||||
(JNIEnv *env, jclass klass, jint fd, jint assocId) {
|
||||
struct sctp_setprim prim;
|
||||
unsigned int prim_len = sizeof(prim);
|
||||
@ -588,11 +588,11 @@ JNIEXPORT jobject JNICALL Java_sun_nio_ch_SctpNet_getPrimAddrOption0
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: sun_nio_ch_SctpNet
|
||||
* Class: sun_nio_ch_sctp_SctpNet
|
||||
* Method: setPrimAddrOption0
|
||||
* Signature: (IILjava/net/InetAddress;I)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_sun_nio_ch_SctpNet_setPrimAddrOption0
|
||||
JNIEXPORT void JNICALL Java_sun_nio_ch_sctp_SctpNet_setPrimAddrOption0
|
||||
(JNIEnv *env, jclass klass, jint fd, jint assocId, jobject iaObj, jint port) {
|
||||
struct sctp_setprim prim;
|
||||
struct sockaddr* sap = (struct sockaddr*)&prim.ssp_addr;
|
||||
@ -612,11 +612,11 @@ JNIEXPORT void JNICALL Java_sun_nio_ch_SctpNet_setPrimAddrOption0
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: sun_nio_ch_SctpNet
|
||||
* Class: sun_nio_ch_sctp_SctpNet
|
||||
* Method: setPeerPrimAddrOption0
|
||||
* Signature: (IILjava/net/InetAddress;I)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_sun_nio_ch_SctpNet_setPeerPrimAddrOption0
|
||||
JNIEXPORT void JNICALL Java_sun_nio_ch_sctp_SctpNet_setPeerPrimAddrOption0
|
||||
(JNIEnv *env, jclass klass, jint fd, jint assocId,
|
||||
jobject iaObj, jint port, jboolean preferIPv6) {
|
||||
struct sctp_setpeerprim prim;
|
||||
@ -638,11 +638,11 @@ JNIEXPORT void JNICALL Java_sun_nio_ch_SctpNet_setPeerPrimAddrOption0
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: sun_nio_ch_SctpNet
|
||||
* Class: sun_nio_ch_sctp_SctpNet
|
||||
* Method: getInitMsgOption0
|
||||
* Signature: (I[I)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_sun_nio_ch_SctpNet_getInitMsgOption0
|
||||
JNIEXPORT void JNICALL Java_sun_nio_ch_sctp_SctpNet_getInitMsgOption0
|
||||
(JNIEnv *env, jclass klass, jint fd, jintArray retVal) {
|
||||
struct sctp_initmsg sctp_initmsg;
|
||||
unsigned int sim_len = sizeof(sctp_initmsg);
|
||||
@ -661,11 +661,11 @@ JNIEXPORT void JNICALL Java_sun_nio_ch_SctpNet_getInitMsgOption0
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: sun_nio_ch_SctpNet
|
||||
* Class: sun_nio_ch_sctp_SctpNet
|
||||
* Method: setInitMsgOption0
|
||||
* Signature: (III)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_sun_nio_ch_SctpNet_setInitMsgOption0
|
||||
JNIEXPORT void JNICALL Java_sun_nio_ch_sctp_SctpNet_setInitMsgOption0
|
||||
(JNIEnv *env, jclass klass, jint fd, jint inArg, jint outArg) {
|
||||
struct sctp_initmsg sctp_initmsg;
|
||||
|
||||
@ -682,11 +682,11 @@ JNIEXPORT void JNICALL Java_sun_nio_ch_SctpNet_setInitMsgOption0
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: sun_nio_ch_SctpNet
|
||||
* Class: sun_nio_ch_sctp_SctpNet
|
||||
* Method: shutdown0
|
||||
* Signature: (II)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_sun_nio_ch_SctpNet_shutdown0
|
||||
JNIEXPORT void JNICALL Java_sun_nio_ch_sctp_SctpNet_shutdown0
|
||||
(JNIEnv *env, jclass klass, jint fd, jint assocId) {
|
||||
int rv;
|
||||
struct msghdr msg[1];
|
||||
@ -738,11 +738,11 @@ JNIEXPORT void JNICALL Java_sun_nio_ch_SctpNet_shutdown0
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: sun_nio_ch_SctpNet
|
||||
* Class: sun_nio_ch_sctp_SctpNet
|
||||
* Method: branch
|
||||
* Signature: (II)I
|
||||
*/
|
||||
JNIEXPORT int JNICALL Java_sun_nio_ch_SctpNet_branch0
|
||||
JNIEXPORT int JNICALL Java_sun_nio_ch_sctp_SctpNet_branch0
|
||||
(JNIEnv *env, jclass klass, jint fd, jint assocId) {
|
||||
int newfd = 0;
|
||||
if ((newfd = nio_sctp_peeloff(fd, assocId)) < 0) {
|
@ -23,7 +23,7 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
#include "sun_nio_ch_SctpServerChannelImpl.h"
|
||||
#include "sun_nio_ch_sctp_SctpServerChannelImpl.h"
|
||||
|
||||
extern void Java_sun_nio_ch_ServerSocketChannelImpl_initIDs(JNIEnv* env,
|
||||
jclass c);
|
||||
@ -32,21 +32,21 @@ extern jint Java_sun_nio_ch_ServerSocketChannelImpl_accept0(JNIEnv* env,
|
||||
jobject this, jobject ssfdo, jobject newfdo, jobjectArray isaa);
|
||||
|
||||
/*
|
||||
* Class: sun_nio_ch_SctpServerChannelImpl
|
||||
* Class: sun_nio_ch_sctp_SctpServerChannelImpl
|
||||
* Method: initIDs
|
||||
* Signature: ()V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_sun_nio_ch_SctpServerChannelImpl_initIDs
|
||||
JNIEXPORT void JNICALL Java_sun_nio_ch_sctp_SctpServerChannelImpl_initIDs
|
||||
(JNIEnv* env, jclass c) {
|
||||
Java_sun_nio_ch_ServerSocketChannelImpl_initIDs(env, c);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: sun_nio_ch_SctpServerChannelImpl
|
||||
* Class: sun_nio_ch_sctp_SctpServerChannelImpl
|
||||
* Method: accept0
|
||||
* Signature: (Ljava/io/FileDescriptor;Ljava/io/FileDescriptor;[Ljava/net/InetSocketAddress;)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_sun_nio_ch_SctpServerChannelImpl_accept0
|
||||
JNIEXPORT jint JNICALL Java_sun_nio_ch_sctp_SctpServerChannelImpl_accept0
|
||||
(JNIEnv* env, jobject this, jobject ssfdo, jobject newfdo, jobjectArray isaa) {
|
||||
return Java_sun_nio_ch_ServerSocketChannelImpl_accept0(env, this,
|
||||
ssfdo, newfdo, isaa);
|
@ -585,7 +585,7 @@ final class WindowsSelectorImpl extends SelectorImpl {
|
||||
((SelChImpl)selch).kill();
|
||||
}
|
||||
|
||||
void putEventOps(SelectionKeyImpl sk, int ops) {
|
||||
public void putEventOps(SelectionKeyImpl sk, int ops) {
|
||||
synchronized (closeLock) {
|
||||
if (pollWrapper == null)
|
||||
throw new ClosedSelectorException();
|
||||
|
@ -22,7 +22,7 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package sun.nio.ch;
|
||||
package sun.nio.ch.sctp;
|
||||
|
||||
import java.net.SocketAddress;
|
||||
import java.net.InetAddress;
|
@ -22,7 +22,7 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package sun.nio.ch;
|
||||
package sun.nio.ch.sctp;
|
||||
|
||||
import java.net.SocketAddress;
|
||||
import java.net.InetAddress;
|
@ -22,7 +22,7 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package sun.nio.ch;
|
||||
package sun.nio.ch.sctp;
|
||||
|
||||
import java.net.SocketAddress;
|
||||
import java.net.InetAddress;
|
Loading…
x
Reference in New Issue
Block a user