src/jdk.sctp/share/classes/com/sun/nio/sctp/SctpServerChannel.java
author joehw
Tue, 07 Nov 2017 16:19:55 -0800
changeset 47712 bde0215f1f70
parent 47216 71c04702a3d5
permissions -rw-r--r--
8181151: Fix lint warnings in JAXP repo: cast Reviewed-by: lancea, rriggs
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2542
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
     1
/*
45132
db2f2d72cd4f 8179697: Fix Html5 errors in java.naming, java.logging, jdk.httpserver, jdk.net, jdk.sctp
ksrini
parents: 34894
diff changeset
     2
 * Copyright (c) 2009, 2017, Oracle and/or its affiliates. All rights reserved.
2542
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
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2542
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2542
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2542
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2542
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
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2542
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2542
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2542
diff changeset
    23
 * questions.
2542
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>
45882
341b124f1001 8184304: (sctp) make tables in jdk.sctp module accessible
jjg
parents: 45132
diff changeset
    50
 * <table class="striped">
341b124f1001 8184304: (sctp) make tables in jdk.sctp module accessible
jjg
parents: 45132
diff changeset
    51
 *   <caption style="display:none">Socket options</caption>
341b124f1001 8184304: (sctp) make tables in jdk.sctp module accessible
jjg
parents: 45132
diff changeset
    52
 *   <thead>
2542
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    53
 *   <tr>
45882
341b124f1001 8184304: (sctp) make tables in jdk.sctp module accessible
jjg
parents: 45132
diff changeset
    54
 *     <th scope="col">Option Name</th>
341b124f1001 8184304: (sctp) make tables in jdk.sctp module accessible
jjg
parents: 45132
diff changeset
    55
 *     <th scope="col">Description</th>
2542
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    56
 *   </tr>
45882
341b124f1001 8184304: (sctp) make tables in jdk.sctp module accessible
jjg
parents: 45132
diff changeset
    57
 *   </thead>
341b124f1001 8184304: (sctp) make tables in jdk.sctp module accessible
jjg
parents: 45132
diff changeset
    58
 *   <tbody>
2542
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    59
 *   <tr>
45882
341b124f1001 8184304: (sctp) make tables in jdk.sctp module accessible
jjg
parents: 45132
diff changeset
    60
 *     <th scope="row"> {@link SctpStandardSocketOptions#SCTP_INIT_MAXSTREAMS
341b124f1001 8184304: (sctp) make tables in jdk.sctp module accessible
jjg
parents: 45132
diff changeset
    61
 *                                          SCTP_INIT_MAXSTREAMS} </th>
2542
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    62
 *     <td> The maximum number of streams requested by the local endpoint during
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    63
 *          association initialization </td>
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    64
 *   </tr>
45882
341b124f1001 8184304: (sctp) make tables in jdk.sctp module accessible
jjg
parents: 45132
diff changeset
    65
 *   </tbody>
2542
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    66
 * </table>
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    67
 * </blockquote>
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    68
 * Additional (implementation specific) options may also be supported. The list
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    69
 * of options supported is obtained by invoking the {@link #supportedOptions()
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    70
 * supportedOptions} method.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    71
 *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    72
 * <p>SCTP server channels are safe for use by multiple concurrent threads.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    73
 *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    74
 * @since 1.7
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    75
 */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    76
public abstract class SctpServerChannel
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    77
    extends AbstractSelectableChannel
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    78
{
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    79
    /**
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    80
     * Initializes a new instance of this class.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    81
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    82
     * @param  provider
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    83
     *         The selector provider for this channel
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    84
     */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    85
    protected SctpServerChannel(SelectorProvider provider) {
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    86
        super(provider);
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    87
    }
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    88
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    89
    /**
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    90
     * Opens an SCTP server channel.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    91
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    92
     * <P> The new channel's socket is initially unbound; it must be bound
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    93
     * to a specific address via one of its socket's {@link #bind bind}
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    94
     * methods before associations can be accepted.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    95
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    96
     * @return  A new SCTP server channel
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    97
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    98
     * @throws  UnsupportedOperationException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    99
     *          If the SCTP protocol is not supported
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   100
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   101
     * @throws  IOException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   102
     *          If an I/O error occurs
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   103
     */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   104
    public static SctpServerChannel open() throws
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   105
        IOException {
11823
ee83ae88512d 7041778: Move SCTP implementation out of sun.nio.ch and into its own package
chegar
parents: 9679
diff changeset
   106
        return new sun.nio.ch.sctp.SctpServerChannelImpl((SelectorProvider)null);
2542
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   107
    }
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   108
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   109
    /**
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   110
     * Accepts an association on this channel's socket.
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> If this channel is in non-blocking mode then this method will
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   113
     * immediately return {@code null} if there are no pending associations.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   114
     * Otherwise it will block indefinitely until a new association is
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   115
     * available or an I/O error occurs.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   116
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   117
     * <P> The {@code SCTPChannel} returned by this method, if any, will be in
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   118
     *  blocking mode regardless of the blocking mode of this channel.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   119
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   120
     * <P> If a security manager has been installed then for each new
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   121
     * association this method verifies that the address and port number of the
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   122
     * assocaitions's remote peer are permitted by the security manager's {@link
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   123
     * java.lang.SecurityManager#checkAccept(String,int) checkAccept} method.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   124
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   125
     * @return  The SCTP channel for the new association, or {@code null}
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   126
     *          if this channel is in non-blocking mode and no association is
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   127
     *          available to be accepted
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   128
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   129
     * @throws  java.nio.channels.ClosedChannelException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   130
     *          If this channel is closed
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   131
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   132
     * @throws  java.nio.channels.AsynchronousCloseException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   133
     *          If another thread closes this channel
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   134
     *          while the accept operation is in progress
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   135
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   136
     * @throws  java.nio.channels.ClosedByInterruptException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   137
     *          If another thread interrupts the current thread
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   138
     *          while the accept operation is in progress, thereby
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   139
     *          closing the channel and setting the current thread's
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   140
     *          interrupt status
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   141
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   142
     * @throws  java.nio.channels.NotYetBoundException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   143
     *          If this channel's socket has not yet been bound
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   144
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   145
     * @throws  SecurityException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   146
     *          If a security manager has been installed and it does not permit
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   147
     *          access to the remote peer of the new association
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   148
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   149
     * @throws  IOException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   150
     *          If some other I/O error occurs
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   151
     */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   152
    public abstract SctpChannel accept() throws IOException;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   153
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   154
    /**
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   155
     * Binds the channel's socket to a local address and configures the socket
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   156
     * to listen for associations.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   157
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   158
     * <P> This method works as if invoking it were equivalent to evaluating the
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   159
     * expression:
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   160
     * <blockquote><pre>
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   161
     * bind(local, 0);
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   162
     * </pre></blockquote>
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   163
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   164
     * @param  local
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   165
     *         The local address to bind the socket, or {@code null} to
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   166
     *         bind the socket to an automatically assigned socket address
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   167
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   168
     * @return  This channel
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   169
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   170
     * @throws  java.nio.channels.ClosedChannelException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   171
     *          If this channel is closed
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   172
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   173
     * @throws  java.nio.channels.AlreadyBoundException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   174
     *          If this channel is already bound
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   175
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   176
     * @throws  java.nio.channels.UnsupportedAddressTypeException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   177
     *          If the type of the given address is not supported
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  SecurityException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   180
     *          If a security manager has been installed and its {@link
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   181
     *          java.lang.SecurityManager#checkListen(int) checkListen} method
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   182
     *          denies the operation
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   183
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   184
     * @throws  IOException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   185
     *          If some other I/O error occurs
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   186
     */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   187
    public final SctpServerChannel bind(SocketAddress local)
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   188
        throws IOException {
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   189
        return bind(local, 0);
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   190
    }
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   191
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   192
    /**
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   193
     * Binds the channel's socket to a local address and configures the socket
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   194
     * to listen for associations.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   195
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   196
     * <P> This method is used to establish a relationship between the socket
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   197
     * and the local address. Once a relationship is established then
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   198
     * the socket remains bound until the channel is closed. This relationship
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   199
     * may not necesssarily be with the address {@code local} as it may be
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   200
     * removed by {@link #unbindAddress unbindAddress}, but there will always be
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   201
     * at least one local address bound to the channel's socket once an
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   202
     * invocation of this method successfully completes.
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> Once the channel's socket has been successfully bound to a specific
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   205
     * address, that is not automatically assigned, more addresses
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   206
     * may be bound to it using {@link #bindAddress bindAddress}, or removed
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   207
     * using {@link #unbindAddress unbindAddress}.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   208
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   209
     * <P> The backlog parameter is the maximum number of pending associations
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   210
     * on the socket. Its exact semantics are implementation specific. An
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   211
     * implementation may impose an implementation specific maximum length or
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   212
     * may choose to ignore the parameter. If the backlog parameter has the
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   213
     * value {@code 0}, or a negative value, then an implementation specific
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   214
     * default is used.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   215
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   216
     * @param  local
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   217
     *         The local address to bind the socket, or {@code null} to
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   218
     *         bind the socket to an automatically assigned socket address
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   219
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   220
     * @param  backlog
28059
e576535359cc 8067377: My hobby: caning, then then canning, the the can-can
martin
parents: 25859
diff changeset
   221
     *         The maximum number of pending associations
2542
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   222
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   223
     * @return  This channel
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   224
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   225
     * @throws  java.nio.channels.ClosedChannelException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   226
     *          If this channel is closed
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   227
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   228
     * @throws  java.nio.channels.AlreadyBoundException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   229
     *          If this channel is already bound
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   230
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   231
     * @throws  java.nio.channels.UnsupportedAddressTypeException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   232
     *          If the type of the given address is not supported
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  SecurityException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   235
     *          If a security manager has been installed and its {@link
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   236
     *          java.lang.SecurityManager#checkListen(int) checkListen} method
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   237
     *          denies the operation
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   238
     *
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
     *          If some other I/O error occurs
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   241
     */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   242
    public abstract SctpServerChannel bind(SocketAddress local,
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   243
                                           int backlog)
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   244
        throws IOException;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   245
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   246
    /**
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   247
     * Adds the given address to the bound addresses for the channel's
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   248
     * socket.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   249
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   250
     * <P> The given address must not be the {@link
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   251
     * java.net.InetAddress#isAnyLocalAddress wildcard} address.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   252
     * The channel must be first bound using {@link #bind bind} before
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   253
     * invoking this method, otherwise {@link
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   254
     * java.nio.channels.NotYetBoundException} is thrown. The {@link #bind bind}
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   255
     * method takes a {@code SocketAddress} as its argument which typically
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   256
     * contains a port number as well as an address. Addresses subquently bound
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   257
     * using this method are simply addresses as the SCTP port number remains
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   258
     * the same for the lifetime of the channel.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   259
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   260
     * <P> New associations accepted after this method successfully completes
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   261
     * will be associated with the given address.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   262
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   263
     * @param  address
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   264
     *         The address to add to the bound addresses for the socket
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   265
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   266
     * @return  This channel
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   267
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   268
     * @throws  java.nio.channels.ClosedChannelException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   269
     *          If this channel is closed
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   270
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   271
     * @throws  java.nio.channels.NotYetBoundException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   272
     *          If this channel is not yet bound
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   273
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   274
     * @throws  java.nio.channels.AlreadyBoundException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   275
     *          If this channel is already bound to the given address
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   276
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   277
     * @throws  IllegalArgumentException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   278
     *          If address is {@code null} or the {@link
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   279
     *          java.net.InetAddress#isAnyLocalAddress wildcard} address
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   280
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   281
     * @throws  IOException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   282
     *          If some other I/O error occurs
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   283
     */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   284
    public abstract SctpServerChannel bindAddress(InetAddress address)
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   285
         throws IOException;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   286
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   287
    /**
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   288
     * Removes the given address from the bound addresses for the channel's
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   289
     * socket.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   290
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   291
     * <P> The given address must not be the {@link
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   292
     * java.net.InetAddress#isAnyLocalAddress wildcard} address.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   293
     * The channel must be first bound using {@link #bind bind} before
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   294
     * invoking this method, otherwise
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   295
     * {@link java.nio.channels.NotYetBoundException} is thrown.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   296
     * If this method is invoked on a channel that does not have
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   297
     * {@code address} as one of its bound addresses, or that has only one
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   298
     * local address bound to it, then this method throws {@link
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   299
     * IllegalUnbindException}.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   300
     * The initial address that the channel's socket is bound to using
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   301
     * {@link #bind bind} may be removed from the bound addresses for the
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   302
     * channel's socket.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   303
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   304
     * <P> New associations accepted after this method successfully completes
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   305
     * will not be associated with the given address.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   306
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   307
     * @param  address
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   308
     *         The address to remove from the bound addresses for the socket
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   309
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   310
     * @return  This channel
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   311
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   312
     * @throws  java.nio.channels.ClosedChannelException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   313
     *          If this channel is closed
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   314
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   315
     * @throws  java.nio.channels.NotYetBoundException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   316
     *          If this channel is not yet bound
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   317
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   318
     * @throws  IllegalArgumentException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   319
     *          If address is {@code null} or the {@link
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   320
     *          java.net.InetAddress#isAnyLocalAddress wildcard} address
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  IllegalUnbindException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   323
     *          If the implementation does not support removing addresses from a
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   324
     *          listening socket, {@code address} is not bound to the channel's
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   325
     *          socket, or the channel has only one address bound to it
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   326
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   327
     * @throws  IOException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   328
     *          If some other I/O error occurs
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   329
     */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   330
    public abstract SctpServerChannel unbindAddress(InetAddress address)
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   331
         throws IOException;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   332
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   333
    /**
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   334
     * Returns all of the socket addresses to which this channel's socket is
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   335
     * bound.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   336
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   337
     * @return  All the socket addresses that this channel's socket is
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   338
     *          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
   339
     *          bound
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   340
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   341
     * @throws  java.nio.channels.ClosedChannelException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   342
     *          If the channel is closed
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   343
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   344
     * @throws  IOException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   345
     *          If an I/O error occurs
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   346
     */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   347
    public abstract Set<SocketAddress> getAllLocalAddresses()
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   348
        throws IOException;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   349
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   350
    /**
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   351
     * Returns the value of a socket option.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   352
     *
19835
505b6711e79b 8024508: Fix doclint issues in com.sun.nio.sctp
chegar
parents: 14342
diff changeset
   353
     * @param   <T>
505b6711e79b 8024508: Fix doclint issues in com.sun.nio.sctp
chegar
parents: 14342
diff changeset
   354
     *          The type of the socket option value
505b6711e79b 8024508: Fix doclint issues in com.sun.nio.sctp
chegar
parents: 14342
diff changeset
   355
     *
2542
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   356
     * @param   name
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   357
     *          The socket option
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   358
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   359
     * @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
   360
     *          a valid value for some socket options.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   361
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   362
     * @throws  UnsupportedOperationException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   363
     *          If the socket option is not supported by this channel
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   364
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   365
     * @throws  java.nio.channels.ClosedChannelException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   366
     *          If this channel is closed
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   367
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   368
     * @throws  IOException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   369
     *          If an I/O error occurs
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   370
     *
9679
d98ae8bc45fc 7042979: Rename StandardSocketOption and StandardWatchEventKind
alanb
parents: 5506
diff changeset
   371
     * @see SctpStandardSocketOptions
2542
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   372
     */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   373
    public abstract <T> T getOption(SctpSocketOption<T> name) throws IOException;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   374
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   375
    /**
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   376
     * Sets the value of a socket option.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   377
     *
19835
505b6711e79b 8024508: Fix doclint issues in com.sun.nio.sctp
chegar
parents: 14342
diff changeset
   378
     * @param   <T>
505b6711e79b 8024508: Fix doclint issues in com.sun.nio.sctp
chegar
parents: 14342
diff changeset
   379
     *          The type of the socket option value
505b6711e79b 8024508: Fix doclint issues in com.sun.nio.sctp
chegar
parents: 14342
diff changeset
   380
     *
2542
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   381
     * @param   name
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   382
     *          The socket option
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   383
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   384
     * @param   value
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   385
     *          The value of the socket option. A value of {@code null} may be
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   386
     *          a valid value for some socket options.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   387
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   388
     * @return  This channel
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   389
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   390
     * @throws  UnsupportedOperationException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   391
     *          If the socket option is not supported by this channel
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   392
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   393
     * @throws  IllegalArgumentException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   394
     *          If the value is not a valid value for this socket option
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   395
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   396
     * @throws  java.nio.channels.ClosedChannelException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   397
     *          If this channel is closed
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   398
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   399
     * @throws  IOException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   400
     *          If an I/O error occurs
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   401
     *
9679
d98ae8bc45fc 7042979: Rename StandardSocketOption and StandardWatchEventKind
alanb
parents: 5506
diff changeset
   402
     * @see SctpStandardSocketOptions
2542
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   403
     */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   404
    public abstract <T> SctpServerChannel setOption(SctpSocketOption<T> name,
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   405
                                                    T value)
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   406
        throws IOException;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   407
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   408
    /**
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   409
     * Returns a set of the socket options supported by this channel.
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> This method will continue to return the set of options even after the
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   412
     * channel has been closed.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   413
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   414
     * @return  A set of the socket options supported by this channel
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   415
     */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   416
    public abstract Set<SctpSocketOption<?>> supportedOptions();
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   417
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   418
    /**
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   419
     * Returns an operation set identifying this channel's supported
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   420
     * operations.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   421
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   422
     * <P> SCTP server channels only support the accepting of new
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   423
     * associations, so this method returns
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   424
     * {@link java.nio.channels.SelectionKey#OP_ACCEPT}.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   425
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   426
     * @return  The valid-operation set
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   427
     */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   428
    @Override
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   429
    public final int validOps() {
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   430
        return SelectionKey.OP_ACCEPT;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   431
    }
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   432
}