| 110 | |
| 111 | |
| 112 | class KeyCache |
| 113 | { |
| 114 | public: |
| 115 | typedef unsigned long long id_t; |
| 116 | private: |
| 117 | mutex m_mutex; |
| 118 | unordered_map<id_t, KeyCacheEntry> m_entries; |
| 119 | id_t m_cur_id; // we increment it and assign as unique id for registered clients |
| 120 | int m_valid_count; |
| 121 | bool m_enabled; |
| 122 | KeyCache(); |
| 123 | void ClearInternal(bool disable); |
| 124 | bool InitClearThread(); |
| 125 | HANDLE m_clearEvent; |
| 126 | HANDLE m_clearThread; |
| 127 | public: |
| 128 | static KeyCache* GetInstance(); |
| 129 | id_t Register(DWORD buf_size); |
| 130 | bool Unregister(id_t id); |
| 131 | void Enable(); |
| 132 | void Clear() { ClearInternal(false); } |
| 133 | void Disable() { ClearInternal(true); } |
| 134 | bool Store(id_t id, const BYTE* ptr, size_t len); |
| 135 | bool Retrieve(id_t id, const vector<KeyBuf>& kbmb); |
| 136 | void StopClearThread(); |
| 137 | |
| 138 | virtual ~KeyCache(); |
| 139 | |
| 140 | // disallow copying |
| 141 | KeyCache(KeyCache const&) = delete; |
| 142 | void operator=(KeyCache const&) = delete; |
| 143 | }; |
| 144 |
nothing calls this directly
no outgoing calls
no test coverage detected