summaryrefslogtreecommitdiff
path: root/src/smtp_service.hpp
blob: 7149e3aef60b87fa9f31830e240f07b7dde51b91 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#pragma once

#include <boost/asio/io_service.hpp>

#include <sdbusplus/asio/connection.hpp>
#include <sdbusplus/asio/object_server.hpp>

#include "settings_storage.hpp"

namespace smtp
{
    using ConnectionPtr = std::shared_ptr<sdbusplus::asio::connection>;
    using InterfacePtr = std::shared_ptr<sdbusplus::asio::dbus_interface>;
    using ObjectServerPtr = std::shared_ptr<sdbusplus::asio::object_server>;

    class SmtpService
    {
    public:
        SmtpService( ConnectionPtr connection );
        ~SmtpService() = default;
    private:
        void FillStorageByDefault();
        void CreateService( ConnectionPtr bus );
        void CreateInterface( ConnectionPtr connection );
        void AddProperties();
        void AddMethods();
        bool RefreshSettings(std::string const& user,
                             std::string const& password,
                             std::string const& host,
                             std::string const& port);

        InterfacePtr mInterface;
        ObjectServerPtr mObjectServer;
        SettingsStorage mStorage;
    };
}