File: sctp_getladdrs.3

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