'\" t .\" Title: nn_cmsg .\" Author: [see the "AUTHOR(S)" section] .\" Generator: Asciidoctor 2.0.20 .\" Date: 2024-02-21 .\" Manual: nanomsg 1.2.1 .\" Source: \ \& .\" Language: English .\" .TH "NN_CMSG" "3" "2024-02-21" "\ \&" "nanomsg 1.2.1" .ie \n(.g .ds Aq \(aq .el .ds Aq ' .ss \n[.ss] 0 .nh .ad l .de URL \fI\\$2\fP <\\$1>\\$3 .. .als MTO URL .if \n[.g] \{\ . mso www.tmac . am URL . ad l . . . am MTO . ad l . . . LINKSTYLE blue R < > .\} .SH "NAME" nn_cmsg \- access control information .SH "SYNOPSIS" .sp \fB#include \fP .sp \fBstruct nn_cmsghdr *NN_CMSG_FIRSTHDR(struct nn_msghdr \fI*hdr\fP);\fP .sp \fBstruct nn_cmsghdr *NN_CMSG_NXTHDR(struct nn_msghdr \fI*hdr\fP, struct nn_cmsghdr \fI*cmsg\fP);\fP .sp \fBunsigned char *NN_CMSG_DATA(struct nn_cmsghdr \fI*cmsg\fP);\fP .sp \fBsize_t NN_CMSG_SPACE(size_t \fIlen\fP);\fP .sp \fBsize_t NN_CMSG_LEN(size_t \fIlen\fP);\fP .SH "DESCRIPTION" .sp These functions can be used to iterate over ancillary data attached to a message. .sp Structure \fInn_cmsghdr\fP represents a single ancillary property and contains following members: .sp .if n .RS 4 .nf .fam C size_t cmsg_len; int cmsg_level; int cmsg_type; .fam .fi .if n .RE .sp \fIcmsg_len\fP is the size of the property data, including the preceding nn_cmsghdr structure. \fIcmsg_level\fP is the level of the property; same values can be used as with nn_getsockopt(3) and nn_setsockopt(3). \fIcmsg_type\fP is the name of the property. These names are specific for each level. .sp \fINN_CMSG_FIRSTHDR\fP returns a pointer to the first nn_cmsghdr in the control buffer in the supplied nn_msghdr structure. .sp \fINN_CMSG_NXTHDR\fP returns the next nn_cmsghdr after the supplied nn_cmsghdr. Returns NULL if there isn\(cqt enough space in the buffer. .sp \fINN_CMSG_DATA\fP returns a pointer to the data associated with supplied nn_cmsghdr. .sp \fINN_CMSG_SPACE\fP returns the number of bytes occupied by nn_cmsghdr with payload of the specified length. .sp \fINN_CMSG_LEN\fP returns the value to store in the cmsg_len member of the cmsghdr structure, taking into account any necessary alignment. .SH "EXAMPLE" .sp Iterating over ancillary properties: .sp .if n .RS 4 .nf .fam C struct nn_cmsghdr *hdr = NN_CMSG_FIRSTHDR (&msg); while (hdr != NULL) { size_t len = hdr\->cmsg_len \- sizeof (nn_cmsghdr); printf ("level: %d property: %d length: %dB data: ", (int) hdr\->cmsg_level, (int) hdr\->cmsg_type, (int) len); unsigned char *data = NN_CMSG_DATA(hdr); while (len) { printf ("%02X", *data); ++data; \-\-len; } printf ("\(rsn"); hdr = NN_CMSG_NXTHDR (&msg, hdr); } .fam .fi .if n .RE .SH "SEE ALSO" .sp nn_sendmsg(3) nn_recvmsg(3) nn_getsockopt(3) nn_setsockopt(3) nanomsg(7) .SH "AUTHORS" .sp .MTO "sustrik\(at250bpm.com" "Martin Sustrik" ""