diff options
author | rrs <rrs@FreeBSD.org> | 2007-02-22 14:32:39 +0000 |
---|---|---|
committer | rrs <rrs@FreeBSD.org> | 2007-02-22 14:32:39 +0000 |
commit | ae6663525ac1c121369ed2987517cf2d29f6139a (patch) | |
tree | cd217c0beddbd5880de5487d7d696e782050ac87 /lib | |
parent | 5a82d0298943e1c4429659c6b6db3445d0ca3fc0 (diff) | |
download | FreeBSD-src-ae6663525ac1c121369ed2987517cf2d29f6139a.zip FreeBSD-src-ae6663525ac1c121369ed2987517cf2d29f6139a.tar.gz |
First cut of the sctp man pages. Still need work.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/net/Makefile.inc | 9 | ||||
-rw-r--r-- | lib/libc/net/sctp_bindx.3 | 109 | ||||
-rw-r--r-- | lib/libc/net/sctp_connectx.3 | 98 | ||||
-rw-r--r-- | lib/libc/net/sctp_freepaddrs.3 | 71 | ||||
-rw-r--r-- | lib/libc/net/sctp_getaddrlen.3 | 80 | ||||
-rw-r--r-- | lib/libc/net/sctp_getassocid.3 | 76 | ||||
-rw-r--r-- | lib/libc/net/sctp_getpaddrs.3 | 100 | ||||
-rw-r--r-- | lib/libc/net/sctp_opt_info.3 | 109 | ||||
-rw-r--r-- | lib/libc/net/sctp_recvmsg.3 | 272 | ||||
-rw-r--r-- | lib/libc/net/sctp_send.3 | 324 | ||||
-rw-r--r-- | lib/libc/net/sctp_sendmsg.3 | 297 | ||||
-rw-r--r-- | lib/libc/sys/Makefile.inc | 1 | ||||
-rw-r--r-- | lib/libc/sys/sctp_generic_recvmsg.2 | 76 | ||||
-rw-r--r-- | lib/libc/sys/sctp_generic_sendmsg.2 | 88 | ||||
-rw-r--r-- | lib/libc/sys/sctp_peeloff.2 | 82 |
15 files changed, 1791 insertions, 1 deletions
diff --git a/lib/libc/net/Makefile.inc b/lib/libc/net/Makefile.inc index ddc1a1b..39e1147 100644 --- a/lib/libc/net/Makefile.inc +++ b/lib/libc/net/Makefile.inc @@ -51,7 +51,10 @@ MAN+= addr2ascii.3 byteorder.3 ethers.3 eui64.3 \ inet.3 inet_net.3 \ inet6_opt_init.3 inet6_option_space.3 inet6_rth_space.3 \ inet6_rthdr_space.3 linkaddr.3 \ - nsdispatch.3 rcmd.3 rcmdsh.3 resolver.3 sockatmark.3 + nsdispatch.3 rcmd.3 rcmdsh.3 resolver.3 sockatmark.3 \ + sctp_bindx.3 sctp_connectx.3 sctp_freepaddrs.3 \ + sctp_getaddrlen.3 sctp_getassocid.3 sctp_getpaddrs.3 \ + sctp_opt_info.3 sctp_recvmsg.3 sctp_send.3 sctp_sendmsg.3 \ MLINKS+=addr2ascii.3 ascii2addr.3 MLINKS+=byteorder.3 htonl.3 byteorder.3 htons.3 byteorder.3 ntohl.3 \ @@ -81,6 +84,10 @@ MLINKS+=inet.3 addr.3 inet.3 inet_addr.3 inet.3 inet_aton.3 \ inet.3 inet_network.3 inet.3 inet_ntoa.3 \ inet.3 inet_ntop.3 inet.3 inet_pton.3 \ inet.3 network.3 inet.3 ntoa.3 +MLINKS+= sctp_send.3 sctp_sendx.3 +MLINKS+= sctp_sendmsg.3 sctp_sendmsgx.3 +MLINKS+= sctp_freepaddrs.3 sctp_freeladdrs.3 +MLINKS+= sctp_getpaddrs.3 sctp_getladdrs.3 MLINKS+=inet_net.3 inet_net_ntop.3 inet_net.3 inet_net_pton.3 MLINKS+=inet6_opt_init.3 inet6_opt_append.3 \ inet6_opt_init.3 inet6_opt_find.3 \ diff --git a/lib/libc/net/sctp_bindx.3 b/lib/libc/net/sctp_bindx.3 new file mode 100644 index 0000000..0c0b10b --- /dev/null +++ b/lib/libc/net/sctp_bindx.3 @@ -0,0 +1,109 @@ +.\" Copyright (c) 1983, 1991, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" From: @(#)send.2 8.2 (Berkeley) 2/21/94 +.\" $FreeBSD$ +.\" +.Dd December 15, 2006 +.Dt SCTP_BINDX 3 +.Os +.Sh NAME +.Nm sctp_bindx +.Nd bind or unbind an SCTP socket to a list of addresses. +.Sh LIBRARY +.Lb libc +.Sh SYNOPSIS +.In sys/types.h +.In sys/socket.h +.In sys/sctp.h +.Ft int +.Fn sctp_bindx "int s" "struct sockaddr *addrs" "int num" "int type" +.Sh DESCRIPTION +The +.Fn sctp_bindx +call binds or unbinds a address or a list of addresses to an +SCTP endpoint. This allows a user to bind a subset of +addresses. The +.Fn sctp_bindx +call operates similarly to +.Fn bind +but allows a list of addresses and also allows a bind or an +unbind. The argument +.Fa s +must be a valid SCTP socket descriptor. The argument +.Fa addrs +is a list of addresses (where the list may be only 1 in +length) that the user wishes to bind or unbind to the +socket. The argument +.Fa type +must be one of the following values. +.Pp +.Dv SCTP_BINDX_ADD_ADDR +This value indicates that the listed address(es) need to +be added to the endpoint. +.Pp +.Dv SCTP_BINDX_DEL_ADDR +This value indicates that the listed address(es) need to +be removed from the endpoint. +.Pp +Note that when a user adds or deletes an address to an +association if the dynamic address flag "net.inet.sctp.auto_asconf" +is enabled any associations in the endpoint will attempt to +have the address(es) added dynamically to the existing +association. +.Sh RETURN VALUES +The call returns 0 on success and -1 upon failure. +.Sh ERRORS +The +.Fn sctp_bindx +can return the following errors. +.Bl -tag -width Er +.It Bq Er EINVAL +This value is returned if the +.Fa type +field is not one of the allowed values (see above). +.It Bq Er ENOMEM +This value is returned if the number of addresses +being added causes a memory allocation failure in +the call. +.It Bq Er EBADF +The argument +.Fa s +is not a valid descriptor. +.It Bq Er ENOTSOCK +The argument +.Fa s +is not a socket. +.El +.Sh SEE ALSO +.Xr sctp 4 , +.Xr bind 2 , + diff --git a/lib/libc/net/sctp_connectx.3 b/lib/libc/net/sctp_connectx.3 new file mode 100644 index 0000000..b556472 --- /dev/null +++ b/lib/libc/net/sctp_connectx.3 @@ -0,0 +1,98 @@ +.\" Copyright (c) 1983, 1991, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd December 15, 2006 +.Dt SCTP_CONNECTX 3 +.Os +.Sh NAME +.Nm sctp_connectx +.Nd connect an sctp socket with multiple destination addresses. +.Sh LIBRARY +.Lb libc +.Sh SYNOPSIS +.In sys/types.h +.In sys/socket.h +.In sys/sctp.h +.Ft int +.Fn sctp_connectx "int s" "struct sockaddr *" "int addrcnt" +.Sh DESCRIPTION +The +.Fn sctp_connectx +call attempts to initiate an association to a peer SCTP +endpoint. The call operates similarly to +.Fn connect +but it also provides the ability to specify multiple destination +addresses for the peer. This allows a fault tolerant method +of initiating an association. When one of the peers addresses +is unreachable, the subsequent listed addresses will also be used +to setup the association with the peer. +.Pp +The user also needs to consider that any address listed in an +.Fn sctp_connectx +call is also consider "confirmed". +A confirmed address is one in +which the SCTP transport will trust is a part of the association +and it will not send a confirmation heartbeat to it with +a random nonce. +.Pp +If the peer SCTP stack does not list one or more of +the provided addresses in its response message then +the extra addresses sent in the +.Fn sctp_connectx +call will be silently discarded from the association. +.Sh RETURN VALUES +The call returns 0 on success and -1 upon failure. +.Sh ERRORS +The +.Fn sctp_connectx +can return the following errors. +.Bl -tag -width Er +.It Bq Er EINVAL +An address listed has an invalid family or no +addresses were provided. +.It Bq Er E2BIG +The size of the address list exceeds the amount of +data provided. +.It Bq Er EBADF +The argument +.Fa s +is not a valid descriptor. +.It Bq Er ENOTSOCK +The argument +.Fa s +is not a socket. +.El +.Sh SEE ALSO +.Xr sctp 4 , +.Xr connect 2 , + diff --git a/lib/libc/net/sctp_freepaddrs.3 b/lib/libc/net/sctp_freepaddrs.3 new file mode 100644 index 0000000..74c810a --- /dev/null +++ b/lib/libc/net/sctp_freepaddrs.3 @@ -0,0 +1,71 @@ +.\" Copyright (c) 1983, 1991, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" From: @(#)send.2 8.2 (Berkeley) 2/21/94 +.\" $FreeBSD$ +.\" +.Dd December 15, 2006 +.Dt SCTP_FREEPADDRS 3 +.Os +.Sh NAME +.Nm sctp_freepaddrs +.Nm sctp_freeladdrs +.Nd release the memory returned from a previous call. +.Sh LIBRARY +.Lb libc +.Sh SYNOPSIS +.In sys/types.h +.In sys/socket.h +.In sys/sctp.h +.Ft void +.Fn sctp_freepaddrs "struct sockaddr *" +.Ft void +.Fn sctp_freeladdrs "struct sockaddr *" + +.Sh DESCRIPTION +The function +.Fn sctp_freepaddrs +and +.Fn sctp_freeladdrs +are used to release the memory allocated by previous +calls to +.Fn sctp_getpaddrs +or +.Fn sctp_getladdrs +respectively. +.Sh RETURN VALUES +none. +.El +.Sh SEE ALSO +.Xr sctp 4 , +.Xr sctp_getpaddrs 3 , +.Xr sctp_getladdrs 3 , + diff --git a/lib/libc/net/sctp_getaddrlen.3 b/lib/libc/net/sctp_getaddrlen.3 new file mode 100644 index 0000000..64a83f6 --- /dev/null +++ b/lib/libc/net/sctp_getaddrlen.3 @@ -0,0 +1,80 @@ +.\" Copyright (c) 1983, 1991, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" From: @(#)send.2 8.2 (Berkeley) 2/21/94 +.\" $FreeBSD$ +.\" +.Dd December 15, 2006 +.Dt SCTP_GETADDRLEN 3 +.Os +.Sh NAME +.Nm sctp_getaddrlen +.Nd return the address length of an address family +.Sh LIBRARY +.Lb libc +.Sh SYNOPSIS +.In sys/types.h +.In sys/socket.h +.In sys/sctp.h +.Ft int +.Fn sctp_getaddrlen "sa_family_t family"" +.Sh DESCRIPTION +The +.Fn sctp_getaddrlen +returns the size of a specific address family. This function +is provided for application binary compatability since it +provides the application with the size the operating system +thinks the specific address family is. Note that the function +will actually create an SCTP socket and then gather the +information via a +.Fn getsockopt +system calls. If for some reason a SCTP socket cannot +be created or the getsockopt fails, an error will be returned +with errno set as specified in the +.Fn socket +or +.Fn getsockopt +system call. +.Sh RETURN VALUES +The call returns the number of bytes that the operating +system expects for the specific address family or -1. +.Sh ERRORS +The +.Fn sctp_getaddrlen +.Bl -tag -width Er +.It Bq Er EINVAL +The address family specified does NOT exist. +.El +.Sh SEE ALSO +.Xr sctp 4 , +.Xr socket 2 , +.Xr getsockopt 2 , + diff --git a/lib/libc/net/sctp_getassocid.3 b/lib/libc/net/sctp_getassocid.3 new file mode 100644 index 0000000..e3dc7d3 --- /dev/null +++ b/lib/libc/net/sctp_getassocid.3 @@ -0,0 +1,76 @@ +.\" Copyright (c) 1983, 1991, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd December 15, 2006 +.Dt SCTP_GETASSOCID 3 +.Os +.Sh NAME +.Nm sctp_getassocid +.Nd return an association id for a specified socket address. +.Sh LIBRARY +.Lb libc +.Sh SYNOPSIS +.In sys/types.h +.In sys/socket.h +.In sys/sctp.h +.Ft sctp_assoc_t +.Fn sctp_getassocid "int s" "struct sockaddr *addr" +.Sh DESCRIPTION +The +.Fn sctp_getassocid +call attempts to lookup the specified socket address +.Fa addr +and find the respective association identification. +.Pp +.Sh RETURN VALUES +The call returns the association id upon success and a +0 is returned upon failure. +.Sh ERRORS +The +.Fn sctp_getassocid +function can return the following errors. +.Bl -tag -width Er +.It Bq Er ENOENT +The address does not have an association setup to it. +.It Bq Er EBADF +The argument +.Fa s +is not a valid descriptor. +.It Bq Er ENOTSOCK +The argument +.Fa s +is not a socket. +.El +.Sh SEE ALSO +.Xr sctp 4 , + diff --git a/lib/libc/net/sctp_getpaddrs.3 b/lib/libc/net/sctp_getpaddrs.3 new file mode 100644 index 0000000..8ff3670 --- /dev/null +++ b/lib/libc/net/sctp_getpaddrs.3 @@ -0,0 +1,100 @@ +.\" Copyright (c) 1983, 1991, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" From: @(#)send.2 8.2 (Berkeley) 2/21/94 +.\" $FreeBSD$ +.\" +.Dd December 15, 2006 +.Dt SCTP_GETPADDR 3 +.Os +.Sh NAME +.Nm sctp_getpaddrs +.Nm sctp_getladdrs +.Nd return a list of addresses to the caller. +.Sh LIBRARY +.Lb libc +.Sh SYNOPSIS +.In sys/types.h +.In sys/socket.h +.In sys/sctp.h +.Ft int +.Fn sctp_getpaddrs "int s" "sctp_assoc_t asocid" "struct sockaddr **addrs" +.Ft int +.Fn sctp_getladdrs "int s" "sctp_assoc_t asocid" "struct sockaddr **addrs" +.Sh DESCRIPTION +The +.Fn sctp_getpaddrs +function is used to get the list of the peers addresses. +The +.Fn sctp_getladdrs +function is used to get the list of the local addresses. +The association of interest is identified by the +.Fa asocid +argument. The addresses are returned in a newly allocated +array of socket addresses returned in the argument +.Fa addrs +upon success. + .Pp +After the caller is through the function +.Fn sctp_freepaddrs +or +.Fn sctp_freeladdrs +should be used to release the memory allocated by these +calls. +.Sh RETURN VALUES +The call returns -1 upon failure and a count of +the number of addresses returned in +.Fa addrs +upon success. +.Sh ERRORS +The functions can return the following errors. +.Bl -tag -width Er +.It Bq Er EINVAL +An address listed has an invalid family or no +addresses were provided. +.It Bq Er ENOMEM +The call cannot allocate memory to hold the +socket addresses. +.It Bq Er EBADF +The argument +.Fa s +is not a valid descriptor. +.It Bq Er ENOTSOCK +The argument +.Fa s +is not a socket. +.El +.Sh SEE ALSO +.Xr sctp 4 , +.Xr sctp_freepaddrs 3 , +.Xr sctp_freeladdrs 3 , +.Xr getsockopt 2 , + diff --git a/lib/libc/net/sctp_opt_info.3 b/lib/libc/net/sctp_opt_info.3 new file mode 100644 index 0000000..00b8af5 --- /dev/null +++ b/lib/libc/net/sctp_opt_info.3 @@ -0,0 +1,109 @@ +.\" Copyright (c) 1983, 1991, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" From: @(#)send.2 8.2 (Berkeley) 2/21/94 +.\" $FreeBSD$ +.\" +.Dd December 15, 2006 +.Dt SCTP_OPT_INFO 3 +.Os +.Sh NAME +.Nm sctp_opt_info +.Nd get sctp socket information +.Sh LIBRARY +.Lb libc +.Sh SYNOPSIS +.In sys/types.h +.In sys/socket.h +.In sys/sctp.h +.Ft int +.Fn sctp_opt_info "int s" "sctp_assoc_t" "int opt" "void *arg" "socklen_t *size" +.Sh DESCRIPTION +The +.Fn sctp_opt_info +call provides a multi-os compatible method for getting +specific +.Fn getsockopt +data where an association identification needs to be passed +into the operating system. For FreeBSD a direct +.Fn getsockopt +may be used, since FreeBSD has the ability to pass information +into the operating system on a +.Fn getsockopt +call. Other operating systems may not have this ability. For those +who wish to write portable code amongst multiple operating system +this call should be used for the for the following sctp +socket options. +.Pp +.Dv SCTP_RTOINFO +.Pp +.Dv SCTP_ASSOCINFO +.Pp +.Dv SCTP_PRIMARY_ADDR +.Pp +.Dv SCTP_SET_PEER_PRIMARY_ADDR +.Pp +.Dv SCTP_STATUS +.Pp +.Dv SCTP_GET_PEER_ADDR_INFO +.Pp +.Dv SCTP_AUTH_ACTIVE_KEY +.Pp +.Dv SCTP_PEER_AUTH_CHUNKS +.Pp +.Dv SCTP_LOCAL_AUTH_CHUNKS +.Sh ERRORS +The +.Fn sctp_opt_info +can return the following errors. +.Bl -tag -width Er +.It Bq Er EINVAL +The argument +.Fa arg +value was invalid. +.It Bq Er EOPNOTSUPP +The argument +.Fa opt +was not one of the above listed SCTP socket +options. +.It Bq Er EBADF +The argument +.Fa s +is not a valid descriptor. +.It Bq Er ENOTSOCK +The argument +.Fa s +is not a socket. +.El +.Sh SEE ALSO +.Xr sctp 4 , +.Xr getsockopt 2 , + diff --git a/lib/libc/net/sctp_recvmsg.3 b/lib/libc/net/sctp_recvmsg.3 new file mode 100644 index 0000000..a7a2019 --- /dev/null +++ b/lib/libc/net/sctp_recvmsg.3 @@ -0,0 +1,272 @@ +.\" Copyright (c) 1983, 1991, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd December 15, 2006 +.Dt SCTP_RECVMSG 3 +.Os +.Sh NAME +.Nm sctp_recvmsg +.Nd send a message from an SCTP socket +.Sh LIBRARY +.Lb libc +.Sh SYNOPSIS +.In sys/types.h +.In sys/socket.h +.In sys/sctp.h +.Ft ssize_t +.Ft ssize_t +.Fn sctp_recvmsg "int s" "void *msg" "size_t len" "struct sockaddr * restrict from" "socklen_t * restrict fromlen" "struct sctp_sndrcvinfo *sinfo" "int *flags" +.Sh DESCRIPTION +The +.Fn sctp_recvmsg +system calls +is used to receive a message from another SCTP endpoint. +The +.Fn sctp_recvmsg +call is used by one-to-one (SOCK_STREAM) type sockets after a +sucessful +.Fn connect 2 +call or after the application has performed a +.Fn listen +followed by a sucessful +.Fn accept 2 +For a one-to-many (SOCK_SEQPACKET)type socket, an endpoint may call +.Fn sctp_recvmsg +after having implicitly started an association via one +of the send calls including +.Fn sctp_sendmsg 2 +.Fn sendto 2 +and +.Fn sendmsg 2 +Or, an application may also receive a message after having +called +.Fn listen 2 +with a postive backlog to enable the reception of new associations. +.Pp +.Pp +The address of the sender is held in the +.Fa from +argument with +.Fa fromlen +specifying its size. At the completion of a sucessful +.Fn sctp_recvmsg +call +.Fa from +will hold the address of the peer and +.Fa fromlen +will hold the length of that address. Note that +the address is bounded by the inital value of +.Fa fromlen +which is used as an in/out variable. +.Pp +The length of the message +.Fa msg +to be received is bounded by +.Fa len . +If the message is to long to fit in the users +receive buffer, then the +.Fa flags +argument will NOT have the MSG_EOF flag +applied. If the message is a complete message then +the +.Fa flags +argument will have MSG_EOF set. Locally detected errors are +indicated by a return value of -1 with errno set accordingly. +The +.Fa flags +argument may also hold the value MSG_NOTIFICATION. When this +occurs this indicates that the message received is NOT from +the peer endpoint, but instead is a notification from the +SCTP stack (see +.Fn sctp 4 +for more details). Note that no notifications are ever +given unless the user subscribes to such notifications using +the SCTP_EVENTS socket option. +.Pp +If no messages is available at the socket then +.Fn sctp_recvmsg +normally blocks on the reception of a message or NOTIFICATION, unless the socket has been placed in +non-blocking I/O mode. +The +.Xr select 2 +system call may be used to determine when it is possible to +receive a message. +.Pp + +The +.Fa sinfo +argument is defined as follows. +.Bd -literal +struct sctp_sndrcvinfo { + u_int16_t sinfo_stream; /* Stream arriving on */ + u_int16_t sinfo_ssn; /* Stream Sequence Number */ + u_int16_t sinfo_flags; /* Flags on the incoming message */ + u_int32_t sinfo_ppid; /* The ppid field */ + u_int32_t sinfo_context; /* context field */ + u_int32_t sinfo_timetolive; /* not used by sctp_recvmsg */ + u_int32_t sinfo_tsn; /* The transport sequence number */ + u_int32_t sinfo_cumtsn; /* The cumulative acknowledgment point */ + sctp_assoc_t sinfo_assoc_id; /* The association id of the peer */ +}; +.Ed + +The +.Fa sinfo->sinfo_ppid +is an opaque 32 bit value that is passed transparently +through the stack from the peer endpoint. +Note that the stack passes this value without regard to byte +order. +.Pp +The +.Fa sinfo->sinfo_flags +field may include the following: +.Bd -literal +#define SCTP_UNORDERED 0x0400 /* Message is un-ordered */ +.Ed +.Pp +The +.Dv SCTP_UNORDERED +flag is used to specify that the message arrived with no +specific order and was delivered to the peer application +as soon as possible. When this flag is absent the message +was delivered in order within the stream it was received. +.Pp +.Fa sinfo->sinfo_stream +is the SCTP stream that the message was received on. +Streams in SCTP are reliable (or partially reliable) flows of ordered +messages. +.Pp + The +.Fa sinfo->sinfo_context +field is used only if the local application set a association level +context with the SCTP_CONTEXT socket option. +Optionally a user process can use this value to index some application +specific data structure for all data coming from a specific +association. +.Pp +The +.Fa sinfo->sinfo_ssn +will hold the stream sequence number assigned +by the peer endpoint if the message is NOT unordered. +For unordered messages this field holds an undefined value. +.Pp +The +.Fa sinfo->sinfo_tsn +holds a transport sequence number (TSN) that was assigned +to this message by the peer endpoint. For messages that fit in or less +than the path MTU this will be the only TSN assigned. +Note that for messages that span multiple TSN's this +value will be one of the TSN's that was used on the +message. +.Pp +The +.Fa sinfo->sinfo_cumtsn +holds the current cumulative acknowledgment point of +the transport association. Note that this may be larger +or smaller than the TSN assigned to the message itself. +.Pp +The +sinfo->sinfo_assoc_id +is the unique association identification that was assigned +to the association. For one-to-many (SOCK_SEQPACKET) type +sockets this value can be used to send data to the peer without +the use of an address field. It is also quite useful in +setting various socket options on the specific association +(see +.Fn sctp 4 +). +.Pp +The +sinfo->info_timetolive +field is not used by +.Fa sctp_recvmsg . +.Sh RETURN VALUES +The call returns the number of characters sent, or -1 +if an error occurred. +.Sh ERRORS +The +.Fn sctp_recvmsg +system call +fail if: +.Bl -tag -width Er +.It Bq Er EBADF +An invalid descriptor was specified. +.It Bq Er ENOTSOCK +The argument +.Fa s +is not a socket. +.It Bq Er EFAULT +An invalid user space address was specified for an argument. +.It Bq Er EMSGSIZE +The socket requires that message be sent atomically, +and the size of the message to be sent made this impossible. +.It Bq Er EAGAIN +The socket is marked non-blocking and the requested operation +would block. +.It Bq Er ENOBUFS +The system was unable to allocate an internal buffer. +The operation may succeed when buffers become available. +.It Bq Er ENOBUFS +The output queue for a network interface was full. +This generally indicates that the interface has stopped sending, +but may be caused by transient congestion. +.It Bq Er EHOSTUNREACH +The remote host was unreachable. +.It Bq Er ENOTCON +On a one to one style socket no association exists. +.It Bq Er ECONNRESET +An abort was received by the stack while the user was +attempting to send data to the peer. +.It Bq Er ENOENT +On a one to many style socket no address is specified +so that the association cannot be located or the +SCTP_ABORT flag was specified on a non-existing association. +.It Bq Er EPIPE +The socket is unable to send anymore data +.Dv ( SBS_CANTSENDMORE +has been set on the socket). +This typically means that the socket +is not connected and is a one-to-one style socket. +.El +.Sh SEE ALSO +.Xr sctp 4 , +.Xr sendmsg 3 , +.Xr sctp_sendmsg 3 , +.Xr sctp_send 3 , +.Xr getsockopt 2 , +.Xr setsockopt 2 , +.Xr recv 2 , +.Xr select 2 , +.Xr socket 2 , +.Xr write 2 + diff --git a/lib/libc/net/sctp_send.3 b/lib/libc/net/sctp_send.3 new file mode 100644 index 0000000..3a6a879 --- /dev/null +++ b/lib/libc/net/sctp_send.3 @@ -0,0 +1,324 @@ +.\" Copyright (c) 1983, 1991, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd December 15, 2006 +.Dt SCTP_SEND 3 +.Os +.Sh NAME +.Nm sctp_send +.Nm sctp_sendx +.Nd send a message from an SCTP socket +.Sh LIBRARY +.Lb libc +.Sh SYNOPSIS +.In sys/types.h +.In sys/socket.h +.In sys/sctp.h +.Ft ssize_t +.Fn sctp_send "int sd" "const void *msg" "size_t len" "const struct sctp_sndrcvinfo *sinfo" "int flags" +.Ft ssize_t +.Fn sctp_sendx "int sd" "const void *msg" "size_t len" "struct sockaddr *addrs" "int addrcnt" "const struct sctp_sndrcvinfo *sinfo" "int flags" +.Sh DESCRIPTION +The +.Fn sctp_send +system calls +is used to transmit a message to another SCTP endpoint. +The +.Fn sctp_send +may be used to send data to an existing association for both +one-to-many (SOCK_SEQPACKET) and one-to-one (SOCK_STREAM) socket types. +The length of the message +.Fa msg +is given by +.Fa len . +If the message is too long to pass atomically through the +underlying protocol, the errno is set to +.Er EMSGSIZE +a -1 is returned, and +the message is not transmitted. +.Pp +No indication of failure to deliver is implicit in a +.Fn sctp_send +Locally detected errors are indicated by a return value of -1. +.Pp +If no messages space is available at the socket to hold +the message to be transmitted, then +.Fn sctp_send +normally blocks, unless the socket has been placed in +non-blocking I/O mode. +The +.Fn select 2 +system call may be used to determine when it is possible to +send more data on one-to-one type (SOCK_STREAM) sockets. +.Pp +The +.Fa sinfo +structure is used to control various SCTP features +and has the following format: +.Bd -literal +struct sctp_sndrcvinfo { + u_int16_t sinfo_stream; /* Stream sending to */ + u_int16_t sinfo_ssn; /* valid for recv only */ + u_int16_t sinfo_flags; /* flags to control sending */ + u_int32_t sinfo_ppid; /* ppid field */ + u_int32_t sinfo_context; /* context field */ + u_int32_t sinfo_timetolive; /* timetolive for PR-SCTP */ + u_int32_t sinfo_tsn; /* valid for recv only */ + u_int32_t sinfo_cumtsn; /* valid for recv only */ + sctp_assoc_t sinfo_assoc_id; /* The association id */ +}; +.Ed +The +.Fa sinfo->sinfo_ppid +argument is an opaque 32 bit value that is passed transparently +through the stack to the peer endpoint. It will be available on +reception of a message (see +.Fn sctp_recvmsg 2 +). Note that the stack passes this value without regard to byte +order. +.Pp +The +.Fa sinfo->sinfo_flags +argument may include one or more of the following: +.Bd -literal +#define SCTP_EOF 0x0100 /* Start a shutdown procedures */ +#define SCTP_ABORT 0x0200 /* Send an ABORT to peer */ +#define SCTP_UNORDERED 0x0400 /* Message is un-ordered */ +#define SCTP_ADDR_OVER 0x0800 /* Override the primary-address */ +#define SCTP_SENDALL 0x1000 /* Send this on all associations */ + /* for the endpoint */ +/* The lower byte is an enumeration of PR-SCTP policies */ +#define SCTP_PR_SCTP_TTL 0x0001 /* Time based PR-SCTP */ +#define SCTP_PR_SCTP_BUF 0x0002 /* Buffer based PR-SCTP */ +#define SCTP_PR_SCTP_RTX 0x0003 /* Number of retransmissions based PR-SCTP */ +.Ed +.Pp +The flag +.Dv SCTP_EOF +is used to instruct the SCTP stack to queue this message +and then start a graceful shutdown of the association. All +remaining data in queue will be sent after which the association +will be shutdown. +.Pp +.Dv SCTP_ABORT +is used to immediately terminate an association. An abort +is sent to the peer and the local TCB is destroyed. +.Pp +.Dv SCTP_UNORDERED +is used to specify that the message being sent has no +specific order and should be delivered to the peer application +as soon as possible. When this flag is absent messages +are delivered in order within the stream they are sent, but without +respect to order to peer streams. +.Pp +The flag +.Dv SCTP_ADDR_OVER +is used to specify that an specific address should be used. Normally +SCTP will use only one of a multi-homed peers address as the primary +address to send to. By default, no matter what the +.Fa to +argument is, this primary address is used to send data. By specifying +this flag, the user is asking the stack to ignore the primary address +and instead use the specified address not only has a lookup mechanism +to find the association but also has the actual address to send to. +.Pp +For a one-to-many type (SOCK_SEQPACKET) socket the flag +.Dv SCTP_SENDALL +can be used as a convient way to make one send call and have +all associations that are under the socket get a copy of the message. +Note that this mechanism is quite efficent and makes only one actual +copy of the data which is shared by all the associations for sending. +.Pp +The remaining flags are used for the partial reliabilty extension (RFC3758) +and will only be effective if the peer endpoint supports this extension. +This option specify's what local policy the local endpoint should use +in skipping data. If none of these options are set, then data is +never skipped over. +.Pp +.Dv SCTP_PR_SCTP_TTL +Is used to indicate that a time based lifetime is being applied +to the data. The +.Fa sinfo->sinfo_timetolive +argument is then a number of milliseconds for which the data is +attempted to be transmitted. If that many milliseconds ellapses +and the peer has not acknowledge the data, the data will be +skipped and no longer transmitted. Note that this policy does +not even assure that the data will ever be sent. In times of a congestion +with large amounts of data being queued, the +.Fa sinfo->sinfo_timetolive +may expire before the first transmission is ever made. +.Pp +The +.Dv SCTP_PR_SCTP_BUF +based policy transforms the +.Fa sinfo->sinfo_timetolive +field into a total number of bytes allowed on the outbound +send queue. If that number or more bytes are in queue, then +other buffer based sends are looked to be removed and +skipped. Note that this policy may also result in the data +never being sent if no buffer based sends are in queue and +the maximum specified by +.Fa timetolive +bytes is in queue. +.Pp +The +.Dv SCTP_PR_SCTP_RTX +policy transforms the +.Fa sinfo->sinfo_timetolive +into a number of retransmissions to allow. This policy +always assures that at a minimum one send attempt is +made of the data. After which no more than +.Fa sinfo->sinfo_timetolive +retransmissions will be made before the data is skipped. +.Pp +.Fa sinfo->sinfo_stream +is the SCTP stream that you wish to send the +message on. Streams in SCTP are reliable (or partially reliable) flows of ordered +messages. +.Pp +The +.Fa sinfo->sinfo_assoc_id +field is used to +select the association to send to on an one-to-many socket. For a +one-to-one socket, this field is ignored. +.Pp +.Fa sinfo->sinfo_context +field is used only in the event the message cannot be sent. This is an opaque +value that the stack retains and will give to the user when a failed send +is given if that notification is enabled (see +.Tn sctp +). Normally a user process can use this value to index some application +specific data structure when a send cannot be fulfilled. +.Pp +The +.Fa flags +argument holds the same meaning and values has those found in +.Fn sendmsg 2 +but is generally ignored by SCTP. +.Pp +The fields +.Fa sinfo->sinfo_ssn , +.Fa sinfo->sinfo_tsn , +and +.Fa sinfo->sinfo_cumtsn +are used only when receiving messages and are thus ignored by +.Fn sctp_send. +The function +.Fn sctp_sendx +has the same properties as +.Fn sctp_send +with the additional arguments of an array of sockaddr structures +passed in. With the +.Fa addrs +argument being given as an array of addresses to be sent to and +the +.Fa addrcnt +argument indicating how many socket addresses are in the passed +in array. Note that all of the addresses will only be used +when an implicit association is being setup. This allows the +user the equivilant behavior as doing a +.Fn sctp_connectx +followed by a +.Fn sctp_send +to the association. Note that if the association id. +.Fa sinfo->sinfo_assoc_id +field is 0, then the first address will be used to look up +the association in place of the association id. If both +an address and and association id are specified, the association +id has priority. +.Sh RETURN VALUES +The call returns the number of characters sent, or -1 +if an error occurred. +.Sh ERRORS +The +.Fn sctp_send +system call +fail if: +.Bl -tag -width Er +.It Bq Er EBADF +An invalid descriptor was specified. +.It Bq Er ENOTSOCK +The argument +.Fa s +is not a socket. +.It Bq Er EFAULT +An invalid user space address was specified for an argument. +.It Bq Er EMSGSIZE +The socket requires that message be sent atomically, +and the size of the message to be sent made this impossible. +.It Bq Er EAGAIN +The socket is marked non-blocking and the requested operation +would block. +.It Bq Er ENOBUFS +The system was unable to allocate an internal buffer. +The operation may succeed when buffers become available. +.It Bq Er ENOBUFS +The output queue for a network interface was full. +This generally indicates that the interface has stopped sending, +but may be caused by transient congestion. +.It Bq Er EHOSTUNREACH +The remote host was unreachable. +.It Bq Er ENOTCON +On a one to one style socket no association exists. +.It Bq Er ECONNRESET +An abort was received by the stack while the user was +attempting to send data to the peer. +.It Bq Er ENOENT +On a one to many style socket no address is specified +so that the association cannot be located or the +SCTP_ABORT flag was specified on a non-existing association. +.It Bq Er EPIPE +The socket is unable to send anymore data +.Dv ( SBS_CANTSENDMORE +has been set on the socket). +This typically means that the socket +is not connected and is a one-to-one style socket. +.El +.Sh SEE ALSO +.Xr sctp 4 , +.Xr sendmsg 2 , +.Xr sctp_sendmsg 3 , +.Xr sctp_recvmsg 3 , +.Xr sctp_connectx 3 , +.Xr getsockopt 2 , +.Xr recv 2 , +.Xr select 2 , +.Xr socket 2 , +.Xr write 2 +.Sh BUGS +Because +.Fn sctp_send +may have multiple associations under one endpoint, a +select on write will only work for a one-to-one style +socket. + diff --git a/lib/libc/net/sctp_sendmsg.3 b/lib/libc/net/sctp_sendmsg.3 new file mode 100644 index 0000000..b771bc0 --- /dev/null +++ b/lib/libc/net/sctp_sendmsg.3 @@ -0,0 +1,297 @@ +.\" Copyright (c) 1983, 1991, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" From: @(#)send.2 8.2 (Berkeley) 2/21/94 +.\" $FreeBSD$ +.\" +.Dd December 15, 2006 +.Dt SCTP_SENDMSG 3 +.Os +.Sh NAME +.Nm sctp_sendmsg +.Nm sctp_sendmsgx +.Nd send a message from an SCTP socket +.Sh LIBRARY +.Lb libc +.Sh SYNOPSIS +.In sys/types.h +.In sys/socket.h +.In sys/sctp.h +.Ft ssize_t +.Fn sctp_sendmsg "int s" "const void *msg" "size_t len" "const struct sockaddr *to" "socklen_t tolen" "uint32_t ppid" "uint32_t flags" "uint16_t stream_no" "uint32_t timetolive" "uint32_t context" +.Ft ssize_t +.Fn sctp_sendmsgx "int s" "const void *msg" "size_t len" "const struct sockaddr *to" "int addrcnt" "uint32_t ppid" "uint32_t flags" "uint16_t stream_no" "uint32_t timetolive" "uint32_t context" + +.Sh DESCRIPTION +The +.Fn sctp_sendmsg +system calls +is used to transmit a message to another SCTP endpoint. +The +.Fn sctp_sendmsg +may be used at any time. If the socket is a one-to-many type (SOCK_SEQPACKET) +socket then an attempt to send to an address that no association exists to will +implicitly create a new association. Data sent in such an instance will result in +the data being sent on the third leg of the SCTP four-way handshake. Note that if +the socket is a one-to-one type (SOCK_STREAM) socket then an association must +be in existance (by use of the +.Fn connect 2 +system call). Calling +.Fn sctp_sendmsg +or +.Fn sctp_sendmsgx +on a non-connected one-to-one socket will result in the errno being set to +.Er ENOTCONN +a -1 being returned, and the message is not transmitted. +.Pp +The address of the target is given by +.Fa to +with +.Fa tolen +specifying its size. +The length of the message +.Fa msg +is given by +.Fa len . +If the message is too long to pass atomically through the +underlying protocol, the errno is set to +.Er EMSGSIZE +a -1 is returned, and +the message is not transmitted. +.Pp +No indication of failure to deliver is implicit in a +.Fn sctp_sendmsg 2 +Locally detected errors are indicated by a return value of -1. +.Pp +If no messages space is available at the socket to hold +the message to be transmitted, then +.Fn sctp_sendmsg 2 +normally blocks, unless the socket has been placed in +non-blocking I/O mode. +The +.Fn select 2 +system call may be used to determine when it is possible to +send more data on one-to-one type (SOCK_STREAM) sockets. +.Pp +The +.Fa ppid +argument is an opaque 32 bit value that is passed transparently +through the stack to the peer endpoint. It will be available on +reception of a message (see +.Fn sctp_recvmsg 2 +). Note that the stack passes this value without regard to byte +order. +.Pp +The +.Fa flags +argument may include one or more of the following: +.Bd -literal +#define SCTP_EOF 0x0100 /* Start a shutdown procedures */ +#define SCTP_ABORT 0x0200 /* Send an ABORT to peer */ +#define SCTP_UNORDERED 0x0400 /* Message is un-ordered */ +#define SCTP_ADDR_OVER 0x0800 /* Override the primary-address */ +#define SCTP_SENDALL 0x1000 /* Send this on all associations */ + /* for the endpoint */ +/* The lower byte is an enumeration of PR-SCTP policies */ +#define SCTP_PR_SCTP_TTL 0x0001 /* Time based PR-SCTP */ +#define SCTP_PR_SCTP_BUF 0x0002 /* Buffer based PR-SCTP */ +#define SCTP_PR_SCTP_RTX 0x0003 /* Number of retransmissions based PR-SCTP */ +.Ed +.Pp +The flag +.Dv SCTP_EOF +is used to instruct the SCTP stack to queue this message +and then start a graceful shutdown of the association. All +remaining data in queue will be sent after which the association +will be shutdown. +.Pp +.Dv SCTP_ABORT +is used to immediately terminate an association. An abort +is sent to the peer and the local TCB is destroyed. +.Pp +.Dv SCTP_UNORDERED +is used to specify that the message being sent has no +specific order and should be delivered to the peer application +as soon as possible. When this flag is absent messages +are delivered in order within the stream they are sent, but without +respect to order to peer streams. +.Pp +The flag +.Dv SCTP_ADDR_OVER +is used to specify that an specific address should be used. Normally +SCTP will use only one of a multi-homed peers address as the primary +address to send to. By default, no matter what the +.Fa to +argument is, this primary address is used to send data. By specifying +this flag, the user is asking the stack to ignore the primary address +and instead use the specified address not only has a lookup mechanism +to find the association but also has the actual address to send to. +.Pp +For a one-to-many type (SOCK_SEQPACKET) socket the flag +.Dv SCTP_SENDALL +can be used as a convient way to make one send call and have +all associations that are under the socket get a copy of the message. +Note that this mechanism is quite efficent and makes only one actual +copy of the data which is shared by all the associations for sending. +.Pp +The remaining flags are used for the partial reliabilty extension (RFC3758) +and will only be effective if the peer endpoint supports this extension. +This option specify's what local policy the local endpoint should use +in skipping data. If none of these options are set, then data is +never skipped over. +.Pp +.Dv SCTP_PR_SCTP_TTL +Is used to indicate that a time based lifetime is being applied +to the data. The +.Fa timetolive +argument is then a number of milliseconds for which the data is +attempted to be transmitted. If that many milliseconds ellapses +and the peer has not acknowledge the data, the data will be +skipped and no longer transmitted. Note that this policy does +not even assure that the data will ever be sent. In times of a congestion +with large amounts of data being queued, the +.Fa timetolive +may expire before the first transmission is ever made. +.Pp +The +.Dv SCTP_PR_SCTP_BUF +based policy transforms the +.Fa timetolive +field into a total number of bytes allowed on the outbound +send queue. If that number or more bytes are in queue, then +other buffer based sends are looked to be removed and +skipped. Note that this policy may also result in the data +never being sent if no buffer based sends are in queue and +the maximum specified by +.Fa timetolive +bytes is in queue. +.Pp +The +.Dv SCTP_PR_SCTP_RTX +policy transforms the +.Fa timetolive +into a number of retransmissions to allow. This policy +always assures that at a minimum one send attempt is +made of the data. After which no more than +.Fa timetolive +retransmissions will be made before the data is skipped. +.Pp +.Fa stream_no +is the SCTP stream that you wish to send the +message on. Streams in SCTP are reliable (or partially reliable) flows of ordered +messages. The +.Fa context +field is used only in the event the message cannot be sent. This is an opaque +value that the stack retains and will give to the user when a failed send +is given if that notification is enabled (see +.Tn sctp +). Normally a user process can use this value to index some application +specific data structure when a send cannot be fulfilled. +.Fn sctp_sendmsgx +is identical to +.Fn sctp_sendmsg +with the exception that it takes a array of sockaddr structures in the +argument +.Fa to +and adds the additional argument +.Fa addrcnt +which specifies how many addresses are in the array. This allows a +caller to implictly setup an association passing multiple addresses +as if an +.Fn sctp_connectx +had been called to setup the association. +.Sh RETURN VALUES +The call returns the number of characters sent, or -1 +if an error occurred. +.Sh ERRORS +The +.Fn sctp_sendmsg 2 +system call +fail if: +.Bl -tag -width Er +.It Bq Er EBADF +An invalid descriptor was specified. +.It Bq Er ENOTSOCK +The argument +.Fa s +is not a socket. +.It Bq Er EFAULT +An invalid user space address was specified for an argument. +.It Bq Er EMSGSIZE +The socket requires that message be sent atomically, +and the size of the message to be sent made this impossible. +.It Bq Er EAGAIN +The socket is marked non-blocking and the requested operation +would block. +.It Bq Er ENOBUFS +The system was unable to allocate an internal buffer. +The operation may succeed when buffers become available. +.It Bq Er ENOBUFS +The output queue for a network interface was full. +This generally indicates that the interface has stopped sending, +but may be caused by transient congestion. +.It Bq Er EHOSTUNREACH +The remote host was unreachable. +.It Bq Er ENOTCON +On a one to one style socket no association exists. +.It Bq Er ECONNRESET +An abort was received by the stack while the user was +attempting to send data to the peer. +.It Bq Er ENOENT +On a one to many style socket no address is specified +so that the association cannot be located or the +SCTP_ABORT flag was specified on a non-existing association. +.It Bq Er EPIPE +The socket is unable to send anymore data +.Dv ( SBS_CANTSENDMORE +has been set on the socket). +This typically means that the socket +is not connected and is a one-to-one style socket. +.El +.Sh SEE ALSO +.Xr sctp 4 , +.Xr sendmsg 3 , +.Xr connect 2 , +.Xr sctp_connectx 3 , +.Xr getsockopt 2 , +.Xr recv 2 , +.Xr select 2 , +.Xr socket 2 , +.Xr write 2 +.Sh BUGS +Because in the one-to-many style socket the +.Fn sctp_sendmsg +or +.Fn sctp_sendmsgx +may have multiple associations under one endpoint, a +select on write will only work for a one-to-one style +socket. + diff --git a/lib/libc/sys/Makefile.inc b/lib/libc/sys/Makefile.inc index 8d2a92e..a753820 100644 --- a/lib/libc/sys/Makefile.inc +++ b/lib/libc/sys/Makefile.inc @@ -84,6 +84,7 @@ MAN+= _exit.2 abort2.2 accept.2 access.2 acct.2 adjtime.2 \ sigaction.2 sigaltstack.2 sigpending.2 sigprocmask.2 sigqueue.2 \ sigreturn.2 sigstack.2 sigsuspend.2 sigwait.2 sigwaitinfo.2 \ socket.2 socketpair.2 stat.2 statfs.2 \ + sctp_generic_recvmsg.2 sctp_generic_sendmsg.2 sctp_peeloff.2 \ swapon.2 symlink.2 sync.2 sysarch.2 syscall.2 \ timer_create.2 timer_delete.2 timer_settime.2 \ truncate.2 umask.2 undelete.2 \ diff --git a/lib/libc/sys/sctp_generic_recvmsg.2 b/lib/libc/sys/sctp_generic_recvmsg.2 new file mode 100644 index 0000000..c4abc6a --- /dev/null +++ b/lib/libc/sys/sctp_generic_recvmsg.2 @@ -0,0 +1,76 @@ +.\" Copyright (c) 1983, 1991, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd December 15, 2006 +.Dt SCTP_GENERIC_RECVMSG 2 +.Os +.Sh NAME +.Nm sctp_generic_recvmsg +.Nd receive data from a peer. +.Sh LIBRARY +.Lb libc +.Sh SYNOPSIS +.In sys/types.h +.In sys/socket.h +.In sys/sctp.h +.Ft int +.Fn sctp_generic_recvmsg "int s" "struct iovec *iov" "int iovlen" "struct sockaddr *from" "socklen_t *fromlen" "struct sctp_sndrcvinfo *sinfo" "int *msgflags" +.Ft int +.Sh DESCRIPTION +The +.Fn sctp_generic_recvmsg +is the true system calls used by the +.Fn sctp_recvmsg +function call. This call is more efficient since it is a +true system calls but it is specific to FreeBSD and +can be expected NOT to be present on any other Operating +System. For detailed useage please see either the +.Fn sctp_recvmsg +function call. +.Sh RETURN VALUES +The call returns the number of bytes read on success and -1 upon failure. +.Sh ERRORS +.Bl -tag -width Er +.It Bq Er EBADF +The argument +.Fa s +is not a valid descriptor. +.It Bq Er ENOTSOCK +The argument +.Fa s +is not a socket. +.El +.Sh SEE ALSO +.Xr sctp 4 , +.Xr sctp_recvmsg 3 , + diff --git a/lib/libc/sys/sctp_generic_sendmsg.2 b/lib/libc/sys/sctp_generic_sendmsg.2 new file mode 100644 index 0000000..8d96e69 --- /dev/null +++ b/lib/libc/sys/sctp_generic_sendmsg.2 @@ -0,0 +1,88 @@ +.\" Copyright (c) 1983, 1991, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd December 15, 2006 +.Dt SCTP_GENERIC_SENDMSG 2 +.Os +.Sh NAME +.Nm sctp_generic_sendmsg +.Nm sctp_generic_sendmsg_iov +.Nd send data to a peer. +.Sh LIBRARY +.Lb libc +.Sh SYNOPSIS +.In sys/types.h +.In sys/socket.h +.In sys/sctp.h +.Ft int +.Fn sctp_generic_sendmsg "int s" "void *msg" "int msglen" "struct sockaddr *to" "socklen_t len" "struct sctp_sndrcvinfo *sinfo" "int flags" +.Ft int +.Fn sctp_generic_sendmsg_iov "int s" "struct iovec *iov" "int iovlen" "struct sockaddr *to" "struct sctp_sndrcvinfo *sinfo" "int flags" + +.Sh DESCRIPTION +The +.Fn sctp_generic_sendmsg +and +.Fn sctp_generic_sendmsg_iov +are the true system calls used by the +.Fn sctp_sendmsg +and +.Fn sctp_send +function calls. These are more efficient since they are +true system calls but they are specific to FreeBSD and +can be expected NOT to be present on any other Operating +System. For detailed useage please see either the +.Fn sctp_send +or +.Fn sctp_sendmsg +function calls. +.Sh RETURN VALUES +The call returns the number of bytes written on success and -1 upon failure. +.Sh ERRORS +.Bl -tag -width Er +.It Bq Er EBADF +The argument +.Fa s +is not a valid descriptor. +.It Bq Er ENOTSOCK +The argument +.Fa s +is not a socket. +.El +.Sh SEE ALSO +.Xr sctp 4 , +.Xr sctp_send 3 , +.Xr sctp_sendx 3 , +.Xr sctp_sendmsg 3 , +.Xr sctp_sendmsgx 3 , + diff --git a/lib/libc/sys/sctp_peeloff.2 b/lib/libc/sys/sctp_peeloff.2 new file mode 100644 index 0000000..7daec46 --- /dev/null +++ b/lib/libc/sys/sctp_peeloff.2 @@ -0,0 +1,82 @@ +.\" Copyright (c) 1983, 1991, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd December 15, 2006 +.Dt SCTP_PEELOFF 2 +.Os +.Sh NAME +.Nm sctp_peeloff +.Nd detach an association from an one-to-many socket to its on sd +.Sh LIBRARY +.Lb libc +.Sh SYNOPSIS +.In sys/types.h +.In sys/socket.h +.In sys/sctp.h +.Ft int +.Fn sctp_peeloff "int s" "sctp_assoc_t id" +.Sh DESCRIPTION +The +.Fn sctp_peeloff +system call attempts detach the association specified by +.Fa id +into its own seperate socket. +.Pp +.Sh RETURN VALUES +The call returns -1 on failure and the new socket descriptor +upon success. +.Sh ERRORS +The +.Fn sctp_peeloff +can return the following errors. +.Bl -tag -width Er +.It Bq Er ENOTCONN +The +.Fa id +given to the call does not map to a valid +association. +.It Bq Er E2BIG +The size of the address list exceeds the amount of +data provided. +.It Bq Er EBADF +The argument +.Fa s +is not a valid descriptor. +.It Bq Er ENOTSOCK +The argument +.Fa s +is not a socket. +.El +.Sh SEE ALSO +.Xr sctp 4 , + |