jdk/src/jdk.sctp/share/classes/com/sun/nio/sctp/Association.java
author serb
Tue, 29 Mar 2016 17:03:18 +0300
changeset 36787 402e5e40f6e5
parent 34894 3248b89d1921
permissions -rw-r--r--
7179078: Remove @beaninfo processing from the makefiles Reviewed-by: erikj, alexsch
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
 */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    54
public class Association {
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    55
    private final int associationID;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    56
    private final int maxInStreams;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    57
    private final int maxOutStreams;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    58
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    59
    /**
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    60
     * Initializes a new instance of this class.
19835
505b6711e79b 8024508: Fix doclint issues in com.sun.nio.sctp
chegar
parents: 5506
diff changeset
    61
     *
505b6711e79b 8024508: Fix doclint issues in com.sun.nio.sctp
chegar
parents: 5506
diff changeset
    62
     * @param  associationID
505b6711e79b 8024508: Fix doclint issues in com.sun.nio.sctp
chegar
parents: 5506
diff changeset
    63
     *         The association ID
505b6711e79b 8024508: Fix doclint issues in com.sun.nio.sctp
chegar
parents: 5506
diff changeset
    64
     * @param  maxInStreams
505b6711e79b 8024508: Fix doclint issues in com.sun.nio.sctp
chegar
parents: 5506
diff changeset
    65
     *         The maximum number of inbound streams
505b6711e79b 8024508: Fix doclint issues in com.sun.nio.sctp
chegar
parents: 5506
diff changeset
    66
     * @param  maxOutStreams
505b6711e79b 8024508: Fix doclint issues in com.sun.nio.sctp
chegar
parents: 5506
diff changeset
    67
     *         The maximum number of outbound streams
2542
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    68
     */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    69
    protected Association(int associationID,
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    70
                          int maxInStreams,
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    71
                          int maxOutStreams) {
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    72
        this.associationID = associationID;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    73
        this.maxInStreams = maxInStreams;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    74
        this.maxOutStreams = maxOutStreams;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    75
    }
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
     * Returns the associationID.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    79
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    80
     * @return  The association ID
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    81
     */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    82
    public final int associationID() {
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    83
        return associationID;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    84
    };
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    85
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    86
    /**
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    87
     * Returns the maximum number of inbound streams that this association
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    88
     * supports.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    89
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    90
     * <P> Data received on this association will be on stream number
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    91
     * {@code s}, where {@code 0 <= s < maxInboundStreams()}.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    92
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    93
     * @return  The maximum number of inbound streams
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    94
     */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    95
    public final int maxInboundStreams() {
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    96
        return maxInStreams;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
    97
    };
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
     * Returns the maximum number of outbound streams that this association
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   101
     * supports.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   102
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   103
     * <P> Data sent on this association must be on stream number
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   104
     * {@code s}, where {@code 0 <= s < maxOutboundStreams()}.
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   105
     *
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   106
     * @return  The maximum number of outbound streams
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   107
     */
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   108
    public final int maxOutboundStreams() {
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   109
        return maxOutStreams;
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   110
    };
d859108aea12 4927640: Implementation of the sctp protocol
chegar
parents:
diff changeset
   111
}