Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // SNF4CGP/main.cpp
  2. //
  3. // (C) Copyright 2009 ARM Research Labs, LLC
  4. // See www.armresearch.com for more information.
  5. //
  6. // SNF4CGP is a "filter helper" for Stalker's CommuniGate Pro
  7. // It implements a full SNFMulti antispam/antimalware engine and multi-threaded
  8. // scanner. SNFMulti scan results are mapped to appropriate responses.
  9. #include <iostream>
  10. #include <string>
  11. #include "ExecutiveProcess.hpp"
  12. using namespace std; // Introduce standard namespace.
  13. const string SNF4CGP_VERSION_INFO = "SNF4CGP Version 0.1.0 Build: " __DATE__ " " __TIME__;
  14. const int ConfigPathArgNumber = 1;
  15. const int CorrectArgcNumber = 2;
  16. bool CommandLineIsValid(int argc, char*argv[]) { // Validate the command line.
  17. if(CorrectArgcNumber != argc) {
  18. cout << "* SNF4CGP - Bad command line, use SNF4CGP <path_to_config_file>" << endl;
  19. return false;
  20. }
  21. return true;
  22. }
  23. void go(string ConfigurationPath) { // Application's main thread.
  24. try {
  25. ExecutiveProcess SNF4CGP(SNF4CGP_VERSION_INFO, ConfigurationPath);
  26. SNF4CGP.doStartup();
  27. SNF4CGP.doProcessing();
  28. SNF4CGP.doShutdown();
  29. }
  30. catch(exception& e) { // Display standard exceptions.
  31. cout << "* SFN4CGP Exception: " << e.what() << endl;
  32. }
  33. catch(...) { // Display unusual exceptions.
  34. cout << "* SNF4CGP Unusual Excetption!" << endl;
  35. }
  36. }
  37. int main(int argc, char* argv[]) { // Main entry point.
  38. if(CommandLineIsValid(argc, argv)) go(argv[ConfigPathArgNumber]); // With a good command line we go.
  39. return 0; // Then we're done.
  40. }