Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/com/sun/nio/sctp/Association.java
38923 views
/*1* Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/24package com.sun.nio.sctp;2526/**27* A class that represents an SCTP association.28*29* <P> An association exists between two SCTP endpoints. Each endpoint is30* represented by a list of transport addresses through which that endpoint can31* be reached and from which it will originate SCTP messages. The association32* spans over all of the possible source/destination combinations which may be33* generated from each endpoint's lists of addresses.34*35* <P> Associations are identified by their Association ID.36* Association ID's are guaranteed to be unique for the lifetime of the37* association. An association ID may be reused after the association has been38* shutdown. An association ID is not unique across multiple SCTP channels.39* An Association's local and remote addresses may change if the SCTP40* implementation supports <I>Dynamic Address Reconfiguration</I> as defined by41* <A HREF="http://tools.ietf.org/html/rfc5061">RFC5061</A>, see the42* {@code bindAddress} and {@code unbindAddress} methods of {@link SctpChannel},43* {@link SctpServerChannel}, and {@link SctpMultiChannel}.44*45* <P> An {@code Association} is returned from an {@link46* SctpChannel#association SctpChannel} or an {@link47* SctpMultiChannel#associations SctpMultiChannel}, as well48* as being given as a parameter to {@link NotificationHandler49* NotificationHandler} methods.50*51* @since 1.752*/53@jdk.Exported54public class Association {55private final int associationID;56private final int maxInStreams;57private final int maxOutStreams;5859/**60* Initializes a new instance of this class.61*62* @param associationID63* The association ID64* @param maxInStreams65* The maximum number of inbound streams66* @param maxOutStreams67* The maximum number of outbound streams68*/69protected Association(int associationID,70int maxInStreams,71int maxOutStreams) {72this.associationID = associationID;73this.maxInStreams = maxInStreams;74this.maxOutStreams = maxOutStreams;75}7677/**78* Returns the associationID.79*80* @return The association ID81*/82public final int associationID() {83return associationID;84};8586/**87* Returns the maximum number of inbound streams that this association88* supports.89*90* <P> Data received on this association will be on stream number91* {@code s}, where {@code 0 <= s < maxInboundStreams()}.92*93* @return The maximum number of inbound streams94*/95public final int maxInboundStreams() {96return maxInStreams;97};9899/**100* Returns the maximum number of outbound streams that this association101* supports.102*103* <P> Data sent on this association must be on stream number104* {@code s}, where {@code 0 <= s < maxOutboundStreams()}.105*106* @return The maximum number of outbound streams107*/108public final int maxOutboundStreams() {109return maxOutStreams;110};111}112113114