]> git.meshlink.io Git - catta/blobdiff - src/iface-windows.h
skeleton implementation of interface change event handling
[catta] / src / iface-windows.h
index cf21c29d6833788ce59e661dcce5b3e487d4542e..f7be1f709106bb06e4b299fb870ab25f2c45571c 100644 (file)
@@ -1,10 +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 {
-    int dummy;  // silence "no members" warning
+    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