diff options
Diffstat (limited to 'tun.h')
-rw-r--r-- | tun.h | 17 |
1 files changed, 15 insertions, 2 deletions
@@ -18,7 +18,10 @@ #ifndef __TUN_H__ #define __TUN_H__ +#include <fcntl.h> #include <linux/if.h> +#include <sys/uio.h> +#include <unistd.h> #include "common.h" #include "ring.h" @@ -29,9 +32,19 @@ struct tun_data { struct packet_ring ring; }; +// tun_open and tun_alloc are defined in tun.c and only used by clatd_microbenchmark.c int tun_open(); int tun_alloc(char *dev, int fd, size_t len); -int send_tun(int fd, clat_packet out, int iov_len); -int set_nonblocking(int fd); + +/* function: send_tun + * sends a clat_packet to a tun interface + * fd - the tun filedescriptor + * out - the packet to send + * iov_len - the number of entries in the clat_packet + * returns: number of bytes read on success, -1 on failure + */ +static inline int send_tun(int fd, clat_packet out, int iov_len) { + return writev(fd, out, iov_len); +} #endif |