2542
|
1 |
/*
|
5506
|
2 |
* Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
|
2542
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
4 |
*
|
|
5 |
* This code is free software; you can redistribute it and/or modify it
|
|
6 |
* under the terms of the GNU General Public License version 2 only, as
|
5506
|
7 |
* published by the Free Software Foundation. Oracle designates this
|
2542
|
8 |
* particular file as subject to the "Classpath" exception as provided
|
5506
|
9 |
* by Oracle in the LICENSE file that accompanied this code.
|
2542
|
10 |
*
|
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that
|
|
15 |
* accompanied this code).
|
|
16 |
*
|
|
17 |
* You should have received a copy of the GNU General Public License version
|
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
20 |
*
|
5506
|
21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
22 |
* or visit www.oracle.com if you need additional information or have any
|
|
23 |
* questions.
|
2542
|
24 |
*/
|
|
25 |
package com.sun.nio.sctp;
|
|
26 |
|
|
27 |
/**
|
|
28 |
* A class that represents an SCTP association.
|
|
29 |
*
|
|
30 |
* <P> An association exists between two SCTP endpoints. Each endpoint is
|
|
31 |
* represented by a list of transport addresses through which that endpoint can
|
|
32 |
* be reached and from which it will originate SCTP messages. The association
|
|
33 |
* spans over all of the possible source/destination combinations which may be
|
|
34 |
* generated from each endpoint's lists of addresses.
|
|
35 |
*
|
|
36 |
* <P> Associations are identified by their Association ID.
|
|
37 |
* Association ID's are guaranteed to be unique for the lifetime of the
|
|
38 |
* association. An association ID may be reused after the association has been
|
|
39 |
* shutdown. An association ID is not unique across multiple SCTP channels.
|
|
40 |
* An Association's local and remote addresses may change if the SCTP
|
|
41 |
* implementation supports <I>Dynamic Address Reconfiguration</I> as defined by
|
|
42 |
* <A HREF="http://tools.ietf.org/html/rfc5061">RFC5061</A>, see the
|
|
43 |
* {@code bindAddress} and {@code unbindAddress} methods of {@link SctpChannel},
|
|
44 |
* {@link SctpServerChannel}, and {@link SctpMultiChannel}.
|
|
45 |
*
|
|
46 |
* <P> An {@code Association} is returned from an {@link
|
|
47 |
* SctpChannel#association SctpChannel} or an {@link
|
|
48 |
* SctpMultiChannel#associations SctpMultiChannel}, as well
|
|
49 |
* as being given as a parameter to {@link NotificationHandler
|
|
50 |
* NotificationHandler} methods.
|
|
51 |
*
|
|
52 |
* @since 1.7
|
|
53 |
*/
|
|
54 |
public class Association {
|
|
55 |
private final int associationID;
|
|
56 |
private final int maxInStreams;
|
|
57 |
private final int maxOutStreams;
|
|
58 |
|
|
59 |
/**
|
|
60 |
* Initializes a new instance of this class.
|
|
61 |
*/
|
|
62 |
protected Association(int associationID,
|
|
63 |
int maxInStreams,
|
|
64 |
int maxOutStreams) {
|
|
65 |
this.associationID = associationID;
|
|
66 |
this.maxInStreams = maxInStreams;
|
|
67 |
this.maxOutStreams = maxOutStreams;
|
|
68 |
}
|
|
69 |
|
|
70 |
/**
|
|
71 |
* Returns the associationID.
|
|
72 |
*
|
|
73 |
* @return The association ID
|
|
74 |
*/
|
|
75 |
public final int associationID() {
|
|
76 |
return associationID;
|
|
77 |
};
|
|
78 |
|
|
79 |
/**
|
|
80 |
* Returns the maximum number of inbound streams that this association
|
|
81 |
* supports.
|
|
82 |
*
|
|
83 |
* <P> Data received on this association will be on stream number
|
|
84 |
* {@code s}, where {@code 0 <= s < maxInboundStreams()}.
|
|
85 |
*
|
|
86 |
* @return The maximum number of inbound streams
|
|
87 |
*/
|
|
88 |
public final int maxInboundStreams() {
|
|
89 |
return maxInStreams;
|
|
90 |
};
|
|
91 |
|
|
92 |
/**
|
|
93 |
* Returns the maximum number of outbound streams that this association
|
|
94 |
* supports.
|
|
95 |
*
|
|
96 |
* <P> Data sent on this association must be on stream number
|
|
97 |
* {@code s}, where {@code 0 <= s < maxOutboundStreams()}.
|
|
98 |
*
|
|
99 |
* @return The maximum number of outbound streams
|
|
100 |
*/
|
|
101 |
public final int maxOutboundStreams() {
|
|
102 |
return maxOutStreams;
|
|
103 |
};
|
|
104 |
}
|