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
     1 class CpEpCOMServerAdapterModule;
     2 
     3 namespace pEp {
     4 
     5 #ifdef UNICODE
     6     typedef std::wstring tstring;
     7 #else
     8     typedef std::string tstring;
     9 #endif
    10 
    11     class GateKeeper {
    12     public:
    13         typedef std::pair<tstring, tstring> product;
    14         typedef std::vector< product > product_list;
    15 
    16         GateKeeper(CpEpCOMServerAdapterModule * const self);
    17         ~GateKeeper();
    18 
    19         CpEpCOMServerAdapterModule * const module() const
    20         {
    21             return _self;
    22         }
    23 
    24         void keep();
    25 
    26     protected:
    27         static const LPCTSTR plugin_reg_path;
    28         static const LPCTSTR plugin_reg_value_name;
    29         static const LPCTSTR updater_reg_path;
    30 
    31         static const time_t cycle;
    32         static const DWORD waiting;
    33 
    34         static time_t time_diff();
    35 
    36         void keep_plugin();
    37 
    38         void update_product(product p);
    39         product_list& registered_products();
    40         void keep_updated();
    41 
    42     private:
    43         time_t now;
    44         time_t next;
    45         bool cu_open;
    46         HKEY cu;
    47         HKEY hkUpdater;
    48 
    49         CpEpCOMServerAdapterModule * const _self;
    50     };
    51 }