jdk/src/share/classes/com/sun/nio/sctp/Association.java
author lana
Thu, 26 Dec 2013 12:04:16 -0800
changeset 23010 6dadb192ad81
parent 20742 4ae78e8060d6
permissions -rw-r--r--
8029235: Update copyright year to match last edit in jdk8 jdk repository for 2013 Summary: updated files with 2011, 2012 and 2013 years according to the file's last updated date Reviewed-by: tbell, lancea, chegar
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2542
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
     1
/*
23010
6dadb192ad81 8029235: Update copyright year to match last edit in jdk8 jdk repository for 2013
lana
parents: 20742
diff changeset
     2
 * Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
2542
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
     4
 *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2542
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2542
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2542
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2542
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    10
 *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    15
 * accompanied this code).
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    16
 *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2542
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2542
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2542
diff changeset
    23
 * questions.
2542
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    24
 */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    25
package com.sun.nio.sctp;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    26
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    27
/**
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    28
 * A class that represents an SCTP association.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    29
 *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    30
 * <P> An association exists between two SCTP endpoints. Each endpoint is
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    31
 * represented by a list of transport addresses through which that endpoint can
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    32
 * be reached and from which it will originate SCTP messages. The association
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    33
 * spans over all of the possible source/destination combinations which may be
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    34
 * generated from each endpoint's lists of addresses.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    35
 *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    36
 * <P> Associations are identified by their Association ID.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    37
 * Association ID's are guaranteed to be unique for the lifetime of the
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    38
 * association. An association ID may be reused after the association has been
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    39
 * shutdown. An association ID is not unique across multiple SCTP channels.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    40
 * An Association's local and remote addresses may change if the SCTP
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    41
 * implementation supports <I>Dynamic Address Reconfiguration</I> as defined by
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    42
 * <A HREF="http://tools.ietf.org/html/rfc5061">RFC5061</A>, see the
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    43
 * {@code bindAddress} and {@code unbindAddress} methods of {@link SctpChannel},
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    44
 * {@link SctpServerChannel}, and {@link SctpMultiChannel}.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    45
 *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    46
 * <P> An {@code Association} is returned from an {@link
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    47
 * SctpChannel#association SctpChannel} or an {@link
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    48
 * SctpMultiChannel#associations SctpMultiChannel}, as well
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    49
 * as being given as a parameter to {@link NotificationHandler
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    50
 * NotificationHandler} methods.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    51
 *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    52
 * @since 1.7
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    53
 */
20742
4ae78e8060d6 8008662: Add @jdk.Exported to JDK-specific/exported APIs
alanb
parents: 19835
diff changeset
    54
@jdk.Exported
2542
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    55
public class Association {
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    56
    private final int associationID;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    57
    private final int maxInStreams;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    58
    private final int maxOutStreams;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    59
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.
19835
505b6711e79b 8024508: Fix doclint issues in com.sun.nio.sctp
chegar
parents: 5506
diff changeset
    62
     *
505b6711e79b 8024508: Fix doclint issues in com.sun.nio.sctp
chegar
parents: 5506
diff changeset
    63
     * @param  associationID
505b6711e79b 8024508: Fix doclint issues in com.sun.nio.sctp
chegar
parents: 5506
diff changeset
    64
     *         The association ID
505b6711e79b 8024508: Fix doclint issues in com.sun.nio.sctp
chegar
parents: 5506
diff changeset
    65
     * @param  maxInStreams
505b6711e79b 8024508: Fix doclint issues in com.sun.nio.sctp
chegar
parents: 5506
diff changeset
    66
     *         The maximum number of inbound streams
505b6711e79b 8024508: Fix doclint issues in com.sun.nio.sctp
chegar
parents: 5506
diff changeset
    67
     * @param  maxOutStreams
505b6711e79b 8024508: Fix doclint issues in com.sun.nio.sctp
chegar
parents: 5506
diff changeset
    68
     *         The maximum number of outbound streams
2542
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    69
     */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    70
    protected Association(int associationID,
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    71
                          int maxInStreams,
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    72
                          int maxOutStreams) {
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    73
        this.associationID = associationID;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    74
        this.maxInStreams = maxInStreams;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    75
        this.maxOutStreams = maxOutStreams;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    76
    }
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    77
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    78
    /**
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    79
     * Returns the associationID.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    80
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    81
     * @return  The association ID
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    82
     */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    83
    public final int associationID() {
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    84
        return associationID;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    85
    };
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    86
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    87
    /**
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    88
     * Returns the maximum number of inbound streams that this association
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    89
     * supports.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    90
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    91
     * <P> Data received on this association will be on stream number
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    92
     * {@code s}, where {@code 0 <= s < maxInboundStreams()}.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    93
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    94
     * @return  The maximum number of inbound streams
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    95
     */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    96
    public final int maxInboundStreams() {
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    97
        return maxInStreams;
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
    /**
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   101
     * Returns the maximum number of outbound streams that this association
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   102
     * supports.
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> Data sent on this association must be on stream number
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   105
     * {@code s}, where {@code 0 <= s < maxOutboundStreams()}.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   106
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   107
     * @return  The maximum number of outbound streams
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   108
     */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   109
    public final int maxOutboundStreams() {
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   110
        return maxOutStreams;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   111
    };
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   112
}