diff options
| author | Garrett D'Amore <garrett@damore.org> | 2017-01-23 14:00:05 -0800 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2017-01-23 14:00:05 -0800 |
| commit | fc553e0689a9be70b90663db1bcd020706ba9ae6 (patch) | |
| tree | 0910800077180ec33903be9f834aec9c792a55b7 /src/nng_compat.h | |
| parent | 5f34e9b1ed7df2102ad8cd3ebbef202a4d8c37cb (diff) | |
| download | nng-fc553e0689a9be70b90663db1bcd020706ba9ae6.tar.gz nng-fc553e0689a9be70b90663db1bcd020706ba9ae6.tar.bz2 nng-fc553e0689a9be70b90663db1bcd020706ba9ae6.zip | |
nn_recvmsg, and enhancements to support NN_MSG allocated messages.
Diffstat (limited to 'src/nng_compat.h')
| -rw-r--r-- | src/nng_compat.h | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/nng_compat.h b/src/nng_compat.h index 020a342a..0a147196 100644 --- a/src/nng_compat.h +++ b/src/nng_compat.h @@ -245,19 +245,24 @@ struct nn_cmsghdr { #define NN_ALIGN(len) \ (((len) + sizeof (size_t) - 1) & (size_t) ~(sizeof (size_t) - 1)) + +// Unlike old nanomsg, we explicitly only support the SP header as attached +// cmsg data. It turns out that old nanomsg didn't really store anything +// useful otherwise anyway. (One specific exception was that it stored the +// message type of text or binary for the websocket transport. We don't think +// anyone used that in practice though.) #define NN_CMSG_FIRSTHDR(mh) \ - nn_cmsg_nexthdr((struct nn_msghdr *) (mh), NULL) + nn_cmsg_next((struct nn_msghdr *) (mh), NULL) #define NN_CMSG_NEXTHDR(mh, ch) \ - nn_cmsg_nexthdr((struct nn_msghdr *) (mh), (struct nn_cmsghdr *) ch) + nn_cmsg_next((struct nn_msghdr *) (mh), (struct nn_cmsghdr *) ch) #define NN_CMSG_DATA(ch) \ - ((unsigned char *) (((struct cmsghdr *) (ch)) + 1)) + ((unsigned char *) (((struct nn_cmsghdr *) (ch)) + 1)) #define NN_CMSG_SPACE(len) \ (NN_ALIGN(len) + NN_ALIGN(sizeof (struct nn_cmsghdr))) #define NN_CMSG_LEN(len) \ (NN_ALIGN(sizeof (nn_cmsghdr)) + (len)) -NN_DECL struct cmsg_hdr *nn_cmsg_nexthdr(const struct nn_msghdr *, - const struct nn_cmsghdr *); +NN_DECL struct cmsg_hdr *nn_cmsg_next(struct nn_msghdr *, struct nn_cmsghdr *); NN_DECL int nn_socket(int, int); NN_DECL int nn_setsockopt(int, int, int, const void *, size_t); NN_DECL int nn_getsockopt(int, int, int, void *, size_t *); |
