1096N/A/*
2362N/A * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
1096N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1096N/A *
1096N/A * This code is free software; you can redistribute it and/or modify it
1096N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
1096N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
1096N/A *
1096N/A * This code is distributed in the hope that it will be useful, but WITHOUT
1096N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1096N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1096N/A * version 2 for more details (a copy is included in the LICENSE file that
1096N/A * accompanied this code).
1096N/A *
1096N/A * You should have received a copy of the GNU General Public License version
1096N/A * 2 along with this work; if not, write to the Free Software Foundation,
1096N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1096N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
1096N/A */
1096N/Apackage com.sun.nio.sctp;
1096N/A
1096N/A/**
1096N/A * A class that represents an SCTP association.
1096N/A *
1096N/A * <P> An association exists between two SCTP endpoints. Each endpoint is
1096N/A * represented by a list of transport addresses through which that endpoint can
1096N/A * be reached and from which it will originate SCTP messages. The association
1096N/A * spans over all of the possible source/destination combinations which may be
1096N/A * generated from each endpoint's lists of addresses.
1096N/A *
1096N/A * <P> Associations are identified by their Association ID.
1096N/A * Association ID's are guaranteed to be unique for the lifetime of the
1096N/A * association. An association ID may be reused after the association has been
1096N/A * shutdown. An association ID is not unique across multiple SCTP channels.
1096N/A * An Association's local and remote addresses may change if the SCTP
1096N/A * implementation supports <I>Dynamic Address Reconfiguration</I> as defined by
1096N/A * <A HREF="http://tools.ietf.org/html/rfc5061">RFC5061</A>, see the
1096N/A * {@code bindAddress} and {@code unbindAddress} methods of {@link SctpChannel},
1096N/A * {@link SctpServerChannel}, and {@link SctpMultiChannel}.
1096N/A *
1096N/A * <P> An {@code Association} is returned from an {@link
1096N/A * SctpChannel#association SctpChannel} or an {@link
1096N/A * SctpMultiChannel#associations SctpMultiChannel}, as well
1096N/A * as being given as a parameter to {@link NotificationHandler
1096N/A * NotificationHandler} methods.
1096N/A *
1096N/A * @since 1.7
1096N/A */
1096N/Apublic class Association {
1096N/A private final int associationID;
1096N/A private final int maxInStreams;
1096N/A private final int maxOutStreams;
1096N/A
1096N/A /**
1096N/A * Initializes a new instance of this class.
1096N/A */
1096N/A protected Association(int associationID,
1096N/A int maxInStreams,
1096N/A int maxOutStreams) {
1096N/A this.associationID = associationID;
1096N/A this.maxInStreams = maxInStreams;
1096N/A this.maxOutStreams = maxOutStreams;
1096N/A }
1096N/A
1096N/A /**
1096N/A * Returns the associationID.
1096N/A *
1096N/A * @return The association ID
1096N/A */
1096N/A public final int associationID() {
1096N/A return associationID;
1096N/A };
1096N/A
1096N/A /**
1096N/A * Returns the maximum number of inbound streams that this association
1096N/A * supports.
1096N/A *
1096N/A * <P> Data received on this association will be on stream number
1096N/A * {@code s}, where {@code 0 <= s < maxInboundStreams()}.
1096N/A *
1096N/A * @return The maximum number of inbound streams
1096N/A */
1096N/A public final int maxInboundStreams() {
1096N/A return maxInStreams;
1096N/A };
1096N/A
1096N/A /**
1096N/A * Returns the maximum number of outbound streams that this association
1096N/A * supports.
1096N/A *
1096N/A * <P> Data sent on this association must be on stream number
1096N/A * {@code s}, where {@code 0 <= s < maxOutboundStreams()}.
1096N/A *
1096N/A * @return The maximum number of outbound streams
1096N/A */
1096N/A public final int maxOutboundStreams() {
1096N/A return maxOutStreams;
1096N/A };
1096N/A}