]> git.sesse.net Git - greproxy/blobdiff - greproxy.cpp
Switch to a different RS encoding.
[greproxy] / greproxy.cpp
index fa116b63da7e7175774b584a9751e5c130f3e463..127e0a6c72f51f717cc02cc3eb84a84877877f27 100644 (file)
@@ -1,18 +1,13 @@
+#include <arpa/inet.h>
+#include <netinet/in.h>
 #include <stdio.h>
-#include <string.h>
 #include <stdlib.h>
+#include <sys/select.h>
 #include <sys/socket.h>
-#include <arpa/inet.h>
-#include <netinet/in.h>
-
-#include <map>
-#include <string>
-#include <queue>
 
 #include "greprotocol.h"
-#include "protocol.h"
 #include "reorderer.h"
-#include "tunprotocol.h"
+#include "rsencoder.h"
 
 using namespace std;
 
@@ -32,8 +27,10 @@ int main(int argc, char **argv)
        in6_addr myaddr = get_addr(argv[3]);
        GREProtocol gre_a(myaddr, addr_a);
        GREProtocol gre_b(myaddr, addr_b);
-       Reorderer dst_a(&gre_a);
-       Reorderer dst_b(&gre_b);
+       RSEncoder rs_a(&gre_a);
+       RSEncoder rs_b(&gre_b);
+       Reorderer reorder_a(&rs_a);
+       Reorderer reorder_b(&rs_b);
 
        fd_set fds;
        FD_ZERO(&fds);
@@ -47,10 +44,10 @@ int main(int argc, char **argv)
                }
 
                if (FD_ISSET(gre_a.fd(), &fds)) {
-                       gre_a.read_packet(&dst_b);
+                       gre_a.read_packet(&reorder_b);
                }
                if (FD_ISSET(gre_b.fd(), &fds)) {
-                       gre_b.read_packet(&dst_a);
+                       gre_b.read_packet(&reorder_a);
                }
        }
 }