sctp_bindx subroutine

Adds or removes bind address on a socket.

Library

/usr/lib/libsctp.a

Syntax

#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/sctp.h>

int sctp_bindx(int sd, struct sockaddr * addrs, int addrcnt, int flags);

Description

The sctp_bindx subroutine adds or removes a set of bind addresses passed in the addrs array to or from the socket sd. The addrcnt parameter is the number of addresses in the array, and the flags parameter specifies if the addresses need to be added or removed.

If the socket sd is an IPv4 socket, the addresses passed must be IPv4 addresses. If the socket sd is an IPv6 socket, the addresses passed can be either IPv4 or IPv6 addresses.

The addrs parameter is a pointer to an array of one or more socket addresses. Each address is contained in its appropriate structure, that is, struct sockaddr_in or struct sockaddr_in6. The family of the address type must be used to distinguish the address length. The caller specifies the number of addresses in the array along with addrcnt.

The flags parameter can be either SCTP_BINDX_ADD_ADDR or SCTP_BINDX_REM_ADDR. An application can use SCTP_BINDX_ADD_ADDR to associate additional addresses with an endpoint after calling the bind command. The SCTP_BINDX_REM_ADDR parameter directs SCTP to remove the given addresses from the association. A caller might not remove all addresses from an association. The command fails resulting in the EINVAL error code.

Return values

Upon successful completion, the sctp_bindx() command returns 0. On failure, the sctp_bindx() command returns -1 and sets the errno parameter to the appropriate error code.

Error codes
Error Description
EINVAL The EINVAL error code indicates that the port or address is invalid or the command is trying to remove all addresses from an association.
EOPNOTSUPP The EOPNOTSUPP error code indicates that the command is trying to add or remove addresses from a connected association.