Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

SNFMilterConfig.hpp 3.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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. #include "SendmailIntegrate.hpp"
  17. /// Class to manage the SNFMilter configuration.
  18. //
  19. // This class creates/maintains the sniffer configuration file, and
  20. // integrates/unintegrates with MTAs.
  21. //
  22. //////////////////////////////////////////////////////////////////////////////////////////////////////////
  23. class SNFMilterConfig : public UtilityConfig {
  24. public:
  25. /// Command specified.
  26. enum CommandEnum {
  27. SetupRepairCommand, ///< Setup or repair the configuration.
  28. UpdateCredentialsCommand, ///< Update the credentials.
  29. IntegrateWithPostfixCommand, ///< Integrate with postfix.
  30. IntegrateWithSendmailCommand, ///< Integrate with sendmail.
  31. IntegrateWithNoneCommand, ///< Unintegrate with all supported MTAs.
  32. StartSnifferCommand, ///< Start the Sniffer.
  33. StopSnifferCommand, ///< Stop the Sniffer.
  34. NoCommand, ///< No command specified.
  35. UnknownCommand ///< Unknown.
  36. };
  37. /// Display usage.
  38. //
  39. // \param[in] Version is the SNFMilter version.
  40. //
  41. void DisplayHelp(std::string Version);
  42. /// Get the command-line input parameters for SNFMilter.
  43. //
  44. // \param[in] argc is the number of parameters.
  45. //
  46. // \param[in] argv is the parameters.
  47. //
  48. // \returns true if all the required command line parameters are
  49. // present and there are no unknown command-line parameters, false
  50. // otherwise.
  51. //
  52. bool GetCommandLineInput(int argc, char* argv[]);
  53. /// Execute the command specified by the command-line parameters.
  54. //
  55. void ExecuteCommand(void);
  56. /// Save the state of all files that might be changed, except the
  57. /// config file.
  58. //
  59. void SaveFileState(void); // OBSOLETE.
  60. #if 0
  61. /// Execute the command to integrate/unintegrate with the MTAs.
  62. void DoIntegrationCommand();
  63. #endif
  64. private:
  65. /// Load the socket info (file name) from the <platform> section
  66. /// of the loaded config file.
  67. void LoadSocketInfo();
  68. /// Setup/repair the directory containing the milter socket.
  69. //
  70. // This method ensures that the directory to contain the milter
  71. // socket exists and has the correct owner and permissions.
  72. void SetupRepairSocketDir();
  73. PostfixIntegrate Postfix; ///< Postfix integration object.
  74. SendmailIntegrate Sendmail; ///< Sendmail integration object.
  75. /// Unintegrate with MTAs.
  76. //
  77. // Unintegrate with all MTAs except the specified MTA.
  78. //
  79. // \param[in] Except is the MTA to not integrate with. The
  80. // acceptable values are:
  81. //
  82. // <ol>
  83. // <li> "postfix" </li>
  84. // <li> "" </li>
  85. // </ol>
  86. //
  87. // The default value is "", which specifies unintegration with all
  88. // MTAs.
  89. //
  90. void UnintegrateWithAllExcept(std::string Except = "");
  91. CommandEnum Command; ///< Specified command.
  92. static const std::string DefaultConfigFile; ///< Default config file.
  93. static const std::string SampleConfigFile; ///< Sample config file.
  94. static const std::string SampleIdentityFile; ///< Sample identity file.
  95. static const std::string ApplicationName; ///< Application name.
  96. std::string SocketFileName;
  97. };
  98. #endif