]> git.meshlink.io Git - catta/blobdiff - iface.h
add code for recieving packets
[catta] / iface.h
diff --git a/iface.h b/iface.h
index 49bcf200995f2b9241c0b49f485087caba62b4d7..f7547b8462f768026f91ce5c4718ccf6af5ea3a6 100644 (file)
--- a/iface.h
+++ b/iface.h
@@ -3,8 +3,6 @@
 
 #include <glib.h>
 
-#include "address.h"
-
 struct _flxInterfaceMonitor;
 typedef struct _flxInterfaceMonitor flxInterfaceMonitor;
 
@@ -14,15 +12,35 @@ typedef struct _flxInterfaceAddress flxInterfaceAddress;
 struct _flxInterface;
 typedef struct _flxInterface flxInterface;
 
+#include "address.h"
+#include "server.h"
+#include "netlink.h"
+#include "cache.h"
+#include "llist.h"
+
+struct _flxInterfaceMonitor {
+    flxServer *server;
+    flxNetlink *netlink;
+    GHashTable *hash_table;
+
+    FLX_LLIST_HEAD(flxInterface, interfaces);
+    
+    guint query_addr_seq, query_link_seq;
+    
+    enum { LIST_IFACE, LIST_ADDR, LIST_DONE } list;
+};
+
 struct _flxInterface {
+    flxInterfaceMonitor *monitor;
     gchar *name;
     gint index;
     guint flags;
 
+    FLX_LLIST_HEAD(flxInterfaceAddress, addresses);
+    FLX_LLIST_FIELDS(flxInterface, interface);
+
     guint n_ipv6_addrs, n_ipv4_addrs;
-    
-    flxInterfaceAddress *addresses;
-    flxInterface *next, *prev;
+    flxCache *ipv4_cache, *ipv6_cache;
 };
 
 struct _flxInterfaceAddress {
@@ -31,35 +49,21 @@ struct _flxInterfaceAddress {
     flxAddress address;
     
     flxInterface *interface;
-    flxInterfaceAddress *next, *prev;
-};
 
-typedef enum { FLX_INTERFACE_NEW, FLX_INTERFACE_REMOVE, FLX_INTERFACE_CHANGE } flxInterfaceChange;
-
-flxInterfaceMonitor *flx_interface_monitor_new(GMainContext *c);
-void flx_interface_monitor_free(flxInterfaceMonitor *m);
+    FLX_LLIST_FIELDS(flxInterfaceAddress, address);
 
-const flxInterface* flx_interface_monitor_get_interface(flxInterfaceMonitor *m, gint index);
-const flxInterface* flx_interface_monitor_get_first(flxInterfaceMonitor *m);
-
-void flx_interface_monitor_add_interface_callback(
-    flxInterfaceMonitor *m,
-    void (*cb)(flxInterfaceMonitor *m, flxInterfaceChange change, const flxInterface *i, gpointer userdata),
-    gpointer userdata);
+    gint rr_id;
+};
 
-void flx_interface_monitor_remove_interface_callback(
-    flxInterfaceMonitor *m,
-    void (*cb)(flxInterfaceMonitor *m, flxInterfaceChange change, const flxInterface *i, gpointer userdata),
-    gpointer userdata);
+flxInterfaceMonitor *flx_interface_monitor_new(flxServer *server);
+void flx_interface_monitor_free(flxInterfaceMonitor *m);
 
-void flx_interface_monitor_add_address_callback(
-    flxInterfaceMonitor *m,
-    void (*cb)(flxInterfaceMonitor *m, flxInterfaceChange change, const flxInterfaceAddress *a, gpointer userdata),
-    gpointer userdata);
+flxInterface* flx_interface_monitor_get_interface(flxInterfaceMonitor *m, gint index);
+flxInterface* flx_interface_monitor_get_first(flxInterfaceMonitor *m);
 
-void flx_interface_monitor_remove_address_callback(
-    flxInterfaceMonitor *m,
-    void (*cb)(flxInterfaceMonitor *m, flxInterfaceChange change, const flxInterfaceAddress *a, gpointer userdata),
-    gpointer userdata);
+int flx_interface_is_relevant(flxInterface *i);
+int flx_address_is_relevant(flxInterfaceAddress *a);
 
+void flx_interface_send_query(flxInterface *i, guchar protocol, flxKey *k);
+    
 #endif