]> git.meshlink.io Git - meshlink/blobdiff - src/net_packet.c
Convert to libevent.
[meshlink] / src / net_packet.c
index ffda5a1253702c3ae2733fbc084e65239f20380d..bb81081d25fafc3089beb320da9d44da2e6b4947 100644 (file)
 #include <openssl/hmac.h>
 
 #include <zlib.h>
-#ifdef HAVE_LZO_LZO1X_H
-#include <lzo/lzo1x.h>
-#endif
-#ifdef HAVE_LZO1X_H
-#include <lzo1x.h>
-#endif
+#include LZO1X_H
 
 #include "avl_tree.h"
 #include "conf.h"
 #include "connection.h"
 #include "device.h"
 #include "ethernet.h"
-#include "event.h"
+#include "tevent.h"
 #include "graph.h"
 #include "list.h"
 #include "logger.h"
@@ -101,11 +96,11 @@ void send_mtu_probe(node_t *n)
                send_udppacket(n, &packet);
        }
 
-       n->mtuevent = xmalloc(sizeof(*n->mtuevent));
+       n->mtuevent = new_tevent();
        n->mtuevent->handler = (event_handler_t)send_mtu_probe;
        n->mtuevent->data = n;
        n->mtuevent->time = now + 1;
-       event_add(n->mtuevent);
+       tevent_add(n->mtuevent);
 }
 
 void mtu_probe_h(node_t *n, vpn_packet_t *packet) {
@@ -489,7 +484,7 @@ void flush_queue(node_t *n)
        }
 }
 
-void handle_incoming_vpn_data(int sock)
+void handle_incoming_vpn_data(int sock, short events, void *data)
 {
        vpn_packet_t pkt;
        char *hostname;
@@ -520,3 +515,11 @@ void handle_incoming_vpn_data(int sock)
 
        receive_udppacket(n, &pkt);
 }
+
+void handle_device_data(int sock, short events, void *data)
+{
+       vpn_packet_t packet;
+
+       if(read_packet(&packet))
+               route(myself, &packet);
+}