aboutsummaryrefslogtreecommitdiff
path: root/src/vpn
diff options
context:
space:
mode:
authorPhilipp Tölke <toelke@in.tum.de>2010-07-20 08:20:39 +0000
committerPhilipp Tölke <toelke@in.tum.de>2010-07-20 08:20:39 +0000
commit755b73c213813659c1b1e1f06dad895710bca3ad (patch)
tree953d101ef87d37d7fc8f8803cf9b6c5c8ab4a8e9 /src/vpn
parent6b7a0245036ee22d6271aeb6b4095f414517c4a6 (diff)
downloadgnunet-755b73c213813659c1b1e1f06dad895710bca3ad.tar.gz
gnunet-755b73c213813659c1b1e1f06dad895710bca3ad.zip
deleted unused functions
Diffstat (limited to 'src/vpn')
-rw-r--r--src/vpn/Makefile.am2
-rw-r--r--src/vpn/gnunet-vpn-packet.c88
2 files changed, 1 insertions, 89 deletions
diff --git a/src/vpn/Makefile.am b/src/vpn/Makefile.am
index 480d58145..a30ff7e6e 100644
--- a/src/vpn/Makefile.am
+++ b/src/vpn/Makefile.am
@@ -36,7 +36,7 @@ gnunet_vpn_helper_SOURCES = \
36# udp.c udp.h 36# udp.c udp.h
37 37
38gnunet_daemon_vpn_SOURCES = \ 38gnunet_daemon_vpn_SOURCES = \
39 gnunet-daemon-vpn.c 39 gnunet-daemon-vpn.c gnunet-vpn-pretty-print.c
40gnunet_daemon_vpn_LDADD = \ 40gnunet_daemon_vpn_LDADD = \
41 $(top_builddir)/src/core/libgnunetcore.la \ 41 $(top_builddir)/src/core/libgnunetcore.la \
42 $(top_builddir)/src/statistics/libgnunetstatistics.la \ 42 $(top_builddir)/src/statistics/libgnunetstatistics.la \
diff --git a/src/vpn/gnunet-vpn-packet.c b/src/vpn/gnunet-vpn-packet.c
deleted file mode 100644
index deda87216..000000000
--- a/src/vpn/gnunet-vpn-packet.c
+++ /dev/null
@@ -1,88 +0,0 @@
1#include <errno.h>
2#include <stdlib.h>
3#include <string.h>
4#include <unistd.h>
5#include <sys/uio.h>
6
7#include <linux/if_tun.h>
8
9#include "debug.h"
10#include "packet.h"
11#include "arpa/inet.h"
12
13short payload(struct ip6_hdr* hdr) {{{
14 return ntohs(hdr->paylgth);
15}}}
16
17void send_pkt(int fd, struct ip6_pkt* pkt) {{{
18 int sz = payload(&(pkt->hdr));
19 int w = 0;
20 char* buf = (char*)pkt;
21
22 w = 0;
23 while ( w > 0) {
24 int t = write(fd, buf+w, (sz + 40) - w);
25 if (t < 0)
26 debug(1, 0, "packet: write : %s\n", strerror(errno));
27 else
28 w+=t;
29 }
30
31 free(buf);
32}}}
33
34int recv_pkt(int fd, struct pkt_tun** pkt) {{{
35 int size = 1504;
36 unsigned char data[size];
37
38 debug(1, 0, "beginning to read...\n");
39
40 int r = read(fd, data, size);
41 debug(1, 0, "read %d bytes\n", r);
42
43 *pkt = (struct pkt_tun*)malloc(r);
44
45 memcpy(*pkt, data, r);
46 struct pkt_tun *_pkt = *pkt;
47
48 debug(1, 0, "read the flags: %04x\n", ntohs(_pkt->flags));
49 debug(1, 0, "read the type: %04x\n", ntohs(_pkt->type));
50
51 switch(ntohs(_pkt->type)) {
52 case 0x86dd:
53 debug(1, 0, "reading an ipv6-packet\n");
54 struct ip6_pkt * pkt6 = (struct ip6_pkt*) *pkt;
55 size = payload(&(pkt6->hdr));
56 // TODO: size might be greater than r!
57 debug(1, 0, "read the size: %d\n", size);
58 return size;
59 break;
60 case 0x0800:
61 debug(1, 0, "unknown pkt-type: IPv4\n");
62 //IPv4 TODO
63 break;
64 default:
65 debug(1, 0, "unknown pkt-type: 0x%02x\n", 0x800);
66 //Whatever TODO
67 break;
68 }
69 return -1;
70}}}
71
72struct ip6_pkt* parse_ip6(struct pkt_tun* pkt) {{{
73 struct ip6_pkt* pkt6 = (struct ip6_pkt*)pkt;
74
75 return pkt6;
76}}}
77
78struct ip6_tcp* parse_ip6_tcp(struct ip6_pkt* pkt) {{{
79 struct ip6_tcp* res = (struct ip6_tcp*) pkt;
80
81 return res;
82}}}
83
84struct ip6_udp* parse_ip6_udp(struct ip6_pkt* pkt) {{{
85 struct ip6_udp* res = (struct ip6_udp*) pkt;
86
87 return res;
88}}}