Make it compile on linux, added copyright

This commit is contained in:
Erik Ekman 2006-06-05 12:48:30 +00:00
parent c5e6cfa708
commit 151a9134fa
3 changed files with 17 additions and 11 deletions

View File

@ -1,5 +1,7 @@
/*
* Copyright (c) 2006 Bjorn Andersson <flex@kryo.se>
* Copyright (c) 2006
* Bjorn Andersson <flex@kryo.se>,
* Erik Ekman <yarrick@kryo.se>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@ -15,6 +17,7 @@
*/
#include <stdio.h>
#include <stdint.h>
#include "tun.h"
@ -23,8 +26,6 @@ main()
{
open_tun();
sleep(10);
close_tun();
return 0;

9
tun.c
View File

@ -1,5 +1,7 @@
/*
* Copyright (c) 2006 Bjorn Andersson <flex@kryo.se>
* Copyright (c) 2006
* Bjorn Andersson <flex@kryo.se>,
* Erik Ekman <yarrick@kryo.se>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@ -18,6 +20,7 @@
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <stdint.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
@ -107,7 +110,7 @@ close_tun()
}
int
write_tun(u_char *buf, int len)
write_tun(uint8_t *buf, int len)
{
if (write(tun_fd, buf, len) != len)
err(1, "write_tun: %s", strerror(errno));
@ -116,7 +119,7 @@ write_tun(u_char *buf, int len)
}
int
read_tun(u_char *buf, int len)
read_tun(uint8_t *buf, int len)
{
return read(tun_fd, buf, len);
}

12
tun.h
View File

@ -1,5 +1,7 @@
/*
* Copyright (c) 2006 Bjorn Andersson <flex@kryo.se>
* Copyright (c) 2006
* Bjorn Andersson <flex@kryo.se>,
* Erik Ekman <yarrick@kryo.se>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@ -20,9 +22,9 @@
extern char *tun_device;
extern int tun_fd;
extern int open_tun();
extern void close_tun();
extern int write_tun(u_char *buf, int len);
extern int read_tun(u_char *buf, int len);
int open_tun();
void close_tun();
int write_tun(uint8_t *buf, int len);
int read_tun(uint8_t *buf, int len);
#endif /* _TUN_H_ */