You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
88 lines
3.8 KiB
C++
88 lines
3.8 KiB
C++
#ifndef __SayTran_Util_h__
|
|
#define __SayTran_Util_h__
|
|
|
|
#include <unistd.h>
|
|
#include <string>
|
|
#include <vector>
|
|
//#include <openssl/evp.h>
|
|
#include <time.h>
|
|
//#define LICENSE_DUE_DATE 20141201
|
|
using namespace std;
|
|
|
|
//const char MA_SALTS[] =
|
|
// { 61, -1, -43, 2, 37, -23, 13, 19, -3, -7, 111, 113, 91, 71, -11 };
|
|
//const int SALTS_LEN = 15;
|
|
|
|
class SayTranUtil
|
|
{
|
|
public:
|
|
SayTranUtil() { }
|
|
~SayTranUtil() {}
|
|
|
|
void Swap16(short *p);
|
|
void Swap32(float *p);
|
|
void Swap32(int *p);
|
|
|
|
void Tokenize(const string& str, vector<string>& tokens, const string& delimiters);
|
|
void Tokenize(const string& str, vector<int>& tokens, const string& delimiters);
|
|
void Tokenize(const string& str, vector<float>& tokens, const string& delimiters);
|
|
|
|
void find_and_replace( string &source, const string find, string replace);
|
|
|
|
void swaptime(time_t org_time,char *time_str, char* engineStr, int option);
|
|
|
|
// txt log
|
|
int st_makeLogTxt(const char* logDir, const char* engineStr, const int& engineId, const char* logStr);
|
|
int st_makeLogTxt(const char* logDir, const char* serverId, const char* engineStr, const int& engineId, const char* logStr);
|
|
int st_makeLogTxt2(const char* logDir, const char* serverId, const char* engineStr, const int& engineId, const char* logStr);
|
|
int st_makeLogTxt3(const char* logDir, const char* serverId, const char* engineStr,const char* UID,const char *SID, const int& engineId, const char* logStr);
|
|
int st_makeLogTxt4(const char* logDir, const char* serverId, const char* engineStr,const char* UID,const char *SID, const int& engineId, const char* logStr);
|
|
|
|
// pcm log
|
|
int st_makeLogSrFp(FILE*& fp, const char* logDir, const char* engineStr, const int& engineId, const char* feaType, const char* userID);
|
|
int st_makeLogSrFp(FILE*& fp, const char* logDir, const char* engineStr, const char* feaType, const char* logFnStr, const char* engineInfo);
|
|
int st_makeLogSrFp2(FILE*& fp, const char* logDir, const char* engineStr, const char* feaType, const char* logFnStr, const char* engineInfo,char * logRetFname);
|
|
//char* st_makeLogSrFp2(FILE*& fp, const char* logDir, const char* engineStr, const char* feaType, const char* logFnStr, const char* engineInfo);
|
|
char* st_makeLogSrFp3(FILE*& fp, const char* logDir, const char* engineStr,const char* UID, const char* SID, const char* feaType, const char* logFnStr, const char* engineInfo);
|
|
|
|
int st_nanosleep(int sec, long nsec);
|
|
|
|
int st_makeResultCode(const char* stCmd, const string& result, short* resultCode, char* resultStr);
|
|
int asr_makeResultCode(const char* stCmd, const string& result, short* resultCode, char* resultStr);
|
|
|
|
void MakeDaemon();
|
|
void daemonize(const char* cmd);
|
|
|
|
/*
|
|
* utf8_to_cp949/cp949_to_utf8 문자열 인코딩 변환 함수
|
|
*/
|
|
char* utf8_to_cp949(const char* in);
|
|
char* cp949_to_utf8(const char* in);
|
|
char* utf8_to_cp936(const char* in);
|
|
|
|
//char* utf8_to_cp949(const char* in, char* out, const int out_buf_len);
|
|
//char* cp949_to_utf8(const char* in, char* out, const int out_buf_len);
|
|
|
|
//int processXOR(char * src, int srcLen, int saltIndex);
|
|
//int checkUserKey(char* inputKey);
|
|
/*static int checkDueDate(){
|
|
time_t cur_time = time(NULL)+(9*3600);
|
|
struct tm *tm_ptr = gmtime(&cur_time);
|
|
int curYear = tm_ptr->tm_year+1900;
|
|
int curMonth = tm_ptr->tm_mon+1;
|
|
int curDay = tm_ptr->tm_mday;
|
|
curDay = curYear*10000+curMonth*100+curDay;
|
|
if(curDay >= LICENSE_DUE_DATE) {
|
|
printf("due date over\n",curDay);
|
|
exit(1);
|
|
}
|
|
};*/
|
|
//int* snt2symidx(char* imagePath,string inputString);
|
|
|
|
private:
|
|
//int fromHex(const char *src, int srcLen, char *&dst, int dstLen);
|
|
//int DeCrypt(EVP_CIPHER_CTX *de_ctx, unsigned char *ciphertext, int cipherLen, unsigned char *&plaintext);
|
|
};
|
|
//string* StringSplit(string strOrigin, char strTok,int *m_token);
|
|
#endif
|