blob: 7e663175727e99b1a55061dfb6066cd3ffaef056 [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_PEELOFF 3 2005-10-25 "Linux 2.6" "Linux Programmer's Manual"
9.SH NAME
10sctp_peeloff \- Branch off an association into a separate 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_peeloff(int " sd ", sctp_assoc_t " assoc_id );
18.BI "int sctp_peeloff_flags(int " sd ", sctp_assoc_t " assoc_id ", unsigned " flags );
19.fi
20.SH DESCRIPTION
21.B sctp_peeloff
22branches off an existing association
23.I assoc_id
24on a one-to-many style socket
25.I sd
26into a separate socket. The new socket is a one-to-one style socket.
27.PP
28This is particularly desirable when, for instance, the application wishes to
29have a number of sporadic message senders/receivers remain under the original
30one-to-many style socket, but branch off those assocations carrying high volume
31data traffic into their own separate socket descriptors.
32
33.B sctp_peeloff_flags
34is a variant of sctp_peeloff, in which flags describing the behavior of
35the newly peeled off socket can be specified. Currently the supported flags
36are:
37.TP
38.B SOCK_NONBLOCK
39Specifies that the new socket should not block on io operations.
40.TP
41.B SOCK_CLOEXEC
42Specifies that the new socket should be closed when the owning process calls
43exec.
44.SH "RETURN VALUE"
45On success, the new socket descriptor representing the branched-off asociation is returned.
46On error, \-1 is returned, and
47.I errno
48is set appropriately.
49.SH ERRORS
50.TP
51.B EBADF
52.I sd
53is not a valid descriptor.
54.TP
55.B EINVAL
56The assoc id passed is invalid or if the socket is a one-to-one style socket.
57.TP
58.B ENOTSOCK
59Argument is a descriptor for a file, not a socket.
60.SH NOTES
61.TP
62sctp_peeloff_flags is a linux specific variant of sctp_peeloff. While it will compile on other systems, its use will result in an error return. Portable code should use sctp_peeloff.
63.SH "SEE ALSO"
64.BR sctp (7)
65.BR sctp_bindx (3),
66.BR sctp_connectx (3),
67.BR sctp_sendmsg (3),
68.BR sctp_sendv (3),
69.BR sctp_send (3),
70.BR sctp_recvmsg (3),
71.BR sctp_recvv (3),
72.BR sctp_getpaddrs (3),
73.BR sctp_getladdrs (3),
74.BR sctp_opt_info (3),