Allows an application to send messages on a socket with the Sensitivity Level (SL) different from that of its own.
Standard C Library (libc.a)Trusted AIX® Sensitivity Label Library (libmls.a)
#include <sys/types.h>
#include <sys/socketvar.h>
#include <sys/mac.h>
#include <sys/socket.h>
int esend (Socket, Message, Length, Flags, Label)
int Socket;
const void * Message;
size_t Length;
int Flags;
sec_labels_t *Label;
int esendmsg ( Socket, Message, Flags, Label)
int Socket;
const struct msghdr Message [ ];
int Flags;
sec_labels_t *Label;
int esendto (Socket, Message, Length, Flags, To, ToLength, Label)
int Socket;
const void * Message;
size_t Length;
int Flags;
const struct sockaddr * To;
socklen_t ToLength;
sec_labels_t *Label;
The esend, esendmsg, and esendto subroutines work exactly like send, sendmsg and sendto subroutines respectively, except that the esend, esendmsg, and esendto subroutines allow applications to associate a Sensitivity Level different from their own to the outgoing data through the Label parameter.
The esend subroutine can be used on connected sockets only. The esendto and esendmsg subroutines can be used with connected or unconnected sockets.
For SOCK_STREAM socket types, when the SL is changed between subsequent send operations, the application is blocked until the pending data on the socket buffer can be flushed. If the socket is marked as nonblocking type and there is pending data on the socket buffer, an error is returned.
Item | Description |
---|---|
Socket | Specifies a unique name for the socket. |
Message | Points to the address of the message or the msghdr structure containing the message to send. |
Length | Specifies the length of the message in bytes. |
Flags | Allows
the sender to control the transmission of the
message.
|
To | Specifies the destination address for the message. The destination address is a sockaddr structure defined in the /usr/include/sys/socket.h file. |
ToLength | Specifies the size of the destination address. |
Label | Specifies the SL to be used on the outgoing data. |
Upon successful completion, the esend, esendmsg, or esendto subroutine returns the number of characters sent.
Error | Description |
---|---|
EACCES | Write access to the named socket is denied, or the socket trying to send a broadcast packet does not have broadcast capability, or the MLS MAC check failed. |
EADDRNOTAVAIL | The specified address is not valid. |
EAFNOSUPPORT | The specified address is not a valid address for the address family of this socket. |
EBADF | The Socket parameter is not valid. |
ECONNRESET | A connection was forcibly closed by a peer. |
EDESTADDRREQ | The socket is not in connection mode and no peer address is set. |
EFAULT | The Address parameter is not in a writable part of the user address space. |
EHOSTUNREACH | The destination host cannot be reached. |
EINTR | A signal interrupted the esend, esendmsg, or esendto subroutine before any data was transmitted. |
EINVAL | The Length parameter is not valid. |
EISCONN | A SOCK_DGRAM socket is already connected. |
EMSGSIZE | The message is too large to be sent all at once, as the socket requires. |
ENETUNREACH | The destination network is not reachable. |
ENOBUFS | Insufficient resources were available in the system to perform the operation. |
ENOENT | The path name does not contain an existing file, or the path name is an empty string. |
ENOMEM | The available data space in memory is not large enough to hold group or ACL information. |
ENOTSOCK | The Socket parameter refers to a file, not a socket. |
EOPNOTSUPP | The Socket parameter is associated with a socket that does not support one or more of the values set in the Flags parameter. |
EPIPE | An attempt was made to send on a socket that was connected, but the connection was shut down either by the remote peer or by this side of the connection. If the socket is of type SOCK_STREAM, the SIGPIPE signal is generated for the calling process. |
EWOULDBLOCK | The socket is marked nonblocking, and no connections are present to be accepted. Or a sending operation was attempted with different SLs while there was pending data on the socket buffer, and the socket was marked nonblocking |