Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openjdk-multiarch-jdk8u
Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/com/sun/nio/sctp/Association.java
38923 views
1
/*
2
* Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
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
7
* published by the Free Software Foundation. Oracle designates this
8
* particular file as subject to the "Classpath" exception as provided
9
* by Oracle in the LICENSE file that accompanied this code.
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
*
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.
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
@jdk.Exported
55
public class Association {
56
private final int associationID;
57
private final int maxInStreams;
58
private final int maxOutStreams;
59
60
/**
61
* Initializes a new instance of this class.
62
*
63
* @param associationID
64
* The association ID
65
* @param maxInStreams
66
* The maximum number of inbound streams
67
* @param maxOutStreams
68
* The maximum number of outbound streams
69
*/
70
protected Association(int associationID,
71
int maxInStreams,
72
int maxOutStreams) {
73
this.associationID = associationID;
74
this.maxInStreams = maxInStreams;
75
this.maxOutStreams = maxOutStreams;
76
}
77
78
/**
79
* Returns the associationID.
80
*
81
* @return The association ID
82
*/
83
public final int associationID() {
84
return associationID;
85
};
86
87
/**
88
* Returns the maximum number of inbound streams that this association
89
* supports.
90
*
91
* <P> Data received on this association will be on stream number
92
* {@code s}, where {@code 0 <= s < maxInboundStreams()}.
93
*
94
* @return The maximum number of inbound streams
95
*/
96
public final int maxInboundStreams() {
97
return maxInStreams;
98
};
99
100
/**
101
* Returns the maximum number of outbound streams that this association
102
* supports.
103
*
104
* <P> Data sent on this association must be on stream number
105
* {@code s}, where {@code 0 <= s < maxOutboundStreams()}.
106
*
107
* @return The maximum number of outbound streams
108
*/
109
public final int maxOutboundStreams() {
110
return maxOutStreams;
111
};
112
}
113
114