/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* An implementation of SctpServerChannel
*/
implements SelChImpl
{
private final int fdVal;
/* IDs of native thread doing accept, for signalling */
/* Lock held by thread currently blocked in this channel */
/* Lock held by any thread that modifies the state fields declared below
* DO NOT invoke a blocking I/O operation while holding this lock! */
private enum ChannelState {
}
/* -- The following fields are protected by stateLock -- */
/* Binding: Once bound the port will remain constant. */
/* Has the channel been bound to the wildcard address */
/* -- End of fields protected by stateLock -- */
/**
* Initializes a new instance of this class.
*/
throws IOException {
//TODO: update provider remove public modifier
super(provider);
}
throws IOException {
synchronized (lock) {
synchronized (stateLock) {
if (!isOpen())
throw new ClosedChannelException();
if (isBound())
wildcard = true;
}
}
return this;
}
throws IOException {
return bindUnbindAddress(address, true);
}
throws IOException {
return bindUnbindAddress(address, false);
}
throws IOException {
throw new IllegalArgumentException();
synchronized (lock) {
synchronized (stateLock) {
if (!isOpen())
throw new ClosedChannelException();
if (!isBound())
throw new NotYetBoundException();
if (wildcard)
throw new IllegalStateException(
"Cannot add or remove addresses from a channel that is bound to the wildcard address");
if (address.isAnyLocalAddress())
throw new IllegalArgumentException(
"Cannot add or remove the wildcard address");
if (add) {
}
}
} else { /*removing */
/* Verify that there is more than one address
* and that address is already bound */
throw new IllegalUnbindException("Cannot remove address from a channel with only one address bound");
boolean foundAddress = false;
foundAddress = true;
break;
}
}
if (!foundAddress )
throw new IllegalUnbindException("Cannot remove address from a channel that is not bound to that address");
}
if (add)
else {
break;
}
}
}
}
}
return this;
}
private boolean isBound() {
synchronized (stateLock) {
return port == -1 ? false : true;
}
}
synchronized (stateLock) {
thread = 0;
kill();
}
}
synchronized (lock) {
if (!isOpen())
throw new ClosedChannelException();
if (!isBound())
throw new NotYetBoundException();
int n = 0;
try {
begin();
if (!isOpen())
return null;
for (;;) {
continue;
break;
}
} finally {
end(n > 0);
}
if (n < 1)
return null;
return sc;
}
}
}
synchronized (stateLock) {
if (thread != 0)
if (!isRegistered())
kill();
}
}
synchronized (stateLock) {
return;
return;
}
assert !isOpen() && !isRegistered();
// Postpone the kill if there is a thread in accept
if (thread == 0) {
} else {
}
}
}
return fd;
}
public int getFDVal() {
return fdVal;
}
/**
* Translates native poll revent ops into a ready operation ops
*/
int newOps = initialOps;
/* This should only happen if this channel is pre-closed while a
* selection operation is in progress
* ## Throw an error if this channel has not been pre-closed */
return false;
}
}
}
}
}
int newOps = 0;
/* Translate ops */
/* Place ops into pollfd array */
}
throws IOException {
throw new NullPointerException();
synchronized (stateLock) {
if (!isOpen())
throw new ClosedChannelException();
return this;
}
}
throw new NullPointerException();
synchronized (stateLock) {
if (!isOpen())
throw new ClosedChannelException();
}
}
private static class DefaultOptionsHolder {
}
}
return DefaultOptionsHolder.defaultOptions;
}
throws IOException {
synchronized (stateLock) {
if (!isOpen())
throw new ClosedChannelException();
if (!isBound())
return Collections.EMPTY_SET;
}
}
/* Native */
private static native void initIDs();
static {
initIDs();
}
}