src/jdk.sctp/share/classes/com/sun/nio/sctp/SctpMultiChannel.java
author erikj
Tue, 12 Sep 2017 19:03:39 +0200
changeset 47216 71c04702a3d5
parent 45882 jdk/src/jdk.sctp/share/classes/com/sun/nio/sctp/SctpMultiChannel.java@341b124f1001
permissions -rw-r--r--
8187443: Forest Consolidation: Move files to unified layout Reviewed-by: darcy, ihse
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.ByteBuffer;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    32
import java.nio.channels.spi.AbstractSelectableChannel;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    33
import java.nio.channels.spi.SelectorProvider;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    34
import java.nio.channels.ClosedChannelException;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    35
import java.nio.channels.NotYetBoundException;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    36
import java.nio.channels.SelectionKey;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    37
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    38
/**
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    39
 * A selectable channel for message-oriented SCTP sockets.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    40
 *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    41
 * <P> An SCTP multi channel supports many associations on a single socket.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    42
 * An {@code SctpMultiChannel} is created by invoking the
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    43
 * {@link #open open} method of this class. A newly-created channel is open but
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    44
 * not yet bound. An attempt to invoke the {@link #receive receive} method of an
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    45
 * unbound channel will cause the {@link NotYetBoundException}
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    46
 * to be thrown. An attempt to invoke the {@link #send send} method of an
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    47
 * unbound channel will cause it to first invoke the {@link #bind bind} method.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    48
 * The address(es) that the channel's socket is bound to can be retrieved by
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    49
 * calling {@link #getAllLocalAddresses getAllLocalAddresses}.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    50
 *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    51
 * <P> Messages may be sent and received without explicitly setting up an
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    52
 * association with the remote peer. The channel will implicitly setup
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    53
 * a new association whenever it sends or receives a message from a remote
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    54
 * peer if there is not already an association with that peer. Upon successful
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    55
 * association setup, an {@link AssociationChangeNotification
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    56
 * association changed} notification will be put to the SCTP stack with its
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    57
 * {@code event} parameter set to {@link
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    58
 * AssociationChangeNotification.AssocChangeEvent#COMM_UP
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    59
 * COMM_UP}. This notification can be received by invoking {@link #receive
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    60
 * receive}.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    61
 *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    62
 * <P> Socket options are configured using the
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    63
 * {@link #setOption(SctpSocketOption,Object,Association) setOption} method. An
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    64
 * {@code SctpMultiChannel} supports the following options:
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    65
 * <blockquote>
45882
341b124f1001 8184304: (sctp) make tables in jdk.sctp module accessible
jjg
parents: 45132
diff changeset
    66
 * <table class="striped">
341b124f1001 8184304: (sctp) make tables in jdk.sctp module accessible
jjg
parents: 45132
diff changeset
    67
 *   <caption style="display:none">Socket options</caption>
341b124f1001 8184304: (sctp) make tables in jdk.sctp module accessible
jjg
parents: 45132
diff changeset
    68
 *   <thead>
2542
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    69
 *   <tr>
45882
341b124f1001 8184304: (sctp) make tables in jdk.sctp module accessible
jjg
parents: 45132
diff changeset
    70
 *     <th scope="col">Option Name</th>
341b124f1001 8184304: (sctp) make tables in jdk.sctp module accessible
jjg
parents: 45132
diff changeset
    71
 *     <th scope="col">Description</th>
2542
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    72
 *   </tr>
45882
341b124f1001 8184304: (sctp) make tables in jdk.sctp module accessible
jjg
parents: 45132
diff changeset
    73
 *   </thead>
341b124f1001 8184304: (sctp) make tables in jdk.sctp module accessible
jjg
parents: 45132
diff changeset
    74
 *   <tbody>
2542
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    75
 *   <tr>
45882
341b124f1001 8184304: (sctp) make tables in jdk.sctp module accessible
jjg
parents: 45132
diff changeset
    76
 *     <th scope="row"> {@link SctpStandardSocketOptions#SCTP_DISABLE_FRAGMENTS
341b124f1001 8184304: (sctp) make tables in jdk.sctp module accessible
jjg
parents: 45132
diff changeset
    77
 *                                          SCTP_DISABLE_FRAGMENTS} </th>
2542
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    78
 *     <td> Enables or disables message fragmentation </td>
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    79
 *   </tr>
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    80
 *   <tr>
45882
341b124f1001 8184304: (sctp) make tables in jdk.sctp module accessible
jjg
parents: 45132
diff changeset
    81
 *     <th scope="row"> {@link SctpStandardSocketOptions#SCTP_EXPLICIT_COMPLETE
341b124f1001 8184304: (sctp) make tables in jdk.sctp module accessible
jjg
parents: 45132
diff changeset
    82
 *                                          SCTP_EXPLICIT_COMPLETE} </th>
2542
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    83
 *     <td> Enables or disables explicit message completion </td>
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    84
 *   </tr>
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    85
 *    <tr>
45882
341b124f1001 8184304: (sctp) make tables in jdk.sctp module accessible
jjg
parents: 45132
diff changeset
    86
 *     <th scope="row"> {@link SctpStandardSocketOptions#SCTP_FRAGMENT_INTERLEAVE
341b124f1001 8184304: (sctp) make tables in jdk.sctp module accessible
jjg
parents: 45132
diff changeset
    87
 *                                          SCTP_FRAGMENT_INTERLEAVE} </th>
2542
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    88
 *     <td> Controls how the presentation of messages occur for the message
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    89
 *          receiver </td>
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    90
 *   </tr>
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    91
 *   <tr>
45882
341b124f1001 8184304: (sctp) make tables in jdk.sctp module accessible
jjg
parents: 45132
diff changeset
    92
 *     <th scope="row"> {@link SctpStandardSocketOptions#SCTP_INIT_MAXSTREAMS
341b124f1001 8184304: (sctp) make tables in jdk.sctp module accessible
jjg
parents: 45132
diff changeset
    93
 *                                          SCTP_INIT_MAXSTREAMS} </th>
2542
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    94
 *     <td> The maximum number of streams requested by the local endpoint during
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    95
 *          association initialization </td>
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    96
 *   </tr>
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    97
 *   <tr>
45882
341b124f1001 8184304: (sctp) make tables in jdk.sctp module accessible
jjg
parents: 45132
diff changeset
    98
 *     <th scope="row"> {@link SctpStandardSocketOptions#SCTP_NODELAY SCTP_NODELAY} </th>
2542
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    99
 *     <td> Enables or disable a Nagle-like algorithm </td>
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   100
 *   </tr>
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   101
 *   <tr>
45882
341b124f1001 8184304: (sctp) make tables in jdk.sctp module accessible
jjg
parents: 45132
diff changeset
   102
 *     <th scope="row"> {@link SctpStandardSocketOptions#SCTP_PRIMARY_ADDR
341b124f1001 8184304: (sctp) make tables in jdk.sctp module accessible
jjg
parents: 45132
diff changeset
   103
 *                                          SCTP_PRIMARY_ADDR} </th>
2542
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   104
 *     <td> Requests that the local SCTP stack use the given peer address as the
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   105
 *          association primary </td>
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   106
 *   </tr>
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   107
 *   <tr>
45882
341b124f1001 8184304: (sctp) make tables in jdk.sctp module accessible
jjg
parents: 45132
diff changeset
   108
 *     <th scope="row"> {@link SctpStandardSocketOptions#SCTP_SET_PEER_PRIMARY_ADDR
341b124f1001 8184304: (sctp) make tables in jdk.sctp module accessible
jjg
parents: 45132
diff changeset
   109
 *                                          SCTP_SET_PEER_PRIMARY_ADDR} </th>
2542
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   110
 *     <td> Requests that the peer mark the enclosed address as the association
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   111
 *          primary </td>
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   112
 *   </tr>
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   113
 *   <tr>
45882
341b124f1001 8184304: (sctp) make tables in jdk.sctp module accessible
jjg
parents: 45132
diff changeset
   114
 *     <th scope="row"> {@link SctpStandardSocketOptions#SO_SNDBUF
341b124f1001 8184304: (sctp) make tables in jdk.sctp module accessible
jjg
parents: 45132
diff changeset
   115
 *                                          SO_SNDBUF} </th>
2542
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   116
 *     <td> The size of the socket send buffer </td>
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   117
 *   </tr>
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   118
 *   <tr>
45882
341b124f1001 8184304: (sctp) make tables in jdk.sctp module accessible
jjg
parents: 45132
diff changeset
   119
 *     <th scope="row"> {@link SctpStandardSocketOptions#SO_RCVBUF
341b124f1001 8184304: (sctp) make tables in jdk.sctp module accessible
jjg
parents: 45132
diff changeset
   120
 *                                          SO_RCVBUF} </th>
2542
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   121
 *     <td> The size of the socket receive buffer </td>
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   122
 *   </tr>
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   123
 *   <tr>
45882
341b124f1001 8184304: (sctp) make tables in jdk.sctp module accessible
jjg
parents: 45132
diff changeset
   124
 *     <th scope="row"> {@link SctpStandardSocketOptions#SO_LINGER
341b124f1001 8184304: (sctp) make tables in jdk.sctp module accessible
jjg
parents: 45132
diff changeset
   125
 *                                          SO_LINGER} </th>
2542
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   126
 *     <td> Linger on close if data is present (when configured in blocking mode
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   127
 *          only) </td>
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   128
 *   </tr>
45882
341b124f1001 8184304: (sctp) make tables in jdk.sctp module accessible
jjg
parents: 45132
diff changeset
   129
 *   </tbody>
2542
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   130
 * </table>
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   131
 * </blockquote>
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   132
 * Additional (implementation specific) options may also be supported. The list
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   133
 * of options supported is obtained by invoking the {@link #supportedOptions()
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   134
 * supportedOptions} method.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   135
 *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   136
 * <p> SCTP multi channels are safe for use by multiple concurrent threads.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   137
 * They support concurrent sending and receiving, though at most one thread may be
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   138
 * sending and at most one thread may be receiving at any given time.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   139
 *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   140
 * @since 1.7
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   141
 */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   142
public abstract class SctpMultiChannel
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   143
    extends AbstractSelectableChannel
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   144
{
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   145
    /**
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   146
     * Initializes a new instance of this class.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   147
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   148
     * @param  provider
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   149
     *         The selector provider for this channel
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   150
     */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   151
    protected SctpMultiChannel(SelectorProvider provider) {
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   152
        super(provider);
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
    /**
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   156
     * Opens an SCTP multi channel.
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> The new channel is unbound.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   159
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   160
     * @return  A new SCTP multi channel
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   161
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   162
     * @throws UnsupportedOperationException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   163
     *         If the SCTP protocol is not supported
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   164
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   165
     * @throws  IOException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   166
     *          If an I/O error occurs
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   167
     */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   168
    public static SctpMultiChannel open() throws
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   169
        IOException {
11823
ee83ae88512d 7041778: Move SCTP implementation out of sun.nio.ch and into its own package
chegar
parents: 9679
diff changeset
   170
        return new sun.nio.ch.sctp.SctpMultiChannelImpl((SelectorProvider)null);
2542
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   171
    }
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   172
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   173
    /**
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   174
     * Returns the open associations on this channel's socket.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   175
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   176
     * <P> Only associations whose {@link AssociationChangeNotification.AssocChangeEvent#COMM_UP
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   177
     * COMM_UP} association change event has been received are included
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   178
     * in the returned set of associations. Associations for which a
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   179
     * {@link AssociationChangeNotification.AssocChangeEvent#COMM_LOST COMM_LOST} or {@link
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   180
     * AssociationChangeNotification.AssocChangeEvent#SHUTDOWN SHUTDOWN} association change
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   181
     * event have been receive are removed from the set of associations.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   182
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   183
     * <P> The returned set of associations is a snapshot of the open
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   184
     * associations at the time that this method is invoked.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   185
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   186
     * @return  A {@code Set} containing the open associations, or an empty
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   187
     *          {@code Set} if there are none.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   188
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   189
     * @throws  ClosedChannelException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   190
     *          If this channel is closed
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   191
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   192
     * @throws  IOException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   193
     *          If some other I/O error occurs
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   194
     */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   195
    public abstract Set<Association> associations()
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   196
        throws IOException;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   197
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   198
    /**
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   199
     * Binds the channel's socket to a local address and configures the socket
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   200
     * to listen for connections.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   201
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   202
     * <P> This method is used to establish a relationship between the socket
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   203
     * and the local address. Once a relationship is established then
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   204
     * the socket remains bound until the channel is closed. This relationship
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   205
     * may not necesssarily be with the address {@code local} as it may be removed
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   206
     * by {@link #unbindAddress unbindAddress}, but there will always be at least one local
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   207
     * address bound to the channel's socket once an invocation of this method
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   208
     * successfully completes.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   209
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   210
     * <P> Once the channel's socket has been successfully bound to a specific
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   211
     * address, that is not automatically assigned, more addresses
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   212
     * may be bound to it using {@link #bindAddress bindAddress}, or removed
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   213
     * using {@link #unbindAddress unbindAddress}.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   214
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   215
     * <P> The backlog parameter is the maximum number of pending connections on
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   216
     * the socket. Its exact semantics are implementation specific. An implementation
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   217
     * may impose an implementation specific maximum length or may choose to ignore
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   218
     * the parameter. If the backlog parameter has the value {@code 0}, or a negative
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   219
     * value, then an implementation specific default is used.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   220
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   221
     * @param  local
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   222
     *         The local address to bind the socket, or {@code null} to
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   223
     *         bind the socket to an automatically assigned socket address
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   224
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   225
     * @param  backlog
28059
e576535359cc 8067377: My hobby: caning, then then canning, the the can-can
martin
parents: 25859
diff changeset
   226
     *         The maximum number of pending connections
2542
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   227
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   228
     * @return  This channel
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  ClosedChannelException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   231
     *          If this channel is closed
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   232
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   233
     * @throws  java.nio.channels.AlreadyBoundException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   234
     *          If this channel is already bound
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   235
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   236
     * @throws  java.nio.channels.UnsupportedAddressTypeException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   237
     *          If the type of the given address is not supported
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  SecurityException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   240
     *          If a security manager has been installed and its {@link
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   241
     *          java.lang.SecurityManager#checkListen(int) checkListen} method
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   242
     *          denies the operation
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   243
     *
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
     *          If some other I/O error occurs
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   246
     */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   247
    public abstract SctpMultiChannel bind(SocketAddress local,
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   248
                                          int backlog)
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   249
        throws IOException;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   250
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   251
    /**
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   252
     * Binds the channel's socket to a local address and configures the socket
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   253
     * to listen for connections.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   254
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   255
     * <P> This method works as if invoking it were equivalent to evaluating the
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   256
     * expression:
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   257
     * <blockquote><pre>
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   258
     * bind(local, 0);
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   259
     * </pre></blockquote>
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   260
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   261
     * @param  local
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   262
     *         The local address to bind the socket, or {@code null} to
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   263
     *         bind the socket to an automatically assigned socket address
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   264
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   265
     * @return  This channel
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  ClosedChannelException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   268
     *          If this channel is closed
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
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  java.nio.channels.UnsupportedAddressTypeException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   274
     *          If the type of the given address is not supported
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   275
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   276
     * @throws  SecurityException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   277
     *          If a security manager has been installed and its {@link
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   278
     *          java.lang.SecurityManager#checkListen(int) checkListen} method
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   279
     *          denies the operation
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 final SctpMultiChannel bind(SocketAddress local)
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
        return bind(local, 0);
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   287
    }
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   288
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   289
    /**
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   290
     * Adds the given address to the bound addresses for the channel's
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   291
     * socket.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   292
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   293
     * <P> The given address must not be the {@link
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   294
     * java.net.InetAddress#isAnyLocalAddress wildcard} address.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   295
     * The channel must be first bound using {@link #bind bind} before
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   296
     * invoking this method, otherwise {@link NotYetBoundException} is thrown.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   297
     * The {@link #bind bind} method takes a {@code SocketAddress} as its
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   298
     * argument which typically contains a port number as well as an address.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   299
     * Addresses subquently bound using this method are simply addresses as the
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   300
     * SCTP port number remains the same for the lifetime of the channel.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   301
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   302
     * <P> New associations setup after this method successfully completes
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   303
     * will be associated with the given address. Adding addresses to existing
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   304
     * associations is optional functionality. If the endpoint supports
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   305
     * dynamic address reconfiguration then it may send the appropriate message
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   306
     * to the peer to change the peers address lists.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   307
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   308
     * @param  address
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   309
     *         The address to add to the bound addresses for the socket
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   310
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   311
     * @return  This channel
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   312
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   313
     * @throws  ClosedChannelException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   314
     *          If this channel is closed
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   315
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   316
     * @throws  NotYetBoundException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   317
     *          If this channel is not yet bound
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   318
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   319
     * @throws  java.nio.channels.AlreadyBoundException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   320
     *          If this channel is already bound to the given 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  IllegalArgumentException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   323
     *          If address is {@code null} or the {@link
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   324
     *          java.net.InetAddress#isAnyLocalAddress wildcard} address
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   325
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   326
     * @throws  IOException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   327
     *          If some other I/O error occurs
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   328
     */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   329
    public abstract SctpMultiChannel bindAddress(InetAddress address)
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   330
         throws IOException;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   331
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   332
    /**
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   333
     * Removes the given address from the bound addresses for the channel's
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   334
     * socket.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   335
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   336
     * <P> The given address must not be the {@link
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   337
     * java.net.InetAddress#isAnyLocalAddress wildcard} address.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   338
     * The channel must be first bound using {@link #bind bind} before
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   339
     * invoking this method, otherwise {@link NotYetBoundException} is thrown.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   340
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   341
     * <P> If this method is invoked on a channel that does
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   342
     * not have {@code address} as one of its bound addresses, or that has only
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   343
     * one local address bound to it, then this method throws
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   344
     * {@link IllegalUnbindException}.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   345
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   346
     * <P> The initial address that the channel's socket is bound to using
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   347
     * {@link #bind bind} may be removed from the bound addresses for the
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   348
     * channel's socket.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   349
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   350
     * <P> New associations setup after this method successfully completes
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   351
     * will not be associated with the given address. Removing addresses from
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   352
     * existing associations is optional functionality. If the endpoint supports
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   353
     * dynamic address reconfiguration then it may send the appropriate message
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   354
     * to the peer to change the peers address lists.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   355
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   356
     * @param  address
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   357
     *         The address to remove from the bound addresses for the socket
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  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  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  NotYetBoundException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   365
     *          If this channel is not yet bound
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   366
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   367
     * @throws  IllegalUnbindException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   368
     *          {@code address} is not bound to the channel's socket, or the
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   369
     *          channel has only one address  bound to it
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   370
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   371
     * @throws  IllegalArgumentException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   372
     *          If address is {@code null} or the {@link
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   373
     *          java.net.InetAddress#isAnyLocalAddress wildcard} address
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   374
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   375
     * @throws  IOException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   376
     *          If some other I/O error occurs
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   377
     */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   378
    public abstract SctpMultiChannel unbindAddress(InetAddress address)
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   379
         throws IOException;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   380
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   381
    /**
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   382
     * Returns all of the socket addresses to which this channel's socket is
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   383
     * bound.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   384
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   385
     * @return  All the socket addresses that this channel's socket is
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   386
     *          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
   387
     *          bound
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  ClosedChannelException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   390
     *          If the channel is closed
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  IOException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   393
     *          If an I/O error occurs
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   394
     */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   395
    public abstract Set<SocketAddress> getAllLocalAddresses()
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   396
        throws IOException;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   397
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   398
    /**
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   399
     * Returns all of the remote addresses to which the given association on
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   400
     * this channel's socket is connected.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   401
     *
19835
505b6711e79b 8024508: Fix doclint issues in com.sun.nio.sctp
chegar
parents: 14342
diff changeset
   402
     * @param  association
505b6711e79b 8024508: Fix doclint issues in com.sun.nio.sctp
chegar
parents: 14342
diff changeset
   403
     *         The association
505b6711e79b 8024508: Fix doclint issues in com.sun.nio.sctp
chegar
parents: 14342
diff changeset
   404
     *
2542
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   405
     * @return  All of the remote addresses for the given association, or
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   406
     *          an empty {@code Set} if the association has been shutdown
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   407
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   408
     * @throws  ClosedChannelException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   409
     *          If the channel is closed
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   410
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   411
     * @throws  IOException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   412
     *          If an I/O error occurs
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   413
     */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   414
    public abstract Set<SocketAddress> getRemoteAddresses(Association association)
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   415
        throws IOException;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   416
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   417
    /**
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   418
     * Shutdown an association without closing the channel.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   419
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   420
     * @param  association
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   421
     *         The association to shutdown
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   422
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   423
     * @return  This channel
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   424
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   425
     * @throws  ClosedChannelException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   426
     *          If this channel is closed
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   427
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   428
     * @throws  IOException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   429
     *          If some other I/O error occurs
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   430
     */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   431
    public abstract SctpMultiChannel shutdown(Association association)
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   432
            throws IOException;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   433
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   434
    /**
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   435
     * Returns the value of a socket option.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   436
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   437
     * <P> Note that some options are retrieved on the channel's socket,
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   438
     * therefore the {@code association} parameter is not applicable and will be
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   439
     * ignored if given. However, if the option is association specific then the
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   440
     * association must be given.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   441
     *
19835
505b6711e79b 8024508: Fix doclint issues in com.sun.nio.sctp
chegar
parents: 14342
diff changeset
   442
     * @param  <T>
505b6711e79b 8024508: Fix doclint issues in com.sun.nio.sctp
chegar
parents: 14342
diff changeset
   443
     *         The type of the socket option value
505b6711e79b 8024508: Fix doclint issues in com.sun.nio.sctp
chegar
parents: 14342
diff changeset
   444
     *
2542
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   445
     * @param  name
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   446
     *         The socket option
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   447
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   448
     * @param  association
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   449
     *         The association whose option should be retrieved, or {@code null}
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   450
     *         if this option should be retrieved at the channel's socket level.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   451
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   452
     * @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
   453
     *          a valid value for some socket options.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   454
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   455
     * @throws  UnsupportedOperationException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   456
     *          If the socket option is not supported by this channel
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   457
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   458
     * @throws  ClosedChannelException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   459
     *          If this channel is closed
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   460
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   461
     * @throws  IOException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   462
     *          If an I/O error occurs
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   463
     *
9679
d98ae8bc45fc 7042979: Rename StandardSocketOption and StandardWatchEventKind
alanb
parents: 5506
diff changeset
   464
     * @see SctpStandardSocketOptions
2542
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   465
     */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   466
    public abstract <T> T getOption(SctpSocketOption<T> name,
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   467
                                    Association association)
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   468
        throws IOException;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   469
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   470
    /**
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   471
     * Sets the value of a socket option.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   472
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   473
     * <P> Note that some options are retrieved on the channel's socket,
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   474
     * therefore the {@code association} parameter is not applicable and will be
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   475
     * ignored if given. However, if the option is association specific then the
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   476
     * association must be given.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   477
     *
19835
505b6711e79b 8024508: Fix doclint issues in com.sun.nio.sctp
chegar
parents: 14342
diff changeset
   478
     * @param   <T>
505b6711e79b 8024508: Fix doclint issues in com.sun.nio.sctp
chegar
parents: 14342
diff changeset
   479
     *          The type of the socket option value
505b6711e79b 8024508: Fix doclint issues in com.sun.nio.sctp
chegar
parents: 14342
diff changeset
   480
     *
2542
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   481
     * @param   name
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   482
     *          The socket option
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   483
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   484
     * @param  association
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   485
     *         The association whose option should be set, or {@code null}
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   486
     *         if this option should be set at the channel's socket level.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   487
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   488
     * @param   value
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   489
     *          The value of the socket option. A value of {@code null} may be
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   490
     *          a valid value for some socket options.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   491
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   492
     * @return  This channel
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   493
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   494
     * @throws  UnsupportedOperationException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   495
     *          If the socket option is not supported by this channel
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   496
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   497
     * @throws  IllegalArgumentException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   498
     *          If the value is not a valid value for this socket option
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   499
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   500
     * @throws  ClosedChannelException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   501
     *          If this channel is closed
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   502
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   503
     * @throws  IOException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   504
     *          If an I/O error occurs
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   505
     *
9679
d98ae8bc45fc 7042979: Rename StandardSocketOption and StandardWatchEventKind
alanb
parents: 5506
diff changeset
   506
     * @see SctpStandardSocketOptions
2542
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   507
     */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   508
    public abstract <T> SctpMultiChannel setOption(SctpSocketOption<T> name,
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   509
                                                   T value,
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   510
                                                   Association association)
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   511
         throws IOException;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   512
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   513
     /**
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   514
     * Returns a set of the socket options supported by this channel.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   515
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   516
     * <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
   517
     * channel has been closed.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   518
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   519
     * @return  A set of the socket options supported by this channel
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   520
     */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   521
    public abstract Set<SctpSocketOption<?>> supportedOptions();
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   522
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   523
    /**
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   524
     * Returns an operation set identifying this channel's supported operations.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   525
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   526
     * <P> SCTP multi channels support reading, and writing, so this
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   527
     * method returns
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   528
     * {@code (}{@link SelectionKey#OP_READ} {@code |}&nbsp;{@link
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   529
     * SelectionKey#OP_WRITE}{@code )}.  </p>
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   530
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   531
     * @return  The valid-operation set
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   532
     */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   533
    @Override
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   534
    public final int validOps() {
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   535
        return (SelectionKey.OP_READ |
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   536
                SelectionKey.OP_WRITE );
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   537
    }
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   538
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   539
    /**
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   540
     * Receives a message and/or handles a notification via this channel.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   541
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   542
     * <P> If a message or notification is immediately available, or if this
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   543
     * channel is in blocking mode and one eventually becomes available, then
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   544
     * the message or notification is returned or handled, respectively. If this
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   545
     * channel is in non-blocking mode and a message or notification is not
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   546
     * immediately available then this method immediately returns {@code null}.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   547
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   548
     * <P> If this method receives a message it is copied into the given byte
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   549
     * buffer and an {@link MessageInfo} is returned.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   550
     * The message is transferred into the given byte buffer starting at its
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   551
     * current position and the buffers position is incremented by the number of
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   552
     * bytes read. If there are fewer bytes remaining in the buffer than are
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   553
     * required to hold the message, or the underlying input buffer does not
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   554
     * contain the complete message, then an invocation of {@link
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   555
     * MessageInfo#isComplete isComplete} on the returned {@code
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   556
     * MessageInfo} will return {@code false}, and more invocations of this
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   557
     * method will be necessary to completely consume the messgae. Only
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   558
     * one message at a time will be partially delivered in any stream. The
9679
d98ae8bc45fc 7042979: Rename StandardSocketOption and StandardWatchEventKind
alanb
parents: 5506
diff changeset
   559
     * socket option {@link SctpStandardSocketOptions#SCTP_FRAGMENT_INTERLEAVE
2542
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   560
     * SCTP_FRAGMENT_INTERLEAVE} controls various aspects of what interlacing of
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   561
     * messages occurs.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   562
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   563
     * <P> If this method receives a notification then the appropriate method of
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   564
     * the given handler, if there is one, is invoked. If the handler returns {@link
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   565
     * HandlerResult#CONTINUE CONTINUE} then this method will try to receive another
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   566
     * message/notification, otherwise, if {@link HandlerResult#RETURN RETURN} is returned
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   567
     * this method will return {@code null}. If an uncaught exception is thrown by the
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   568
     * handler it will be propagated up the stack through this method.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   569
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   570
     * <P> If a security manager has been installed then for each new association
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   571
     * setup this method verifies that the associations source address and port
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   572
     * number are permitted by the security manager's {@link
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   573
     * java.lang.SecurityManager#checkAccept(String,int) checkAccept} method.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   574
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   575
     * <P> This method may be invoked at any time. If another thread has
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   576
     * already initiated a receive operation upon this channel, then an
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   577
     * invocation of this method will block until the first operation is
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   578
     * complete. The given handler is invoked without holding any locks used
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   579
     * to enforce the above synchronization policy, that way handlers
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   580
     * will not stall other threads from receiving. A handler should not invoke
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   581
     * the {@code receive} method of this channel, if it does an
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   582
     * {@link IllegalReceiveException} will be thrown.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   583
     *
19835
505b6711e79b 8024508: Fix doclint issues in com.sun.nio.sctp
chegar
parents: 14342
diff changeset
   584
     * @param  <T>
505b6711e79b 8024508: Fix doclint issues in com.sun.nio.sctp
chegar
parents: 14342
diff changeset
   585
     *         The type of the attachment
505b6711e79b 8024508: Fix doclint issues in com.sun.nio.sctp
chegar
parents: 14342
diff changeset
   586
     *
2542
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   587
     * @param  buffer
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   588
     *         The buffer into which bytes are to be transferred
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   589
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   590
     * @param  attachment
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   591
     *         The object to attach to the receive operation; can be
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   592
     *         {@code null}
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   593
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   594
     * @param  handler
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   595
     *         A handler to handle notifications from the SCTP stack, or
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   596
     *         {@code null} to ignore any notifications.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   597
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   598
     * @return  The {@code MessageInfo}, {@code null} if this channel is in
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   599
     *          non-blocking mode and no messages are immediately available or
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   600
     *          the notification handler returns {@code RETURN} after handling
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   601
     *          a notification
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   602
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   603
     * @throws  java.nio.channels.ClosedChannelException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   604
     *          If this channel is closed
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   605
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   606
     * @throws  java.nio.channels.AsynchronousCloseException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   607
     *          If another thread closes this channel
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   608
     *          while the read operation is in progress
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   609
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   610
     * @throws  java.nio.channels.ClosedByInterruptException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   611
     *          If another thread interrupts the current thread
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   612
     *          while the read operation is in progress, thereby
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   613
     *          closing the channel and setting the current thread's
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   614
     *          interrupt status
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   615
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   616
     * @throws  NotYetBoundException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   617
     *          If this channel is not yet bound
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   618
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   619
     * @throws  IllegalReceiveException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   620
     *          If the given handler invokes the {@code receive} method of this
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   621
     *          channel
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   622
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   623
     * @throws  SecurityException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   624
     *          If a security manager has been installed and it does not permit
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   625
     *          new associations to be accepted from the message's sender
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   626
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   627
     * @throws  IOException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   628
     *          If some other I/O error occurs
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   629
     */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   630
    public abstract <T> MessageInfo receive(ByteBuffer buffer,
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   631
                                            T attachment,
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   632
                                            NotificationHandler<T> handler)
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   633
        throws IOException;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   634
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   635
    /**
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   636
     * Sends a message via this channel.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   637
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   638
     * <P> If this channel is unbound then this method will invoke {@link
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   639
     * #bind(SocketAddress, int) bind(null, 0)} before sending any data.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   640
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   641
     * <P> If there is no association existing between this channel's socket
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   642
     * and the intended receiver, identified by the address in the given messageInfo, then one
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   643
     * will be automatically setup to the intended receiver. This is considered
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   644
     * to be Implicit Association Setup. Upon successful association setup, an
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   645
     * {@link AssociationChangeNotification association changed}
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   646
     * notification will be put to the SCTP stack with its {@code event} parameter set
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   647
     * to {@link AssociationChangeNotification.AssocChangeEvent#COMM_UP COMM_UP}
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   648
     * . This notification can be received by invoking {@link #receive
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   649
     * receive}.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   650
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   651
     * <P> If this channel is in blocking mode, there is sufficient room in the
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   652
     * underlying output buffer, then the remaining bytes in the given byte
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   653
     * buffer are transmitted as a single message. Sending a message
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   654
     * is atomic unless explicit message completion {@link
9679
d98ae8bc45fc 7042979: Rename StandardSocketOption and StandardWatchEventKind
alanb
parents: 5506
diff changeset
   655
     * SctpStandardSocketOptions#SCTP_EXPLICIT_COMPLETE SCTP_EXPLICIT_COMPLETE}
2542
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   656
     * socket option is enabled on this channel's socket.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   657
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   658
     * <P> If this channel is in non-blocking mode, there is sufficient room
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   659
     * in the underlying output buffer, and an implicit association setup is
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   660
     * required, then the remaining bytes in the given byte buffer are
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   661
     * transmitted as a single message, subject to {@link
9679
d98ae8bc45fc 7042979: Rename StandardSocketOption and StandardWatchEventKind
alanb
parents: 5506
diff changeset
   662
     * SctpStandardSocketOptions#SCTP_EXPLICIT_COMPLETE SCTP_EXPLICIT_COMPLETE}.
2542
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   663
     * If for any reason the message cannot
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   664
     * be delivered an {@link AssociationChangeNotification association
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   665
     * changed} notification is put on the SCTP stack with its {@code event} parameter set
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   666
     * to {@link AssociationChangeNotification.AssocChangeEvent#CANT_START CANT_START}.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   667
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   668
     * <P> The message is transferred from the byte buffer as if by a regular
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   669
     * {@link java.nio.channels.WritableByteChannel#write(java.nio.ByteBuffer)
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   670
     * write} operation.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   671
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   672
     * <P> If a security manager has been installed then for each new association
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   673
     * setup this method verifies that the given remote peers address and port
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   674
     * number are permitted by the security manager's {@link
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   675
     * java.lang.SecurityManager#checkConnect(String,int) checkConnect} method.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   676
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   677
     * <P> This method may be invoked at any time. If another thread has already
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   678
     * initiated a send operation upon this channel, then an invocation of
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   679
     * this method will block until the first operation is complete.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   680
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   681
     * @param  buffer
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   682
     *         The buffer containing the message to be sent
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   683
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   684
     * @param  messageInfo
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   685
     *         Ancillary data about the message to be sent
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   686
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   687
     * @return  The number of bytes sent, which will be either the number of
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   688
     *          bytes that were remaining in the messages buffer when this method
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   689
     *          was invoked or, if this channel is non-blocking, may be zero if
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   690
     *          there was insufficient room for the message in the underlying
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   691
     *          output buffer
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   692
     *
19835
505b6711e79b 8024508: Fix doclint issues in com.sun.nio.sctp
chegar
parents: 14342
diff changeset
   693
     * @throws  InvalidStreamException
2542
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   694
     *          If {@code streamNumber} is negative, or if an association already
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   695
     *          exists and {@code streamNumber} is greater than the maximum number
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   696
     *          of outgoing streams
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   697
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   698
     * @throws  java.nio.channels.ClosedChannelException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   699
     *          If this channel is closed
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   700
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   701
     * @throws  java.nio.channels.AsynchronousCloseException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   702
     *          If another thread closes this channel
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   703
     *          while the read operation is in progress
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   704
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   705
     * @throws  java.nio.channels.ClosedByInterruptException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   706
     *          If another thread interrupts the current thread
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   707
     *          while the read operation is in progress, thereby
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   708
     *          closing the channel and setting the current thread's
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   709
     *          interrupt status
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   710
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   711
     * @throws  SecurityException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   712
     *          If a security manager has been installed and it does not permit
28059
e576535359cc 8067377: My hobby: caning, then then canning, the the can-can
martin
parents: 25859
diff changeset
   713
     *          new associations to be setup with the messages's address
2542
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   714
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   715
     * @throws  IOException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   716
     *          If some other I/O error occurs
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   717
     */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   718
    public abstract int send(ByteBuffer buffer, MessageInfo messageInfo)
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   719
        throws IOException;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   720
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   721
    /**
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   722
     * Branches off an association.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   723
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   724
     * <P> An application can invoke this method to branch off an association
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   725
     * into a separate channel. The new bound and connected {@link SctpChannel}
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   726
     * will be created for the association. The branched off association will no
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   727
     * longer be part of this channel.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   728
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   729
     * <P> This is particularly useful when, for instance, the application
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   730
     * wishes to have a number of sporadic message senders/receivers remain
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   731
     * under the original SCTP multi channel but branch off those
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   732
     * associations carrying high volume data traffic into their own
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   733
     * separate SCTP channels.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   734
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   735
     * @param  association
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   736
     *         The association to branch off
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   737
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   738
     * @return  The {@code SctpChannel}
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   739
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   740
     * @throws  java.nio.channels.ClosedChannelException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   741
     *          If this channel is closed
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   742
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   743
     * @throws  IOException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   744
     *          If some other I/O error occurs
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   745
     */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   746
    public abstract SctpChannel branch(Association association)
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   747
        throws IOException;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   748
}