diff options
| author | Garrett D'Amore <garrett@damore.org> | 2017-01-24 19:26:31 -0800 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2017-01-24 19:42:43 -0800 |
| commit | e88f07b434dbcfdb57435a14e1beadcdae3cef0d (patch) | |
| tree | 79433ae3c4ed6d2501e4d63ad9ada5a621df3bd9 /src/nng_compat.h | |
| parent | 907a1eb392ca4b29c62b9cc3d2df1ad337695abf (diff) | |
| download | nng-e88f07b434dbcfdb57435a14e1beadcdae3cef0d.tar.gz nng-e88f07b434dbcfdb57435a14e1beadcdae3cef0d.tar.bz2 nng-e88f07b434dbcfdb57435a14e1beadcdae3cef0d.zip | |
Add endpoint tuning of maxrcv size. Fix cmsg API.
The CMSG handling was completely borked. This is fixed now, and
we stash the SP header size (ugh) in the CMSG contents to match what
nanomsg does. We now pass the cmsg validation test.
We also fixed handling of certain endpoint-related options, so that
endpoints can get options from the socket at initialization time.
This required a minor change to the transport API for endpoints.
Finally, we fixed a critical fault in the REP handling of RAW sockets,
which caused them to always return NNG_ESTATE in all cases. It should
now honor the actual socket option.
Diffstat (limited to 'src/nng_compat.h')
| -rw-r--r-- | src/nng_compat.h | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/nng_compat.h b/src/nng_compat.h index 64ace069..5866fe2c 100644 --- a/src/nng_compat.h +++ b/src/nng_compat.h @@ -258,7 +258,7 @@ struct nn_cmsghdr { int cmsg_type; }; -#define NN_ALIGN(len) \ +#define NN_CMSG_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 @@ -268,16 +268,17 @@ struct nn_cmsghdr { // anyone used that in practice though.) #define NN_CMSG_FIRSTHDR(mh) \ nn_cmsg_next((struct nn_msghdr *) (mh), NULL) -#define NN_CMSG_NEXTHDR(mh, ch) \ +#define NN_CMSG_NXTHDR(mh, ch) \ nn_cmsg_next((struct nn_msghdr *) (mh), (struct nn_cmsghdr *) ch) #define NN_CMSG_DATA(ch) \ ((unsigned char *) (((struct nn_cmsghdr *) (ch)) + 1)) #define NN_CMSG_SPACE(len) \ - (NN_ALIGN(len) + NN_ALIGN(sizeof (struct nn_cmsghdr))) + (NN_CMSG_ALIGN(len) + NN_CMSG_ALIGN(sizeof (struct nn_cmsghdr))) #define NN_CMSG_LEN(len) \ - (NN_ALIGN(sizeof (nn_cmsghdr)) + (len)) + (NN_CMSG_ALIGN(sizeof (struct nn_cmsghdr)) + (len)) -NN_DECL struct cmsg_hdr *nn_cmsg_next(struct nn_msghdr *, struct nn_cmsghdr *); +NN_DECL struct nn_cmsghdr *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 *); @@ -287,7 +288,7 @@ NN_DECL int nn_shutdown(int, int); NN_DECL int nn_send(int, const void *, size_t, int); NN_DECL int nn_recv(int, void *, size_t, int); NN_DECL int nn_sendmsg(int, const struct nn_msghdr *, int); -NN_DECL int nn_recvcmsg(int, struct nn_msghdr *, int); +NN_DECL int nn_recvmsg(int, struct nn_msghdr *, int); NN_DECL int nn_close(int); NN_DECL int nn_poll(struct nn_pollfd *, int, int); NN_DECL int nn_device(int, int); |
