diff options
author | Mattias Andrée <maandree@kth.se> | 2018-08-29 16:51:41 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2018-08-29 16:52:38 +0200 |
commit | 7f397be7159a28d459d8f4ba6b934ab86458d633 (patch) | |
tree | 87be67fa6baf8e5b6d548084b80bf038c9a91912 /recvfrom_timestamped.c | |
parent | Add tests for strtotimespec and strtotimeval (diff) | |
download | libsimple-7f397be7159a28d459d8f4ba6b934ab86458d633.tar.gz libsimple-7f397be7159a28d459d8f4ba6b934ab86458d633.tar.bz2 libsimple-7f397be7159a28d459d8f4ba6b934ab86458d633.tar.xz |
Remove sendfd, recvfd, recvfrom_timestamped, and recv_timestamped for now
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-rw-r--r-- | recvfrom_timestamped.c | 70 |
1 files changed, 0 insertions, 70 deletions
diff --git a/recvfrom_timestamped.c b/recvfrom_timestamped.c deleted file mode 100644 index 49e8e3f..0000000 --- a/recvfrom_timestamped.c +++ /dev/null @@ -1,70 +0,0 @@ -/* See LICENSE file for copyright and license details. */ -#include "libsimple.h" -#ifndef TEST - - -ssize_t -libsimple_recvfrom_timestamped(int fd, void *restrict buf, size_t n, int flags, struct sockaddr *restrict addr, /* TODO test */ - socklen_t addrlen, struct timespec *restrict ts) -{ - struct iovec iov; - struct msghdr msg; - struct cmsghdr *cmsg; - char cms[CMSG_SPACE(sizeof(*ts))]; - size_t r; - - iov.iov_base = buf; - iov.iov_len = n; - - memset(&msg, 0, sizeof(msg)); - msg.msg_name = addr; - msg.msg_namelen = addrlen; - msg.msg_iov = &iov; - msg.msg_iovlen = 1; - - msg.msg_control = (caddr_t)cms; - msg.msg_controllen = sizeof(cms); - - switch ((r = recvmsg(fd, &msg, flags))) { - case -1: - return -1; - case 0: - errno = ECONNRESET; - return -1; - default: - break; - } - - if (!ts) - return r; - - cmsg = CMSG_FIRSTHDR(&msg); - if (cmsg && - cmsg->cmsg_level == SOL_SOCKET && - cmsg->cmsg_type == SCM_TIMESTAMPNS && - cmsg->cmsg_len == CMSG_LEN(sizeof(*ts))) { - memcpy(ts, CMSG_DATA(cmsg), sizeof(*ts)); - } else if (cmsg && - cmsg->cmsg_level == SOL_SOCKET && - cmsg->cmsg_type == SCM_TIMESTAMP && - cmsg->cmsg_len == CMSG_LEN(sizeof(*ts))) { - memcpy(ts, CMSG_DATA(cmsg), sizeof(*ts)); - ts->tv_nsec *= 1000; - } else { - memset(ts, 0, sizeof(*ts)); - } - - return r; -} - - -#else -#include "test.h" - -int -main(void) -{ - return 0; -} - -#endif |