-
Notifications
You must be signed in to change notification settings - Fork 389
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Winsock Kernel (WSK) Interface for the VIOSOCK Driver #835
Merged
YanVugenfirer
merged 18 commits into
virtio-win:master
from
MartinDrab:feature/viosock/wsk-interface
Feb 11, 2024
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
c9d0914
WSK: Fixes related to the repository and MSVS requirements
MartinDrab 2e6e47a
WSK: Add more convenient debug print macros
MartinDrab 3dcadeb
WSK: Module initialization, Wsk(De)Register, Wsk(Capture|Release)Prov…
MartinDrab 2b8c937
WSK: Address translation routines
MartinDrab 12333f5
WSK: Ability to create and close sockets
MartinDrab f90ad5a
WSK: Add logic for sending IOCTL requests
MartinDrab 0a1af6f
WSK: Implement WskGetLocalAddress
MartinDrab ad273da
WSK: Implement WskGetRemoteAddress
MartinDrab 8ce5cc7
WSK: Implement WskConnect
MartinDrab 98132e6
WSK: Implement WskControlSocket
MartinDrab e012927
WSK: Implement VIoWskSend
MartinDrab 4b9d4a9
WSK: Impelemnt WskReceive
MartinDrab be7bac3
WSK: Implement WskDisconnect
MartinDrab 1ba6185
WSK: Implement WskAccept
MartinDrab 750cedb
WSK: Implement WskBind
MartinDrab a569f19
WSK: Let unsupported calls correctly report STATUS_NOT_IMPLEMENTED
MartinDrab 493efc4
Implement a test driver demonstrating WSK capabilities
MartinDrab a831488
Enable WPP Event Tracing for both the WSK library and the test driver
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
/* | ||
* Exports definition for virtio socket WSK interface | ||
* | ||
* Copyright (c) 2021 Virtuozzo International GmbH | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions | ||
* are met : | ||
* 1. Redistributions of source code must retain the above copyright | ||
* notice, this list of conditions and the following disclaimer. | ||
* 2. Redistributions in binary form must reproduce the above copyright | ||
* notice, this list of conditions and the following disclaimer in the | ||
* documentation and / or other materials provided with the distribution. | ||
* 3. Neither the names of the copyright holders nor the names of their contributors | ||
* may be used to endorse or promote products derived from this software | ||
* without specific prior written permission. | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND | ||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
* ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE | ||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
* SUCH DAMAGE. | ||
*/ | ||
|
||
#ifndef __DEBUG_UTILS_H__ | ||
#define __DEBUG_UTILS_H__ | ||
|
||
|
||
#include <Evntrace.h> | ||
#include "wpp-trace.h" | ||
#include "..\..\virtio\kdebugprint.h" | ||
|
||
#ifndef EVENT_TRACING | ||
|
||
|
||
#if defined(DBG) || defined(_DEBUG) | ||
|
||
#define DEBUG_ENTER_FUNCTION(Format, ...) \ | ||
DbgPrintEx(DPFLTR_DEFAULT_ID, DPFLTR_TRACE_LEVEL, "[0x%x:0x%x:%u]: " __FUNCTION__ "(" Format ")\n", \ | ||
PtrToUlong(PsGetCurrentProcessId()), PtrToUlong(PsGetCurrentThreadId()), KeGetCurrentIrql(), __VA_ARGS__) | ||
|
||
#define DEBUG_ENTER_FUNCTION_NO_ARGS() \ | ||
DbgPrintEx(DPFLTR_DEFAULT_ID, DPFLTR_TRACE_LEVEL, "[0x%x:0x%x:%u]: " __FUNCTION__ "()\n", \ | ||
PtrToUlong(PsGetCurrentProcessId()), PtrToUlong(PsGetCurrentThreadId()), KeGetCurrentIrql()) | ||
|
||
#define DEBUG_EXIT_FUNCTION(Format, ...) \ | ||
DbgPrintEx(DPFLTR_DEFAULT_ID, DPFLTR_TRACE_LEVEL, "[0x%x:0x%x:%u]: " __FUNCTION__ "(-):" Format "\n", \ | ||
PtrToUlong(PsGetCurrentProcessId()), PtrToUlong(PsGetCurrentThreadId()), KeGetCurrentIrql(), __VA_ARGS__) | ||
|
||
#define DEBUG_EXIT_FUNCTION_VOID() \ | ||
DbgPrintEx(DPFLTR_DEFAULT_ID, DPFLTR_TRACE_LEVEL, "[0x%x:0x%x:%u]: " __FUNCTION__ "(-)\n", \ | ||
PtrToUlong(PsGetCurrentProcessId()), PtrToUlong(PsGetCurrentThreadId()), KeGetCurrentIrql()) | ||
|
||
#else | ||
|
||
#define DEBUG_ENTER_FUNCTION(Format, ...) do { } while (FALSE) | ||
|
||
#define DEBUG_ENTER_FUNCTION_NO_ARGS() do { } while (FALSE) | ||
|
||
#define DEBUG_EXIT_FUNCTION(Format, ...) do { } while (FALSE) | ||
|
||
#define DEBUG_EXIT_FUNCTION_VOID() do { } while (FALSE) | ||
|
||
#endif | ||
|
||
|
||
#define DEBUG_ERROR(Format, ...) \ | ||
DbgPrintEx(DPFLTR_DEFAULT_ID, DPFLTR_ERROR_LEVEL, "[0x%x:0x%x:%u]: " __FUNCTION__ " (" __FILE__ ":%u): ERROR: " Format "\n", \ | ||
PtrToUlong(PsGetCurrentProcessId()), PtrToUlong(PsGetCurrentThreadId()), KeGetCurrentIrql(), __LINE__, __VA_ARGS__) | ||
|
||
#define DEBUG_WARNING(Format, ...) \ | ||
DbgPrintEx(DPFLTR_DEFAULT_ID, DPFLTR_WARNING_LEVEL, "[0x%x:0x%x:%u]: " __FUNCTION__ " (" __FILE__ ":%u): WARNING: " Format "\n", \ | ||
PtrToUlong(PsGetCurrentProcessId()), PtrToUlong(PsGetCurrentThreadId()), KeGetCurrentIrql(), __LINE__, __VA_ARGS__) | ||
|
||
#define DEBUG_TRACE(Format, ...) \ | ||
DbgPrintEx(DPFLTR_DEFAULT_ID, DPFLTR_TRACE_LEVEL, "[0x%x:0x%x:%u]: " __FUNCTION__ " (" __FILE__ ":%u): TRACE: " Format "\n", \ | ||
PtrToUlong(PsGetCurrentProcessId()), PtrToUlong(PsGetCurrentThreadId()), KeGetCurrentIrql(), __LINE__, __VA_ARGS__) | ||
|
||
#define DEBUG_INFO(Format, ...) \ | ||
DbgPrintEx(DPFLTR_DEFAULT_ID, DPFLTR_INFO_LEVEL, "[0x%x:0x%x:%u]: " __FUNCTION__ ": INFO: " Format "\n", \ | ||
PtrToUlong(PsGetCurrentProcessId()), PtrToUlong(PsGetCurrentThreadId()), KeGetCurrentIrql(), __VA_ARGS__) | ||
|
||
|
||
#endif | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
Copyright 2019 Virtuozzo, Inc. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions | ||
are met: | ||
|
||
Redistributions of source code must retain the above copyright | ||
notice, this list of conditions and the following disclaimer. | ||
|
||
Redistributions in binary form must reproduce the above copyright | ||
notice, this list of conditions and the following disclaimer in the | ||
documentation and/or other materials provided with the distribution. | ||
|
||
Neither the name of the copyright holder nor the names of its | ||
contributors may be used to endorse or promote products derived from | ||
this software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
@echo off | ||
call ..\..\Tools\clean.bat |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use existing debug printing infrastructure that depending one configuration will use different debug print methods?
Checkout: InitializeDebugPrints and VirtioDebugPrintProc