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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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. #include "PostfixIntegrate.hpp"
  16. /// Class to manage the SNFMilter configuration.
  17. //
  18. // This class creates/maintains the sniffer configuration file, and
  19. // integrates/unintegrates with MTAs.
  20. //
  21. //////////////////////////////////////////////////////////////////////////////////////////////////////////
  22. class SNFMilterConfig : public UtilityConfig {
  23. public:
  24. /// Command.
  25. enum CommandEnum {
  26. IntegrateWithNoneCmd, ///< Remove integration with all MTAs.
  27. IntegrateWithPostfixCmd, ///< Integrate with postfix.
  28. IntegrateWithSendmailCmd ///< Integrate with sendmail.
  29. };
  30. /// Display usage.
  31. //
  32. // \param[in] Version is the SNFMilter version.
  33. //
  34. void DisplayHelp(std::string Version);
  35. /// Get the command-line input parameters for SNFMilter.
  36. //
  37. // \param[in] argc is the number of parameters.
  38. //
  39. // \param[in] argv is the parameters.
  40. //
  41. // \returns true if all the required command line parameters are
  42. // present and there are no unknown command-line parameters, false
  43. // otherwise.
  44. //
  45. bool GetCommandLineInput(int argc, char* argv[]);
  46. /// Create or update the configuration files.
  47. //
  48. // The SNFMilter.xml and GBUdbIgnoreList.txt files are created if
  49. // they don't exist. In any case, the owner/group is changed by
  50. // SetOwnerGroup(), and the permissions are changed to readonly
  51. // for everyone, and read/write for the owner.
  52. //
  53. void UpdateConfigFiles();
  54. /// Execute the command to integrate/unintegrate with the MTAs.
  55. void DoIntegrationCommand();
  56. private:
  57. /// Load the socket info (file name) from the <platform> section
  58. /// of the loaded config file.
  59. void LoadSocketInfo();
  60. void CreateSocketDir();
  61. PostfixIntegrate Postfix; ///< Postfix integration object.
  62. void IntegrateWithPostfix(); ///< Integrate with postfix.
  63. void UnintegrateWithPostfix(); ///< Unintegrate with postfix.
  64. void IntegrateWithSendmail(); ///< Integrate with sendmail.
  65. void UnintegrateWithSendmail(); ///< Unintegrate with sendmail.
  66. ///< Unintegrate with MTAs.
  67. //
  68. // Unintegrate with all MTAs except the specified MTA.
  69. //
  70. // \param[in] Except is the MTA to not integrate with. The
  71. // acceptable values are:
  72. //
  73. // <ol>
  74. // <li> "postfix" </li>
  75. // <li> "" </li>
  76. // </ol>
  77. //
  78. // The default value is "", which specifies unintegration with all
  79. // MTAs.
  80. //
  81. void UnintegrateWithAllExcept(std::string Except = "");
  82. CommandEnum Command; ///< Specified command.
  83. static const std::string DefaultConfigFile; ///< Default config file.
  84. static const std::string DefaultSampleConfigFile; ///< Sample config file.
  85. std::string SocketFileName;
  86. };
  87. #endif