jdk/src/share/classes/com/sun/nio/sctp/MessageInfo.java
author alanb
Mon, 09 May 2011 18:45:33 +0100
changeset 9679 d98ae8bc45fc
parent 5506 202f599c92aa
child 11823 ee83ae88512d
permissions -rw-r--r--
7042979: Rename StandardSocketOption and StandardWatchEventKind Reviewed-by: forax, chegar
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2542
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
     1
/*
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2542
diff changeset
     2
 * Copyright (c) 2009, 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
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    29
/**
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    30
 * The {@code MessageInfo} class provides additional ancillary information about
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    31
 * messages.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    32
 *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    33
 * <P> Received SCTP messages, returned by
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    34
 * {@link SctpChannel#receive SctpChannel.receive} and {@link
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    35
 * SctpMultiChannel#receive SctpMultiChannel.receive},
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    36
 * return a {@code MessageInfo} instance that can be queried to determine
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    37
 * ancillary information about the received message. Messages being sent should
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    38
 * use one of the {@link #createOutgoing(java.net.SocketAddress,int)
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    39
 * createOutgoing} methods to provide ancillary data for the message being
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    40
 * sent, and may use the appropriate setter methods to override the default
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    41
 * values provided for {@link #isUnordered() unordered}, {@link #timeToLive()
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    42
 * timeToLive}, {@link #isComplete() complete} and {@link #payloadProtocolID()
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    43
 * payloadProtocolID}, before sending the message.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    44
 *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    45
 * <P> For out going messages the {@code timeToLive} parameter is a time period
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    46
 * that the sending side SCTP stack may expire the message if it has not been
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    47
 * sent. This time period is an indication to the stack that the message is no
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    48
 * longer required to be sent after the time period expires. It is not a hard
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    49
 * timeout and may be influenced by whether the association supports the partial
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    50
 * reliability extension, <a href=http://www.ietf.org/rfc/rfc3758.txt>RFC 3758
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    51
 * <a>
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    52
 *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    53
 * <P> {@code MessageInfo} instances are not safe for use by multiple concurrent
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    54
 * threads. If a MessageInfo is to be used by more than one thread then access
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    55
 * to the MessageInfo should be controlled by appropriate synchronization.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    56
 *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    57
 * @since 1.7
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    58
 */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    59
public abstract class MessageInfo {
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    60
    /**
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    61
     * Initializes a new instance of this class.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    62
     */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    63
    protected MessageInfo() {}
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    64
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    65
    /**
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    66
     * Creates a {@code MessageInfo} instance suitable for use when
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    67
     * sending a message.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    68
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    69
     * <P> The returned instance will have its {@link #isUnordered() unordered}
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    70
     * value set to {@code false}, its {@link #timeToLive() timeToLive} value
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    71
     * set to {@code 0}, its {@link #isComplete() complete} value set
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    72
     * to {@code true}, and its {@link #payloadProtocolID() payloadProtocolID}
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    73
     * value set to {@code 0}. These values, if required, can be set through
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    74
     * the appropriate setter method before sending the message.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    75
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    76
     * @param  address
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    77
     *         For a connected {@code SctpChannel} the address is the
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    78
     *         preferred peer address of the association to send the message
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    79
     *         to, or {@code null} to use the peer primary address. For an
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    80
     *         {@code SctpMultiChannel} the address is used to determine
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    81
     *         the association, or if no association exists with a peer of that
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    82
     *         address then one is setup.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    83
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    84
     * @param  streamNumber
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    85
     *         The stream number that the message will be sent on
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    86
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    87
     * @return  The outgoing message info
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    88
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    89
     * @throws  IllegalArgumentException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    90
     *          If the streamNumber is negative or greater than {@code 65536}
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    91
     */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    92
    public static MessageInfo createOutgoing(SocketAddress address,
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    93
                                             int streamNumber) {
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    94
        if (streamNumber < 0 || streamNumber > 65536)
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    95
            throw new IllegalArgumentException("Invalid stream number");
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    96
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    97
        return new sun.nio.ch.SctpMessageInfoImpl(null, address, streamNumber);
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    98
    }
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    99
    /**
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   100
     * Creates a {@code MessageInfo} instance suitable for use when
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   101
     * sending a message to a given association. Typically used for
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   102
     * {@code SctpMultiChannel} when an association has already been setup.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   103
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   104
     * <P> The returned instance will have its {@link #isUnordered() unordered}
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   105
     * value set to {@code false}, its {@link #timeToLive() timeToLive} value
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   106
     * set to {@code 0}, its {@link #isComplete() complete} value set
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   107
     * to {@code true}, and its {@link #payloadProtocolID() payloadProtocolID}
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   108
     * value set to {@code 0}. These values, if required, can be set through
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   109
     * the appropriate setter method before sending the message.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   110
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   111
     * @param  association
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   112
     *         The association to send the message on
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   113
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   114
     * @param  address
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   115
     *         The preferred peer address of the association to send the message
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   116
     *         to, or {@code null} to use the peer primary address
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   117
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   118
     * @param  streamNumber
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   119
     *         The stream number that the message will be sent on.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   120
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   121
     * @return  The outgoing message info
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   122
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   123
     * @throws  IllegalArgumentException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   124
     *          If {@code association} is {@code null}, or the streamNumber is
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   125
     *          negative or greater than {@code 65536}
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   126
     */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   127
    public static MessageInfo createOutgoing(Association association,
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   128
                                             SocketAddress address,
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   129
                                             int streamNumber) {
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   130
        if (association == null)
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   131
            throw new IllegalArgumentException("association cannot be null");
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   132
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   133
        if (streamNumber < 0 || streamNumber > 65536)
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   134
            throw new IllegalArgumentException("Invalid stream number");
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   135
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   136
        return new sun.nio.ch.SctpMessageInfoImpl(association, address,
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   137
                streamNumber);
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   138
    }
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   139
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   140
    /**
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   141
     * Returns the source socket address if the message has been received,
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   142
     * otherwise the preferred destination of the message to be sent.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   143
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   144
     * @return  The socket address, or {@code null} if this instance is to be
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   145
     *          used for sending a message and has been construced without
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   146
     *          specifying a preferred destination address
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   147
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   148
     */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   149
    public abstract SocketAddress address();
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   150
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   151
    /**
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   152
     * Returns the association that the message was received on, if the message
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   153
     * has been received, otherwise the association that the message is to be
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   154
     * sent on.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   155
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   156
     * @return The association, or {@code null} if this instance is to be
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   157
     *         used for sending a message and has been construced using the
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   158
     *         the {@link #createOutgoing(SocketAddress,int)
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   159
     *         createOutgoing(SocketAddress,int)} static factory method
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   160
     */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   161
    public abstract Association association();
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   162
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   163
    /**
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   164
     * Returns the number of bytes read for the received message.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   165
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   166
     * <P> This method is only appicable for received messages, it has no
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   167
     * meaning for messages being sent.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   168
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   169
     * @return  The number of bytes read, {@code -1} if the channel is an {@link
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   170
     *          SctpChannel} that has reached end-of-stream, otherwise
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   171
     *          {@code 0}
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   172
     */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   173
    public abstract int bytes();
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   174
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   175
    /**
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   176
     * Tells whether or not the message is complete.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   177
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   178
     * <P> For received messages {@code true} indicates that the message was
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   179
     * completely received. For messages being sent {@code true} indicates that
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   180
     * the message is complete, {@code false} indicates that the message is not
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   181
     * complete. How the send channel interprets this value depends on the value
9679
d98ae8bc45fc 7042979: Rename StandardSocketOption and StandardWatchEventKind
alanb
parents: 5506
diff changeset
   182
     * of its {@link SctpStandardSocketOptions#SCTP_EXPLICIT_COMPLETE
2542
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   183
     * SCTP_EXPLICIT_COMPLETE} socket option.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   184
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   185
     * @return  {@code true} if, and only if, the message is complete
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   186
     */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   187
    public abstract boolean isComplete();
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   188
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   189
    /**
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   190
     * Sets whether or not the message is complete.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   191
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   192
     * <P> For messages being sent {@code true} indicates that
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   193
     * the message is complete, {@code false} indicates that the message is not
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   194
     * complete. How the send channel interprets this value depends on the value
9679
d98ae8bc45fc 7042979: Rename StandardSocketOption and StandardWatchEventKind
alanb
parents: 5506
diff changeset
   195
     * of its {@link SctpStandardSocketOptions#SCTP_EXPLICIT_COMPLETE
2542
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   196
     * SCTP_EXPLICIT_COMPLETE} socket option.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   197
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   198
     * @param  complete
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   199
     *         {@code true} if, and only if, the message is complete
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   200
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   201
     * @return  This MessageInfo
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   202
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   203
     * @see  MessageInfo#isComplete()
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   204
     */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   205
    public abstract MessageInfo complete(boolean complete);
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   206
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   207
    /**
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   208
     * Tells whether or not the message is unordered. For received messages
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   209
     * {@code true} indicates that the message was sent non-ordered. For
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   210
     * messages being sent {@code true} requests the un-ordered delivery of the
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   211
     * message, {@code false} indicates that the message is ordered.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   212
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   213
     * @return  {@code true} if the message is unordered, otherwise
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   214
     *          {@code false}
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   215
     */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   216
    public abstract boolean isUnordered();
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   217
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   218
    /**
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   219
     * Sets whether or not the message is unordered.
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  unordered
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   222
     *         {@code true} requests the un-ordered delivery of the message,
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   223
     *         {@code false} indicates that the message is ordered.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   224
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   225
     * @return  This MessageInfo
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   226
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   227
     * @see  MessageInfo#isUnordered()
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   228
     */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   229
    public abstract MessageInfo unordered(boolean unordered);
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   230
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   231
    /**
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   232
     * Returns the payload protocol Identifier.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   233
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   234
     * <P> A value indicating the type of payload protocol data being
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   235
     * transmitted/received. This value is passed as opaque data by SCTP.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   236
     * {@code 0} indicates an unspecified payload protocol identifier.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   237
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   238
     * @return  The Payload Protocol Identifier
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   239
     */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   240
    public abstract int payloadProtocolID();
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   241
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   242
    /**
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   243
     * Sets the payload protocol Identifier.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   244
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   245
     * <P> A value indicating the type of payload protocol data being
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   246
     * transmitted. This value is passed as opaque data by SCTP.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   247
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   248
     * @param  ppid
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   249
     *         The Payload Protocol Identifier, or {@code 0} indicate an
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   250
     *         unspecified payload protocol identifier.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   251
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   252
     * @return  This MessageInfo
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   253
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   254
     * @see  MessageInfo#payloadProtocolID()
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   255
     */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   256
    public abstract MessageInfo payloadProtocolID(int ppid);
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   257
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   258
    /**
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   259
     * Returns the stream number that the message was received on, if the
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   260
     * message has been received, otherwise the stream number that the message
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   261
     * is to be sent on.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   262
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   263
     * @return  The stream number
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   264
     */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   265
    public abstract int streamNumber();
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   266
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   267
    /**
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   268
     * Sets the stream number that the message is to be sent on.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   269
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   270
     * @param  streamNumber
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   271
     *         The stream number
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   272
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   273
     * @throws  IllegalArgumentException
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   274
     *          If the streamNumber is negative or greater than {@code 65536}
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   275
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   276
     * @return  This MessageInfo
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   277
     */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   278
    public abstract MessageInfo streamNumber(int streamNumber);
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   279
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   280
    /**
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   281
     * The time period that the sending side may expire the message if it has
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   282
     * not been sent, or {@code 0} to indicate that no timeout should occur. This
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   283
     * value is only applicable for messages being sent, it has no meaning for
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   284
     * received messages.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   285
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   286
     * @return  The time period in milliseconds, or {@code 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
    public abstract long timeToLive();
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   289
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   290
    /**
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   291
     * Sets the time period that the sending side may expire the message if it
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   292
     * has not been sent.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   293
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   294
     * @param  millis
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   295
     *         The time period in milliseconds, or {@code 0} to indicate that no
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   296
     *         timeout should occur
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   297
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   298
     * @return  This MessageInfo
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   299
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   300
     * @see MessageInfo#timeToLive()
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   301
     */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   302
    public abstract MessageInfo timeToLive(long millis);
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   303
}