summaryrefslogtreecommitdiff
path: root/src/service/smtp.hpp
blob: c311645882fada88b83b815d6159785f4eb975e9 (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
#pragma once

#include <boost/asio/io_service.hpp>

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

#include "settings.hpp"

namespace smtp::service
{
    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 Smtp
    {
    public:
        Smtp( ConnectionPtr connection );
        ~Smtp() = default;
    private:
        void FillStorageByDefault();
        void CreateService( ConnectionPtr bus );
        void CreateInterface( ConnectionPtr connection );
        void AddProperties();
        void AddMethods();
        bool RefreshSettings( bool is_need_auth, bool is_need_ssl,
                              std::string const& user, std::string const& password,
                              std::string const& host, std::string const& port );

        InterfacePtr mInterface;
        ObjectServerPtr mObjectServer;
        Settings mSettingsStorage;
    };
}