'\" te
.\" Copyright (c) 2007, 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_BINDX 3SOCKET "Aug 22, 2007"
.SH NAME
sctp_bindx \- add or remove IP addresses to or from 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_bindx\fR(\fBint\fR \fIsock\fR, \fBvoid *\fR\fIaddrs\fR, \fBint\fR \fIaddrcnt\fR, \fBint\fR \fIflags\fR);
.fi

.SH DESCRIPTION
.LP
The \fBsctp_bindx()\fR function adds or removes addresses to or from an SCTP
socket. If \fIsock\fR is an Internet Protocol Version 4 (IPv4) socket,
\fIaddrs\fR should be an array of \fBsockaddr_in\fR structures containing IPv4
addresses. If \fIsock\fR is an Internet Protocol Version 6 (IPv6) socket,
\fIaddrs\fR should be an array of \fBsockaddr_in6\fR structures containing IPv6
or IPv4-mapped IPv6 addresses. The \fIaddrcnt\fR is the number of array
elements in \fIaddrs\fR. The family of the address type is used with
\fIaddrcnt\fR to determine the size of the array.
.sp
.LP
The \fIflags\fR parameter is a bitmask that indicates whether addresses are to
be added or removed from a socket. The \fIflags\fR parameter is formed by
bitwise OR of zero or more of the following flags:
.sp
.ne 2
.na
\fB\fBSCTP_BINDX_ADD_ADDR\fR\fR
.ad
.RS 23n
Indicates that addresses from \fIaddrs\fR should be added to the SCTP socket.
.RE

.sp
.ne 2
.na
\fB\fBSCTP_BINDX_REM_ADDR\fR\fR
.ad
.RS 23n
Indicates that addresses from \fIaddrs\fR should be removed from the SCTP
socket.
.RE

.sp
.LP
These two flags are mutually exclusive. If \fIflags\fR is formed by a bitwise
OR of both \fBSCTP_BINDX_ADD_ADDR\fR and \fBSCTP_BINDX_REM_ADDR\fR, the
\fBsctp_bindx()\fR function will fail.
.sp
.LP
Prior to calling \fBsctp_bindx()\fR on an SCTP endpoint, the endpoint should be
bound using \fBbind\fR(3SOCKET). On a listening socket, a special
\fBINADDR_ANY\fR value for IP or an unspecified address of all zeros for IPv6
can be used in \fIaddrs\fR to add all IPv4 or IPv6 addresses on the system to
the socket. The \fBsctp_bindx()\fR function can also be used to add or remove
addresses to or from an established association. In such a case, messages are
exchanged between the SCTP endpoints to update the address lists for that
association if both endpoints support dynamic address reconfiguration.
.SH RETURN VALUES
.LP
Upon successful completion, the \fBsctp_bindx()\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_bindx()\fR call fails under the following conditions.
.sp
.ne 2
.na
\fB\fBEBADF\fR\fR
.ad
.RS 12n
The \fIsock\fR argument is an invalid file descriptor.
.RE

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

.sp
.ne 2
.na
\fB\fBEINVAL\fR\fR
.ad
.RS 12n
One or more of the IPv4 or IPv6 addresses is invalid.
.RE

.sp
.ne 2
.na
\fB\fBEINVAL\fR\fR
.ad
.RS 12n
The endpoint is not bound.
.RE

.sp
.ne 2
.na
\fB\fBEINVAL\fR\fR
.ad
.RS 12n
The last address is requested to be removed from an established association.
.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	Committed
_
MT-Level	Safe
.TE

.SH SEE ALSO
.LP
\fBbind\fR(3SOCKET), \fBin.h\fR(3HEAD), \fBlibsctp\fR(3LIB),
\fBlisten\fR(3SOCKET), \fBsctp_freeladdrs\fR(3SOCKET),
\fBsctp_freepaddrs\fR(3SOCKET), \fBsctp_getladdrs\fR(3SOCKET),
\fBsctp_getpaddrs\fR(3SOCKET), \fBsockaddr\fR(3SOCKET), \fBsocket\fR(3SOCKET),
\fBinet\fR(7P), \fBinet6\fR(7P), \fBip\fR(7P), \fBip6\fR(7P), \fBsctp\fR(7P)

.SH NOTES
.LP
IPv4-mapped addresses are not recommended.