| Current File : //usr/man/man3socket/sctp_getladdrs.3socket |
'\" te
.\" Copyright (c) 2008, Sun Microsystems, Inc. All Rights Reserved.
.TH sctp_getladdrs 3SOCKET "23 Jan 2008" "SunOS 5.11" "Sockets Library Functions"
.SH NAME
sctp_getladdrs, sctp_freeladdrs \- returns all locally bound addresses on an SCTP socket
.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_getladdrs\fR(\fBint\fR \fIsock\fR, \fBsctp_assoc_t\fR \fIid\fR, \fBvoid **\fR\fIaddrs\fR);
.fi
.LP
.nf
\fBvoid\fR \fBsctp_freeladdrs\fR(\fBvoid *\fR\fIaddrs\fR);
.fi
.SH DESCRIPTION
.sp
.LP
The \fBsctp_getladdrs()\fR function queries addresses to which an SCTP socket is bound. The \fBsctp_freeladdrs()\fR function releases resources that are allocated to hold the addresses.
.sp
.LP
The \fBsctp_getladdrs()\fR function returns all the locally bound addresses on the SCTP socket \fIsock\fR. On completion \fIaddrs\fR points to a dynamically allocated array of \fBsockaddr_in\fR structures for an Internet Protocol (IPv4) socket or an array of \fBsockaddr_in6\fR structures for an Internet Protocol Version 6 (IPv6) socket. The \fIaddrs\fR parameter must not be \fINULL\fR. For an IPv4 SCTP socket, the addresses returned in the \fBsockaddr_in\fR structures are IPv4 addresses. For an IPv6 SCTP socket, the addresses in the \fBsockaddr_in6\fR structures can be IPv6 addresses or IPv4-mapped IPv6 addresses.
.sp
.LP
If \fIsock\fR is a one-to-many style SCTP socket, \fIid\fR specifies the association of interest. A value of \fB0\fR to \fIid\fR returns locally-bound addresses regardless of a particular association. If \fIsock\fR is a one-to-one style SCTP socket, \fIid\fR is ignored.
.sp
.LP
The \fBsctp_freeladdrs()\fR function frees the resources allocated by \fBsctp_getladdrs()\fR. The \fIaddrs\fR parameter is the array of addresses allocated by \fBsctp_getladdrs()\fR.
.SH RETURN VALUES
.sp
.LP
Upon successful completion, the \fBsctp_getladdrs()\fR function returns the number of addresses in the \fIaddrs\fR array. Otherwise, the function returns \fB-1\fR and sets \fBerrno\fR to indicate the error.
.SH ERRORS
.sp
.LP
The \fBsctp_getladdrs()\fR call fails under the following conditions.
.sp
.ne 2
.mk
.na
\fB\fBEBADF\fR\fR
.ad
.RS 12n
.rt
The \fIsock\fR argument is an invalid file descriptor.
.RE
.sp
.ne 2
.mk
.na
\fB\fBENOTSOCK\fR\fR
.ad
.RS 12n
.rt
The \fIsock\fR argument is not a socket.
.RE
.sp
.ne 2
.mk
.na
\fB\fBEINVAL\fR\fR
.ad
.RS 12n
.rt
The \fIaddrs\fR argument is \fINULL\fR.
.RE
.sp
.ne 2
.mk
.na
\fB\fBEINVAL\fR\fR
.ad
.RS 12n
.rt
The \fIid\fR argument is an invalid socket.
.RE
.SH ATTRIBUTES
.sp
.LP
See \fBattributes\fR(5) for descriptions of the following attributes:
.sp
.sp
.TS
tab() box;
cw(2.75i) |cw(2.75i)
lw(2.75i) |lw(2.75i)
.
ATTRIBUTE TYPEATTRIBUTE VALUE
_
Interface StabilityCommitted
_
MT-LevelSafe
.TE
.SH SEE ALSO
.sp
.LP
\fBbind\fR(3SOCKET), \fBin.h\fR(3HEAD), \fBlibsctp\fR(3LIB), \fBsctp_freepaddrs\fR(3SOCKET), \fBsctp_getpaddrs\fR(3SOCKET), \fBsocket\fR(3SOCKET), \fBattributes\fR(5), \fBinet\fR(7P), \fBinet6\fR(7P), \fBip\fR(7P), \fBip6\fR(7P), \fBsctp\fR(7P)