NAME
t6recvfrom - read security attributes and data from a trusted endpoint
cc [ flag ... ] file ... -lt6 [ library ... ]
#include <tsix/t6attrs.h>
int t6recvfrom(int fd, char *buf, int len, int flags, struct sockaddr
*from, int *fromlen, t6attr_t attr_ptr, t6mask_t *new_attrs)
DESCRIPTION
t6recvfrom receives data and its associated security attributes
from a communication endpoint. The from and fromlen parameters
are only used if you wish to receive the source address for the data. This
may not be applicable for some trusted endpoints. If not used, these fields
should be set to 0 . If from is not a pointer, the source
address of the message is filled in. fromlen is a value-result parameter,
initialized to the size of the buffer associated with from , and
modified on return to indicate the actual size of the address stored there.
The length of the message is returned. If a message is too long to fit
in the supplied buffer, excess bytes may be discarded depending on the
type of socket the message is received from (see
socket(3N)
).
The flags parameter is formed by ORing one or more of the following:
Read any out-of-band data present on the
socket rather than the regular in-band data. If attr_ptr is non-,
out-of-band data security attributes are also retrieved.
Peek at the data present on the socket;
the data is returned, but not consumed, so that a subsequent receive operation
will see the same data. If attr_ptr is non-, security attributes
of the data are also peeked.
attr_ptr specifies a control structure in which to store those attributes the caller wishes to retrieve. To get an attribute from the control structure, see t6get_attr(3N) . Any attribute that the receiving process does not care to receive may not be specified in the control structure. This minimizes the attribute translation time when passing the attributes out of the kernel.
If the t6new_attr(3N) call was made previously with a setting of , the security attributes of the received data will be returned only if they have changed from the last set read. *new_attrs is set to the mask of those attributes actually returned. If new attributes are detected, all attributes requested by the receiving process are returned, not just those that have changed.
Again, it is critical that the return value always be checked. It is the number of bytes actually received, or -1 with the error code stored in errno . Revocation of access is possible if the received data changes to a level not accessible to the receiving process.
ERRORS
Errors generated by t6recvfrom is indicated by the global variable
errno .
The calls fail if:
An I/O error occurred while reading from or writing to the file system.
There was insufficient user memory available for the operation to complete.
There were insufficient
STREAMS resources available for the operation to complete.
RETURN VALUE
t6recvfrom returns -1 on failure, and the number of bytes
read on successful completion.
SEE ALSO
libt6(3N)
,
t6get_attr(3N)
,
t6sendto(3N)