SCTP Programmer's Guide
On success, sctp_getpaddrs() returns the number of peer addresses in the
association. The sctp_getpaddrs() API can fail for the following reasons:
• If an association does not exist on a socket, sctp_getpaddrs() returns 0. The
value of *addrs is undefined.
• If an error occurs, sctp_getpaddrs() returns -1 and the value of *addrs is left
undefined.
The sctp_freepaddrs() SCTP Socket API
Applications must use the sctp_freepaddrs() socket API to free all resources
allocated by the sctp_getpaddrs() API.
Following is the syntax for the sctp_freepaddrs() socket API:
void sctp_freepaddrs(struct sockaddr *addrs);
where:
addrs Specifies the array of peer addresses returned by sctp_getpaddrs().
The sctp_getladdrs() SCTP Socket API
Applications can use the sctp_getladdrs() SCTP socket API to return all the locally
bound addresses on a socket.
Following is the syntax for the sctp_getladdrs() SCTP socket API:
int sctp_getladdrs(int sd, sctp_assoc_t id, struct sockaddr **ss);
where:
sd Specifies the socket descriptor. If sd is an IPv4 socket, the addresses returned will
be an IPv4 addresses. If sd is an IPv6 socket, the addresses returned can be either
an IPv4 or IPv6 address.
id Specifies the association ID. For one-to-many style sockets, id specifies the
association to query. An application ignores id for one-to-one style sockets. If id
is set to 0 (zero), the locally bound addresses are returned irrespective of the
particular association.
ss Points to a dynamically allocated array of sockaddr structures of the appropriate
socket type.
An application must use sctp_freeaddrs() to free the memory that is allocated by
sctp_getladdrs(), to store addresses.
On success, sctp_getladdrs() returns the number of local addresses bound to the
socket. If the socket is unbound, sctp_getladdrs() returns 0, and the value of
*addrs is left undefined. If an error occurs, sctp_getladdrs() returns -1, and the
value of *addrs is left undefined.
SCTP-Specific Socket APIs 63