Allows applications to receive messages from sockets along with the Sensitivity Level (SL).
#include <sys/socket.h>
#include <sys/mac.h>
int erecv (Socket, Buffer, Length, Flags, Label)
int Socket;
void * Buffer;
size_t Length;
int Flags;
sec_labels_t *Label;
int erecvmsg ( Socket, Message, Flags, Label)
int Socket;
struct msghdr Message [ ];
int Flags;
sec_labels_t *Label;
ssize_t erecvfrom (Socket, Buffer, Length, Flags, From, FromLength, Label)
int Socket;
void * Buffer;
size_t Length,
int Flags;
struct sockaddr * From;
socklen_t * FromLength;
sec_labels_t *Label;
int enrecvmsg (Socket, Message, Flags, Label)
int Socket;
struct msghdr Message [ ];
int Flags;
sec_labels_t *Label;
ssize_t enrecvfrom (Socket, Buffer, Length, Flags, From, FromLength, Label)
int Socket;
void *Buffer;
size_t Length;
int Flags;
struct sockaddr *From;
socklen_t *FromLength;
sec_labels_t *Label;
The erecv, erecvmsg, erecvfrom, enrecvmsg, and enrecvfrom subroutines work exactly like the recv, recvmsg, recvfrom, nrecvmsg, and nrecvfrom subroutines respectively, except that the erecv, erecvmsg, erecvfrom, enrecvmsg, and enrecvfrom subroutines allow the application to retrieve the SL from the received data by providing a valid Label parameter.
If no messages are available at the socket, the erecv, erecvmsg, erecvfrom, enrecvmsg, and enrecvfrom subroutines wait for a message to arrive, unless the socket is nonblocking. If a socket is nonblocking, the system returns an error.
Item | Description |
---|---|
Socket | Specifies the socket descriptor. |
Buffer | Specifies the address where the message is placed. |
Length | Specifies the size of the Buffer parameter. |
Flags | Points to a value controlling the message reception.
The /usr/include/sys/socket.h file defines the Flags parameter.
The argument to receive a call is formed by the logical OR operation
with one or more of the following values:
|
Message | Points to the address of the msghdr structure, which contains both the address for the incoming message and the space for the sender address. |
From | Points to a socket structure, containing the address of the source. |
FromLength | Specifies the length of the address of the sender or of the source. |
Label | Specifies a result parameter that contains the SL from the received data. |
Upon successful completion, the subroutines return the length of the message in bytes.
Item | Description |
---|---|
EBADF | The Socket parameter is not valid. |
ECONNRESET | The remote peer forced the connection to be closed. |
EFAULT | The data was directed into a nonexistent or protected part of the process address space. (The Buffer parameter is not valid.) |
EINTR | A signal interrupted the erecv, erecvmsg, erecvfrom, enrecvmsg, or enrecvfrom subroutine before any data is available. |
EINVAL | The MSG_OOB value was set and no out-of-band data was available. |
ENOBUF | Insufficient resources are available in the system to perform the operation. |
ENOTCONN | A receiving operation was attempted on a SOCK_STREAM socket that was not connected. |
ENOTSOCK | The Socket parameter refers to a file, not a socket. |
EOPNOTSUPP | The MSG_OOB value is set for a SOCK_DGRAM socket or any AF_UNIX socket. |
ETIMEDOUT | The connection timed out during connection establishment, or there was a transmission timeout on an active connection. |
EWOULDBLOCK | The socket is marked nonblocking, and no connections are present to be accepted. |
EACCES | The MLS MAC check failed. |