Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. // \file SNFMilterConfig.hpp
  2. //
  3. // Copyright (C) 2011 ARM Research Labs, LLC.
  4. // See www.armresearch.com for the copyright terms.
  5. //
  6. // This file defines the SNFMilterConfig interface.
  7. //
  8. // $Id$
  9. //
  10. ///////////////////////////////////////////////////////////////////////////////////////////////////
  11. #ifndef SNFMilterConfighpp_included
  12. #define SNFMilterConfighpp_included
  13. #include <string>
  14. #include "UtilityConfig.hpp"
  15. /// Class to manage the SNFMilter configuration.
  16. //
  17. // This class creates/maintains the sniffer configuration file, and
  18. // integrates/unintegrates with MTAs.
  19. //
  20. //////////////////////////////////////////////////////////////////////////////////////////////////////////
  21. class SNFMilterConfig : public UtilityConfig {
  22. public:
  23. /// Command.
  24. enum CommandEnum {
  25. IntegrateWithNoneCmd, ///< Remove integration with all MTAs.
  26. IntegrateWithPostfixCmd, ///< Integrate with postfix.
  27. IntegrateWithSendmailCmd ///< Integrate with sendmail.
  28. };
  29. /// Display usage.
  30. //
  31. // \param[in] Version is the SNFMilter version.
  32. //
  33. void DisplayHelp(std::string Version);
  34. /// Get the command-line input parameters for SNFMilter.
  35. //
  36. // \param[in] argc is the number of parameters.
  37. //
  38. // \param[in] argv is the parameters.
  39. //
  40. // \returns true if all the required command line parameters are
  41. // present and there are no unknown command-line parameters, false
  42. // otherwise.
  43. //
  44. bool GetCommandLineInput(int argc, char* argv[]);
  45. /// Create or update the configuration files.
  46. //
  47. // The SNFMilter.xml and GBUdbIgnoreList.txt files are created if
  48. // they don't exist. In any case, the owner/group is changed by
  49. // SetOwnerGroup(), and the permissions are changed to readonly
  50. // for everyone, and read/write for the owner.
  51. //
  52. void UpdateConfigFiles();
  53. /// Execute the command to integrate/unintegrate with the MTAs.
  54. void DoIntegrationCommand();
  55. private:
  56. /// Load the socket info (file name) from the <platform> section
  57. /// of the loaded config file.
  58. void LoadSocketInfo();
  59. void CreateSocketDir();
  60. void IntegrateWithPostfix(); ///< Integrate with postfix.
  61. void UnintegrateWithPostfix(); ///< Unintegrate with postfix.
  62. void IntegrateWithSendmail(); ///< Integrate with sendmail.
  63. void UnintegrateWithSendmail(); ///< Unintegrate with sendmail.
  64. void UnintegrateWithAll(); ///< Unintegrate with all MTAs.
  65. CommandEnum Command; ///< Specified command.
  66. static const std::string DefaultConfigFile; ///< Default config file.
  67. static const std::string DefaultSampleConfigFile; ///< Sample config file.
  68. std::string SocketFileName;
  69. };
  70. #endif