]> git.meshlink.io Git - catta/blobdiff - src/iface-windows.h
skeleton implementation of interface change event handling
[catta] / src / iface-windows.h
index 1d77b213636f75fc8f3802852cb0ca6ca2e2c875..f7be1f709106bb06e4b299fb870ab25f2c45571c 100644 (file)
@@ -1,11 +1,26 @@
 #ifndef fooifacewindowshfoo
 #define fooifacewindowshfoo
 
-#include "hashmap.h"
+#include <catta/llist.h>
+#include <pthread.h>
+
+// we register with Windows to receive callbacks when IP interfaces change.
+// we save these events in the structures below and pick them up from our
+// own mainloop which we wake via a pipe.
+
+typedef struct ChangeEvent ChangeEvent;
 
 typedef struct CattaInterfaceMonitorOSDep {
-    CattaHashmap *idxmap;   // maps adapter LUIDs to stable int indexes
-    int nidx;               // number of assigned indexes (= size of idxmap)
+    pthread_mutex_t mutex;  // guards access to event queues and the pipe
+
+    CATTA_LLIST_HEAD(ChangeEvent, events);
+
+    int pipefd[2];      // used to wake up the mainloop and check for events
+
+    // handles for deregistering the handler and notification callbacks
+    HANDLE icnhandle;   // interface change notification handle
+    HANDLE acnhandle;   // address change notification handle
+    CattaWatch *watch;
 } CattaInterfaceMonitorOSDep;
 
 #endif