Переглянути джерело

Updated scripts to compile SNFMulti.dll (32- and 64-bit), ran test programs (cpp, cs, and vb).

master
adeniz 4 роки тому
джерело
коміт
99b668337c

BIN
32bitDll/snfmulti.dll Переглянути файл


BIN
32bitDll/vs2008_snfmulti.exp Переглянути файл


BIN
32bitDll/vs2008_snfmulti.lib Переглянути файл


BIN
64bitDll/snfmulti.dll Переглянути файл


BIN
64bitDll/vs2008_snfmulti.exp Переглянути файл


BIN
64bitDll/vs2008_snfmulti.lib Переглянути файл


+ 7
- 6
BuildDistribution.cmd Переглянути файл

@@ -4,23 +4,24 @@ REM Before moving to a new version this script must be updated.
REM When properly configured this script does:
REM
REM 1. Update the source and project directories in SNFMultiSDK_Windows_X.Y
REM from the same directories in ../SNFMultiSDK_Windows_X.Y
REM from the same directories in SNFMultiSDK_Windows_X.Y\..
REM
REM 2. Copy SNFMultiSDK_Windows_X.Y to SDKBuild/SNFMultiSDK_Windows_X.Y
REM 2. Copy SNFMultiSDK_Windows_X.Y to C:\TEMP\SNFMultiSDK_Windows_X.Y
REM
REM 3. Remove the .svn files from all subdirectories in Build/SNFMultiSDK_Windows_X.Y
REM 3. Remove the .svn files from all subdirectories in C:\TEMP\SNFMultiSDK_Windows_X.Y
REM
REM 4. Create the zip file SNFMultiSDK_Windows_X.Y.zip
REM
REM 5. Copy the SNFMultiSDK_Windows_X.Y.zip file to .. (back to the PKG-SNF-SDK-WIN root)
REM
REM 6. Empty the SDKBuild directory.
REM 6. Empty the C:\TEMP\SNFMultiSDK_Windows_X.Y directory.
REM
REM 7. Pause to let the developer view the success and remind them to commit the revision to SVN.
REM 7. Pause to let the developer view the success and remind them to commit the revision to
REM the repository.
setlocal
set PATH=32bitdll;%PATH%
set DISTDIR=SNFMultiSDK_Windows_3.3
set DISTDIR=SNFMultiSDK_Windows_4.0
set TEMPDIR=C:\TEMP
set ZIPFILE=%DISTDIR%.zip
set TEMPDIST=%TEMPDIR%\%DISTDIR%

+ 0
- 2
CodeBlocks/SNFMulti/SNFMulti.cbp Переглянути файл

@@ -88,8 +88,6 @@
<Unit filename="..\..\SNFMulti\snf_engine.cpp" />
<Unit filename="..\..\SNFMulti\snf_engine.hpp" />
<Unit filename="..\..\SNFMulti\snf_match.h" />
<Unit filename="..\..\SNFMulti\snf_saccades.cpp" />
<Unit filename="..\..\SNFMulti\snf_saccades.hpp" />
<Unit filename="..\..\SNFMulti\snf_sync.cpp" />
<Unit filename="..\..\SNFMulti\snf_sync.hpp" />
<Unit filename="..\..\SNFMulti\snf_xci.cpp" />

+ 292
- 0
CodeBlocks/SNFMulti/SNFMulti.depend Переглянути файл

@@ -1185,3 +1185,295 @@
"../CodeDweller/networking.hpp"
"../CodeDweller/configuration.hpp"
1593802164 source:c:\users\alban\desktop\codedevelopment\pkg-snf-sdk-win\codedweller\base64codec.cpp
"base64codec.hpp"
1593679366 c:\users\alban\desktop\codedevelopment\pkg-snf-sdk-win\codedweller\base64codec.hpp
<vector>
<cstring>
<string>
1593679366 source:c:\users\alban\desktop\codedevelopment\pkg-snf-sdk-win\codedweller\configuration.cpp
"configuration.hpp"
1593679366 c:\users\alban\desktop\codedevelopment\pkg-snf-sdk-win\codedweller\configuration.hpp
<string>
<vector>
<sstream>
<fstream>
<cstring>
<cstdlib>
<list>
1593679366 source:c:\users\alban\desktop\codedevelopment\pkg-snf-sdk-win\codedweller\mangler.cpp
"mangler.hpp"
1593679366 c:\users\alban\desktop\codedevelopment\pkg-snf-sdk-win\codedweller\mangler.hpp
1593806330 source:c:\users\alban\desktop\codedevelopment\pkg-snf-sdk-win\codedweller\networking.cpp
"networking.hpp"
1593679366 c:\users\alban\desktop\codedevelopment\pkg-snf-sdk-win\codedweller\networking.hpp
<stdexcept>
<iostream>
<string>
<sstream>
<cstring>
<cstdlib>
<cstdio>
<cerrno>
<winsock2.h>
<netdb.h>
<sys/socket.h>
<netinet/in.h>
<sys/file.h>
<arpa/inet.h>
<unistd.h>
<fcntl.h>
1593802164 source:c:\users\alban\desktop\codedevelopment\pkg-snf-sdk-win\codedweller\threading.cpp
"threading.hpp"
1593679366 c:\users\alban\desktop\codedevelopment\pkg-snf-sdk-win\codedweller\threading.hpp
<set>
<vector>
<string>
<queue>
"faults.hpp"
<windows.h>
<process.h>
<pthread.h>
<sched.h>
1593679366 c:\users\alban\desktop\codedevelopment\pkg-snf-sdk-win\codedweller\faults.hpp
<stdexcept>
<cstdlib>
<iostream>
<string>
1593679366 source:c:\users\alban\desktop\codedevelopment\pkg-snf-sdk-win\codedweller\timing.cpp
<ctime>
<sys/time.h>
<cerrno>
<windows.h>
"timing.hpp"
1593679366 c:\users\alban\desktop\codedevelopment\pkg-snf-sdk-win\codedweller\timing.hpp
1593806652 source:c:\users\alban\desktop\codedevelopment\pkg-snf-sdk-win\snfmultidll\snfmultidll.cpp
<windows.h>
<stdexcept>
<cmath>
"../SNFMulti/snfmulti.hpp"
1593679379 c:\users\alban\desktop\codedevelopment\pkg-snf-sdk-win\snfmulti\snfmulti.hpp
<stdexcept>
<sys/types.h>
<sys/stat.h>
<ctime>
<string>
"../CodeDweller/faults.hpp"
"../CodeDweller/threading.hpp"
"GBUdb.hpp"
"FilterChain.hpp"
"snf_engine.hpp"
"snf_match.h"
"snfCFGmgr.hpp"
"snfLOGmgr.hpp"
"snfNETmgr.hpp"
"snfGBUdbmgr.hpp"
"snfXCImgr.hpp"
<cassert>
1593679379 c:\users\alban\desktop\codedevelopment\pkg-snf-sdk-win\snfmulti\gbudb.hpp
"../CodeDweller/faults.hpp"
"../CodeDweller/threading.hpp"
<cmath>
<cctype>
<string>
<sstream>
<list>
<cstdlib>
<ctime>
1593679379 c:\users\alban\desktop\codedevelopment\pkg-snf-sdk-win\snfmulti\filterchain.hpp
<stdexcept>
<iostream>
<sstream>
<string>
<cstring>
<cstdlib>
<cctype>
1593679379 c:\users\alban\desktop\codedevelopment\pkg-snf-sdk-win\snfmulti\snf_engine.hpp
<cassert>
<stdexcept>
<unistd.h>
<cstdio>
<cctype>
<ctime>
<cstdlib>
<fstream>
<iostream>
<string>
<vector>
<exception>
"../CodeDweller/faults.hpp"
"../CodeDweller/mangler.hpp"
1593679379 c:\users\alban\desktop\codedevelopment\pkg-snf-sdk-win\snfmulti\snf_match.h
1593679379 c:\users\alban\desktop\codedevelopment\pkg-snf-sdk-win\snfmulti\snfcfgmgr.hpp
"GBUdb.hpp"
"snf_HeaderFinder.hpp"
"../CodeDweller/configuration.hpp"
"../CodeDweller/threading.hpp"
<string>
<set>
1593679379 c:\users\alban\desktop\codedevelopment\pkg-snf-sdk-win\snfmulti\snf_headerfinder.hpp
<string>
<set>
<map>
<vector>
1593679379 c:\users\alban\desktop\codedevelopment\pkg-snf-sdk-win\snfmulti\snflogmgr.hpp
<list>
<set>
<string>
<vector>
<sstream>
<ctime>
<cstdio>
"../CodeDweller/timing.hpp"
"../CodeDweller/threading.hpp"
"../CodeDweller/histogram.hpp"
"snf_match.h"
"snfCFGmgr.hpp"
"snfNETmgr.hpp"
"GBUdb.hpp"
1593802164 c:\users\alban\desktop\codedevelopment\pkg-snf-sdk-win\codedweller\histogram.hpp
<set>
1593679379 c:\users\alban\desktop\codedevelopment\pkg-snf-sdk-win\snfmulti\snfnetmgr.hpp
<stdexcept>
<vector>
"../CodeDweller/networking.hpp"
"../CodeDweller/timing.hpp"
"../CodeDweller/threading.hpp"
"../CodeDweller/mangler.hpp"
"snfCFGmgr.hpp"
"snfLOGmgr.hpp"
"snfGBUdbmgr.hpp"
1593679379 c:\users\alban\desktop\codedevelopment\pkg-snf-sdk-win\snfmulti\snfgbudbmgr.hpp
"../CodeDweller/threading.hpp"
"../CodeDweller/timing.hpp"
"snfCFGmgr.hpp"
"snfLOGmgr.hpp"
"GBUdb.hpp"
1593679379 c:\users\alban\desktop\codedevelopment\pkg-snf-sdk-win\snfmulti\snfxcimgr.hpp
<string>
<queue>
"../CodeDweller/timing.hpp"
"../CodeDweller/threading.hpp"
"../CodeDweller/networking.hpp"
"snf_xci.hpp"
1593679379 c:\users\alban\desktop\codedevelopment\pkg-snf-sdk-win\snfmulti\snf_xci.hpp
"../CodeDweller/configuration.hpp"
1593679379 source:c:\users\alban\desktop\codedevelopment\pkg-snf-sdk-win\snfmulti\filterchain.cpp
"FilterChain.hpp"
1593679379 source:c:\users\alban\desktop\codedevelopment\pkg-snf-sdk-win\snfmulti\gbudb.cpp
<iostream>
<fstream>
<cstring>
<unistd.h>
"GBUdb.hpp"
1593679379 source:c:\users\alban\desktop\codedevelopment\pkg-snf-sdk-win\snfmulti\snfmulti.cpp
<sys/types.h>
<sys/stat.h>
<ctime>
<cstring>
<cstdlib>
<sstream>
"SNFMulti.hpp"
"../CodeDweller/timing.hpp"
1593772143 source:c:\users\alban\desktop\codedevelopment\pkg-snf-sdk-win\snfmulti\scanner.cpp
"scanner.hpp"
1593772143 c:\users\alban\desktop\codedevelopment\pkg-snf-sdk-win\snfmulti\scanner.hpp
"FilterChain.hpp"
"snf_engine.hpp"
1593679379 source:c:\users\alban\desktop\codedevelopment\pkg-snf-sdk-win\snfmulti\snfcfgmgr.cpp
"snfCFGmgr.hpp"
<iostream>
1593679379 source:c:\users\alban\desktop\codedevelopment\pkg-snf-sdk-win\snfmulti\snfgbudbmgr.cpp
"snfGBUdbmgr.hpp"
<unistd.h>
1593679379 source:c:\users\alban\desktop\codedevelopment\pkg-snf-sdk-win\snfmulti\snflogmgr.cpp
"snfLOGmgr.hpp"
"../CodeDweller/threading.hpp"
"../CodeDweller/timing.hpp"
<unistd.h>
<sstream>
<iomanip>
1593679379 source:c:\users\alban\desktop\codedevelopment\pkg-snf-sdk-win\snfmulti\snfnetmgr.cpp
<sys/types.h>
<sys/stat.h>
<ctime>
<cstring>
<string>
<vector>
<fstream>
<sstream>
"snfNETmgr.hpp"
"snf_sync.hpp"
"../CodeDweller/mangler.hpp"
"../CodeDweller/base64codec.hpp"
1593679379 c:\users\alban\desktop\codedevelopment\pkg-snf-sdk-win\snfmulti\snf_sync.hpp
<list>
<cstring>
"GBUdb.hpp"
"../CodeDweller/networking.hpp"
"../CodeDweller/configuration.hpp"
1593679379 source:c:\users\alban\desktop\codedevelopment\pkg-snf-sdk-win\snfmulti\snfxcimgr.cpp
"SNFMulti.hpp"
"snfXCImgr.hpp"
1593679379 source:c:\users\alban\desktop\codedevelopment\pkg-snf-sdk-win\snfmulti\snf_headerfinder.cpp
"snf_HeaderFinder.hpp"
"snfLOGmgr.hpp"
"snfCFGmgr.hpp"
1593679379 source:c:\users\alban\desktop\codedevelopment\pkg-snf-sdk-win\snfmulti\snf_engine.cpp
<unistd.h>
<cstdio>
<cctype>
<ctime>
<cstdlib>
<fstream>
<iostream>
<string>
<vector>
"../CodeDweller/mangler.hpp"
"snf_engine.hpp"
1593679379 source:c:\users\alban\desktop\codedevelopment\pkg-snf-sdk-win\snfmulti\snf_sync.cpp
"snf_sync.hpp"
1593679379 source:c:\users\alban\desktop\codedevelopment\pkg-snf-sdk-win\snfmulti\snf_xci.cpp
"snf_xci.hpp"

+ 7
- 1
CodeBlocks/SNFMulti/SNFMulti.layout Переглянути файл

@@ -1,6 +1,9 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_layout_file>
<ActiveTarget name="Debug" />
<ActiveTarget name="Release" />
<File name="..\..\CodeDweller\networking.cpp" open="0" top="0" tabpos="0">
<Cursor position="20237" topLine="356" />
</File>
<File name="..\..\CodeDweller\threading.cpp" open="0" top="0" tabpos="1">
<Cursor position="18093" topLine="276" />
</File>
@@ -10,4 +13,7 @@
<File name="..\..\CodeDweller\timing.hpp" open="0" top="0" tabpos="2">
<Cursor position="0" topLine="0" />
</File>
<File name="..\..\SNFMultiDll\snfmultidll.cpp" open="0" top="0" tabpos="0">
<Cursor position="22493" topLine="332" />
</File>
</CodeBlocks_layout_file>

+ 2
- 1
CodeBlocks/SNFMultiTest/README Переглянути файл

@@ -29,7 +29,8 @@ To build the application:
or bin\Release relative to this directory.
Before running the application, copy the SNFServer configuration file
to prescale.xml in this directory.
to prescale.xml in this directory (e.g. from the prescale.xml file in
the MinGW-32 directory).
Creating the SNFMultiTest project file
-----------------------------------

+ 34
- 0
CodeBlocks/SNFMultiTest/SNFMultiTest.depend Переглянути файл

@@ -73,3 +73,37 @@
1342303937 source:c:\users\alban\desktop\codedevelopment\pkg-snf-sdk-win\trunk\codedweller\threading.cpp
"threading.hpp"
1593679366 source:c:\users\alban\desktop\codedevelopment\pkg-snf-sdk-win\codedweller\timing.cpp
<ctime>
<sys/time.h>
<cerrno>
<windows.h>
"timing.hpp"
1593679366 c:\users\alban\desktop\codedevelopment\pkg-snf-sdk-win\codedweller\timing.hpp
1593807637 source:c:\users\alban\desktop\codedevelopment\pkg-snf-sdk-win\snfmultitest\main.cpp
<windows.h>
<iostream>
<string>
"snfmultidll.h"
"../CodeDweller/timing.hpp"
"../CodeDweller/threading.hpp"
1593679366 c:\users\alban\desktop\codedevelopment\pkg-snf-sdk-win\codedweller\threading.hpp
<set>
<vector>
<string>
<queue>
"faults.hpp"
<windows.h>
<process.h>
<pthread.h>
<sched.h>
1593679366 c:\users\alban\desktop\codedevelopment\pkg-snf-sdk-win\codedweller\faults.hpp
<stdexcept>
<cstdlib>
<iostream>
<string>

+ 2
- 2
CodeBlocks/SNFMultiTest/SNFMultiTest.layout Переглянути файл

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_layout_file>
<ActiveTarget name="Debug" />
<File name="..\..\SNFMultiTest\main.cpp" open="1" top="1" tabpos="0">
<Cursor position="7577" topLine="128" />
<File name="..\..\SNFMultiTest\main.cpp" open="0" top="0" tabpos="0">
<Cursor position="7587" topLine="122" />
</File>
</CodeBlocks_layout_file>

+ 1
- 1
CodeDweller

@@ -1 +1 @@
Subproject commit 2c3aafcc16cbc2d9ea121b0b9c8851b0337c9168
Subproject commit ee37106bc3e2acdf549c9d04ab515b77b6da48f4

+ 2
- 2
MinGW-32/buildSNFMultiDLL.cmd Переглянути файл

@@ -3,5 +3,5 @@ del snfmulti.dll snfmulti.def libsnfmulti.a
set path=c:\MinGW\bin;%path%
set CXX=c++
set LIB=c:\MinGW\lib\libws2_32.a -loleaut32
set LDFLAGS=-Wl,--output-def=snfmulti.def -Wl,--out-implib=libsnfmulti.a -Wl,-dll
%CXX% -shared -o snfmulti.dll %LDFLAGS% snfmultidll.o snf_saccades.o FilterChain.o GBUdb.o mangler.o scanner.o snfCFGmgr.o snf_engine.o snfGBUdbmgr.o snf_HeaderFinder.o snfLOGmgr.o SNFMulti.o snfNETmgr.o snf_sync.o snf_xci.o snfXCImgr.o base64codec.o configuration.o networking.o threading.o timing.o %LIB%
set LDFLAGS=-Wl,--output-def=snfmulti.def -Wl,--out-implib=libsnfmulti.a -Wl,-dll
%CXX% -shared -o snfmulti.dll %LDFLAGS% snfmultidll.o FilterChain.o GBUdb.o mangler.o scanner.o snfCFGmgr.o snf_engine.o snfGBUdbmgr.o snf_HeaderFinder.o snfLOGmgr.o SNFMulti.o snfNETmgr.o snf_sync.o snf_xci.o snfXCImgr.o base64codec.o configuration.o networking.o threading.o timing.o %LIB%

+ 0
- 1
MinGW-32/compileSNFMultiDLL.cmd Переглянути файл

@@ -3,7 +3,6 @@ set path=c:\MinGW\bin;%path%
set CXX=c++
set CXXFLAGS=-I../CodeDweller -I../SNFMulti -mthreads -O3 -m32 -D_USE_32BIT_TIME_T
del *.o
%CXX% %CXXFLAGS% -c ../SNFMulti/snf_saccades.cpp -o snf_saccades.o
%CXX% %CXXFLAGS% -c ../SNFMulti/FilterChain.cpp -o FilterChain.o
%CXX% %CXXFLAGS% -c ../SNFMulti/GBUdb.cpp -o GBUdb.o
%CXX% %CXXFLAGS% -c ../SNFMulti/scanner.cpp -o scanner.o

+ 1
- 1
MinGW-64/buildSNFMultiDLL.cmd Переглянути файл

@@ -3,4 +3,4 @@ set path=c:\MinGW-64\bin;%path%
set CXX=x86_64-pc-mingw32-c++
set LIB=c:\MinGW-64\x86_64-pc-mingw32\lib64\libws2_32.a -loleaut32
set LDFLAGS=-Wl,--output-def=snfmulti.def -Wl,--out-implib=libsnfmulti.a -Wl,-dll
%CXX% -shared -o snfmulti.dll %LDFLAGS% snfmultidll.o snf_saccades.o FilterChain.o GBUdb.o mangler.o scanner.o snfCFGmgr.o snf_engine.o snfGBUdbmgr.o snf_HeaderFinder.o snfLOGmgr.o SNFMulti.o snfNETmgr.o snf_sync.o snf_xci.o snfXCImgr.o base64codec.o configuration.o networking.o threading.o timing.o %LIB%
%CXX% -shared -o snfmulti.dll %LDFLAGS% snfmultidll.o FilterChain.o GBUdb.o mangler.o scanner.o snfCFGmgr.o snf_engine.o snfGBUdbmgr.o snf_HeaderFinder.o snfLOGmgr.o SNFMulti.o snfNETmgr.o snf_sync.o snf_xci.o snfXCImgr.o base64codec.o configuration.o networking.o threading.o timing.o %LIB%

+ 0
- 1
MinGW-64/compileSNFMultiDLL.cmd Переглянути файл

@@ -3,7 +3,6 @@ set CXX=x86_64-pc-mingw32-c++
REM set CXX=c++
set CXXFLAGS=-I../CodeDweller -I../SNFMulti -mthreads -O3
del *.o
%CXX% %CXXFLAGS% -c ../SNFMulti/snf_saccades.cpp -o snf_saccades.o
%CXX% %CXXFLAGS% -c ../SNFMulti/FilterChain.cpp -o FilterChain.o
%CXX% %CXXFLAGS% -c ../SNFMulti/GBUdb.cpp -o GBUdb.o
%CXX% %CXXFLAGS% -c ../SNFMulti/scanner.cpp -o scanner.o

+ 8
- 8
SNFMultiDll/snfmultidll.cpp Переглянути файл

@@ -218,10 +218,10 @@ int ScannerInstance::getScanResult() {
class snfScannerPool { // Dynamically allocated scanner pool.
private:
Mutex myMutex; // Protect the state of the pool.
codedweller::Mutex myMutex; // Protect the state of the pool.
snf_RulebaseHandler* myRulebaseHandler; // This is our rulebase manager.
vector<ScannerInstance*> ScannerPool; // This is a collection of scanners.
ProductionQueue<ScannerInstance*> AvailableScanners; // This is the available scanners queue.
codedweller::ProductionQueue<ScannerInstance*> AvailableScanners; // This is the available scanners queue.
unsigned int ScanThreadLimit; // Maximum number of concurrent threads.
public:
@@ -254,7 +254,7 @@ void snfScannerPool::Throttle(int ThreadLimit) {
}
void snfScannerPool::startup(char* ConfigurationPath) { // Start the engine with this config.
ScopeMutex StateIsInFlux(myMutex); // Protect our state data.
codedweller::ScopeMutex StateIsInFlux(myMutex); // Protect our state data.
if(myRulebaseHandler) return; // If we are started, do nothing.
myRulebaseHandler = new snf_RulebaseHandler(); // Create a new rulebase handler.
myRulebaseHandler->PlatformVersion(SNF_DLL_VERSION); // Record our version identification.
@@ -262,7 +262,7 @@ void snfScannerPool::startup(char* ConfigurationPath) {
}
void snfScannerPool::startupAuthenticated(char* Path, char* Lic, char* Auth) { // Startup engine w/ full auth.
ScopeMutex StateIsInFlux(myMutex); // Protect our state data.
codedweller::ScopeMutex StateIsInFlux(myMutex); // Protect our state data.
if(myRulebaseHandler) return; // If we are started, do nothing.
myRulebaseHandler = new snf_RulebaseHandler(); // Create a new rulebase handler.
myRulebaseHandler->PlatformVersion(SNF_DLL_VERSION); // Record our version identification.
@@ -270,7 +270,7 @@ void snfScannerPool::startupAuthenticated(char* Path, char* Lic, char* Auth) {
}
void snfScannerPool::shutdown() { // Shutdown the engine.
ScopeMutex StateIsInFlux(myMutex); // Protect our state data.
codedweller::ScopeMutex StateIsInFlux(myMutex); // Protect our state data.
if(
0 == ScannerPool.size() &&
0 == AvailableScanners.size() &&
@@ -295,7 +295,7 @@ void snfScannerPool::shutdown() {
}
int snfScannerPool::testIP(unsigned long int IPToCheck) { // This is how we test IPs.
ScopeMutex StayAsYouAre(myMutex); // Hold things steady while we do this.
codedweller::ScopeMutex StayAsYouAre(myMutex); // Hold things steady while we do this.
if(0 == myRulebaseHandler) return snf_ERROR_NO_HANDLE; // If we have no engine, punt!
IPTestRecord Tester(IPToCheck); // Make up a test record for this IP.
myRulebaseHandler->performIPTest(Tester); // Run it past the engine.
@@ -303,7 +303,7 @@ int snfScannerPool::testIP(unsigned long int IPToCheck) {
}
double snfScannerPool::getIPReputation(unsigned long int IPToCheck) { // This is how we get IP reps.
ScopeMutex StayAsYouAre(myMutex); // Hold things steady while we do this.
codedweller::ScopeMutex StayAsYouAre(myMutex); // Hold things steady while we do this.
if(0 == myRulebaseHandler) return snf_ERROR_NO_HANDLE; // If we have no engine, punt!
IPTestRecord Tester(IPToCheck); // Make up a test record for this IP.
myRulebaseHandler->performIPTest(Tester); // Run it past the engine.
@@ -344,7 +344,7 @@ double snfScannerPool::getIPReputation(unsigned long int IPToCheck) {
// return an error.
ScannerInstance* snfScannerPool::grabScanner() { // Get the next available scanner.
ScopeMutex FreezeOurState(myMutex); // Don't change while I'm doing this.
codedweller::ScopeMutex FreezeOurState(myMutex); // Don't change while I'm doing this.
if(0 == myRulebaseHandler) return 0; // If we're not alive return nothing.
if(1 > AvailableScanners.size()) { // No scanners? See about making one.
if(

+ 52
- 52
SNFMultiTest/main.cpp Переглянути файл

@@ -6,23 +6,23 @@
#include "../CodeDweller/threading.hpp"


class Pounder : private Thread { // A Pounder _REALLY_ scans its msg.
class Pounder : private codedweller::Thread { // A Pounder _REALLY_ scans its msg.
private:
string MessageToTest; // This is the message to test.
std::string MessageToTest; // This is the message to test.
bool TimeToStop; // True when time to stop.
volatile int ScansAccomplished; // Number completed so far.
volatile int HighestHandleSeen; // Highest handle so far.
void myTask(); // How it is done.

public:
Pounder(string Message); // Ctor takes the message to scan.
Pounder(std::string Message); // Ctor takes the message to scan.
~Pounder(); // Dtor shuts things down.
int NumberOfScans(); // Returns number of scans.
int HighestHandle(); // Returns the highest handle.
void stop(); // Stops.
};

Pounder::Pounder(string Message) : // Ctor for a pounder.
Pounder::Pounder(std::string Message) : // Ctor for a pounder.
MessageToTest(Message), // Capture the message to test
TimeToStop(false), // and initialize the variables.
ScansAccomplished(0),
@@ -74,7 +74,7 @@ void Pounder::myTask() {
int ScanResult =
getScanXHeaders(ScanHandle, &HeadersString, &HeadersStringLength); // Get the results.

string XHeaders = HeadersString; // Form a string.
std::string XHeaders = HeadersString; // Form a string.
closeScan(ScanHandle); // Got our data, close the scan.

if(0 > ScanResult) { TimeToStop = true; break; } // If we got an error, stop.
@@ -88,7 +88,7 @@ void Pounder::myTask() {
}
}

string BigGiantUglyMessage =
std::string BigGiantUglyMessage =
"Received: from [213.93.213.84] (HELO uw-4b58d8528225.arnhem.chello.nl)\r\n"
" by inbound.appriver.com (CommuniGate Pro SMTP 5.0.6)\r\n"
"Received: from [13.93.213.84] (HELO uw-4b58d8528225.arnhem.chello.nl)\r\n"
@@ -129,7 +129,7 @@ int main()

int LastResult;

std::cout << "Throttling not set" << endl;
std::cout << "Throttling not set" << std::endl;
//setThrottle(3);

std::cout << "startupSNF(): ";
@@ -137,7 +137,7 @@ int main()
std::cout << LastResult << std::endl;

std::cout << "Scanning ugly text: ";
string UglyText1 =
std::string UglyText1 =
"Received: from [213.93.213.84] (HELO uw-4b58d8528225.arnhem.chello.nl)\r\n"
" by inbound.appriver.com (CommuniGate Pro SMTP 5.0.6)\r\n"
"From: \"somebody\" <somebody@someplace.com>\r\n"
@@ -146,7 +146,7 @@ int main()
"So, this is a message eh?\r\n"
".\r\n";

string UglyText2 =
std::string UglyText2 =
"Received: from [11.93.213.84] (HELO uw-4b58d8528225.arnhem.chello.nl)\r\n"
" by inbound.appriver.com (CommuniGate Pro SMTP 5.0.6)\r\n"
"From: \"somebody\" <somebody@someplace.com>\r\n"
@@ -158,145 +158,145 @@ int main()
int HandleOne = scanBuffer((unsigned char*)UglyText1.c_str(), UglyText1.length(), (char *) "", 0);
char* Result1; int Result1Length;
LastResult = getScanXHeaders(HandleOne, &Result1, &Result1Length);
std::cout << HandleOne << ", " << LastResult << endl;
std::cout << HandleOne << ", " << LastResult << std::endl;
std::cout << Result1;
LastResult = closeScan(HandleOne);
std::cout << "Closed handle one: " << LastResult << endl;
std::cout << "Closed handle one: " << LastResult << std::endl;

// DEBUG.
// cout << "scanFile('testFile', 33): " << scanFile("testFile", 33) << endl;
// cout << "scanFile('testFile', 33): " << scanFile("testFile", 33) << std::endl;
// exit(0);
// END OF DEBUG.

HandleOne = scanBuffer((unsigned char*)UglyText1.c_str(), UglyText1.length(), (char *) "", 0);
LastResult = getScanXHeaders(HandleOne, &Result1, &Result1Length);
std::cout << HandleOne << ", " << LastResult << endl;
std::cout << HandleOne << ", " << LastResult << std::endl;
std::cout << Result1;

int HandleTwo = scanBuffer((unsigned char*)UglyText1.c_str(), UglyText1.length(), (char *) "", 0);
char* Result2; int Result2Length;
LastResult = getScanXHeaders(HandleTwo, &Result2, &Result2Length);
std::cout << HandleTwo << ", " << LastResult << endl;
std::cout << HandleTwo << ", " << LastResult << std::endl;
std::cout << Result2;

std::cout << "Closing Scanners: ";
LastResult = closeScan(HandleOne);
std::cout << LastResult << ", ";
LastResult = closeScan(HandleTwo);
std::cout << LastResult << endl;
std::cout << LastResult << std::endl;

std::cout << "Scanners Closed" << endl;
std::cout << "Scanners Closed" << std::endl;

//// Heavy multi-thread testing now...

Sleeper WaitATic(1000);
std::cout << "Starting Pounder 1" << endl;
codedweller::Sleeper WaitATic(1000);
std::cout << "Starting Pounder 1" << std::endl;
Pounder Pounder1(BigGiantUglyMessage);
for(int a = 0; a < 10; a++) {
WaitATic();
std:cout
std::cout
<< "Pounder 1: " << Pounder1.NumberOfScans()
<< ", " << Pounder1.HighestHandle() << endl;
<< ", " << Pounder1.HighestHandle() << std::endl;
}

std::cout << "Starting Pounder 2" << endl;
std::cout << "Starting Pounder 2" << std::endl;
Pounder Pounder2(BigGiantUglyMessage);
for(int a = 0; a < 10; a++) {
WaitATic();
std::cout << "Pounder 1: " << Pounder1.NumberOfScans()
<< ", " << Pounder1.HighestHandle() << endl;
<< ", " << Pounder1.HighestHandle() << std::endl;

std::cout << "Pounder 2: " << Pounder2.NumberOfScans()
<< ", " << Pounder2.HighestHandle() << endl;
<< ", " << Pounder2.HighestHandle() << std::endl;

}

std::cout << "Starting Pounder 3" << endl;
std::cout << "Starting Pounder 3" << std::endl;
Pounder Pounder3(BigGiantUglyMessage);
for(int a = 0; a < 10; a++) {
WaitATic();
std::cout << "Pounder 1: " << Pounder1.NumberOfScans()
<< ", " << Pounder1.HighestHandle() << endl;
<< ", " << Pounder1.HighestHandle() << std::endl;

std::cout << "Pounder 2: " << Pounder2.NumberOfScans()
<< ", " << Pounder2.HighestHandle() << endl;
<< ", " << Pounder2.HighestHandle() << std::endl;

std::cout << "Pounder 3: " << Pounder3.NumberOfScans()
<< ", " << Pounder3.HighestHandle() << endl;
<< ", " << Pounder3.HighestHandle() << std::endl;

}

std::cout << "Starting Pounder 4" << endl;
std::cout << "Starting Pounder 4" << std::endl;
Pounder Pounder4(BigGiantUglyMessage);
for(int a = 0; a < 10; a++) {
WaitATic();
std::cout << "Pounder 1: " << Pounder1.NumberOfScans()
<< ", " << Pounder1.HighestHandle() << endl;
<< ", " << Pounder1.HighestHandle() << std::endl;

std::cout << "Pounder 2: " << Pounder2.NumberOfScans()
<< ", " << Pounder2.HighestHandle() << endl;
<< ", " << Pounder2.HighestHandle() << std::endl;

std::cout << "Pounder 3: " << Pounder3.NumberOfScans()
<< ", " << Pounder3.HighestHandle() << endl;
<< ", " << Pounder3.HighestHandle() << std::endl;

std::cout << "Pounder 4: " << Pounder4.NumberOfScans()
<< ", " << Pounder4.HighestHandle() << endl;
<< ", " << Pounder4.HighestHandle() << std::endl;

}

std::cout << "Starting Pounder 5" << endl;
std::cout << "Starting Pounder 5" << std::endl;
Pounder Pounder5(BigGiantUglyMessage);
for(int a = 0; a < 10; a++) {
WaitATic();
std::cout << "Pounder 1: " << Pounder1.NumberOfScans()
<< ", " << Pounder1.HighestHandle() << endl;
<< ", " << Pounder1.HighestHandle() << std::endl;

std::cout << "Pounder 2: " << Pounder2.NumberOfScans()
<< ", " << Pounder2.HighestHandle() << endl;
<< ", " << Pounder2.HighestHandle() << std::endl;

std::cout << "Pounder 3: " << Pounder3.NumberOfScans()
<< ", " << Pounder3.HighestHandle() << endl;
<< ", " << Pounder3.HighestHandle() << std::endl;

std::cout << "Pounder 4: " << Pounder4.NumberOfScans()
<< ", " << Pounder4.HighestHandle() << endl;
<< ", " << Pounder4.HighestHandle() << std::endl;

std::cout << "Pounder 5: " << Pounder5.NumberOfScans()
<< ", " << Pounder5.HighestHandle() << endl;
<< ", " << Pounder5.HighestHandle() << std::endl;

}

std::cout << "Starting Pounder 6" << endl;
std::cout << "Starting Pounder 6" << std::endl;
Pounder Pounder6(BigGiantUglyMessage);
for(int a = 0; a < 30; a++) {
WaitATic();
std::cout << "Pounder 1: " << Pounder1.NumberOfScans()
<< ", " << Pounder1.HighestHandle() << endl;
<< ", " << Pounder1.HighestHandle() << std::endl;

std::cout << "Pounder 2: " << Pounder2.NumberOfScans()
<< ", " << Pounder2.HighestHandle() << endl;
<< ", " << Pounder2.HighestHandle() << std::endl;

std::cout << "Pounder 3: " << Pounder3.NumberOfScans()
<< ", " << Pounder3.HighestHandle() << endl;
<< ", " << Pounder3.HighestHandle() << std::endl;

std::cout << "Pounder 4: " << Pounder4.NumberOfScans()
<< ", " << Pounder4.HighestHandle() << endl;
<< ", " << Pounder4.HighestHandle() << std::endl;

std::cout << "Pounder 5: " << Pounder5.NumberOfScans()
<< ", " << Pounder5.HighestHandle() << endl;
<< ", " << Pounder5.HighestHandle() << std::endl;

std::cout << "Pounder 6: " << Pounder6.NumberOfScans()
<< ", " << Pounder6.HighestHandle() << endl;
<< ", " << Pounder6.HighestHandle() << std::endl;

}

std::cout << "Stopping All Pounders" << endl;
std::cout << "Stopping All Pounders" << std::endl;

Pounder1.stop(); std::cout << "1 stopped." << endl;
Pounder2.stop(); std::cout << "2 stopped." << endl;
Pounder3.stop(); std::cout << "3 stopped." << endl;
Pounder4.stop(); std::cout << "4 stopped." << endl;
Pounder5.stop(); std::cout << "5 stopped." << endl;
Pounder6.stop(); std::cout << "6 stopped." << endl;
Pounder1.stop(); std::cout << "1 stopped." << std::endl;
Pounder2.stop(); std::cout << "2 stopped." << std::endl;
Pounder3.stop(); std::cout << "3 stopped." << std::endl;
Pounder4.stop(); std::cout << "4 stopped." << std::endl;
Pounder5.stop(); std::cout << "5 stopped." << std::endl;
Pounder6.stop(); std::cout << "6 stopped." << std::endl;

std::cout << "shutdownSNF(): ";
LastResult = shutdownSNF();

+ 4
- 4
VBSample/main.vb Переглянути файл

@@ -11,9 +11,9 @@ Module SNFMultiDLLExample
#Region "DLL Imports"
' Location of SNFMulti.dll.
'Const SNFMULTI_DLL As String = "..\..\..\..\64bitDll\SNFMulti.dll" ' Set CPU type to "Any CPU"
Const SNFMULTI_DLL As String = "..\..\..\..\64bitDll\SNFMulti.dll" ' Set CPU type to "Any CPU"
'Const SNFMULTI_DLL As String = "..\..\..\..\..\64bitDll\SNFMulti.dll" ' Set CPU type to "x64"
Const SNFMULTI_DLL As String = "..\..\..\..\..\32bitDll\SNFMulti.dll" ' Set CPU type to "x86"
'Const SNFMULTI_DLL As String = "..\..\..\..\..\32bitDll\SNFMulti.dll" ' Set CPU type to "x86"
'int setThrottle(int Threads); /* Set scan thread limit. */
'int startupSNF(char* Path); /* Start SNF with configuration. */
@@ -108,8 +108,8 @@ Module SNFMultiDLLExample
'Const LicenseID As String = "licensid" ' SNF License ID can be passed
'Const Authentication As String = "authentication" ' directly or read from the
' configuration. OEMs go direct!
'Const ConfigurationPath As String = "..\..\..\snf_engine.xml" ' For "Any CPU" platform.
Const ConfigurationPath As String = "..\..\..\..\snf_engine.xml" ' For "x86" or "x64" platforms.
Const ConfigurationPath As String = "..\..\..\snf_engine.xml" ' For "Any CPU" platform.
'Const ConfigurationPath As String = "..\..\..\..\snf_engine.xml" ' For "x86" or "x64" platforms.
Const IPToTest As UInt32 = &HC22384E ' Same as IP 12.34.56.78

BIN
VS2008CPPSample/VS2008CPPSample.suo Переглянути файл


+ 13
- 8
readme Переглянути файл

@@ -95,14 +95,19 @@ To build and test the SDK:
2) Repeat in MinGW-64.
3) Build and run VS2008CPPSample, x32 and x64. First copy
snf_engine.xml to VS2008CPPSample. Needed to copy *.dll to
VS2008CPPSample.
4) Build and run VS2008CSSample, any, x32, and x64. First copy
snf_engine.xml to VS2008CSSample.
5) Build and run VS2008VBSample, any, x32, and x64. First copy
snf_engine.xml to VS2008VBSample.
snf_engine.xml to VS2008CPPSample. For x32, copy *.dll from
32bitDll to VS2008CPPSample. For x64, copy *.dll from 64bitDll
to VS2008CPPSample.
4) Build and run VS2008CSSample, any, x32, and x64. Copy
snf_engine.xml to VS2008CSSample. Modify main.cs to specify
the location of snf_engine.xml and snfmulti.dll, which is
different for any, x32, and x64.
5) Build and run VS2008VBSample, any, x32, and x64. Copy
snf_engine.xml to VS2008VBSample. Modify main.vb to specify
the location of snf_engine.xml and snfmulti.dll, which is
different for any, x32, and x64.
To create a zipfile distribution:

Завантаження…
Відмінити
Зберегти