jdk/src/jdk.sctp/share/classes/com/sun/nio/sctp/SctpServerChannel.java
author duke
Wed, 05 Jul 2017 20:52:05 +0200
changeset 32881 5f9d335c43c3
parent 28059 e576535359cc
child 34894 3248b89d1921
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2542
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
     1
/*
23010
6dadb192ad81 8029235: Update copyright year to match last edit in jdk8 jdk repository for 2013
lana
parents: 20742
diff changeset
     2
 * Copyright (c) 2009, 2013, 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>
19835
505b6711e79b 8024508: Fix doclint issues in com.sun.nio.sctp
chegar
parents: 14342
diff changeset
    50
 * <table border summary="Socket options">
2542
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>
9679
d98ae8bc45fc 7042979: Rename StandardSocketOption and StandardWatchEventKind
alanb
parents: 5506
diff changeset
    56
 *     <td> {@link SctpStandardSocketOptions#SCTP_INIT_MAXSTREAMS
2542
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
 */
20742
4ae78e8060d6 8008662: Add @jdk.Exported to JDK-specific/exported APIs
alanb
parents: 19835
diff changeset
    71
@jdk.Exported
2542
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    72
public abstract class SctpServerChannel
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    73
    extends AbstractSelectableChannel
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    74
{
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    75
    /**
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    76
     * Initializes a new instance of this class.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    77
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    78
     * @param  provider
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    79
     *         The selector provider for this channel
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    80
     */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    81
    protected SctpServerChannel(SelectorProvider provider) {
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    82
        super(provider);
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
    /**
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    86
     * Opens an SCTP server channel.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    87
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    88
     * <P> The new channel's socket is initially unbound; it must be bound
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    89
     * to a specific address via one of its socket's {@link #bind bind}
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    90
     * methods before associations can be accepted.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    91
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    92
     * @return  A new SCTP server channel
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    93
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    94
     * @throws  UnsupportedOperationException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    95
     *          If the SCTP protocol is not supported
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    96
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    97
     * @throws  IOException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    98
     *          If an I/O error occurs
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    99
     */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   100
    public static SctpServerChannel open() throws
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   101
        IOException {
11823
ee83ae88512d 7041778: Move SCTP implementation out of sun.nio.ch and into its own package
chegar
parents: 9679
diff changeset
   102
        return new sun.nio.ch.sctp.SctpServerChannelImpl((SelectorProvider)null);
2542
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
    /**
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   106
     * Accepts an association on this channel's socket.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   107
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   108
     * <P> If this channel is in non-blocking mode then this method will
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   109
     * immediately return {@code null} if there are no pending associations.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   110
     * Otherwise it will block indefinitely until a new association is
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   111
     * available or an I/O error occurs.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   112
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   113
     * <P> The {@code SCTPChannel} returned by this method, if any, will be in
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   114
     *  blocking mode regardless of the blocking mode of this channel.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   115
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   116
     * <P> If a security manager has been installed then for each new
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   117
     * association this method verifies that the address and port number of the
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   118
     * assocaitions's remote peer are permitted by the security manager's {@link
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   119
     * java.lang.SecurityManager#checkAccept(String,int) checkAccept} method.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   120
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   121
     * @return  The SCTP channel for the new association, or {@code null}
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   122
     *          if this channel is in non-blocking mode and no association is
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   123
     *          available to be accepted
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   124
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   125
     * @throws  java.nio.channels.ClosedChannelException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   126
     *          If this channel is closed
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   127
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   128
     * @throws  java.nio.channels.AsynchronousCloseException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   129
     *          If another thread closes this channel
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   130
     *          while the accept operation is in progress
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.ClosedByInterruptException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   133
     *          If another thread interrupts the current thread
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   134
     *          while the accept operation is in progress, thereby
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   135
     *          closing the channel and setting the current thread's
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   136
     *          interrupt status
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   137
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   138
     * @throws  java.nio.channels.NotYetBoundException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   139
     *          If this channel's socket has not yet been bound
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   140
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   141
     * @throws  SecurityException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   142
     *          If a security manager has been installed and it does not permit
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   143
     *          access to the remote peer of the new association
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  IOException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   146
     *          If some other I/O error occurs
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   147
     */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   148
    public abstract SctpChannel accept() throws IOException;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   149
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   150
    /**
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   151
     * Binds the channel's socket to a local address and configures the socket
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   152
     * to listen for associations.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   153
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   154
     * <P> This method works as if invoking it were equivalent to evaluating the
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   155
     * expression:
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   156
     * <blockquote><pre>
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   157
     * bind(local, 0);
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   158
     * </pre></blockquote>
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   159
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   160
     * @param  local
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   161
     *         The local address to bind the socket, or {@code null} to
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   162
     *         bind the socket to an automatically assigned socket address
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   163
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   164
     * @return  This channel
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   165
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   166
     * @throws  java.nio.channels.ClosedChannelException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   167
     *          If this channel is closed
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   168
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   169
     * @throws  java.nio.channels.AlreadyBoundException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   170
     *          If this channel is already bound
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   171
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   172
     * @throws  java.nio.channels.UnsupportedAddressTypeException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   173
     *          If the type of the given address is not supported
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   174
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   175
     * @throws  SecurityException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   176
     *          If a security manager has been installed and its {@link
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   177
     *          java.lang.SecurityManager#checkListen(int) checkListen} method
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   178
     *          denies the operation
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   179
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   180
     * @throws  IOException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   181
     *          If some other I/O error occurs
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   182
     */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   183
    public final SctpServerChannel bind(SocketAddress local)
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
        return bind(local, 0);
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
    /**
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   189
     * Binds the channel's socket to a local address and configures the socket
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   190
     * to listen for associations.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   191
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   192
     * <P> This method is used to establish a relationship between the socket
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   193
     * and the local address. Once a relationship is established then
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   194
     * the socket remains bound until the channel is closed. This relationship
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   195
     * may not necesssarily be with the address {@code local} as it may be
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   196
     * removed by {@link #unbindAddress unbindAddress}, but there will always be
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   197
     * at least one local address bound to the channel's socket once an
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   198
     * invocation of this method successfully completes.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   199
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   200
     * <P> Once the channel's socket has been successfully bound to a specific
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   201
     * address, that is not automatically assigned, more addresses
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   202
     * may be bound to it using {@link #bindAddress bindAddress}, or removed
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   203
     * using {@link #unbindAddress unbindAddress}.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   204
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   205
     * <P> The backlog parameter is the maximum number of pending associations
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   206
     * on the socket. Its exact semantics are implementation specific. An
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   207
     * implementation may impose an implementation specific maximum length or
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   208
     * may choose to ignore the parameter. If the backlog parameter has the
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   209
     * value {@code 0}, or a negative value, then an implementation specific
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   210
     * default is used.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   211
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   212
     * @param  local
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   213
     *         The local address to bind the socket, or {@code null} to
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   214
     *         bind the socket to an automatically assigned socket address
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  backlog
28059
e576535359cc 8067377: My hobby: caning, then then canning, the the can-can
martin
parents: 25859
diff changeset
   217
     *         The maximum number of pending associations
2542
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   218
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   219
     * @return  This channel
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   220
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   221
     * @throws  java.nio.channels.ClosedChannelException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   222
     *          If this channel is closed
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   223
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   224
     * @throws  java.nio.channels.AlreadyBoundException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   225
     *          If this channel is already bound
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   226
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   227
     * @throws  java.nio.channels.UnsupportedAddressTypeException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   228
     *          If the type of the given address is not supported
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   229
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   230
     * @throws  SecurityException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   231
     *          If a security manager has been installed and its {@link
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   232
     *          java.lang.SecurityManager#checkListen(int) checkListen} method
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   233
     *          denies the operation
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   234
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   235
     * @throws  IOException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   236
     *          If some other I/O error occurs
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   237
     */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   238
    public abstract SctpServerChannel bind(SocketAddress local,
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   239
                                           int backlog)
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   240
        throws IOException;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   241
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   242
    /**
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   243
     * Adds the given address to the bound addresses for the channel's
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   244
     * socket.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   245
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   246
     * <P> The given address must not be the {@link
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   247
     * java.net.InetAddress#isAnyLocalAddress wildcard} address.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   248
     * The channel must be first bound using {@link #bind bind} before
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   249
     * invoking this method, otherwise {@link
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   250
     * java.nio.channels.NotYetBoundException} is thrown. The {@link #bind bind}
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   251
     * method takes a {@code SocketAddress} as its argument which typically
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   252
     * contains a port number as well as an address. Addresses subquently bound
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   253
     * using this method are simply addresses as the SCTP port number remains
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   254
     * the same for the lifetime of the channel.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   255
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   256
     * <P> New associations accepted after this method successfully completes
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   257
     * will be associated with the given address.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   258
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   259
     * @param  address
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   260
     *         The address to add to the bound addresses for the socket
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   261
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   262
     * @return  This channel
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   263
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   264
     * @throws  java.nio.channels.ClosedChannelException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   265
     *          If this channel is closed
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   266
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   267
     * @throws  java.nio.channels.NotYetBoundException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   268
     *          If this channel is not yet bound
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   269
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   270
     * @throws  java.nio.channels.AlreadyBoundException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   271
     *          If this channel is already bound to the given address
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   272
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   273
     * @throws  IllegalArgumentException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   274
     *          If address is {@code null} or the {@link
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   275
     *          java.net.InetAddress#isAnyLocalAddress wildcard} 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  IOException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   278
     *          If some other I/O error occurs
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   279
     */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   280
    public abstract SctpServerChannel bindAddress(InetAddress address)
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
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   283
    /**
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   284
     * Removes the given address from the bound addresses for the channel's
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   285
     * socket.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   286
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   287
     * <P> The given address must not be the {@link
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   288
     * java.net.InetAddress#isAnyLocalAddress wildcard} address.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   289
     * The channel must be first bound using {@link #bind bind} before
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   290
     * invoking this method, otherwise
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   291
     * {@link java.nio.channels.NotYetBoundException} is thrown.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   292
     * If this method is invoked on a channel that does not have
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   293
     * {@code address} as one of its bound addresses, or that has only one
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   294
     * local address bound to it, then this method throws {@link
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   295
     * IllegalUnbindException}.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   296
     * The initial address that the channel's socket is bound to using
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   297
     * {@link #bind bind} may be removed from the bound addresses for the
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   298
     * channel's socket.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   299
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   300
     * <P> New associations accepted after this method successfully completes
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   301
     * will not be associated with the given address.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   302
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   303
     * @param  address
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   304
     *         The address to remove from the bound addresses for the socket
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   305
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   306
     * @return  This channel
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   307
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   308
     * @throws  java.nio.channels.ClosedChannelException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   309
     *          If this channel is closed
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   310
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   311
     * @throws  java.nio.channels.NotYetBoundException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   312
     *          If this channel is not yet bound
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   313
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   314
     * @throws  IllegalArgumentException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   315
     *          If address is {@code null} or the {@link
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   316
     *          java.net.InetAddress#isAnyLocalAddress wildcard} address
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  IllegalUnbindException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   319
     *          If the implementation does not support removing addresses from a
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   320
     *          listening socket, {@code address} is not bound to the channel's
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   321
     *          socket, or the channel has only one address bound to it
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   322
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   323
     * @throws  IOException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   324
     *          If some other I/O error occurs
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   325
     */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   326
    public abstract SctpServerChannel unbindAddress(InetAddress address)
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
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   329
    /**
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   330
     * Returns all of the socket addresses to which this channel's socket is
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   331
     * bound.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   332
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   333
     * @return  All the socket addresses that this channel's socket is
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   334
     *          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
   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
     * @throws  java.nio.channels.ClosedChannelException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   338
     *          If the channel is closed
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   339
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   340
     * @throws  IOException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   341
     *          If an I/O error occurs
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   342
     */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   343
    public abstract Set<SocketAddress> getAllLocalAddresses()
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
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   346
    /**
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   347
     * Returns the value of a socket option.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   348
     *
19835
505b6711e79b 8024508: Fix doclint issues in com.sun.nio.sctp
chegar
parents: 14342
diff changeset
   349
     * @param   <T>
505b6711e79b 8024508: Fix doclint issues in com.sun.nio.sctp
chegar
parents: 14342
diff changeset
   350
     *          The type of the socket option value
505b6711e79b 8024508: Fix doclint issues in com.sun.nio.sctp
chegar
parents: 14342
diff changeset
   351
     *
2542
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   352
     * @param   name
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   353
     *          The socket option
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   354
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   355
     * @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
   356
     *          a valid value for some socket options.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   357
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   358
     * @throws  UnsupportedOperationException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   359
     *          If the socket option is not supported by this channel
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   360
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   361
     * @throws  java.nio.channels.ClosedChannelException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   362
     *          If this channel is closed
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   363
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   364
     * @throws  IOException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   365
     *          If an I/O error occurs
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   366
     *
9679
d98ae8bc45fc 7042979: Rename StandardSocketOption and StandardWatchEventKind
alanb
parents: 5506
diff changeset
   367
     * @see SctpStandardSocketOptions
2542
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   368
     */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   369
    public abstract <T> T getOption(SctpSocketOption<T> name) throws IOException;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   370
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   371
    /**
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   372
     * Sets the value of a socket option.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   373
     *
19835
505b6711e79b 8024508: Fix doclint issues in com.sun.nio.sctp
chegar
parents: 14342
diff changeset
   374
     * @param   <T>
505b6711e79b 8024508: Fix doclint issues in com.sun.nio.sctp
chegar
parents: 14342
diff changeset
   375
     *          The type of the socket option value
505b6711e79b 8024508: Fix doclint issues in com.sun.nio.sctp
chegar
parents: 14342
diff changeset
   376
     *
2542
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   377
     * @param   name
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   378
     *          The socket option
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   379
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   380
     * @param   value
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   381
     *          The value of the socket option. A value of {@code null} may be
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   382
     *          a valid value for some socket options.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   383
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   384
     * @return  This channel
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   385
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   386
     * @throws  UnsupportedOperationException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   387
     *          If the socket option is not supported by this channel
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   388
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   389
     * @throws  IllegalArgumentException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   390
     *          If the value is not a valid value for this socket option
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   391
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   392
     * @throws  java.nio.channels.ClosedChannelException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   393
     *          If this channel is closed
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   394
     *
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
     *          If an I/O error occurs
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   397
     *
9679
d98ae8bc45fc 7042979: Rename StandardSocketOption and StandardWatchEventKind
alanb
parents: 5506
diff changeset
   398
     * @see SctpStandardSocketOptions
2542
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   399
     */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   400
    public abstract <T> SctpServerChannel setOption(SctpSocketOption<T> name,
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   401
                                                    T value)
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   402
        throws IOException;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   403
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   404
    /**
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   405
     * Returns a set of the socket options supported by this channel.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   406
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   407
     * <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
   408
     * channel has been closed.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   409
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   410
     * @return  A set of the socket options supported by this channel
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   411
     */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   412
    public abstract Set<SctpSocketOption<?>> supportedOptions();
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   413
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   414
    /**
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   415
     * Returns an operation set identifying this channel's supported
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   416
     * operations.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   417
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   418
     * <P> SCTP server channels only support the accepting of new
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   419
     * associations, so this method returns
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   420
     * {@link java.nio.channels.SelectionKey#OP_ACCEPT}.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   421
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   422
     * @return  The valid-operation set
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   423
     */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   424
    @Override
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   425
    public final int validOps() {
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   426
        return SelectionKey.OP_ACCEPT;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   427
    }
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   428
}