Hi all, I've made some changes to the API.First of all, using an sp_ prefix which doesn't correlate with the name of library was confusing. After all, SP is a name of layer in network stack and thus using sp_send() to send messages is similar to TCP asking you to use L4_send() to send data.
Thus, I've changed all the prefixes to nn_ or NN_, as approriate.The only place where SP remains, is the place where it is appropriate, i.e. when specifying at which level of network stack the socket operates:
s = nn_socket (AF_SP, NN_PUB);The second change involves how zero-copy buffers are handled. So far the fucntionality was not implemeted, so changing the API should have minimal impact.
nn_sendmsg and nn_recvmsg which were originally intended to send/recv zero-copy buffers were changed to by fully compliant with POSIX. The support gather/scatter arrays, control information (ancillary data) etc.
Instead, zero-copy buffers can be used with and send/recv function (nn_send, nn_recv, nn_sendmsg, nn_recvmsg). The way to do it is to specify NN_MSG instead of length of the buffer. That way the library knows that the buffer supplied is not a common buffer, rather a one [to be] allocated by nn_allocmsg. Examples:
void *buf = nn_allocmsg (10, 0); memset (buf, 0xab, 10); nn_send (s, buf, NN_MSG, 0); void *buf; nn_recv (s, &buf, NN_MSG, 0); nn_freemsg (buf);Please, find the changes (as well as actual implementation of zero-copy buffers) in iovecs branch of the project.
If there are to substantial objections, I will merge the changes to the mainline shortly.
Martin