#ifndef __COMM_H #define __COMM_H #include #include #include #include #include #include #include #include #include using namespace std; #define EVENT_MOD_INITIALIZER_MK_LOADED 0x50900001 // 主密钥初始化成功 #define EVENT_MOD_INITIALIZER_MK_FAILED 0x50980002 // 主密钥初始化失败 #define PUKFILENAME_RSA "RVCPubKey.ini" #define PUKFILENAME_SM2 "RVCSM2PubKey.ini" #define PFKEYFILENAME_DES "CMBRVCKeys.dat" #define PFKEYFILENAME_SM4 "CMBRVCSm4Keys.dat" typedef unsigned char BYTE; void GetNewForm(const char* form, char* newForm); string GetOutPutStr(const char* form, ...); int no_begin_with(const char strA[], const char strB[]); int str2int(const string str, int& ret); vector split_str(string strA, string strB); int ip2byte(const string str, BYTE ip[]); char* Hex2Str(const char* src, int& dstLen); char* Str2Hex(const char* str, int strLen); #ifdef __linux__ #define RUNTIME_PATH "/opt/run/runinfo/runcfg" #include #include #include #include #include int getIPFromLinux(char* ip); bool get_cpu_id_by_asm(std::string& cpu_id); bool get_cpu_id_by_system(std::string& cpu_id, const string save_path = RUNTIME_PATH); bool get_board_serial_by_system(std::string& board_serial, const string save_path = RUNTIME_PATH); bool get_disk_serial_by_system(std::vector& serial_no, int &errCode,const string save_path = RUNTIME_PATH); bool file_is_exist(string filePath); bool dir_is_exist(string dirPath); int file_create(string filePath); int dir_create(string dirPath); int remove_file(string filePath); int remove_dir(string dirPath); #include #include typedef struct { int year; int month; int day; int hour; int minute; int second; } TIME; bool set_system_time(TIME* _time); extern "C" bool set_system_time_by_sec(int sec); TIME* get_system_time(); #endif //__linux__ #endif // !__COMM_H