1 #ifndef SESSION_LIBRARY_H_ 2 #define SESSION_LIBRARY_H_ 3 4 #include <mutex> 5 #include <vector> 6 7 namespace castkeydrm { 8 9 class SessionLibrary { 10 public: 11 static SessionLibrary* get(); 12 std::vector<uint8_t> createSession(); 13 void closeSession(const std::vector<uint8_t>& session); 14 15 private: SessionLibrary()16 SessionLibrary() : next_session_id_(1) {} 17 18 static std::mutex singleton_lock_; 19 static SessionLibrary* singleton_; 20 21 std::mutex session_lock_; 22 uint32_t next_session_id_; 23 std::vector<std::vector<uint8_t>> sessions_; 24 }; 25 26 } // namespace castkeydrm 27 28 #endif // SESSION_LIBRARY_H_