|
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- // \file SNFMilterConfig.hpp
- //
- // Copyright (C) 2011 ARM Research Labs, LLC.
- // See www.armresearch.com for the copyright terms.
- //
- // This file defines the SNFMilterConfig interface.
- //
- // $Id$
- //
- ///////////////////////////////////////////////////////////////////////////////////////////////////
-
- #ifndef SNFMilterConfighpp_included
- #define SNFMilterConfighpp_included
-
- #include <string>
-
- #include "UtilityConfig.hpp"
-
- /// Class to manage the SNFMilter configuration.
- //
- // This class creates/maintains the sniffer configuration file, and
- // integrates/unintegrates with MTAs.
- //
- //////////////////////////////////////////////////////////////////////////////////////////////////////////
- class SNFMilterConfig : public UtilityConfig {
-
- public:
-
- /// Command.
- enum CommandEnum {
- IntegrateWithNoneCmd, ///< Remove integration with all MTAs.
- IntegrateWithPostfixCmd, ///< Integrate with postfix.
- IntegrateWithSendmailCmd ///< Integrate with sendmail.
- };
-
- /// Display usage.
- //
- // \param[in] Version is the SNFMilter version.
- //
- void DisplayHelp(std::string Version);
-
- /// Get the command-line input parameters for SNFMilter.
- //
- // \param[in] argc is the number of parameters.
- //
- // \param[in] argv is the parameters.
- //
- // \returns true if all the required command line parameters are
- // present and there are no unknown command-line parameters, false
- // otherwise.
- //
- bool GetCommandLineInput(int argc, char* argv[]);
-
- /// Create or update the configuration files.
- //
- // The SNFMilter.xml and GBUdbIgnoreList.txt files are created if
- // they don't exist. In any case, the owner/group is changed by
- // SetOwnerGroup(), and the permissions are changed to readonly
- // for everyone, and read/write for the owner.
- //
- void UpdateConfigFiles();
-
- /// Execute the command to integrate/unintegrate with the MTAs.
- void DoIntegrationCommand();
-
- private:
-
- /// Load the socket info (file name) from the <platform> section
- /// of the loaded config file.
- void LoadSocketInfo();
-
- void CreateSocketDir();
-
- void IntegrateWithPostfix(); ///< Integrate with postfix.
-
- void UnintegrateWithPostfix(); ///< Unintegrate with postfix.
-
- void IntegrateWithSendmail(); ///< Integrate with sendmail.
-
- void UnintegrateWithSendmail(); ///< Unintegrate with sendmail.
-
- void UnintegrateWithAll(); ///< Unintegrate with all MTAs.
-
- CommandEnum Command; ///< Specified command.
-
- static const std::string DefaultConfigFile; ///< Default config file.
-
- static const std::string DefaultSampleConfigFile; ///< Sample config file.
-
- std::string SocketFileName;
-
- };
-
- #endif
|