aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.md10
-rw-r--r--api/exports.def2
-rw-r--r--api/session.c2
-rw-r--r--api/wintun.h12
-rw-r--r--example/example.c7
5 files changed, 16 insertions, 17 deletions
diff --git a/README.md b/README.md
index 133a94f..37fe295 100644
--- a/README.md
+++ b/README.md
@@ -38,7 +38,7 @@ else if (GetLastError() != ERROR_BUFFER_OVERFLOW) // Silently drop packets if th
Log(L"Packet write failed");
```
-And the `WintunReceivePacket` and `WintunReceiveRelease` functions can be used for receiving packets ([used by `ReceivePackets` in the example.c code](https://git.zx2c4.com/wintun/tree/example/example.c)):
+And the `WintunReceivePacket` and `WintunReleaseReceivePacket` functions can be used for receiving packets ([used by `ReceivePackets` in the example.c code](https://git.zx2c4.com/wintun/tree/example/example.c)):
```C
for (;;)
@@ -48,7 +48,7 @@ for (;;)
if (IncomingPacket)
{
DoSomethingWithPacket(IncomingPacket, IncomingPacketSize);
- WintunReceiveRelease(Session, IncomingPacket);
+ WintunReleaseReceivePacket(Session, IncomingPacket);
}
else if (GetLastError() == ERROR_NO_MORE_ITEMS)
WaitForSingleObject(WintunGetReadWaitEvent(Session), INFINITE);
@@ -361,7 +361,7 @@ Pointer to receive event handle to wait for available data when reading. Should
`BYTE* WintunReceivePacket (WINTUN_SESSION_HANDLE Session, DWORD * PacketSize)`
-Retrieves one or packet. After the packet content is consumed, call WintunReceiveRelease with Packet returned from this function to release internal buffer. This function is thread-safe.
+Retrieves one or packet. After the packet content is consumed, call WintunReleaseReceivePacket with Packet returned from this function to release internal buffer. This function is thread-safe.
**Parameters**
@@ -372,9 +372,9 @@ Retrieves one or packet. After the packet content is consumed, call WintunReceiv
Pointer to layer 3 IPv4 or IPv6 packet. Client may modify its content at will. If the function fails, the return value is NULL. To get extended error information, call GetLastError. Possible errors include the following: ERROR\_HANDLE\_EOF Wintun adapter is terminating; ERROR\_NO\_MORE\_ITEMS Wintun buffer is exhausted; ERROR\_INVALID\_DATA Wintun buffer is corrupt
-#### WintunReceiveRelease()
+#### WintunReleaseReceivePacket()
-`void WintunReceiveRelease (WINTUN_SESSION_HANDLE Session, const BYTE * Packet)`
+`void WintunReleaseReceivePacket (WINTUN_SESSION_HANDLE Session, const BYTE * Packet)`
Releases internal buffer after the received packet has been processed by the client. This function is thread-safe.
diff --git a/api/exports.def b/api/exports.def
index 4ca739f..e3bedcd 100644
--- a/api/exports.def
+++ b/api/exports.def
@@ -14,7 +14,7 @@ EXPORTS
WintunGetReadWaitEvent
WintunGetRunningDriverVersion
WintunReceivePacket
- WintunReceiveRelease
+ WintunReleaseReceivePacket
WintunSendPacket
WintunSetAdapterName
WintunSetLogger
diff --git a/api/session.c b/api/session.c
index 867ac04..e854bde 100644
--- a/api/session.c
+++ b/api/session.c
@@ -222,7 +222,7 @@ cleanup:
}
void WINAPI
-WintunReceiveRelease(_In_ TUN_SESSION *Session, _In_ const BYTE *Packet)
+WintunReleaseReceivePacket(_In_ TUN_SESSION *Session, _In_ const BYTE *Packet)
{
EnterCriticalSection(&Session->Send.Lock);
TUN_PACKET *ReleasedBuffPacket = (TUN_PACKET *)(Packet - offsetof(TUN_PACKET, Data));
diff --git a/api/wintun.h b/api/wintun.h
index dd232fb..7a54aa0 100644
--- a/api/wintun.h
+++ b/api/wintun.h
@@ -41,7 +41,7 @@ typedef void *WINTUN_ADAPTER_HANDLE;
* @return If the function succeeds, the return value is the adapter handle. Must be released with WintunFreeAdapter. If
* the function fails, the return value is NULL. To get extended error information, call GetLastError.
*/
-typedef _Return_type_success_(return != NULL) WINTUN_ADAPTER_HANDLE (WINAPI *WINTUN_CREATE_ADAPTER_FUNC)(
+typedef _Return_type_success_(return != NULL) WINTUN_ADAPTER_HANDLE(WINAPI *WINTUN_CREATE_ADAPTER_FUNC)(
_In_z_ const WCHAR *Pool,
_In_z_ const WCHAR *Name,
_In_opt_ const GUID *RequestedGUID,
@@ -104,10 +104,8 @@ typedef BOOL(CALLBACK *WINTUN_ENUM_CALLBACK)(_In_ WINTUN_ADAPTER_HANDLE Adapter,
* @return If the function succeeds, the return value is nonzero. If the function fails, the return value is zero. To
* get extended error information, call GetLastError.
*/
-typedef _Return_type_success_(return != FALSE) BOOL(WINAPI *WINTUN_ENUM_ADAPTERS_FUNC)(
- _In_z_ const WCHAR *Pool,
- _In_ WINTUN_ENUM_CALLBACK Callback,
- _In_ LPARAM Param);
+typedef _Return_type_success_(return != FALSE) BOOL(
+ WINAPI *WINTUN_ENUM_ADAPTERS_FUNC)(_In_z_ const WCHAR *Pool, _In_ WINTUN_ENUM_CALLBACK Callback, _In_ LPARAM Param);
/**
* Releases Wintun adapter resources.
@@ -273,7 +271,7 @@ typedef HANDLE(WINAPI *WINTUN_GET_READ_WAIT_EVENT_FUNC)(_In_ WINTUN_SESSION_HAND
#define WINTUN_MAX_IP_PACKET_SIZE 0xFFFF
/**
- * Retrieves one or packet. After the packet content is consumed, call WintunReceiveRelease with Packet returned
+ * Retrieves one or packet. After the packet content is consumed, call WintunReleaseReceivePacket with Packet returned
* from this function to release internal buffer. This function is thread-safe.
*
* @param Session Wintun session handle obtained with WintunStartSession
@@ -297,7 +295,7 @@ typedef _Return_type_success_(return != NULL) _Ret_bytecount_(*PacketSize) BYTE
*
* @param Packet Packet obtained with WintunReceivePacket
*/
-typedef void(WINAPI *WINTUN_RECEIVE_RELEASE_FUNC)(_In_ WINTUN_SESSION_HANDLE Session, _In_ const BYTE *Packet);
+typedef void(WINAPI *WINTUN_RELEASE_RECEIVE_PACKET_FUNC)(_In_ WINTUN_SESSION_HANDLE Session, _In_ const BYTE *Packet);
/**
* Allocates memory for a packet to send. After the memory is filled with packet data, call WintunSendPacket to send
diff --git a/example/example.c b/example/example.c
index 550bd77..731bc38 100644
--- a/example/example.c
+++ b/example/example.c
@@ -28,7 +28,7 @@ static WINTUN_START_SESSION_FUNC WintunStartSession;
static WINTUN_END_SESSION_FUNC WintunEndSession;
static WINTUN_GET_READ_WAIT_EVENT_FUNC WintunGetReadWaitEvent;
static WINTUN_RECEIVE_PACKET_FUNC WintunReceivePacket;
-static WINTUN_RECEIVE_RELEASE_FUNC WintunReceiveRelease;
+static WINTUN_RELEASE_RECEIVE_PACKET_FUNC WintunReleaseReceivePacket;
static WINTUN_ALLOCATE_SEND_PACKET_FUNC WintunAllocateSendPacket;
static WINTUN_SEND_PACKET_FUNC WintunSendPacket;
@@ -50,7 +50,8 @@ InitializeWintun(void)
X(WintunGetRunningDriverVersion, WINTUN_GET_RUNNING_DRIVER_VERSION_FUNC) ||
X(WintunSetLogger, WINTUN_SET_LOGGER_FUNC) || X(WintunStartSession, WINTUN_START_SESSION_FUNC) ||
X(WintunEndSession, WINTUN_END_SESSION_FUNC) || X(WintunGetReadWaitEvent, WINTUN_GET_READ_WAIT_EVENT_FUNC) ||
- X(WintunReceivePacket, WINTUN_RECEIVE_PACKET_FUNC) || X(WintunReceiveRelease, WINTUN_RECEIVE_RELEASE_FUNC) ||
+ X(WintunReceivePacket, WINTUN_RECEIVE_PACKET_FUNC) ||
+ X(WintunReleaseReceivePacket, WINTUN_RELEASE_RECEIVE_PACKET_FUNC) ||
X(WintunAllocateSendPacket, WINTUN_ALLOCATE_SEND_PACKET_FUNC) || X(WintunSendPacket, WINTUN_SEND_PACKET_FUNC))
#undef X
{
@@ -250,7 +251,7 @@ ReceivePackets(_Inout_ DWORD_PTR SessionPtr)
if (Packet)
{
PrintPacket(Packet, PacketSize);
- WintunReceiveRelease(Session, Packet);
+ WintunReleaseReceivePacket(Session, Packet);
}
else
{