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_GETLADDRS 3SOCKET "Jan 23, 2008"
8 sctp_getladdrs, sctp_freeladdrs \- returns all locally bound addresses on an
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_getladdrs\fR(\fBint\fR \fIsock\fR, \fBsctp_assoc_t\fR \fIid\fR, \fBvoid **\fR\fIaddrs\fR);
23 \fBvoid\fR \fBsctp_freeladdrs\fR(\fBvoid *\fR\fIaddrs\fR);
28 The \fBsctp_getladdrs()\fR function queries addresses to which an SCTP socket
29 is bound. The \fBsctp_freeladdrs()\fR function releases resources that are
30 allocated to hold the addresses.
33 The \fBsctp_getladdrs()\fR function returns all the locally bound addresses on
34 the SCTP socket \fIsock\fR. On completion \fIaddrs\fR points to a dynamically
35 allocated array of \fBsockaddr_in\fR structures for an Internet Protocol (IPv4)
36 socket or an array of \fBsockaddr_in6\fR structures for an Internet Protocol
37 Version 6 (IPv6) socket. The \fIaddrs\fR parameter must not be \fINULL\fR. For
38 an IPv4 SCTP socket, the addresses returned in the \fBsockaddr_in\fR structures
39 are IPv4 addresses. For an IPv6 SCTP socket, the addresses in the
40 \fBsockaddr_in6\fR structures can be IPv6 addresses or IPv4-mapped IPv6
44 If \fIsock\fR is a one-to-many style SCTP socket, \fIid\fR specifies the
45 association of interest. A value of \fB0\fR to \fIid\fR returns locally-bound
46 addresses regardless of a particular association. If \fIsock\fR is a one-to-one
47 style SCTP socket, \fIid\fR is ignored.
50 The \fBsctp_freeladdrs()\fR function frees the resources allocated by
51 \fBsctp_getladdrs()\fR. The \fIaddrs\fR parameter is the array of addresses
52 allocated by \fBsctp_getladdrs()\fR.
55 Upon successful completion, the \fBsctp_getladdrs()\fR function returns the
56 number of addresses in the \fIaddrs\fR array. Otherwise, the function returns
57 \fB-1\fR and sets \fBerrno\fR to indicate the error.
60 The \fBsctp_getladdrs()\fR call fails under the following conditions.
67 The \fIsock\fR argument is an invalid file descriptor.
76 The \fIsock\fR argument is not a socket.
85 The \fIaddrs\fR argument is \fINULL\fR.
94 The \fIid\fR argument is an invalid socket.
99 See \fBattributes\fR(5) for descriptions of the following attributes:
107 ATTRIBUTE TYPE ATTRIBUTE VALUE
109 Interface Stability Committed
116 \fBbind\fR(3SOCKET), \fBin.h\fR(3HEAD), \fBlibsctp\fR(3LIB),
117 \fBsctp_freepaddrs\fR(3SOCKET), \fBsctp_getpaddrs\fR(3SOCKET),
118 \fBsockaddr\fR(3SOCKET),
119 \fBsocket\fR(3SOCKET), \fBattributes\fR(5), \fBinet\fR(7P), \fBinet6\fR(7P),
120 \fBip\fR(7P), \fBip6\fR(7P), \fBsctp\fR(7P)