| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- #pragma once
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <string>
- using namespace std;
- //#define MSHY "/etc/mshy.so" // 验证权限文件
- #define MSHY "mshy.so" // 验证权限文件
- typedef struct {
- std::string code; // 机器码
- std::string data; // 到期时间
- int trunkNum; // 中继数量
- int agentNum; // 坐席数量
- } AuthInfo;
- class SoftAuth
- {
- public:
- bool MakeAuth(std::string machCode);
- bool MakeAuthV2(std::string machCode);
- bool Auth();
- bool AuthV2();
- bool Auth(std::string& encode); // 解码
- bool AuthV2(std::string& encode); // 解码
- bool isExpire();
- int trunkNum() { return aInfo.trunkNum; }
- int acdNum() { return aInfo.agentNum; }
- bool getMachineCode(std::string& code);
- void getAuthInfo(AuthInfo &authInfo) { authInfo = aInfo; }
- static SoftAuth* GetInstance() { return &instance; }
- private:
- SoftAuth() { /*aInfo = nullptr; */ };
- ~SoftAuth() {};
- SoftAuth(const SoftAuth&) = default;
- SoftAuth& operator=(const SoftAuth&) = delete;
- int __getdiskid(std::string& hardc);
- bool Base64Encode(const string & input, string & output);
- bool Base64Decode(const string & input, string & output);
- private:
- static SoftAuth instance;
- /*AuthInfo* aInfo;*/
- AuthInfo aInfo;
- };
|