struct iovec is defined in <uio.h> by the following way:
/* Structure for scatter/gather I/O. */
struct iovec
{
void *iov_base; /* Pointer to data. */
size_t iov_len; /* Length of data. */
};
Now I do ugly casting from const void* to void*:
int send_frame_once( int fd, const struct iovec* iov, size_t iovlen );
int send_frame( int fd, const void* buffer, size_t len )
{
struct iovec iov;
iov.iov_base = (void*)buffer; /* const iov cast */
iov.iov_len = len;
return send_frame_once( fd, &iov, 1 );
}
Is that necessary kludge?
Or should I remove const keyword from declaration of send_frame function. Like this:
int send_frame( int fd, void* buffer, size_t len )