blob: c5aad14eeee48af7580030a168448dfeb65b7526 [file] [log] [blame]
Austin Schuh8d0a2852019-12-28 22:54:28 -08001.\" (C) Copyright Sridhar Samudrala IBM Corp. 2004, 2005.
2.\"
3.\" Permission is granted to distribute possibly modified copies
4.\" of this manual provided the header is included verbatim,
5.\" and in case of nontrivial modification author and date
6.\" of the modification is added to the header.
7.\"
8.TH SCTP_GETLADDRS 3 2005-10-25 "Linux 2.6" "Linux Programmer's Manual"
9.SH NAME
10sctp_getladdrs \- Returns all locally bound addresses on a socket.
11.SH SYNOPSIS
12.nf
13.B #include <sys/types.h>
14.B #include <sys/socket.h>
15.B #include <netinet/sctp.h>
16.sp
17.BI "int sctp_getladdrs(int " sd ", sctp_assoc_t " assoc_id ,
18.BI " struct sockaddr **" addrs );
19.sp
20.BI "void sctp_freeladdrs(struct sockaddr *" addrs );
21.fi
22.SH DESCRIPTION
23.BR sctp_getladdrs
24returns all locally bound addresses on a socket. On return,
25.I addrs
26will point to a dynamically allocated packed array of
27.B sockaddr
28structures of the appropriate type for each local address. The caller
29should use
30.BR sctp_freeladdrs
31to free the memory. Note that the in/out parameter
32.I addrs
33must not be NULL.
34.PP
35If
36.I sd
37is an IPv4 socket, the addresses returned will be all IPv4 addresses. If
38.I sd
39is an IPv6 socket, the addresses returned can be a mix of IPv4 or IPv6
40addresses.
41.PP
42For one-to-many style sockets,
43.I id
44specifies the association to query. For one-to-one style sockets,
45.I id
46is ignored.
47.PP
48If the
49.I id
50field is set to 0, then the locally bound addresses are returned
51without regard to any particular association.
52.PP
53.BR sctp_freeladdrs
54frees all the resources allocated by
55.BR sctp_getladdrs
56.SH "RETURN VALUE"
57On success,
58.BR sctp_getladdrs
59returns the number of local addresses bound to the socket. If the socket
60is unbound, 0 is returned and the value of
61.I *addrs
62is undefined. On error,
63.BR sctp_getladdrs
64returns -1 and the value of
65.I *addrs
66is undefined.
67.SH "SEE ALSO"
68.BR sctp (7)
69.BR sctp_bindx (3),
70.BR sctp_connectx (3),
71.BR sctp_sendmsg (3),
72.BR sctp_sendv (3),
73.BR sctp_send (3),
74.BR sctp_recvmsg (3),
75.BR sctp_recvv (3),
76.BR sctp_peeloff (3),
77.BR sctp_getpaddrs (3),
78.BR sctp_opt_info (3),