// \file PostfixIntegrate.hpp
//
// Copyright (C) 2012 ARM Research Labs, LLC.
// See www.armresearch.com for the copyright terms.
//
// This file defines the PostfixIntegrate interface.
//
// $Id$
//
///////////////////////////////////////////////////////////////////////////////////////////////////

#ifndef PostfixIntegratehpp_included
#define PostfixIntegratehpp_included

#include "MtaIntegrate.hpp"

/// Class to manage the SNFServer integration with postfix.
//
// This class implements the MtaIntegrate interface for postfix.
//
//////////////////////////////////////////////////////////////////////////////////////////////////////////
class PostfixIntegrate : public MtaIntegrate {

public:

    virtual void SetOperatingSystem(std::string OperatingSystemType);

    virtual void Integrate(FileBackup *SaveFile);

    virtual void Unintegrate(FileBackup *SaveFile);

    // Return the default chroot configuration of Postfix.
    //
    // \returns true if the default configuration is for postfix to
    // run chrooted, false otherwise.
    //
    bool DefaultIsChrooted();

private:

    virtual bool MtaIsRunningDetected();

    virtual bool ReloadMta();

    virtual bool IsIntegrated();

    bool MtaConfigurationIsChrooted();

    /// Directory containing the snfSniffer script.
    std::string SnfSnifferDirName;

    /// snfSniffer script file name, including the directory.
    std::string SnfSnifferFileName;

    /// Sample snfSniffer script file name, including the directory.
    std::string SnfSnifferSampleFileName;

    /// Content filter line.
    //
    // To integrate, this line is added to master.cf just after the
    // "smtp" line.
    //
    std::string ContentFilterLine;

    /// Content filter specification.
    //
    // To integrate this is added to the end of the master.cf line.
    //
    std::string ContentFilterSpec;

    /// Postfix main.cf file path.
    std::string PostfixMainCfPath;

    /// Postfix master.cf file path.
    std::string PostfixMasterCfPath;

    /// Command to determine whether postfix is running.
    std::string MtaIsRunningCommand;

    /// Command to reload postfix.
    std::string ReloadMtaCommand;

    /// True if postfix runs chrooted by default.
    bool PostfixDefaultIsChrooted;

};

#endif
