aboutsummaryrefslogtreecommitdiffstats
path: root/api/api.h
diff options
context:
space:
mode:
authorSimon Rozman <simon@rozman.si>2020-07-07 15:42:39 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2020-10-30 16:50:58 +0100
commitd3a63116bae420db751bb2243f72baaa3b61c441 (patch)
treef6efa29387261a51750861e98acc66d9b85974be /api/api.h
parentapi: port nci package from wireguard-go (diff)
downloadwintun-d3a63116bae420db751bb2243f72baaa3b61c441.tar.xz
wintun-d3a63116bae420db751bb2243f72baaa3b61c441.zip
api: port GetInterface member from wireguard-go
Mind that this also fixes the order of adapter detection checks. A fast test to eliminate non-Wintun adapters from iteration to speed things up rendered the method incapable of detecting a non-Wintun adapter with the name we are looking for. ERROR_OBJECT_NOT_FOUND was replaced with ERROR_FILE_NOT_FOUND. Signed-off-by: Simon Rozman <simon@rozman.si>
Diffstat (limited to 'api/api.h')
-rw-r--r--api/api.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/api/api.h b/api/api.h
index cda22b3..6b05de2 100644
--- a/api/api.h
+++ b/api/api.h
@@ -36,3 +36,21 @@ NciInit();
void
NciCleanup();
+
+#define MAX_POOL 256
+#define MAX_INSTANCE_ID MAX_PATH /* TODO: Is MAX_PATH always enough? */
+
+typedef struct _WINTUN_ADAPTER
+{
+ GUID CfgInstanceID;
+ WCHAR DevInstanceID[MAX_INSTANCE_ID];
+ DWORD LuidIndex;
+ DWORD IfType;
+ WCHAR Pool[MAX_POOL];
+} WINTUN_ADAPTER;
+
+VOID WINAPI
+WintunFreeAdapter(_In_ WINTUN_ADAPTER *Adapter);
+
+_Return_type_success_(return == 0) DWORD WINAPI
+ WintunGetAdapter(_In_z_count_c_(MAX_POOL) LPCWSTR Pool, _In_z_ LPCWSTR IfName, _Out_ WINTUN_ADAPTER **Adapter);