Skip to content

Commit

Permalink
[NPF] Import NPF from winpcap
Browse files Browse the repository at this point in the history
  • Loading branch information
DarkFire01 committed Sep 24, 2024
1 parent c62a0d3 commit cf30fa8
Show file tree
Hide file tree
Showing 36 changed files with 12,995 additions and 0 deletions.
Empty file added drivers/3rdparty/CMakeLists.txt
Empty file.
108 changes: 108 additions & 0 deletions drivers/3rdparty/npf/DEBUG.H
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
/*
* Copyright (c) 1999 - 2005 NetGroup, Politecnico di Torino (Italy)
* Copyright (c) 2005 - 2006 CACE Technologies, Davis (California)
* All rights reserved.
*
* 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 name of the Politecnico di Torino, CACE Technologies
* 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
* OWNER 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_INCLUDE
#define __DEBUG_INCLUDE


#if DBG

#define IF_PACKETDEBUG(f) if (PacketDebugFlag & (f))
extern ULONG PacketDebugFlag;

#define PACKET_DEBUG_LOUD 0x00000001 // debugging info
#define PACKET_DEBUG_VERY_LOUD 0x00000002 // excessive debugging info

#define PACKET_DEBUG_INIT 0x00000100 // init debugging info

//
// unfortunately, NT4 does not have the __FUNCTION__ macro, so we define it as null
//
#ifndef __FUNCTION__
#define __FUNCTION__
#endif

//
// Macro for deciding whether to dump lots of debugging information.
//

#define IF_LOUD(A) IF_PACKETDEBUG( PACKET_DEBUG_LOUD ) { A }
#define IF_VERY_LOUD(A) IF_PACKETDEBUG( PACKET_DEBUG_VERY_LOUD ) { A }
#define IF_INIT_LOUD(A) IF_PACKETDEBUG( PACKET_DEBUG_INIT ) { A }

#define TRACE_ENTER() DbgPrint("--> " __FUNCTION__)
#define TRACE_EXIT() DbgPrint("<-- " __FUNCTION__)
#define TRACE_MESSAGE(__level__, __message__) do{ if (PacketDebugFlag & (__level__)) DbgPrint(" " __FUNCTION__ ": " __message__);} while(FALSE)

#define TRACE_MESSAGE1(__level__, __message__, __p1__) do \
{ \
if (PacketDebugFlag & (__level__)) \
DbgPrint(" " __FUNCTION__ ": " __message__, __p1__); \
} while(FALSE)

#define TRACE_MESSAGE2(__level__, __message__, __p1__, __p2__) do \
{ \
if (PacketDebugFlag & (__level__)) \
DbgPrint(" " __FUNCTION__ ": " __message__, __p1__, __p2__); \
} while(FALSE)

#define TRACE_MESSAGE3(__level__, __message__, __p1__, __p2__, __p3__) do \
{ \
if (PacketDebugFlag & (__level__)) \
DbgPrint(" " __FUNCTION__ ": " __message__, __p1__, __p2__, __p3__); \
} while(FALSE)

#define TRACE_MESSAGE4(__level__, __message__, __p1__, __p2__, __p3__, __p4__) do \
{ \
if (PacketDebugFlag & (__level__)) \
DbgPrint(" " __FUNCTION__ ": " __message__, __p1__, __p2__, __p3__, __p4__ ); \
} while(FALSE)


#else //DBG

#define IF_LOUD(A)
#define IF_VERY_LOUD(A)
#define IF_INIT_LOUD(A)

#define TRACE_ENTER()
#define TRACE_EXIT()
#define TRACE_MESSAGE(__level__, __message__)
#define TRACE_MESSAGE1(__level__, __message__, __p1__)
#define TRACE_MESSAGE2(__level__, __message__, __p1__, __p2__)
#define TRACE_MESSAGE3(__level__, __message__, __p1__, __p2__, __p3__)
#define TRACE_MESSAGE4(__level__, __message__, __p1__, __p2__, __p3__, __p4__)

#endif

#endif /*#define __DEBUG_INCLUDE*/
266 changes: 266 additions & 0 deletions drivers/3rdparty/npf/Driver.vcproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,266 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="WinPcap NTx Driver"
ProjectGUID="{5E91F1EF-C30E-43F7-9187-E37A0BDA7FDB}"
RootNamespace="WinPcap NTx Driver"
Keyword="MakeFileProj"
>
<Platforms>
<Platform
Name="Win32"
/>
<Platform
Name="x64"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="Debug"
IntermediateDirectory="Debug"
ConfigurationType="0"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
>
<Tool
Name="VCNMakeTool"
BuildCommandLine="cd..&#x0D;&#x0A;CompileDriverNew.bat x86 checked"
ReBuildCommandLine="cd..&#x0D;&#x0A;CompileDriverNew.bat x86 checked"
CleanCommandLine=""
Output=""
PreprocessorDefinitions=""
IncludeSearchPath=""
ForcedIncludes=""
AssemblySearchPath=""
ForcedUsingAssemblies=""
CompileAsManaged=""
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="Release"
IntermediateDirectory="Release"
ConfigurationType="0"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
>
<Tool
Name="VCNMakeTool"
BuildCommandLine="cd..&#x0D;&#x0A;CompileDriverNew.bat x86 free&#x0D;&#x0A;"
ReBuildCommandLine="cd..&#x0D;&#x0A;CompileDriverNew.bat x86 free&#x0D;&#x0A;"
CleanCommandLine=""
Output=""
PreprocessorDefinitions=""
IncludeSearchPath=""
ForcedIncludes=""
AssemblySearchPath=""
ForcedUsingAssemblies=""
CompileAsManaged=""
/>
</Configuration>
<Configuration
Name="Debug|x64"
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="0"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
>
<Tool
Name="VCNMakeTool"
BuildCommandLine="cd..&#x0D;&#x0A;CompileDriverNew.bat AMD64 checked"
ReBuildCommandLine="cd..&#x0D;&#x0A;CompileDriverNew.bat AMD64 checked"
CleanCommandLine=""
Output=""
PreprocessorDefinitions=""
IncludeSearchPath=""
ForcedIncludes=""
AssemblySearchPath=""
ForcedUsingAssemblies=""
CompileAsManaged=""
/>
</Configuration>
<Configuration
Name="Release|x64"
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="0"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
>
<Tool
Name="VCNMakeTool"
BuildCommandLine="cd..&#x0D;&#x0A;CompileDriverNew.bat AMD64 free&#x0D;&#x0A;"
ReBuildCommandLine="cd..&#x0D;&#x0A;CompileDriverNew.bat AMD64 free&#x0D;&#x0A;"
CleanCommandLine=""
Output=""
PreprocessorDefinitions=""
IncludeSearchPath=""
ForcedIncludes=""
AssemblySearchPath=""
ForcedUsingAssemblies=""
CompileAsManaged=""
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\dump.c"
>
</File>
<File
RelativePath=".\jitter.c"
>
</File>
<File
RelativePath=".\Openclos.c"
>
</File>
<File
RelativePath=".\Packet.c"
>
</File>
<File
RelativePath=".\Read.c"
>
</File>
<File
RelativePath=".\win_bpf_filter.c"
>
</File>
<File
RelativePath=".\Write.c"
>
</File>
<Filter
Name="TME"
>
<File
RelativePath=".\bucket_lookup.c"
>
</File>
<File
RelativePath=".\count_packets.c"
>
</File>
<File
RelativePath=".\functions.c"
>
</File>
<File
RelativePath=".\normal_lookup.c"
>
</File>
<File
RelativePath=".\tcp_session.c"
>
</File>
<File
RelativePath=".\tme.c"
>
</File>
<File
RelativePath=".\win_bpf_filter_init.c"
>
</File>
</Filter>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath="..\..\Common\dagc.h"
>
</File>
<File
RelativePath=".\Debug.h"
>
</File>
<File
RelativePath=".\jitter.h"
>
</File>
<File
RelativePath=".\Packet.h"
>
</File>
<File
RelativePath=".\time_calls.h"
>
</File>
<File
RelativePath=".\valid_insns.h"
>
</File>
<File
RelativePath=".\win_bpf.h"
>
</File>
<Filter
Name="TME"
>
<File
RelativePath=".\bucket_lookup.h"
>
</File>
<File
RelativePath=".\count_packets.h"
>
</File>
<File
RelativePath=".\functions.h"
>
</File>
<File
RelativePath=".\memory_t.h"
>
</File>
<File
RelativePath=".\normal_lookup.h"
>
</File>
<File
RelativePath=".\tcp_session.h"
>
</File>
<File
RelativePath=".\tme.h"
>
</File>
<File
RelativePath=".\win_bpf_filter_init.h"
>
</File>
</Filter>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
</Filter>
<Filter
Name="Build Scripts"
>
<File
RelativePath="..\CompileDriverNew.bat"
>
</File>
<File
RelativePath=".\Sources"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>
7 changes: 7 additions & 0 deletions drivers/3rdparty/npf/MAKEFILE
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#
# DO NOT EDIT THIS FILE!!! Edit .\sources. if you want to add a new source
# file to this component. This file merely indirects to the real make file
# that is shared by all the driver components of the Windows NT DDK
#

!INCLUDE $(NTMAKEENV)\makefile.def
Loading

0 comments on commit cf30fa8

Please sign in to comment.