GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
NN_CMSG(3) nanomsg 1.1.5 NN_CMSG(3)

nn_cmsg - access control information

#include <nanomsg/nn.h>

struct nn_cmsghdr *NN_CMSG_FIRSTHDR(struct nn_msghdr *hdr);

struct nn_cmsghdr *NN_CMSG_NXTHDR(struct nn_msghdr *hdr , struct nn_cmsghdr *cmsg);

unsigned char *NN_CMSG_DATA(struct nn_cmsghdr *cmsg);

size_t NN_CMSG_SPACE(size_t len);

size_t NN_CMSG_LEN(size_t len);

These functions can be used to iterate over ancillary data attached to a message.

Structure nn_cmsghdr represents a single ancillary property and contains following members:

size_t cmsg_len;
int cmsg_level;
int cmsg_type;

cmsg_len is the size of the property data, including the preceding nn_cmsghdr structure. cmsg_level is the level of the property; same values can be used as with nn_getsockopt(3) and nn_setsockopt(3). cmsg_type is the name of the property. These names are specific for each level.

NN_CMSG_FIRSTHDR returns a pointer to the first nn_cmsghdr in the control buffer in the supplied nn_msghdr structure.

NN_CMSG_NXTHDR returns the next nn_cmsghdr after the supplied nn_cmsghdr. Returns NULL if there isn’t enough space in the buffer.

NN_CMSG_DATA returns a pointer to the data associated with supplied nn_cmsghdr.

NN_CMSG_SPACE returns the number of bytes occupied by nn_cmsghdr with payload of the specified length.

NN_CMSG_LEN returns the value to store in the cmsg_len member of the cmsghdr structure, taking into account any necessary alignment.

Iterating over ancillary properties:

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 ("\n");
    hdr = NN_CMSG_NXTHDR (&msg, hdr);
}

nn_sendmsg(3) nn_recvmsg(3) nn_getsockopt(3) nn_setsockopt(3) nanomsg(7)

Martin Sustrik <sustrik@250bpm.com>
2018-10-15  

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.