1 /** 2 * @file src/megacmdsandbox.h 3 * @brief MegaCMD: A sandbox class to store status variables 4 * 5 * (c) 2013 by Mega Limited, Auckland, New Zealand 6 * 7 * This file is part of the MEGAcmd. 8 * 9 * MEGAcmd is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 * 13 * @copyright Simplified (2-clause) BSD License. 14 * 15 * You should have received a copy of the license along with this 16 * program. 17 */ 18 19 #ifndef MEGACMDSANDBOX_H 20 #define MEGACMDSANDBOX_H 21 22 #include <mega.h> 23 #include <ctime> 24 #include <string> 25 #include <future> 26 #include "megacmdexecuter.h" 27 28 namespace megacmd { 29 class MegaCmdExecuter; 30 31 class MegaCmdSandbox 32 { 33 private: 34 bool overquota; 35 std::mutex reasonBlockedMutex; 36 std::string reasonblocked; 37 bool reasonPending = false; 38 std::promise<std::string> reasonPromise; 39 40 void doSetReasonBlocked(const std::string &value); 41 42 public: 43 bool istemporalbandwidthvalid; 44 long long temporalbandwidth; 45 long long temporalbandwithinterval; 46 ::mega::m_time_t lastQuerytemporalBandwith; 47 ::mega::m_time_t timeOfOverquota; 48 ::mega::m_time_t secondsOverQuota; 49 50 ::mega::m_time_t timeOfPSACheck; 51 int lastPSAnumreceived; 52 53 int storageStatus; 54 long long receivedStorageSum; 55 long long totalStorage; 56 57 MegaCmdExecuter * cmdexecuter = nullptr; 58 59 public: 60 MegaCmdSandbox(); 61 bool isOverquota() const; 62 void setOverquota(bool value); 63 void resetSandBox(); 64 65 std::string getReasonblocked(); 66 void setReasonPendingPromise(); 67 void setReasonblocked(const std::string &value); 68 void setPromisedReasonblocked(const std::string &value); 69 70 71 }; 72 73 }//end namespace 74 #endif // MEGACMDSANDBOX_H 75