jdk/src/share/classes/com/sun/nio/sctp/SctpServerChannel.java
author chegar
Thu, 16 Apr 2009 17:42:00 +0100
changeset 2542 d859108aea12
child 5506 202f599c92aa
permissions -rw-r--r--
4927640: Implementation of the sctp protocol Summary: An implementation-specific API for the Stream Control Transmission Protocol Reviewed-by: alanb, michaelm, jccollet
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2542
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
     1
/*
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
     2
 * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
     4
 *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Sun designates this
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
     9
 * by Sun in the LICENSE file that accompanied this code.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    10
 *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    15
 * accompanied this code).
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    16
 *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    20
 *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    21
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    22
 * CA 95054 USA or visit www.sun.com if you need additional information or
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    23
 * have any questions.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    24
 */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    25
package com.sun.nio.sctp;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    26
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    27
import java.net.SocketAddress;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    28
import java.net.InetAddress;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    29
import java.io.IOException;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    30
import java.util.Set;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    31
import java.nio.channels.SelectionKey;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    32
import java.nio.channels.spi.SelectorProvider;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    33
import java.nio.channels.spi.AbstractSelectableChannel;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    34
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    35
/**
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    36
 * A selectable channel for message-oriented listening SCTP sockets.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    37
 *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    38
 * <p> An {@code SCTPServerChannel} is created by invoking the
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    39
 * {@link #open open} method of this class. A newly-created SCTP server
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    40
 * channel is open but not yet bound. An attempt to invoke the
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    41
 * {@link #accept accept} method of an unbound channel will cause the
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    42
 * {@link java.nio.channels.NotYetBoundException} to be thrown. An SCTP server
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    43
 * channel can be bound by invoking one of the
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    44
 * {@link #bind(java.net.SocketAddress,int) bind} methods defined by this class.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    45
 *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    46
 * <p> Socket options are configured using the
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    47
 * {@link #setOption(SctpSocketOption,Object) setOption} method. SCTP server socket
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    48
 * channels support the following options:
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    49
 * <blockquote>
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    50
 * <table border>
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    51
 *   <tr>
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    52
 *     <th>Option Name</th>
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    53
 *     <th>Description</th>
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    54
 *   </tr>
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    55
 *   <tr>
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    56
 *     <td> {@link SctpStandardSocketOption#SCTP_INIT_MAXSTREAMS
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    57
 *                                          SCTP_INIT_MAXSTREAMS} </td>
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    58
 *     <td> The maximum number of streams requested by the local endpoint during
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    59
 *          association initialization </td>
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    60
 *   </tr>
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    61
 * </table>
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    62
 * </blockquote>
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    63
 * Additional (implementation specific) options may also be supported. The list
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    64
 * of options supported is obtained by invoking the {@link #supportedOptions()
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    65
 * supportedOptions} method.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    66
 *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    67
 * <p>SCTP server channels are safe for use by multiple concurrent threads.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    68
 *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    69
 * @since 1.7
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    70
 */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    71
public abstract class SctpServerChannel
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    72
    extends AbstractSelectableChannel
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    73
{
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    74
    /**
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    75
     * Initializes a new instance of this class.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    76
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    77
     * @param  provider
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    78
     *         The selector provider for this channel
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    79
     */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    80
    protected SctpServerChannel(SelectorProvider provider) {
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    81
        super(provider);
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    82
    }
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    83
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    84
    /**
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    85
     * Opens an SCTP server channel.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    86
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    87
     * <P> The new channel's socket is initially unbound; it must be bound
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    88
     * to a specific address via one of its socket's {@link #bind bind}
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    89
     * methods before associations can be accepted.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    90
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    91
     * @return  A new SCTP server channel
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    92
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    93
     * @throws  UnsupportedOperationException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    94
     *          If the SCTP protocol is not supported
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    95
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    96
     * @throws  IOException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    97
     *          If an I/O error occurs
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    98
     */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    99
    public static SctpServerChannel open() throws
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   100
        IOException {
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   101
        return new sun.nio.ch.SctpServerChannelImpl((SelectorProvider)null);
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   102
    }
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   103
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   104
    /**
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   105
     * Accepts an association on this channel's socket.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   106
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   107
     * <P> If this channel is in non-blocking mode then this method will
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   108
     * immediately return {@code null} if there are no pending associations.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   109
     * Otherwise it will block indefinitely until a new association is
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   110
     * available or an I/O error occurs.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   111
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   112
     * <P> The {@code SCTPChannel} returned by this method, if any, will be in
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   113
     *  blocking mode regardless of the blocking mode of this channel.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   114
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   115
     * <P> If a security manager has been installed then for each new
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   116
     * association this method verifies that the address and port number of the
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   117
     * assocaitions's remote peer are permitted by the security manager's {@link
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   118
     * java.lang.SecurityManager#checkAccept(String,int) checkAccept} method.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   119
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   120
     * @return  The SCTP channel for the new association, or {@code null}
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   121
     *          if this channel is in non-blocking mode and no association is
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   122
     *          available to be accepted
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   123
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   124
     * @throws  java.nio.channels.ClosedChannelException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   125
     *          If this channel is closed
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   126
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   127
     * @throws  java.nio.channels.AsynchronousCloseException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   128
     *          If another thread closes this channel
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   129
     *          while the accept operation is in progress
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   130
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   131
     * @throws  java.nio.channels.ClosedByInterruptException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   132
     *          If another thread interrupts the current thread
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   133
     *          while the accept operation is in progress, thereby
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   134
     *          closing the channel and setting the current thread's
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   135
     *          interrupt status
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   136
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   137
     * @throws  java.nio.channels.NotYetBoundException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   138
     *          If this channel's socket has not yet been bound
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   139
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   140
     * @throws  SecurityException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   141
     *          If a security manager has been installed and it does not permit
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   142
     *          access to the remote peer of the new association
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   143
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   144
     * @throws  IOException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   145
     *          If some other I/O error occurs
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   146
     */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   147
    public abstract SctpChannel accept() throws IOException;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   148
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   149
    /**
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   150
     * Binds the channel's socket to a local address and configures the socket
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   151
     * to listen for associations.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   152
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   153
     * <P> This method works as if invoking it were equivalent to evaluating the
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   154
     * expression:
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   155
     * <blockquote><pre>
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   156
     * bind(local, 0);
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   157
     * </pre></blockquote>
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   158
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   159
     * @param  local
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   160
     *         The local address to bind the socket, or {@code null} to
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   161
     *         bind the socket to an automatically assigned socket address
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   162
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   163
     * @return  This channel
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   164
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   165
     * @throws  java.nio.channels.ClosedChannelException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   166
     *          If this channel is closed
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   167
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   168
     * @throws  java.nio.channels.AlreadyBoundException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   169
     *          If this channel is already bound
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   170
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   171
     * @throws  java.nio.channels.UnsupportedAddressTypeException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   172
     *          If the type of the given address is not supported
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   173
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   174
     * @throws  SecurityException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   175
     *          If a security manager has been installed and its {@link
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   176
     *          java.lang.SecurityManager#checkListen(int) checkListen} method
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   177
     *          denies the operation
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   178
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   179
     * @throws  IOException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   180
     *          If some other I/O error occurs
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   181
     */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   182
    public final SctpServerChannel bind(SocketAddress local)
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   183
        throws IOException {
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   184
        return bind(local, 0);
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   185
    }
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   186
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   187
    /**
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   188
     * Binds the channel's socket to a local address and configures the socket
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   189
     * to listen for associations.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   190
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   191
     * <P> This method is used to establish a relationship between the socket
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   192
     * and the local address. Once a relationship is established then
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   193
     * the socket remains bound until the channel is closed. This relationship
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   194
     * may not necesssarily be with the address {@code local} as it may be
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   195
     * removed by {@link #unbindAddress unbindAddress}, but there will always be
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   196
     * at least one local address bound to the channel's socket once an
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   197
     * invocation of this method successfully completes.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   198
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   199
     * <P> Once the channel's socket has been successfully bound to a specific
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   200
     * address, that is not automatically assigned, more addresses
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   201
     * may be bound to it using {@link #bindAddress bindAddress}, or removed
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   202
     * using {@link #unbindAddress unbindAddress}.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   203
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   204
     * <P> The backlog parameter is the maximum number of pending associations
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   205
     * on the socket. Its exact semantics are implementation specific. An
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   206
     * implementation may impose an implementation specific maximum length or
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   207
     * may choose to ignore the parameter. If the backlog parameter has the
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   208
     * value {@code 0}, or a negative value, then an implementation specific
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   209
     * default is used.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   210
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   211
     * @param  local
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   212
     *         The local address to bind the socket, or {@code null} to
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   213
     *         bind the socket to an automatically assigned socket address
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   214
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   215
     * @param  backlog
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   216
     *         The maximum number number of pending associations
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   217
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   218
     * @return  This channel
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   219
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   220
     * @throws  java.nio.channels.ClosedChannelException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   221
     *          If this channel is closed
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   222
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   223
     * @throws  java.nio.channels.AlreadyBoundException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   224
     *          If this channel is already bound
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   225
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   226
     * @throws  java.nio.channels.UnsupportedAddressTypeException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   227
     *          If the type of the given address is not supported
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   228
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   229
     * @throws  SecurityException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   230
     *          If a security manager has been installed and its {@link
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   231
     *          java.lang.SecurityManager#checkListen(int) checkListen} method
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   232
     *          denies the operation
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   233
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   234
     * @throws  IOException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   235
     *          If some other I/O error occurs
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   236
     */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   237
    public abstract SctpServerChannel bind(SocketAddress local,
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   238
                                           int backlog)
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   239
        throws IOException;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   240
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   241
    /**
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   242
     * Adds the given address to the bound addresses for the channel's
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   243
     * socket.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   244
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   245
     * <P> The given address must not be the {@link
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   246
     * java.net.InetAddress#isAnyLocalAddress wildcard} address.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   247
     * The channel must be first bound using {@link #bind bind} before
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   248
     * invoking this method, otherwise {@link
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   249
     * java.nio.channels.NotYetBoundException} is thrown. The {@link #bind bind}
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   250
     * method takes a {@code SocketAddress} as its argument which typically
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   251
     * contains a port number as well as an address. Addresses subquently bound
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   252
     * using this method are simply addresses as the SCTP port number remains
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   253
     * the same for the lifetime of the channel.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   254
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   255
     * <P> New associations accepted after this method successfully completes
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   256
     * will be associated with the given address.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   257
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   258
     * @param  address
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   259
     *         The address to add to the bound addresses for the socket
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   260
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   261
     * @return  This channel
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   262
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   263
     * @throws  java.nio.channels.ClosedChannelException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   264
     *          If this channel is closed
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   265
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   266
     * @throws  java.nio.channels.NotYetBoundException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   267
     *          If this channel is not yet bound
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   268
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   269
     * @throws  java.nio.channels.AlreadyBoundException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   270
     *          If this channel is already bound to the given address
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   271
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   272
     * @throws  IllegalArgumentException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   273
     *          If address is {@code null} or the {@link
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   274
     *          java.net.InetAddress#isAnyLocalAddress wildcard} address
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   275
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   276
     * @throws  IOException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   277
     *          If some other I/O error occurs
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   278
     */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   279
    public abstract SctpServerChannel bindAddress(InetAddress address)
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   280
         throws IOException;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   281
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   282
    /**
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   283
     * Removes the given address from the bound addresses for the channel's
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   284
     * socket.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   285
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   286
     * <P> The given address must not be the {@link
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   287
     * java.net.InetAddress#isAnyLocalAddress wildcard} address.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   288
     * The channel must be first bound using {@link #bind bind} before
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   289
     * invoking this method, otherwise
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   290
     * {@link java.nio.channels.NotYetBoundException} is thrown.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   291
     * If this method is invoked on a channel that does not have
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   292
     * {@code address} as one of its bound addresses, or that has only one
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   293
     * local address bound to it, then this method throws {@link
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   294
     * IllegalUnbindException}.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   295
     * The initial address that the channel's socket is bound to using
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   296
     * {@link #bind bind} may be removed from the bound addresses for the
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   297
     * channel's socket.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   298
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   299
     * <P> New associations accepted after this method successfully completes
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   300
     * will not be associated with the given address.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   301
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   302
     * @param  address
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   303
     *         The address to remove from the bound addresses for the socket
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   304
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   305
     * @return  This channel
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   306
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   307
     * @throws  java.nio.channels.ClosedChannelException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   308
     *          If this channel is closed
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   309
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   310
     * @throws  java.nio.channels.NotYetBoundException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   311
     *          If this channel is not yet bound
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   312
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   313
     * @throws  IllegalArgumentException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   314
     *          If address is {@code null} or the {@link
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   315
     *          java.net.InetAddress#isAnyLocalAddress wildcard} address
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   316
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   317
     * @throws  IllegalUnbindException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   318
     *          If the implementation does not support removing addresses from a
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   319
     *          listening socket, {@code address} is not bound to the channel's
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   320
     *          socket, or the channel has only one address bound to it
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   321
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   322
     * @throws  IOException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   323
     *          If some other I/O error occurs
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   324
     */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   325
    public abstract SctpServerChannel unbindAddress(InetAddress address)
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   326
         throws IOException;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   327
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   328
    /**
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   329
     * Returns all of the socket addresses to which this channel's socket is
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   330
     * bound.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   331
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   332
     * @return  All the socket addresses that this channel's socket is
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   333
     *          bound to, or an empty {@code Set} if the channel's socket is not
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   334
     *          bound
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   335
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   336
     * @throws  java.nio.channels.ClosedChannelException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   337
     *          If the channel is closed
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   338
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   339
     * @throws  IOException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   340
     *          If an I/O error occurs
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   341
     */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   342
    public abstract Set<SocketAddress> getAllLocalAddresses()
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   343
        throws IOException;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   344
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   345
    /**
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   346
     * Returns the value of a socket option.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   347
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   348
     * @param   name
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   349
     *          The socket option
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   350
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   351
     * @return  The value of the socket option. A value of {@code null} may be
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   352
     *          a valid value for some socket options.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   353
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   354
     * @throws  UnsupportedOperationException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   355
     *          If the socket option is not supported by this channel
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   356
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   357
     * @throws  java.nio.channels.ClosedChannelException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   358
     *          If this channel is closed
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   359
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   360
     * @throws  IOException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   361
     *          If an I/O error occurs
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   362
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   363
     * @see SctpStandardSocketOption
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   364
     */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   365
    public abstract <T> T getOption(SctpSocketOption<T> name) throws IOException;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   366
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   367
    /**
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   368
     * Sets the value of a socket option.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   369
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   370
     * @param   name
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   371
     *          The socket option
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   372
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   373
     * @param   value
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   374
     *          The value of the socket option. A value of {@code null} may be
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   375
     *          a valid value for some socket options.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   376
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   377
     * @return  This channel
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   378
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   379
     * @throws  UnsupportedOperationException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   380
     *          If the socket option is not supported by this channel
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   381
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   382
     * @throws  IllegalArgumentException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   383
     *          If the value is not a valid value for this socket option
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   384
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   385
     * @throws  java.nio.channels.ClosedChannelException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   386
     *          If this channel is closed
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   387
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   388
     * @throws  IOException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   389
     *          If an I/O error occurs
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   390
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   391
     * @see SctpStandardSocketOption
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   392
     */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   393
    public abstract <T> SctpServerChannel setOption(SctpSocketOption<T> name,
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   394
                                                    T value)
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   395
        throws IOException;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   396
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   397
    /**
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   398
     * Returns a set of the socket options supported by this channel.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   399
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   400
     * <P> This method will continue to return the set of options even after the
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   401
     * channel has been closed.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   402
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   403
     * @return  A set of the socket options supported by this channel
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   404
     */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   405
    public abstract Set<SctpSocketOption<?>> supportedOptions();
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   406
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   407
    /**
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   408
     * Returns an operation set identifying this channel's supported
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   409
     * operations.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   410
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   411
     * <P> SCTP server channels only support the accepting of new
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   412
     * associations, so this method returns
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   413
     * {@link java.nio.channels.SelectionKey#OP_ACCEPT}.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   414
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   415
     * @return  The valid-operation set
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   416
     */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   417
    @Override
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   418
    public final int validOps() {
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   419
        return SelectionKey.OP_ACCEPT;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   420
    }
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   421
}