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


Manual Reference Pages  -  NN_CMSG (3)

.ds Aq ’

NAME

nn_cmsg - access control information

CONTENTS

SYNOPSIS

#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);

DESCRIPTION

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\(cqt 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.

EXAMPLE

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);
}

SEE ALSO

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

AUTHORS

Martin Sustrik <\m[blue]sustrik@250bpm.com\m[][1]>

NOTES

1. sustrik@250bpm.com  mailto:sustrik@250bpm.com
Search for    or go to Top of page |  Section 3 |  Main Index


nanomsg Unknown NN_CMSG (3) 03/17/2016

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