| 1 |
.\" (C) Copyright Xin Long REDHAT Corp. 2018. |
| 2 |
.\" |
| 3 |
.\" Permission is granted to distribute possibly modified copies |
| 4 |
.\" of this manual provided the header is included verbatim, |
| 5 |
.\" and in case of nontrivial modification author and date |
| 6 |
.\" of the modification is added to the header. |
| 7 |
.\" |
| 8 |
.TH SCTP_RECVV 3 2018-04-29 "Linux 4.16 "Linux Programmer's Manual" |
| 9 |
.SH NAME |
| 10 |
sctp_recvv \- Receive a message from a SCTP socket with an extensible way. |
| 11 |
.SH SYNOPSIS |
| 12 |
.nf |
| 13 |
.B #include <sys/types.h> |
| 14 |
.B #include <sys/socket.h> |
| 15 |
.B #include <netinet/sctp.h> |
| 16 |
.sp |
| 17 |
.BI "int sctp_recvv(int " sd ", const struct iovec * " iov ", int " iovlen , |
| 18 |
.BI " struct sockaddr * " from ", socklen_t * " fromlen ", void * " info , |
| 19 |
.BI " socklen_t * " infolen ", unsigned int * " infotype ", int * " flags ); |
| 20 |
.fi |
| 21 |
.SH DESCRIPTION |
| 22 |
.BR sctp_recvv |
| 23 |
provides an extensible way for the SCTP stack to pass up different SCTP |
| 24 |
attributes associated with a received message to an application. |
| 25 |
There are two types of attributes that can be returned by this call: the |
| 26 |
attribute of the received message and the attribute of the next message |
| 27 |
in the receive buffer. The caller enables the SCTP_RECVRCVINFO and |
| 28 |
SCTP_RECVNXTINFO socket options, respectively, to receive these attributes. |
| 29 |
Attributes of the received message are returned in struct sctp_rcvinfo, |
| 30 |
and attributes of the next message are returned in struct sctp_nxtinfo. |
| 31 |
If both options are enabled, both attributes are returned using the |
| 32 |
following structure. |
| 33 |
|
| 34 |
struct sctp_recvv_rn { |
| 35 |
struct sctp_rcvinfo recvv_rcvinfo; |
| 36 |
struct sctp_nxtinfo recvv_nxtinfo; |
| 37 |
}; |
| 38 |
|
| 39 |
.I sd |
| 40 |
is the socket descriptor. |
| 41 |
.I iov |
| 42 |
is the scatter buffer, and only one user message is returned in this buffer. |
| 43 |
.I iovlen |
| 44 |
is the number of elements in iov. |
| 45 |
.I from |
| 46 |
is a pointer to a buffer to be filled with the sender of the received message's |
| 47 |
address. |
| 48 |
.I fromlen |
| 49 |
is an in/out parameter describing the from length. |
| 50 |
.I info |
| 51 |
is a pointer to the buffer to hold the attributes of the received message, the |
| 52 |
structure type of info is determined by the info_type parameter. |
| 53 |
.I infolen |
| 54 |
is an in/out parameter describing the size of the info buffer. |
| 55 |
On return, |
| 56 |
.I infotype |
| 57 |
is set to the type of the info buffer, and the current defined |
| 58 |
values are as follows: |
| 59 |
.TP |
| 60 |
.B SCTP_RECVV_NOINFO |
| 61 |
If neither SCTP_RECVRCVINFO nor SCTP_RECVNXTINFO options are enabled, no |
| 62 |
attribute will be returned. If only the SCTP_RECVNXTINFO option is enabled |
| 63 |
but there is no next message in the buffer, no attribute will be returned. |
| 64 |
In these cases, *info_type will be set to SCTP_RECVV_NOINFO. |
| 65 |
.TP |
| 66 |
.B SCTP_RECVV_RCVINFO |
| 67 |
The type of info is struct sctp_rcvinfo, and the attribute relates to the |
| 68 |
received message. |
| 69 |
.TP |
| 70 |
.B SCTP_RECVV_NXTINFO |
| 71 |
The type of info is struct sctp_nxtinfo, and the attribute relates to the |
| 72 |
next message in the receive buffer. This is the case when only the |
| 73 |
SCTP_RECVNXTINFO option is enabled and there is a next message in the buffer. |
| 74 |
.TP |
| 75 |
.B SCTP_RECVV_RN |
| 76 |
The type of info is struct sctp_recvv_rn. The recvv_rcvinfo field is the |
| 77 |
attribute of the received message, and the recvv_nxtinfo field is the attribute |
| 78 |
of the next message in the buffer. This is the case when both SCTP_RECVRCVINFO |
| 79 |
and SCTP_RECVNXTINFO options are enabled and there is a next message in the |
| 80 |
receive buffer. |
| 81 |
.PP |
| 82 |
.I flags |
| 83 |
is pointer to an integer to be filled with any message flags (e.g., |
| 84 |
MSG_NOTIFICATION). |
| 85 |
.SH "RETURN VALUE" |
| 86 |
On success, |
| 87 |
.BR sctp_recvv |
| 88 |
returns the number of bytes received or -1 if an error occurred. |
| 89 |
.SH "SEE ALSO" |
| 90 |
.BR sctp (7) |
| 91 |
.BR sctp_bindx (3), |
| 92 |
.BR sctp_connectx (3), |
| 93 |
.BR sctp_sendmsg (3), |
| 94 |
.BR sctp_sendv (3), |
| 95 |
.BR sctp_send (3), |
| 96 |
.BR sctp_peeloff (3), |
| 97 |
.BR sctp_getpaddrs (3), |
| 98 |
.BR sctp_getladdrs (3), |
| 99 |
.BR sctp_opt_info (3) |