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