1d8b5fd91SRandall Stewart.\" Copyright (c) 1983, 1991, 1993 2d8b5fd91SRandall Stewart.\" The Regents of the University of California. All rights reserved. 3d8b5fd91SRandall Stewart.\" 4d8b5fd91SRandall Stewart.\" Redistribution and use in source and binary forms, with or without 5d8b5fd91SRandall Stewart.\" modification, are permitted provided that the following conditions 6d8b5fd91SRandall Stewart.\" are met: 7d8b5fd91SRandall Stewart.\" 1. Redistributions of source code must retain the above copyright 8d8b5fd91SRandall Stewart.\" notice, this list of conditions and the following disclaimer. 9d8b5fd91SRandall Stewart.\" 2. Redistributions in binary form must reproduce the above copyright 10d8b5fd91SRandall Stewart.\" notice, this list of conditions and the following disclaimer in the 11d8b5fd91SRandall Stewart.\" documentation and/or other materials provided with the distribution. 12921ca2fdSEd Maste.\" 3. Neither the name of the University nor the names of its contributors 13d8b5fd91SRandall Stewart.\" may be used to endorse or promote products derived from this software 14d8b5fd91SRandall Stewart.\" without specific prior written permission. 15d8b5fd91SRandall Stewart.\" 16d8b5fd91SRandall Stewart.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 17d8b5fd91SRandall Stewart.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18d8b5fd91SRandall Stewart.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19d8b5fd91SRandall Stewart.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 20d8b5fd91SRandall Stewart.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21d8b5fd91SRandall Stewart.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22d8b5fd91SRandall Stewart.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23d8b5fd91SRandall Stewart.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24d8b5fd91SRandall Stewart.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25d8b5fd91SRandall Stewart.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26d8b5fd91SRandall Stewart.\" SUCH DAMAGE. 27d8b5fd91SRandall Stewart.\" 28*eee88ef4SMichael Tuexen.Dd May 2, 2024 29d8b5fd91SRandall Stewart.Dt SCTP_RECVMSG 3 30d8b5fd91SRandall Stewart.Os 31d8b5fd91SRandall Stewart.Sh NAME 325590bacaSLexi Winter.Nm sctp_recvmsg , 335590bacaSLexi Winter.Nm sctp_recvv 34694b0a6bSGabor Kovesdan.Nd receive a message from an SCTP socket 35d8b5fd91SRandall Stewart.Sh LIBRARY 36d8b5fd91SRandall Stewart.Lb libc 37d8b5fd91SRandall Stewart.Sh SYNOPSIS 38d8b5fd91SRandall Stewart.In sys/types.h 39d8b5fd91SRandall Stewart.In sys/socket.h 407c376800SRandall Stewart.In netinet/sctp.h 41d8b5fd91SRandall Stewart.Ft ssize_t 4216c90ceeSChristian Brueffer.Fo sctp_recvmsg 43*eee88ef4SMichael Tuexen.Fa "int s" "void *msg" "size_t len" "struct sockaddr *from" 44*eee88ef4SMichael Tuexen.Fa "socklen_t *fromlen" "struct sctp_sndrcvinfo *sinfo" "int *flags" 4516c90ceeSChristian Brueffer.Fc 465590bacaSLexi Winter.Ft ssize_t 475590bacaSLexi Winter.Fo sctp_recvv 485590bacaSLexi Winter.Fa "int s" "const struct iovec *iov" "int iovlen" "struct sockaddr *from" 495590bacaSLexi Winter.Fa "socklen_t *fromlen" "void *info" "socklen_t *infolen" 505590bacaSLexi Winter.Fa "unsigned int *infotype" "int *flags" 515590bacaSLexi Winter.Fc 52d8b5fd91SRandall Stewart.Sh DESCRIPTION 53d8b5fd91SRandall StewartThe 54d8b5fd91SRandall Stewart.Fn sctp_recvmsg 555590bacaSLexi Winterand 565590bacaSLexi Winter.Fn sctp_recvv 575590bacaSLexi Winterfunctions are used to receive a message from another SCTP endpoint. 585590bacaSLexi WinterThey are used by one-to-one (SOCK_STREAM) type sockets after a successful 5916c90ceeSChristian Brueffer.Fn connect 60d8b5fd91SRandall Stewartcall or after the application has performed a 61d8b5fd91SRandall Stewart.Fn listen 6244d9c281SChristian Bruefferfollowed by a successful 6344d9c281SChristian Brueffer.Fn accept . 64d8b5fd91SRandall StewartFor a one-to-many (SOCK_SEQPACKET) type socket, an endpoint may call 65d8b5fd91SRandall Stewart.Fn sctp_recvmsg 665590bacaSLexi Winteror 675590bacaSLexi Winter.Fn sctp_recvv 68d8b5fd91SRandall Stewartafter having implicitly started an association via one 69d8b5fd91SRandall Stewartof the send calls including 70a3fb6da9SGlen Barber.Fn sctp_sendmsg , 7116c90ceeSChristian Brueffer.Fn sendto 72d8b5fd91SRandall Stewartand 7316c90ceeSChristian Brueffer.Fn sendmsg . 74d8b5fd91SRandall StewartOr, an application may also receive a message after having 75d8b5fd91SRandall Stewartcalled 7616c90ceeSChristian Brueffer.Fn listen 7744d9c281SChristian Bruefferwith a positive backlog to enable the reception of new associations. 78d8b5fd91SRandall Stewart.Pp 79d8b5fd91SRandall StewartThe address of the sender is held in the 80d8b5fd91SRandall Stewart.Fa from 81d8b5fd91SRandall Stewartargument with 82d8b5fd91SRandall Stewart.Fa fromlen 8316c90ceeSChristian Bruefferspecifying its size. 8416c90ceeSChristian BruefferAt the completion of a successful 85d8b5fd91SRandall Stewart.Fn sctp_recvmsg 86d8b5fd91SRandall Stewartcall 87d8b5fd91SRandall Stewart.Fa from 88d8b5fd91SRandall Stewartwill hold the address of the peer and 89d8b5fd91SRandall Stewart.Fa fromlen 9016c90ceeSChristian Bruefferwill hold the length of that address. 9116c90ceeSChristian BruefferNote that 92f6ac2391SJoel Dahlthe address is bounded by the initial value of 93d8b5fd91SRandall Stewart.Fa fromlen 94d8b5fd91SRandall Stewartwhich is used as an in/out variable. 95d8b5fd91SRandall Stewart.Pp 96d8b5fd91SRandall StewartThe length of the message 97d8b5fd91SRandall Stewart.Fa msg 98d8b5fd91SRandall Stewartto be received is bounded by 99d8b5fd91SRandall Stewart.Fa len . 10016c90ceeSChristian BruefferIf the message is too long to fit in the users 101d8b5fd91SRandall Stewartreceive buffer, then the 102d8b5fd91SRandall Stewart.Fa flags 10344d9c281SChristian Bruefferargument will 10444d9c281SChristian Brueffer.Em not 10544d9c281SChristian Bruefferhave the 106446734c2SMichael Tuexen.Dv MSG_EOR 10716c90ceeSChristian Bruefferflag applied. 10816c90ceeSChristian BruefferIf the message is a complete message then 109d8b5fd91SRandall Stewartthe 110d8b5fd91SRandall Stewart.Fa flags 11116c90ceeSChristian Bruefferargument will have 112446734c2SMichael Tuexen.Dv MSG_EOR 11316c90ceeSChristian Bruefferset. 11416c90ceeSChristian BruefferLocally detected errors are 11516c90ceeSChristian Bruefferindicated by a return value of -1 with 11616c90ceeSChristian Brueffer.Va errno 11716c90ceeSChristian Bruefferset accordingly. 118d8b5fd91SRandall StewartThe 119d8b5fd91SRandall Stewart.Fa flags 12016c90ceeSChristian Bruefferargument may also hold the value 12116c90ceeSChristian Brueffer.Dv MSG_NOTIFICATION . 12216c90ceeSChristian BruefferWhen this 12344d9c281SChristian Bruefferoccurs it indicates that the message received is 12444d9c281SChristian Brueffer.Em not 12544d9c281SChristian Bruefferfrom 126d8b5fd91SRandall Stewartthe peer endpoint, but instead is a notification from the 127d8b5fd91SRandall StewartSCTP stack (see 12816c90ceeSChristian Brueffer.Xr sctp 4 12916c90ceeSChristian Bruefferfor more details). 13016c90ceeSChristian BruefferNote that no notifications are ever 131d8b5fd91SRandall Stewartgiven unless the user subscribes to such notifications using 13216c90ceeSChristian Bruefferthe 13316c90ceeSChristian Brueffer.Dv SCTP_EVENTS 13416c90ceeSChristian Brueffersocket option. 135d8b5fd91SRandall Stewart.Pp 13616c90ceeSChristian BruefferIf no messages are available at the socket then 137d8b5fd91SRandall Stewart.Fn sctp_recvmsg 13816c90ceeSChristian Brueffernormally blocks on the reception of a message or NOTIFICATION, unless the 13916c90ceeSChristian Brueffersocket has been placed in non-blocking I/O mode. 140d8b5fd91SRandall StewartThe 141d8b5fd91SRandall Stewart.Xr select 2 142d8b5fd91SRandall Stewartsystem call may be used to determine when it is possible to 143d8b5fd91SRandall Stewartreceive a message. 144d8b5fd91SRandall Stewart.Pp 145d8b5fd91SRandall StewartThe 146d8b5fd91SRandall Stewart.Fa sinfo 147d8b5fd91SRandall Stewartargument is defined as follows. 148d8b5fd91SRandall Stewart.Bd -literal 149d8b5fd91SRandall Stewartstruct sctp_sndrcvinfo { 1503d36ac98SRebecca Cran uint16_t sinfo_stream; /* Stream arriving on */ 1513d36ac98SRebecca Cran uint16_t sinfo_ssn; /* Stream Sequence Number */ 1523d36ac98SRebecca Cran uint16_t sinfo_flags; /* Flags on the incoming message */ 1533d36ac98SRebecca Cran uint32_t sinfo_ppid; /* The ppid field */ 1543d36ac98SRebecca Cran uint32_t sinfo_context; /* context field */ 1553d36ac98SRebecca Cran uint32_t sinfo_timetolive; /* not used by sctp_recvmsg */ 1563d36ac98SRebecca Cran uint32_t sinfo_tsn; /* The transport sequence number */ 1573d36ac98SRebecca Cran uint32_t sinfo_cumtsn; /* The cumulative acknowledgment point */ 158d8b5fd91SRandall Stewart sctp_assoc_t sinfo_assoc_id; /* The association id of the peer */ 159d8b5fd91SRandall Stewart}; 160d8b5fd91SRandall Stewart.Ed 16116c90ceeSChristian Brueffer.Pp 162d8b5fd91SRandall StewartThe 163d8b5fd91SRandall Stewart.Fa sinfo->sinfo_ppid 164a47698f8SChristian Bruefferfield is an opaque 32 bit value that is passed transparently 165d8b5fd91SRandall Stewartthrough the stack from the peer endpoint. 166d8b5fd91SRandall StewartNote that the stack passes this value without regard to byte 167d8b5fd91SRandall Stewartorder. 168d8b5fd91SRandall Stewart.Pp 169d8b5fd91SRandall StewartThe 170d8b5fd91SRandall Stewart.Fa sinfo->sinfo_flags 171d8b5fd91SRandall Stewartfield may include the following: 172d8b5fd91SRandall Stewart.Bd -literal 173d8b5fd91SRandall Stewart#define SCTP_UNORDERED 0x0400 /* Message is un-ordered */ 174d8b5fd91SRandall Stewart.Ed 175d8b5fd91SRandall Stewart.Pp 176d8b5fd91SRandall StewartThe 177d8b5fd91SRandall Stewart.Dv SCTP_UNORDERED 178d8b5fd91SRandall Stewartflag is used to specify that the message arrived with no 179d8b5fd91SRandall Stewartspecific order and was delivered to the peer application 18016c90ceeSChristian Bruefferas soon as possible. 18116c90ceeSChristian BruefferWhen this flag is absent the message 182d8b5fd91SRandall Stewartwas delivered in order within the stream it was received. 183d8b5fd91SRandall Stewart.Pp 184a47698f8SChristian BruefferThe 185d8b5fd91SRandall Stewart.Fa sinfo->sinfo_stream 186a47698f8SChristian Bruefferfield is the SCTP stream that the message was received on. 187d8b5fd91SRandall StewartStreams in SCTP are reliable (or partially reliable) flows of ordered 188d8b5fd91SRandall Stewartmessages. 189d8b5fd91SRandall Stewart.Pp 190d8b5fd91SRandall StewartThe 191d8b5fd91SRandall Stewart.Fa sinfo->sinfo_context 19216c90ceeSChristian Bruefferfield is used only if the local application set an association level 19316c90ceeSChristian Brueffercontext with the 19416c90ceeSChristian Brueffer.Dv SCTP_CONTEXT 19516c90ceeSChristian Brueffersocket option. 196d8b5fd91SRandall StewartOptionally a user process can use this value to index some application 197d8b5fd91SRandall Stewartspecific data structure for all data coming from a specific 198d8b5fd91SRandall Stewartassociation. 199d8b5fd91SRandall Stewart.Pp 200d8b5fd91SRandall StewartThe 201d8b5fd91SRandall Stewart.Fa sinfo->sinfo_ssn 202a47698f8SChristian Bruefferfield will hold the stream sequence number assigned 20344d9c281SChristian Bruefferby the peer endpoint if the message is 20444d9c281SChristian Brueffer.Em not 20544d9c281SChristian Bruefferunordered. 206d8b5fd91SRandall StewartFor unordered messages this field holds an undefined value. 207d8b5fd91SRandall Stewart.Pp 208d8b5fd91SRandall StewartThe 209d8b5fd91SRandall Stewart.Fa sinfo->sinfo_tsn 210a47698f8SChristian Bruefferfield holds a transport sequence number (TSN) that was assigned 21116c90ceeSChristian Bruefferto this message by the peer endpoint. 21216c90ceeSChristian BruefferFor messages that fit in or less 213d8b5fd91SRandall Stewartthan the path MTU this will be the only TSN assigned. 21444d9c281SChristian BruefferNote that for messages that span multiple TSNs this 21544d9c281SChristian Brueffervalue will be one of the TSNs that was used on the 216d8b5fd91SRandall Stewartmessage. 217d8b5fd91SRandall Stewart.Pp 218d8b5fd91SRandall StewartThe 219d8b5fd91SRandall Stewart.Fa sinfo->sinfo_cumtsn 220a47698f8SChristian Bruefferfield holds the current cumulative acknowledgment point of 22116c90ceeSChristian Bruefferthe transport association. 22216c90ceeSChristian BruefferNote that this may be larger 223d8b5fd91SRandall Stewartor smaller than the TSN assigned to the message itself. 224d8b5fd91SRandall Stewart.Pp 225d8b5fd91SRandall StewartThe 22616c90ceeSChristian Brueffer.Fa sinfo->sinfo_assoc_id 227d8b5fd91SRandall Stewartis the unique association identification that was assigned 22816c90ceeSChristian Bruefferto the association. 22916c90ceeSChristian BruefferFor one-to-many (SOCK_SEQPACKET) type 230d8b5fd91SRandall Stewartsockets this value can be used to send data to the peer without 23116c90ceeSChristian Bruefferthe use of an address field. 23216c90ceeSChristian BruefferIt is also quite useful in 233d8b5fd91SRandall Stewartsetting various socket options on the specific association 234d8b5fd91SRandall Stewart(see 23544d9c281SChristian Brueffer.Xr sctp 4 ) . 236d8b5fd91SRandall Stewart.Pp 237d8b5fd91SRandall StewartThe 23816c90ceeSChristian Brueffer.Fa sinfo->info_timetolive 239d8b5fd91SRandall Stewartfield is not used by 240a47698f8SChristian Brueffer.Fn sctp_recvmsg . 2415590bacaSLexi Winter.Pp 2425590bacaSLexi WinterThe 2435590bacaSLexi Winter.Fn sctp_recvv 2445590bacaSLexi Winterfunction works as 2455590bacaSLexi Winter.Fn sctp_recvmsg 2465590bacaSLexi Winterwith two differences. 2475590bacaSLexi WinterFirstly, the receive buffer is passed as an array containing 2485590bacaSLexi Winter.Vt iocnt 2495590bacaSLexi Winterobjects of type 2505590bacaSLexi Winter.Vt struct iovec , 2515590bacaSLexi Winterwhere the received data will be scattered in the same manner as 2525590bacaSLexi Winter.Xr readv 2 . 2535590bacaSLexi WinterSecondly, the 2545590bacaSLexi Winter.Fa sinfo 2555590bacaSLexi Winterargument is replaced by the tuple 2565590bacaSLexi Winter.Fa info , 2575590bacaSLexi Winter.Fa infolen , 2585590bacaSLexi Winterand 2595590bacaSLexi Winter.Fa infotype , 2605590bacaSLexi Winterwhich allow different information to be received based on the socket options. 2615590bacaSLexi Winter.Pp 2625590bacaSLexi WinterTo receive an 2635590bacaSLexi Winter.Vt sctp_rcvinfo 2645590bacaSLexi Winterstructure, set the 2655590bacaSLexi Winter.Va SCTP_RECVRCVINFO 2665590bacaSLexi Wintersocket option, and pass a pointer to a 2675590bacaSLexi Winter.Vt struct sctp_rcvinfo 2685590bacaSLexi Winterstructure in 2695590bacaSLexi Winter.Fa info . 2705590bacaSLexi WinterThe 2715590bacaSLexi Winter.Vt sctp_rcvinfo 2725590bacaSLexi Winterstructure has the following format: 2735590bacaSLexi Winter.Bd -literal 2745590bacaSLexi Winterstruct sctp_rcvinfo { 2755590bacaSLexi Winter uint16_t rcv_sid; /* Stream arriving on */ 2765590bacaSLexi Winter uint16_t rcv_ssn; /* Stream Sequence Number */ 2775590bacaSLexi Winter uint16_t rcv_flags; /* Flags on the incoming message */ 2785590bacaSLexi Winter uint32_t rcv_ppid; /* The ppid field */ 2795590bacaSLexi Winter uint32_t rcv_tsn; /* The transport sequence number */ 2805590bacaSLexi Winter uint32_t rcv_cumtsn; /* The cumulative TSN */ 2815590bacaSLexi Winter uint32_t rcv_context; /* Opaque context field */ 2825590bacaSLexi Winter sctp_assoc_t rcv_assoc_id; /* Peer association id */ 2835590bacaSLexi Winter}; 2845590bacaSLexi Winter.Ed 2855590bacaSLexi Winter.Pp 2865590bacaSLexi WinterThese fields have the same meaning as the equivalent fields in 2875590bacaSLexi Winter.Vt struct sctp_sndrcvinfo , 2885590bacaSLexi Winterdefined above. 2895590bacaSLexi Winter.Pp 2905590bacaSLexi WinterTo receive an 2915590bacaSLexi Winter.Vt sctp_nxtinfo 2925590bacaSLexi Winterstructure, set the 2935590bacaSLexi Winter.Va SCTP_RECVNXTINFO 2945590bacaSLexi Wintersocket option, and pass a pointer to a 2955590bacaSLexi Winter.Vt struct sctp_nxtinfo 2965590bacaSLexi Winterstructure in 2975590bacaSLexi Winter.Fa info . 2985590bacaSLexi WinterThe 2995590bacaSLexi Winter.Vt struct sctp_nxtinfo 3005590bacaSLexi Winterstructure has the following format: 3015590bacaSLexi Winter.Bd -literal 3025590bacaSLexi Winterstruct sctp_nxtinfo { 3035590bacaSLexi Winter uint16_t nxt_sid; /* Next message's stream number */ 3045590bacaSLexi Winter uint16_t nxt_flags; /* Flags (see below) */ 3055590bacaSLexi Winter uint32_t nxt_ppid; /* The ppid field */ 3065590bacaSLexi Winter uint32_t nxt_length; /* Length of next message */ 3075590bacaSLexi Winter sctp_assoc_t nxt_assoc_id; /* Peer association id */ 3085590bacaSLexi Winter}; 3095590bacaSLexi Winter.Ed 3105590bacaSLexi Winter.Pp 3115590bacaSLexi WinterThe fields 3125590bacaSLexi Winter.Va nxt_sid , 3135590bacaSLexi Winter.Va nxt_ppid , 3145590bacaSLexi Winterand 3155590bacaSLexi Winter.Va nxt_assoc_id 3165590bacaSLexi Winterhave the same meaning as in 3175590bacaSLexi Winter.Vt struct sctp_rcvinfo , 3185590bacaSLexi Winterexcept they refer to the next message rather than the message that was 3195590bacaSLexi Winterreceived. 3205590bacaSLexi WinterThe field 3215590bacaSLexi Winter.Va nxt_length 3225590bacaSLexi Wintercontains the length of the part of the next message currently available in 3235590bacaSLexi Winterthe socket buffer. 3245590bacaSLexi WinterThis may not represent the length of the entire message unless the 3255590bacaSLexi Winter.Va SCTP_COMPLETE 3265590bacaSLexi Winterflag is set in 3275590bacaSLexi Winter.Va nxt_flags . 3285590bacaSLexi Winter.Pp 3295590bacaSLexi WinterThe 3305590bacaSLexi Winter.Va nxt_flags 3315590bacaSLexi Winterfield is a bitmask which may contain any of the following values: 3325590bacaSLexi Winter.Bl -bullet 3335590bacaSLexi Winter.It 3345590bacaSLexi Winter.Va SCTP_UNORDERED : 3355590bacaSLexi WinterThe next message was sent unordered. 3365590bacaSLexi Winter.It 3375590bacaSLexi Winter.Va SCTP_COMPLETE : 3385590bacaSLexi WinterThe entirety of the next message has been received in the socket buffer. 3395590bacaSLexi WinterIn this case, the 3405590bacaSLexi Winter.Va nxt_length 3415590bacaSLexi Winterfield contains the length of the entire message. 3425590bacaSLexi Winter.It 3435590bacaSLexi Winter.Va SCTP_NOTIFICATION : 3445590bacaSLexi WinterThe next message is a notification, not a user message. 3455590bacaSLexi Winter.El 3465590bacaSLexi Winter.Pp 3475590bacaSLexi WinterIf both the 3485590bacaSLexi Winter.Va SCTP_RECVRCVINFO 3495590bacaSLexi Winterand 3505590bacaSLexi Winter.Va SCTP_RECVNXTINFO 3515590bacaSLexi Wintersocket options are set, then pass a pointer to a 3525590bacaSLexi Winter.Vt struct sctp_recvv_rn 3535590bacaSLexi Winterstructure in 3545590bacaSLexi Winter.Fa info . 3555590bacaSLexi WinterThis struct has the following format: 3565590bacaSLexi Winter.Bd -literal 3575590bacaSLexi Winterstruct sctp_recvv_rn { 3585590bacaSLexi Winter struct sctp_rcvinfo recvv_rcvinfo; 3595590bacaSLexi Winter struct sctp_nxtinfo recvv_nxtinfo; 3605590bacaSLexi Winter}; 3615590bacaSLexi Winter.Ed 3625590bacaSLexi Winter.Pp 3635590bacaSLexi WinterThe value pointed to by 3645590bacaSLexi Winter.Fa infolen 3655590bacaSLexi Wintershould initially contain the length of the structure to which 3665590bacaSLexi Winter.Fa info 3675590bacaSLexi Winterpoints. 3685590bacaSLexi WinterWhen the function returns, it will be set to the length of the 3695590bacaSLexi Winterreturned structure. 3705590bacaSLexi WinterAdditionally, 3715590bacaSLexi Winter.Fa *infotype 3725590bacaSLexi Winterwill be set to one of the following values depending on what type of info 3735590bacaSLexi Winterwas returned: 3745590bacaSLexi Winter.Bl -bullet 3755590bacaSLexi Winter.It 3765590bacaSLexi Winter.Va SCTP_RECVV_NOINFO : 3775590bacaSLexi Winterno information was returned. 3785590bacaSLexi Winter.It 3795590bacaSLexi Winter.Va SCTP_RECVV_RCVINFO : 3805590bacaSLexi Winter.Fa *info 3815590bacaSLexi Wintercontains an object of type 3825590bacaSLexi Winter.Vt struct sctp_rcvinfo . 3835590bacaSLexi Winter.It 3845590bacaSLexi Winter.Va SCTP_RECVV_NXTINFO : 3855590bacaSLexi Winter.Fa *info 3865590bacaSLexi Wintercontains an object of type 3875590bacaSLexi Winter.Vt struct sctp_nxtinfo . 3885590bacaSLexi Winter.It 3895590bacaSLexi Winter.Va SCTP_RECVV_RN : 3905590bacaSLexi Winter.Fa *info 3915590bacaSLexi Wintercontains an object of type 3925590bacaSLexi Winter.Vt struct sctp_recvv_rn . 3935590bacaSLexi Winter.El 394d8b5fd91SRandall Stewart.Sh RETURN VALUES 395cefac273SRebecca CranThe call returns the number of bytes received, or -1 396d8b5fd91SRandall Stewartif an error occurred. 397d8b5fd91SRandall Stewart.Sh ERRORS 398d8b5fd91SRandall StewartThe 399d8b5fd91SRandall Stewart.Fn sctp_recvmsg 400d8b5fd91SRandall Stewartsystem call 40116c90ceeSChristian Bruefferfails if: 402d8b5fd91SRandall Stewart.Bl -tag -width Er 403d8b5fd91SRandall Stewart.It Bq Er EBADF 404d8b5fd91SRandall StewartAn invalid descriptor was specified. 405d8b5fd91SRandall Stewart.It Bq Er ENOTSOCK 406d8b5fd91SRandall StewartThe argument 407d8b5fd91SRandall Stewart.Fa s 408d8b5fd91SRandall Stewartis not a socket. 409d8b5fd91SRandall Stewart.It Bq Er EFAULT 410d8b5fd91SRandall StewartAn invalid user space address was specified for an argument. 411d8b5fd91SRandall Stewart.It Bq Er EMSGSIZE 412d8b5fd91SRandall StewartThe socket requires that message be sent atomically, 413d8b5fd91SRandall Stewartand the size of the message to be sent made this impossible. 414d8b5fd91SRandall Stewart.It Bq Er EAGAIN 415d8b5fd91SRandall StewartThe socket is marked non-blocking and the requested operation 416d8b5fd91SRandall Stewartwould block. 417d8b5fd91SRandall Stewart.It Bq Er ENOBUFS 418d8b5fd91SRandall StewartThe system was unable to allocate an internal buffer. 419d8b5fd91SRandall StewartThe operation may succeed when buffers become available. 420d8b5fd91SRandall Stewart.It Bq Er ENOBUFS 421d8b5fd91SRandall StewartThe output queue for a network interface was full. 422d8b5fd91SRandall StewartThis generally indicates that the interface has stopped sending, 423d8b5fd91SRandall Stewartbut may be caused by transient congestion. 424d8b5fd91SRandall Stewart.It Bq Er EHOSTUNREACH 425d8b5fd91SRandall StewartThe remote host was unreachable. 4260add3200SRebecca Cran.It Bq Er ENOTCONN 42716c90ceeSChristian BruefferOn a one-to-one style socket no association exists. 428d8b5fd91SRandall Stewart.It Bq Er ECONNRESET 429d8b5fd91SRandall StewartAn abort was received by the stack while the user was 430d8b5fd91SRandall Stewartattempting to send data to the peer. 431d8b5fd91SRandall Stewart.It Bq Er ENOENT 432d8b5fd91SRandall StewartOn a one to many style socket no address is specified 433d8b5fd91SRandall Stewartso that the association cannot be located or the 434d8b5fd91SRandall StewartSCTP_ABORT flag was specified on a non-existing association. 435d8b5fd91SRandall Stewart.It Bq Er EPIPE 436d8b5fd91SRandall StewartThe socket is unable to send anymore data 437d8b5fd91SRandall Stewart.Dv ( SBS_CANTSENDMORE 438d8b5fd91SRandall Stewarthas been set on the socket). 439d8b5fd91SRandall StewartThis typically means that the socket 440d8b5fd91SRandall Stewartis not connected and is a one-to-one style socket. 441d8b5fd91SRandall Stewart.El 4425590bacaSLexi Winter.Sh NOTES 4435590bacaSLexi WinterThe 4445590bacaSLexi Winter.Fn sctp_recvmsg 4455590bacaSLexi Winterfunction is deprecated. 4465590bacaSLexi WinterNew applications should use 4475590bacaSLexi Winter.Fn sctp_recvv . 448d8b5fd91SRandall Stewart.Sh SEE ALSO 4490aee91e1SChristian Brueffer.Xr getsockopt 2 , 450d8b5fd91SRandall Stewart.Xr recv 2 , 451d8b5fd91SRandall Stewart.Xr select 2 , 452a561a028SEdward Tomasz Napierala.Xr sendmsg 2 , 4530aee91e1SChristian Brueffer.Xr setsockopt 2 , 454d8b5fd91SRandall Stewart.Xr socket 2 , 45516c90ceeSChristian Brueffer.Xr write 2 , 45616c90ceeSChristian Brueffer.Xr sctp_send 3 , 45716c90ceeSChristian Brueffer.Xr sctp_sendmsg 3 , 45816c90ceeSChristian Brueffer.Xr sctp 4 4595590bacaSLexi Winter.Rs 4605590bacaSLexi Winter.%A R. Stewart 4615590bacaSLexi Winter.%A M. Tuexen 4625590bacaSLexi Winter.%A K. Poon 4635590bacaSLexi Winter.%A P. Lei 4645590bacaSLexi Winter.%A V. Yasevich 4655590bacaSLexi Winter.%T Sockets API Extensions for the Stream Control Transmission Protocol (SCTP) 4665590bacaSLexi Winter.%R RFC 6458 4675590bacaSLexi Winter.%D December 2011 4685590bacaSLexi Winter.Re 4695590bacaSLexi Winter.Sh STANDARDS 4705590bacaSLexi WinterThe functions described in this document conform to RFC 6458. 471