12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- // SNF4CGP/main.cpp
- //
- // (C) Copyright 2009 ARM Research Labs, LLC
- // See www.armresearch.com for more information.
- //
- // SNF4CGP is a "filter helper" for Stalker's CommuniGate Pro
- // It implements a full SNFMulti antispam/antimalware engine and multi-threaded
- // scanner. SNFMulti scan results are mapped to appropriate responses.
-
- #include <iostream>
- #include <string>
- #include "ExecutiveProcess.hpp"
-
- using namespace std; // Introduce standard namespace.
-
- const string SNF4CGP_VERSION_INFO = "SNF4CGP Version 0.1.0 Build: " __DATE__ " " __TIME__;
-
- const int ConfigPathArgNumber = 1;
- const int CorrectArgcNumber = 2;
- bool CommandLineIsValid(int argc, char*argv[]) { // Validate the command line.
- if(CorrectArgcNumber != argc) {
- cout << "* SNF4CGP - Bad command line, use SNF4CGP <path_to_config_file>" << endl;
- return false;
- }
- return true;
- }
-
- void go(string ConfigurationPath) { // Application's main thread.
- try {
- ExecutiveProcess SNF4CGP(SNF4CGP_VERSION_INFO, ConfigurationPath);
- SNF4CGP.doStartup();
- SNF4CGP.doProcessing();
- SNF4CGP.doShutdown();
- }
- catch(exception& e) { // Display standard exceptions.
- cout << "* SFN4CGP Exception: " << e.what() << endl;
- }
- catch(...) { // Display unusual exceptions.
- cout << "* SNF4CGP Unusual Excetption!" << endl;
- }
- }
-
- int main(int argc, char* argv[]) { // Main entry point.
- if(CommandLineIsValid(argc, argv)) go(argv[ConfigPathArgNumber]); // With a good command line we go.
- return 0; // Then we're done.
- }
|