summaryrefslogtreecommitdiff
path: root/usr/src/man/man3socket/sctp_opt_info.3socket
blob: 63984ffd88b9f52cb3038d8d3c01f4429e565597 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
'\" te
.\" Copyright (c) 2005, Sun Microsystems, Inc. All Rights Reserved.
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH SCTP_OPT_INFO 3SOCKET "Nov 26, 2017"
.SH NAME
sctp_opt_info \- examine SCTP level options for an SCTP endpoint
.SH SYNOPSIS
.LP
.nf
\fBcc\fR [ \fIflag\fR... ] \fIfile\fR... \fB-lsocket\fR \fB -lnsl \fR \fB -lsctp \fR [ \fIlibrary\fR... ]
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/sctp.h>

\fBint\fR \fBsctp_opt_info\fR(\fBint\fR \fIsock\fR, \fBsctp_assoc_t\fR \fIid\fR, \fBint\fR \fIopt\fR, \fBvoid *\fR\fIarg\fR,
     \fBsocklen_t *\fR\fIlen\fR);
.fi

.SH DESCRIPTION
.LP
The \fBsctp_opt_info()\fR returns SCTP level options associated with the SCTP
socket \fIsock\fR. If \fIsock\fR is a one-to-many style socket, \fIid\fR refers
to the association of interest. If \fIsock\fR is a one-to-one socket or if
\fIsock\fR is a branched-off one-to-many style socket, \fIid\fR is ignored. The
\fIopt\fR parameter specifies the SCTP option to get. The \fIarg\fR structure
is an option-specific structure buffer allocated by the caller. The \fIlen\fR
parameter is the length of the option specified.
.sp
.LP
Following are the currently supported values for the \fIopt\fR parameter. When
one of the options below specifies an association \fIid\fR, the \fIid\fR is
relevant for only one-to-many style SCTP sockets. The associatation \fIid\fR
can be ignored for one-to-one style or branched-off one-to-many style SCTP
sockets.
.sp
.ne 2
.na
\fB\fBSCTP_RTOINFO\fR\fR
.ad
.RS 27n
Returns the protocol parameters used to initialize and bind retransmission
timeout (RTO) tunable. The following structure is used to access these
parameters:
.sp
.in +2
.nf
struct sctp_rtoinfo {
       sctp_assoc_t            srto_assoc_id;
       uint32_t                srto_initial;
       uint32_t                srto_max;
       uint32_t                srto_min;
};
where:
       srto_assoc_id           Association ID specified by the caller
       srto_initial            Initial RTO value
       srto_max                Maximum value for the RTO
       srto_min                Minimum value for the RTO
.fi
.in -2

.RE

.sp
.ne 2
.na
\fB\fBSSCTP_ASSOCINFO\fR\fR
.ad
.RS 27n
Returns association-specific parameters. The following structure is used to
access the parameters:
.sp
.in +2
.nf
struct sctp_assocparams {
       sctp_assoc_t            sasoc_assoc_id;
       uint16_t                sasoc_asocmaxrxt;
       uint16_t                sasoc_number_peer_destinations;
       uint32_t                sasoc_peer_rwnd;
       uint32_t                sasoc_local_rwnd;
       uint32_t                sasoc_cookie_life;
};
where:
       srto_assoc_id           Association ID specified by the caller
       sasoc_asocmaxrxt        Maximum retransmission count for
                               the association
       sasoc_number_peer_destinations
                               Number of addresses the peer has
       sasoc_peer_rwnd         Current value of the peer's
                               receive window
       sasoc_local_rwnd        Last reported receive window sent
                               to the peer
       sasoc_cookie_life       Association cookie lifetime used
                               when issuing cookies
.fi
.in -2

All parameters with time values are in milliseconds.
.RE

.sp
.ne 2
.na
\fB\fBSCTP_DEFAULT_SEND_PARAM\fR\fR
.ad
.RS 27n
Returns the default set of parameters used by the \fBsendto()\fR function on
this association. The following structure is used to access the parameters:
.sp
.in +2
.nf
struct sctp_sndrcvinfo {
       uint16_t                sinfo_stream;
       uint16_t                sinfo_ssn;
       uint16_t                sinfo_flags;
       uint32_t                sinfo_ppid;
       uint32_t                sinfo_context;
       uint32_t                sinfo_timetolive;
       uint32_t                sinfo_tsn;
       uint32_t                sinfo_cumtsn;
       sctp_assoc_t            sinfo_assoc_id;
};
where:
       sinfo_stream            Default stream for \fBsendmsg()\fR
       sinfo_ssn               Always returned as 0
       sinfo_flags             Default flags for \fBsendmsg()\fR
                               that include the following:
                               MSG_UNORDERED
                               MSG_ADDR_OVER
                               MSG_ABORT
                               MSG_EOF
                               MSG_PR_SCTP
       sinfo_ppid              Default payload protocol identifier
                               for \fBsendmsg()\fR
       sinfo_context           Default context for \fBsendmsg()\fR
       sinfo_timetolive        Time to live in milliseconds for a
                               message on the sending side.
                               The message expires if the sending
                               side does not start the first
                               transmission for the message within
                               the specified time period. If the
                               sending side starts the first
                               transmission before the time period
                               expires, the message is sent as a
                               normal reliable message. A value of
                               0 indicates that the message does not
                               expire. When MSG_PR_SCTP is set in
                               sinfo_flags, the message expires if
                               it is not acknowledged within the
                               time period.
       sinfo_tsn               Always returned as 0
       sinfo_cumtsn            Always returned as 0
       sinfo_assoc_id          Association ID specified by the caller
.fi
.in -2

.RE

.sp
.ne 2
.na
\fB\fBSCTP_PEER_ADDR_PARAMS\fR\fR
.ad
.RS 27n
Returns the parameters for a specified peer address of the association. The
following structure is used to access the parameters:
.sp
.in +2
.nf
struct sctp_paddrparams {
       sctp_assoc_t            spp_assoc_id;
       struct sockaddr_storage spp_address;
       uint32_t                spp_hbinterval;
       uint16_t                spp_pathmaxrxt;
};
where:
       spp_assoc_id            Association ID specified by the caller
       spp_address             Peer's address
       spp_hbinterval          Heartbeat interval in milliseconds
       spp_pathmaxrxt          Maximum number of retransmissions
                               to an address before it is
                               considered unreachable
.fi
.in -2

.RE

.sp
.ne 2
.na
\fB\fBSCTP_STATUS\fR\fR
.ad
.RS 27n
Returns the current status information about the association. The following
structure is used to access the parameters:
.sp
.in +2
.nf
struct sctp_status {
       sctp_assoc_t            sstat_assoc_id;
       int32_t                 sstat_state;
       uint32_t                sstat_rwnd;
       uint16_t                sstat_unackdata;
       uint16_t                sstat_penddata;
       uint16_t                sstat_instrms;
       uint16_t                sstat_outstrms;
       uint16_t                sstat_fragmentation_point;
       struct sctp_paddrinfo   sstat_primary;
};
where:

       sstat_assoc_id          Association ID specified by the caller
       sstat_state             Current state of the association
                               which might be one of the following:

                               SCTP_CLOSED
                               SCTP_BOUND
                               SCTP_LISTEN
                               SCTP_COOKIE_WAIT
                               SCTP_COOKIE_ECHOED
                               SCTP_ESTABLISHED
                               SCTP_SHUTDOWN_PENDING
                               SCTP_SHUTDOWN_SENT
                               SCTP_SHUTDOWN_RECEIVED
                               SCTP_SHUTDOWN_ACK_SENT
       sstat_rwnd              Current receive window of the
                               association peer
       sstat_unackdata         Number of unacked DATA chunks
       sstat_penddata          Number of DATA chunks pending
                               receipt
       sstat_instrms           Number of inbound streams
       sstat_outstrms          Number of outbound streams
       sstat_fragmentation_point
                               Size at which SCTP fragmentation occurs
       sstat_primary           Information about the primary
                               peer address

       sstat_primary has the following structure
                        struct sctp_paddrinfo {
                               sctp_assoc_t            spinfo_assoc_id;
                               struct sockaddr_storage spinfo_address;
                               int32_t                 spinfo_state;
                               uint32_t                spinfo cwnd;
                               uint32_t                spinfo_srtt;
                               uint32_t                spinfo_rto;
                               uint32_t                spinfo_mtu;
                        };
                        where:
                        spinfo_assoc_id         Association ID
                                                specified by
                                                the caller
                        spinfo_address          Primary peer
                                                address
                        spinfo_state            State of the peer
                                                address:
                                                SCTP_ACTIVE or
                                                SCTP_INACTIVE
                        spinfo_cwnd             Congestion window
                                                of the peer
                                                address
                        spinfo_srtt             Smoothed round-trip
                                                time calculation of
                                                the peer address
                        spinfo_rto              Current retransmission
                                                timeout value of the
                                                peer address in
                                                milliseconds
                        spinfo_mtu              P-MTU of the address
.fi
.in -2

.RE

.SH RETURN VALUES
.LP
Upon successful completion, the \fBsctp_opt_info()\fR function returns \fB0\fR.
Otherwise, the function returns \fB-1\fR and sets \fBerrno\fR to indicate the
error.
.SH ERRORS
.LP
The \fBsctp_opt_info()\fR call fails under the following conditions.
.sp
.ne 2
.na
\fB\fBEBADF\fR\fR
.ad
.RS 16n
The \fIsock\fR argument is an invalid file descriptor.
.RE

.sp
.ne 2
.na
\fB\fBENOTSOCK\fR\fR
.ad
.RS 16n
The \fIsock\fR argument is not a socket.
.RE

.sp
.ne 2
.na
\fB\fBEINVAL\fR\fR
.ad
.RS 16n
The association \fIid\fR is invalid for a one-to-many style SCTP socket.
.RE

.sp
.ne 2
.na
\fB\fBEINVAL\fR\fR
.ad
.RS 16n
The input buffer length is insufficient for the option specified.
.RE

.sp
.ne 2
.na
\fB\fBEINVAL\fR\fR
.ad
.RS 16n
The peer address is invalid or does not belong to the association.
.RE

.sp
.ne 2
.na
\fB\fBEAFNOSUPPORT\fR\fR
.ad
.RS 16n
The address family for the peer's address is other than \fBAF_INET\fR or
\fBAF_INET6\fR.
.RE

.SH ATTRIBUTES
.LP
See \fBattributes\fR(5) for descriptions of the following attributes:
.sp

.sp
.TS
box;
c | c
l | l .
ATTRIBUTE TYPE	ATTRIBUTE VALUE
_
Interface Stability	Evolving
_
MT-Level	Safe
.TE

.SH SEE ALSO
.LP
\fBin.h\fR(3HEAD), \fBlibsctp\fR(3LIB), \fBgetsockopt\fR(3SOCKET),
\fBsetsockopt\fR(3SOCKET), \fBsockaddr\fR(3SOCKET), \fBsocket\fR(3SOCKET),
\fBinet\fR(7P), \fBinet6\fR(7P), \fBip\fR(7P), \fBip6\fR(7P), \fBsctp\fR(7P)