6 #include <netinet/in.h>
13 #include "greprotocol.h"
15 #include "reorderer.h"
16 #include "tunprotocol.h"
20 in6_addr get_addr(const char *str) {
22 if (inet_pton(AF_INET6, str, &ret) != 1) {
23 fprintf(stderr, "Could not parse %s\n", str);
29 int main(int argc, char **argv)
31 in6_addr myaddr = get_addr(argv[1]);
32 in6_addr remoteaddr = get_addr(argv[2]);
33 GREProtocol gre(myaddr, remoteaddr);
34 TUNProtocol tun("tungre");
36 Reorderer tun_reorderer(&tun);
41 FD_SET(gre.fd(), &fds);
42 FD_SET(tun.fd(), &fds);
43 int ret = select(1024, &fds, NULL, NULL, NULL);
49 if (FD_ISSET(gre.fd(), &fds)) {
50 gre.read_packet(&tun_reorderer);
52 if (FD_ISSET(tun.fd(), &fds)) {
53 tun.read_packet(&gre);