aboutsummaryrefslogtreecommitdiffstats
path: root/api/wintun.h (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Allow packet over-allocation on sendsr/api-improvementsSimon Rozman2021-04-131-1/+3
| | | | | | | | | | | Should client desire to prepare packets for Wintun inside the ring memory (e.g. to reduce memory copying), the final sending packet size is not always known at the WintunAllocateSendPacket() time. This commit modifies Wintun to calculate the packet size on delivery to NDIS. The packet size is derived from IPv4/IPv6 packet header. Signed-off-by: Simon Rozman <simon@rozman.si>
* Allow optional padding before and after layer 3 packetsSimon Rozman2021-04-131-2/+26
| | | | | | | | | | To avoid additional packet memory allocation and copy when sending or receiving packets, this commit introduces additional available space before and after layer 3 IPv4 or IPv6 packet in the Wintun rings. Wintun will ignore data in those areas. Requested-by: David Woodhouse <dwmw2@infradead.org> Signed-off-by: Simon Rozman <simon@rozman.si>
* api: make .h filenames lowercase for building with MinGW on LinuxSimon Rozman2021-03-161-2/+2
| | | | | | | | MinGW supplies all Windows header files using lowercase filenames. This makes some of the #include lines in wintun.h fail to resolve the .h files correctly on a case-sensitive filesystem. Signed-off-by: Simon Rozman <simon@rozman.si>
* global: bump copyrightJason A. Donenfeld2021-01-301-1/+1
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* api: allow header to be mitJason A. Donenfeld2020-11-271-1/+1
| | | | | | | This doesn't change much, but it does make it mildly more convenient plop this into mixed-use codebases. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* api: remove return value from logger functionJason A. Donenfeld2020-11-101-3/+1
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* api: remove WintunOpenAdapterDeviceObjectJason A. Donenfeld2020-11-051-12/+0
| | | | | | | Discourage use of kernel interface, which gives us more flexibility if we ever want to change it. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* api: rearrange wintun.h to have better grouping and improve docsJason A. Donenfeld2020-11-051-26/+27
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* api: rename WintunGetAdapter to WintunOpenAdapterJason A. Donenfeld2020-11-051-8/+8
| | | | | | "Create" and "Open" natural names for these. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* api: rename ReceiveRelease to ReleaseReceivePacketJason A. Donenfeld2020-11-051-7/+5
| | | | | | | | This makes the API parallel: Wintun*Allocate*SendPacket -> WintunSendPacket WintunReceivePacket -> Wintun*Release*ReceivePacket Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* api: fix typo in ring-management function prototype declarationsSimon Rozman2020-11-051-5/+5
| | | | Signed-off-by: Simon Rozman <simon@rozman.si>
* api: document enum argument properlyJason A. Donenfeld2020-11-041-1/+1
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* api: document log enumJason A. Donenfeld2020-11-041-3/+6
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* api: remove enum name for logger levelJason A. Donenfeld2020-11-041-1/+1
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* api: document adapter handle return value properlyJason A. Donenfeld2020-11-041-1/+1
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* api: CALLBACK_FUNC -> CALLBACKJason A. Donenfeld2020-11-041-4/+4
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* api: rename GetVersion to GetRunningDriverVersionJason A. Donenfeld2020-11-041-1/+1
| | | | | | | This makes our intentions a lot more clear, and in case we ever add other version functions, makes the forward path simpler. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* api: translate NTSTATUS to Win32 error codesSimon Rozman2020-11-041-2/+1
| | | | Signed-off-by: Simon Rozman <simon@rozman.si>
* api: use GetLastError() to report failures like standard Win32Simon Rozman2020-11-041-71/+60
| | | | Signed-off-by: Simon Rozman <simon@rozman.si>
* api: constify pool argumentJason A. Donenfeld2020-11-031-1/+1
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* api: remove guid getterJason A. Donenfeld2020-11-031-9/+0
| | | | | | | | | The iphlpapi takes both LUIDs and GUIDs but prefers LUIDs, so exposing the NET_LUID makes sense. However, we were previously exposing the configuration GUID, rather than the net GUID, which is confusing, so just make it all go away. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* api: use 'open' name since caller must close handleJason A. Donenfeld2020-11-031-1/+1
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* api: add pool/driver removal for uninstaller semanticsJason A. Donenfeld2020-11-031-3/+10
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* api: only return top two version nibblesJason A. Donenfeld2020-11-031-1/+1
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* api: pass around NET_LUID instead of LUIDJason A. Donenfeld2020-11-021-1/+2
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* api: consistancy in exported interfaceJason A. Donenfeld2020-11-021-8/+8
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* api: install driver on demandSimon Rozman2020-11-021-3/+12
| | | | | | ...and add API for uninstalling it. Signed-off-by: Simon Rozman <simon@rozman.si>
* api: separate read-wait handle into other functionJason A. Donenfeld2020-11-021-7/+13
| | | | | | Makes the API a bit more clear. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* api: make version function uniformJason A. Donenfeld2020-11-021-15/+3
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* api: cleanup namesJason A. Donenfeld2020-11-011-5/+5
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* api: check buffer overflows in runtimeSimon Rozman2020-10-311-17/+15
| | | | Signed-off-by: Simon Rozman <simon@rozman.si>
* api: do not require RebootRequiredJason A. Donenfeld2020-10-311-4/+4
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* api: RebootRequire is an _Out_Jason A. Donenfeld2020-10-311-6/+4
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* api expose Send.TailMoved event to clientsSimon Rozman2020-10-311-19/+15
| | | | | | This allows clients to use it in WaitForMultipleObjects(). Signed-off-by: Simon Rozman <simon@rozman.si>
* api: rename MAX_POOL to WINTUN_MAX_POOLSimon Rozman2020-10-311-6/+11
| | | | Signed-off-by: Simon Rozman <simon@rozman.si>
* api: only force close handles if requestedJason A. Donenfeld2020-10-311-4/+8
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* api: depretiate WintunIsPacketAvailable()Simon Rozman2020-10-311-9/+0
| | | | | | | Spinning on the WintunReceivePacket() while it returns ERROR_NO_MORE_ITEMS achieves the same. Signed-off-by: Simon Rozman <simon@rozman.si>
* api: upgrade ring managementSimon Rozman2020-10-311-45/+49
| | | | | | | | | - Return pointer to ring buffer with packet data allowing clients to read/write directly. This eliminates one memcpy(). - Make sending/receiving packets thread-safe. Signed-off-by: Simon Rozman <simon@rozman.si>
* api: allow wintun.h use in C++Simon Rozman2020-10-301-0/+8
| | | | Signed-off-by: Simon Rozman <simon@rozman.si>
* api: add ring managementSimon Rozman2020-10-301-0/+123
| | | | | | | | Rather than every client reinvent the art of using the Wintun and its ring buffers, we offer helper structs and functions to unify and simplify Wintun usage. Signed-off-by: Simon Rozman <simon@rozman.si>
* api: connect rundll32 child with parent using stdout and stderrSimon Rozman2020-10-301-1/+3
| | | | | | | | | | | | | | | | | The WintunCreateAdapter()+CreateAdapter() and WintunDeleteAdapter()+ DeleteAdapter() communicate using Unicode anonymous pipes now. This allows the WintunCreateAdapter() to exactly determine the adapter CreateAdapter() just created by its GUID rather than its name - avoiding the possible ambiguity caused by same-adapter-name ordinal suffixes. This also allows exact retrieval of the result code and pending reboot flag from the rundll32 child process. Furthermore, CreateAdapter() and DeleteAdapter() are now available in _DEBUG for all platforms to allow testing. It took a #pragma comment( linker, "/EXPORT") trick to stop compiler from decorating function names and exporting as _CreateAdapter@16() and _DeleteAdapter@16() in x86. Signed-off-by: Simon Rozman <simon@rozman.si>
* api: introduce wintun.hSimon Rozman2020-10-301-0/+211
The SDK header for deployment containing datatype and function declarations for use by C/C++ clients. As we shall not distribute MSVC wintun.lib files, making clients need to use GetProcAddress(), this file contains function type declarations rather then __declspec(dllimport) function declarations. Signed-off-by: Simon Rozman <simon@rozman.si>