Browse Source

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

master
adeniz 4 years ago
parent
commit
99b668337c

BIN
32bitDll/snfmulti.dll View File


BIN
32bitDll/vs2008_snfmulti.exp View File


BIN
32bitDll/vs2008_snfmulti.lib View File


BIN
64bitDll/snfmulti.dll View File


BIN
64bitDll/vs2008_snfmulti.exp View File


BIN
64bitDll/vs2008_snfmulti.lib View File


+ 7
- 6
BuildDistribution.cmd View File

REM When properly configured this script does: REM When properly configured this script does:
REM REM
REM 1. Update the source and project directories in SNFMultiSDK_Windows_X.Y 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
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
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
REM 4. Create the zip file SNFMultiSDK_Windows_X.Y.zip REM 4. Create the zip file SNFMultiSDK_Windows_X.Y.zip
REM REM
REM 5. Copy the SNFMultiSDK_Windows_X.Y.zip file to .. (back to the PKG-SNF-SDK-WIN root) REM 5. Copy the SNFMultiSDK_Windows_X.Y.zip file to .. (back to the PKG-SNF-SDK-WIN root)
REM REM
REM 6. Empty the SDKBuild directory.
REM 6. Empty the C:\TEMP\SNFMultiSDK_Windows_X.Y directory.
REM 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 setlocal
set PATH=32bitdll;%PATH% set PATH=32bitdll;%PATH%
set DISTDIR=SNFMultiSDK_Windows_3.3
set DISTDIR=SNFMultiSDK_Windows_4.0
set TEMPDIR=C:\TEMP set TEMPDIR=C:\TEMP
set ZIPFILE=%DISTDIR%.zip set ZIPFILE=%DISTDIR%.zip
set TEMPDIST=%TEMPDIR%\%DISTDIR% set TEMPDIST=%TEMPDIR%\%DISTDIR%

+ 0
- 2
CodeBlocks/SNFMulti/SNFMulti.cbp View File

<Unit filename="..\..\SNFMulti\snf_engine.cpp" /> <Unit filename="..\..\SNFMulti\snf_engine.cpp" />
<Unit filename="..\..\SNFMulti\snf_engine.hpp" /> <Unit filename="..\..\SNFMulti\snf_engine.hpp" />
<Unit filename="..\..\SNFMulti\snf_match.h" /> <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.cpp" />
<Unit filename="..\..\SNFMulti\snf_sync.hpp" /> <Unit filename="..\..\SNFMulti\snf_sync.hpp" />
<Unit filename="..\..\SNFMulti\snf_xci.cpp" /> <Unit filename="..\..\SNFMulti\snf_xci.cpp" />

+ 292
- 0
CodeBlocks/SNFMulti/SNFMulti.depend View File

"../CodeDweller/networking.hpp" "../CodeDweller/networking.hpp"
"../CodeDweller/configuration.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 View File

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_layout_file> <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"> <File name="..\..\CodeDweller\threading.cpp" open="0" top="0" tabpos="1">
<Cursor position="18093" topLine="276" /> <Cursor position="18093" topLine="276" />
</File> </File>
<File name="..\..\CodeDweller\timing.hpp" open="0" top="0" tabpos="2"> <File name="..\..\CodeDweller\timing.hpp" open="0" top="0" tabpos="2">
<Cursor position="0" topLine="0" /> <Cursor position="0" topLine="0" />
</File> </File>
<File name="..\..\SNFMultiDll\snfmultidll.cpp" open="0" top="0" tabpos="0">
<Cursor position="22493" topLine="332" />
</File>
</CodeBlocks_layout_file> </CodeBlocks_layout_file>

+ 2
- 1
CodeBlocks/SNFMultiTest/README View File

or bin\Release relative to this directory. or bin\Release relative to this directory.
Before running the application, copy the SNFServer configuration file 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 Creating the SNFMultiTest project file
----------------------------------- -----------------------------------

+ 34
- 0
CodeBlocks/SNFMultiTest/SNFMultiTest.depend View File

1342303937 source:c:\users\alban\desktop\codedevelopment\pkg-snf-sdk-win\trunk\codedweller\threading.cpp 1342303937 source:c:\users\alban\desktop\codedevelopment\pkg-snf-sdk-win\trunk\codedweller\threading.cpp
"threading.hpp" "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 View File

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_layout_file> <CodeBlocks_layout_file>
<ActiveTarget name="Debug" /> <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> </File>
</CodeBlocks_layout_file> </CodeBlocks_layout_file>

+ 1
- 1
CodeDweller

Subproject commit 2c3aafcc16cbc2d9ea121b0b9c8851b0337c9168
Subproject commit ee37106bc3e2acdf549c9d04ab515b77b6da48f4

+ 2
- 2
MinGW-32/buildSNFMultiDLL.cmd View File

set path=c:\MinGW\bin;%path% set path=c:\MinGW\bin;%path%
set CXX=c++ set CXX=c++
set LIB=c:\MinGW\lib\libws2_32.a -loleaut32 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 View File

set CXX=c++ set CXX=c++
set CXXFLAGS=-I../CodeDweller -I../SNFMulti -mthreads -O3 -m32 -D_USE_32BIT_TIME_T set CXXFLAGS=-I../CodeDweller -I../SNFMulti -mthreads -O3 -m32 -D_USE_32BIT_TIME_T
del *.o 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/FilterChain.cpp -o FilterChain.o
%CXX% %CXXFLAGS% -c ../SNFMulti/GBUdb.cpp -o GBUdb.o %CXX% %CXXFLAGS% -c ../SNFMulti/GBUdb.cpp -o GBUdb.o
%CXX% %CXXFLAGS% -c ../SNFMulti/scanner.cpp -o scanner.o %CXX% %CXXFLAGS% -c ../SNFMulti/scanner.cpp -o scanner.o

+ 1
- 1
MinGW-64/buildSNFMultiDLL.cmd View File

set CXX=x86_64-pc-mingw32-c++ set CXX=x86_64-pc-mingw32-c++
set LIB=c:\MinGW-64\x86_64-pc-mingw32\lib64\libws2_32.a -loleaut32 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 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 View File

REM set CXX=c++ REM set CXX=c++
set CXXFLAGS=-I../CodeDweller -I../SNFMulti -mthreads -O3 set CXXFLAGS=-I../CodeDweller -I../SNFMulti -mthreads -O3
del *.o 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/FilterChain.cpp -o FilterChain.o
%CXX% %CXXFLAGS% -c ../SNFMulti/GBUdb.cpp -o GBUdb.o %CXX% %CXXFLAGS% -c ../SNFMulti/GBUdb.cpp -o GBUdb.o
%CXX% %CXXFLAGS% -c ../SNFMulti/scanner.cpp -o scanner.o %CXX% %CXXFLAGS% -c ../SNFMulti/scanner.cpp -o scanner.o

+ 8
- 8
SNFMultiDll/snfmultidll.cpp View File

class snfScannerPool { // Dynamically allocated scanner pool. class snfScannerPool { // Dynamically allocated scanner pool.
private: 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. snf_RulebaseHandler* myRulebaseHandler; // This is our rulebase manager.
vector<ScannerInstance*> ScannerPool; // This is a collection of scanners. 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. unsigned int ScanThreadLimit; // Maximum number of concurrent threads.
public: public:
} }
void snfScannerPool::startup(char* ConfigurationPath) { // Start the engine with this config. 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. if(myRulebaseHandler) return; // If we are started, do nothing.
myRulebaseHandler = new snf_RulebaseHandler(); // Create a new rulebase handler. myRulebaseHandler = new snf_RulebaseHandler(); // Create a new rulebase handler.
myRulebaseHandler->PlatformVersion(SNF_DLL_VERSION); // Record our version identification. myRulebaseHandler->PlatformVersion(SNF_DLL_VERSION); // Record our version identification.
} }
void snfScannerPool::startupAuthenticated(char* Path, char* Lic, char* Auth) { // Startup engine w/ full auth. 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. if(myRulebaseHandler) return; // If we are started, do nothing.
myRulebaseHandler = new snf_RulebaseHandler(); // Create a new rulebase handler. myRulebaseHandler = new snf_RulebaseHandler(); // Create a new rulebase handler.
myRulebaseHandler->PlatformVersion(SNF_DLL_VERSION); // Record our version identification. myRulebaseHandler->PlatformVersion(SNF_DLL_VERSION); // Record our version identification.
} }
void snfScannerPool::shutdown() { // Shutdown the engine. void snfScannerPool::shutdown() { // Shutdown the engine.
ScopeMutex StateIsInFlux(myMutex); // Protect our state data.
codedweller::ScopeMutex StateIsInFlux(myMutex); // Protect our state data.
if( if(
0 == ScannerPool.size() && 0 == ScannerPool.size() &&
0 == AvailableScanners.size() && 0 == AvailableScanners.size() &&
} }
int snfScannerPool::testIP(unsigned long int IPToCheck) { // This is how we test IPs. 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! 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. IPTestRecord Tester(IPToCheck); // Make up a test record for this IP.
myRulebaseHandler->performIPTest(Tester); // Run it past the engine. myRulebaseHandler->performIPTest(Tester); // Run it past the engine.
} }
double snfScannerPool::getIPReputation(unsigned long int IPToCheck) { // This is how we get IP reps. 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! 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. IPTestRecord Tester(IPToCheck); // Make up a test record for this IP.
myRulebaseHandler->performIPTest(Tester); // Run it past the engine. myRulebaseHandler->performIPTest(Tester); // Run it past the engine.
// return an error. // return an error.
ScannerInstance* snfScannerPool::grabScanner() { // Get the next available scanner. 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(0 == myRulebaseHandler) return 0; // If we're not alive return nothing.
if(1 > AvailableScanners.size()) { // No scanners? See about making one. if(1 > AvailableScanners.size()) { // No scanners? See about making one.
if( if(

+ 52
- 52
SNFMultiTest/main.cpp View File

#include "../CodeDweller/threading.hpp" #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: 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. bool TimeToStop; // True when time to stop.
volatile int ScansAccomplished; // Number completed so far. volatile int ScansAccomplished; // Number completed so far.
volatile int HighestHandleSeen; // Highest handle so far. volatile int HighestHandleSeen; // Highest handle so far.
void myTask(); // How it is done. void myTask(); // How it is done.


public: 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. ~Pounder(); // Dtor shuts things down.
int NumberOfScans(); // Returns number of scans. int NumberOfScans(); // Returns number of scans.
int HighestHandle(); // Returns the highest handle. int HighestHandle(); // Returns the highest handle.
void stop(); // Stops. 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 MessageToTest(Message), // Capture the message to test
TimeToStop(false), // and initialize the variables. TimeToStop(false), // and initialize the variables.
ScansAccomplished(0), ScansAccomplished(0),
int ScanResult = int ScanResult =
getScanXHeaders(ScanHandle, &HeadersString, &HeadersStringLength); // Get the results. 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. closeScan(ScanHandle); // Got our data, close the scan.


if(0 > ScanResult) { TimeToStop = true; break; } // If we got an error, stop. if(0 > ScanResult) { TimeToStop = true; break; } // If we got an error, stop.
} }
} }


string BigGiantUglyMessage =
std::string BigGiantUglyMessage =
"Received: from [213.93.213.84] (HELO uw-4b58d8528225.arnhem.chello.nl)\r\n" "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" " 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" "Received: from [13.93.213.84] (HELO uw-4b58d8528225.arnhem.chello.nl)\r\n"


int LastResult; int LastResult;


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


std::cout << "startupSNF(): "; std::cout << "startupSNF(): ";
std::cout << LastResult << std::endl; std::cout << LastResult << std::endl;


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


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


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


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


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


std::cout << "Closing Scanners: "; std::cout << "Closing Scanners: ";
LastResult = closeScan(HandleOne); LastResult = closeScan(HandleOne);
std::cout << LastResult << ", "; std::cout << LastResult << ", ";
LastResult = closeScan(HandleTwo); 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... //// 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); Pounder Pounder1(BigGiantUglyMessage);
for(int a = 0; a < 10; a++) { for(int a = 0; a < 10; a++) {
WaitATic(); WaitATic();
std:cout
std::cout
<< "Pounder 1: " << Pounder1.NumberOfScans() << "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); Pounder Pounder2(BigGiantUglyMessage);
for(int a = 0; a < 10; a++) { for(int a = 0; a < 10; a++) {
WaitATic(); WaitATic();
std::cout << "Pounder 1: " << Pounder1.NumberOfScans() std::cout << "Pounder 1: " << Pounder1.NumberOfScans()
<< ", " << Pounder1.HighestHandle() << endl;
<< ", " << Pounder1.HighestHandle() << std::endl;


std::cout << "Pounder 2: " << Pounder2.NumberOfScans() 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); Pounder Pounder3(BigGiantUglyMessage);
for(int a = 0; a < 10; a++) { for(int a = 0; a < 10; a++) {
WaitATic(); WaitATic();
std::cout << "Pounder 1: " << Pounder1.NumberOfScans() std::cout << "Pounder 1: " << Pounder1.NumberOfScans()
<< ", " << Pounder1.HighestHandle() << endl;
<< ", " << Pounder1.HighestHandle() << std::endl;


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


std::cout << "Pounder 3: " << Pounder3.NumberOfScans() 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); Pounder Pounder4(BigGiantUglyMessage);
for(int a = 0; a < 10; a++) { for(int a = 0; a < 10; a++) {
WaitATic(); WaitATic();
std::cout << "Pounder 1: " << Pounder1.NumberOfScans() std::cout << "Pounder 1: " << Pounder1.NumberOfScans()
<< ", " << Pounder1.HighestHandle() << endl;
<< ", " << Pounder1.HighestHandle() << std::endl;


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


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


std::cout << "Pounder 4: " << Pounder4.NumberOfScans() 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); Pounder Pounder5(BigGiantUglyMessage);
for(int a = 0; a < 10; a++) { for(int a = 0; a < 10; a++) {
WaitATic(); WaitATic();
std::cout << "Pounder 1: " << Pounder1.NumberOfScans() std::cout << "Pounder 1: " << Pounder1.NumberOfScans()
<< ", " << Pounder1.HighestHandle() << endl;
<< ", " << Pounder1.HighestHandle() << std::endl;


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


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


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


std::cout << "Pounder 5: " << Pounder5.NumberOfScans() 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); Pounder Pounder6(BigGiantUglyMessage);
for(int a = 0; a < 30; a++) { for(int a = 0; a < 30; a++) {
WaitATic(); WaitATic();
std::cout << "Pounder 1: " << Pounder1.NumberOfScans() std::cout << "Pounder 1: " << Pounder1.NumberOfScans()
<< ", " << Pounder1.HighestHandle() << endl;
<< ", " << Pounder1.HighestHandle() << std::endl;


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


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


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


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


std::cout << "Pounder 6: " << Pounder6.NumberOfScans() 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(): "; std::cout << "shutdownSNF(): ";
LastResult = shutdownSNF(); LastResult = shutdownSNF();

+ 4
- 4
VBSample/main.vb View File

#Region "DLL Imports" #Region "DLL Imports"
' Location of SNFMulti.dll. ' 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 = "..\..\..\..\..\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 setThrottle(int Threads); /* Set scan thread limit. */
'int startupSNF(char* Path); /* Start SNF with configuration. */ 'int startupSNF(char* Path); /* Start SNF with configuration. */
'Const LicenseID As String = "licensid" ' SNF License ID can be passed 'Const LicenseID As String = "licensid" ' SNF License ID can be passed
'Const Authentication As String = "authentication" ' directly or read from the 'Const Authentication As String = "authentication" ' directly or read from the
' configuration. OEMs go direct! ' 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 Const IPToTest As UInt32 = &HC22384E ' Same as IP 12.34.56.78

BIN
VS2008CPPSample/VS2008CPPSample.suo View File


+ 13
- 8
readme View File

2) Repeat in MinGW-64. 2) Repeat in MinGW-64.
3) Build and run VS2008CPPSample, x32 and x64. First copy 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: To create a zipfile distribution:

Loading…
Cancel
Save