3 #include <sys/socket.h>
11 #include "pretty-print.h"
13 #include <arpa/inet.h>
16 int main(int c, char** v) {
18 memset(dev, 0, IFNAMSIZ);
19 int fd = init_tun(dev);
21 debug(1, 0, "Initialized the interface %s.\n", dev);
26 printf("read %d bytes from socket, ", recv_pkt(fd, &pkt));
27 switch (ntohs(pkt->type)) {
29 printf("parsing ipv6:\n");
30 struct ip6_pkt* pkt6 = parse_ip6(pkt);
32 struct ip6_tcp* pkt6_tcp;
33 struct ip6_udp* pkt6_udp;
34 switch(pkt6->hdr.nxthdr) {
36 pkt6_tcp = parse_ip6_tcp(pkt6);
37 pkt_printf_ip6tcp(pkt6_tcp);
41 pkt6_udp = parse_ip6_udp(pkt6);
42 pkt_printf_ip6udp(pkt6_udp);
47 printf("unknown/unimplemented packet-type\n");