5331 want sockaddr(3SOCKET)
[illumos-gate.git] / usr / src / man / man3socket / sctp_getpaddrs.3socket
blobc2558279b29abe06e1663c5e9c8c56d51590f8d9
1 '\" te
2 .\" Copyright (c) 2008, Sun Microsystems, Inc. All Rights Reserved.
3 .\" 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.
4 .\" 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.
5 .\" 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]
6 .TH SCTP_GETPADDRS 3SOCKET "Jan 23, 2008"
7 .SH NAME
8 sctp_getpaddrs, sctp_freepaddrs \- returns all peer addresses on an SCTP
9 association
10 .SH SYNOPSIS
11 .LP
12 .nf
13 \fBcc\fR [ \fIflag\fR... ] \fIfile\fR... \fB-lsocket\fR \fB -lnsl \fR \fB -lsctp \fR [ \fIlibrary\fR... ]
14 #include <sys/types.h>
15 #include <sys/socket.h>
16 #include <netinet/sctp.h>
18 \fBint\fR \fBsctp_getpaddrs\fR(\fBint\fR \fIsock\fR, \fBsctp_assoc_t\fR \fIid\fR, \fBvoid **\fR\fIaddrs\fR);
19 .fi
21 .LP
22 .nf
23 \fBvoid\fR \fBsctp_freepaddrs\fR(\fBvoid *\fR\fIaddrs\fR);
24 .fi
26 .SH DESCRIPTION
27 .LP
28 The \fBsctp_getpaddrs()\fR queries the peer addresses in an SCTP association.
29 The \fBsctp_freepaddrs()\fR function releases resources that are allocated to
30 hold the addresses.
31 .sp
32 .LP
33 The \fBsctp_getpaddrs()\fR function returns all the peer addresses in the SCTP
34 association identified by \fIsock\fR. On completion \fIaddrs\fR points to a
35 dynamically allocated array of \fBsockaddr_in\fR structures for an Internet
36 Protocol (IPv4) socket or an array of \fBsockaddr_in6\fR structures for an
37 Internet Protocol Version 6 (IPv6) socket. The \fIaddrs\fR parameter must not
38 be \fINULL\fR. For an IPv4 SCTP socket, the addresses returned in the
39 \fBsockaddr_in\fR structures are IPv4 addresses. For an IPv6 SCTP socket, the
40 addresses in the \fBsockaddr_in6\fR structures can be IPv6 addresses or
41 IPv4-mapped IPv6 addresses.
42 .sp
43 .LP
44 If \fIsock\fR is a one-to-many style SCTP socket, \fIid\fR specifies the
45 association of interest. If \fIsock\fR is a one-to-one style SCTP socket,
46 \fIid\fR is ignored.
47 .sp
48 .LP
49 The \fBsctp_freepaddrs()\fR function frees the resources allocated by
50 \fBsctp_getpaddrs()\fR. The \fIaddrs\fR parameter is the array of addresses
51 allocated by \fBsctp_getpaddrs()\fR.
52 .SH RETURN VALUES
53 .LP
54 Upon successful completion, the \fBsctp_getpaddrs()\fR function returns the
55 number of addresses in the \fIaddrs\fR array. Otherwise, the function returns
56 \fB-1\fR and sets \fBerrno\fR to indicate the error.
57 .SH ERRORS
58 .LP
59 The \fBsctp_getpaddrs()\fR succeeds unless one of the following conditions
60 exist.
61 .sp
62 .ne 2
63 .na
64 \fB\fBEBADF\fR\fR
65 .ad
66 .RS 12n
67 The \fIsock\fR argument is an invalid file descriptor.
68 .RE
70 .sp
71 .ne 2
72 .na
73 \fB\fBENOTSOCK\fR\fR
74 .ad
75 .RS 12n
76 The \fIsock\fR argument is not a socket.
77 .RE
79 .sp
80 .ne 2
81 .na
82 \fB\fBEINVAL\fR\fR
83 .ad
84 .RS 12n
85 The \fIaddrs\fR argument is \fINULL\fR.
86 .RE
88 .sp
89 .ne 2
90 .na
91 \fB\fBEINVAL\fR\fR
92 .ad
93 .RS 12n
94 The \fIid\fR argument is an invalid association identifier for a one-to-many
95 style STP socket.
96 .RE
98 .sp
99 .ne 2
101 \fB\fBENOTCONN\fR\fR
103 .RS 12n
104 The specified socket is not connected.
107 .SH ATTRIBUTES
109 See \fBattributes\fR(5) for descriptions of the following attributes:
114 box;
115 c | c
116 l | l .
117 ATTRIBUTE TYPE  ATTRIBUTE VALUE
119 Interface Stability     Committed
121 MT-Level        Safe
124 .SH SEE ALSO
126 \fBbind\fR(3SOCKET), \fBin.h\fR(3HEAD), \fBlibsctp\fR(3LIB),
127 \fBsctp_freeladdrs\fR(3SOCKET), \fBsctp_getladdrs\fR(3SOCKET),
128 \fBsockaddr\fR(3SOCKET),
129 \fBsocket\fR(3SOCKET), \fBattributes\fR(5), \fBinet\fR(7P), \fBinet6\fR(7P),
130 \fBip\fR(7P), \fBip6\fR(7P), \fBsctp\fR(7P)