X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=src%2Fiface-windows.h;h=f7be1f709106bb06e4b299fb870ab25f2c45571c;hb=HEAD;hp=1d77b213636f75fc8f3802852cb0ca6ca2e2c875;hpb=28302bf673d9a57b0919a91943c6aeb083ddcdb2;p=catta diff --git a/src/iface-windows.h b/src/iface-windows.h index 1d77b21..f7be1f7 100644 --- a/src/iface-windows.h +++ b/src/iface-windows.h @@ -1,11 +1,26 @@ #ifndef fooifacewindowshfoo #define fooifacewindowshfoo -#include "hashmap.h" +#include +#include + +// 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