xref: /freebsd/lib/libc/net/sctp_getpaddrs.3 (revision e1e636193db45630c7881246d25902e57c43d24e)
1.\" Copyright (c) 1983, 1991, 1993
2.\"	The Regents of the University of California.  All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\"    notice, this list of conditions and the following disclaimer in the
11.\"    documentation and/or other materials provided with the distribution.
12.\" 3. Neither the name of the University nor the names of its contributors
13.\"    may be used to endorse or promote products derived from this software
14.\"    without specific prior written permission.
15.\"
16.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26.\" SUCH DAMAGE.
27.\"
28.Dd February 2, 2024
29.Dt SCTP_GETPADDRS 3
30.Os
31.Sh NAME
32.Nm sctp_getpaddrs ,
33.Nm sctp_getladdrs
34.Nd return a list of addresses to the caller
35.Sh LIBRARY
36.Lb libc
37.Sh SYNOPSIS
38.In sys/types.h
39.In sys/socket.h
40.In netinet/sctp.h
41.Ft int
42.Fn sctp_getpaddrs "int s" "sctp_assoc_t asocid" "struct sockaddr **addrs"
43.Ft int
44.Fn sctp_getladdrs "int s" "sctp_assoc_t asocid" "struct sockaddr **addrs"
45.Sh DESCRIPTION
46The
47.Fn sctp_getpaddrs
48function is used to get the list of the peers addresses.
49The
50.Fn sctp_getladdrs
51function is used to get the list of the local addresses.
52The association of interest is identified by the
53.Fa asocid
54argument.
55The addresses are returned in a newly allocated
56array of socket addresses returned in the argument
57.Fa addrs
58upon success.
59.Pp
60After the caller is finished, the function
61.Fn sctp_freepaddrs
62or
63.Fn sctp_freeladdrs
64should be used to release the memory allocated by these
65calls.
66.Sh RETURN VALUES
67The call returns -1 upon failure and a count of
68the number of addresses returned in
69.Fa addrs
70upon success.
71.Sh ERRORS
72The functions can return the following errors:
73.Bl -tag -width Er
74.It Bq Er EINVAL
75An address listed has an invalid family or no
76addresses were provided.
77.It Bq Er ENOMEM
78The call cannot allocate memory to hold the
79socket addresses.
80.It Bq Er EBADF
81The argument
82.Fa s
83is not a valid descriptor.
84.It Bq Er ENOTSOCK
85The argument
86.Fa s
87is not a socket.
88.El
89.Sh SEE ALSO
90.Xr getsockopt 2 ,
91.Xr sctp_freeladdrs 3 ,
92.Xr sctp_freepaddrs 3 ,
93.Xr sctp 4
94.Rs
95.%A R. Stewart
96.%A M. Tuexen
97.%A K. Poon
98.%A P. Lei
99.%A V. Yasevich
100.%T Sockets API Extensions for the Stream Control Transmission Protocol (SCTP)
101.%R RFC 6458
102.%D December 2011
103.Re
104.Sh STANDARDS
105The
106.Fn sctp_getpaddrs
107and
108.Fn sctp_getladdrs
109functions conform to RFC 6458.
110