GateKeeper.h
author Volker Birk <vb@pep-project.org>
Sun, 19 Jun 2016 13:04:41 +0200
changeset 96 7c1816ce1dbd
parent 94 59e25c32911a
child 97 f4d2d5c35f94
permissions -rw-r--r--
Updater infrastructure
vb@88
     1
class CpEpCOMServerAdapterModule;
vb@88
     2
vb@96
     3
namespace pEp {
vb@88
     4
vb@96
     5
#ifdef UNICODE
vb@96
     6
    typedef std::wstring tstring;
vb@96
     7
#else
vb@96
     8
    typedef std::string tstring;
vb@96
     9
#endif
vb@88
    10
vb@96
    11
    class GateKeeper {
vb@96
    12
    public:
vb@96
    13
        typedef std::pair<tstring, tstring> product;
vb@96
    14
        typedef std::vector< product > product_list;
vb@89
    15
vb@96
    16
        GateKeeper(CpEpCOMServerAdapterModule * const self);
vb@96
    17
        ~GateKeeper();
vb@88
    18
vb@96
    19
        CpEpCOMServerAdapterModule * const module() const
vb@96
    20
        {
vb@96
    21
            return _self;
vb@96
    22
        }
vb@88
    23
vb@96
    24
        void keep();
vb@88
    25
vb@96
    26
    protected:
vb@96
    27
        static const LPCTSTR plugin_reg_path;
vb@96
    28
        static const LPCTSTR plugin_reg_value_name;
vb@96
    29
        static const LPCTSTR updater_reg_path;
vb@88
    30
vb@96
    31
        static const time_t cycle;
vb@96
    32
        static const DWORD waiting;
vb@96
    33
vb@96
    34
        static time_t time_diff();
vb@96
    35
vb@96
    36
        void keep_plugin();
vb@96
    37
vb@96
    38
        void update_product(product p);
vb@96
    39
        product_list& registered_products();
vb@96
    40
        void keep_updated();
vb@96
    41
vb@96
    42
    private:
vb@96
    43
        time_t now;
vb@96
    44
        time_t next;
vb@96
    45
        bool cu_open;
vb@96
    46
        HKEY cu;
vb@96
    47
        HKEY hkUpdater;
vb@96
    48
vb@96
    49
        CpEpCOMServerAdapterModule * const _self;
vb@96
    50
    };
vb@96
    51
}