From 112c00ecb85e2f1ae16841d01949f009a709fd5e Mon Sep 17 00:00:00 2001
From: houxiao <houxiao@454eff88-639b-444f-9e54-f578c98de674>
Date: 星期五, 09 十二月 2016 10:38:37 +0800
Subject: [PATCH] merge my fix
---
ProxyServer/main.c | 26 ++++
ProxyServer/proxyserver.h | 47 +++-----
ProxyServer/make.sh | 12 +
ProxyServer/proxyserver.c | 177 +++++++++++++++++++++++-----------
4 files changed, 171 insertions(+), 91 deletions(-)
diff --git a/ProxyServer/main.c b/ProxyServer/main.c
index ae8b6ca..3a15018 100644
--- a/ProxyServer/main.c
+++ b/ProxyServer/main.c
@@ -19,12 +19,34 @@
char* user="supervisor";
char* pass="supervisor";
int Channel=0;
- int s_year=2016,s_month=12,s_day=6,s_hour=17,s_min=27,s_sec=41;
- int e_year=2016,e_month=12,e_day=7,e_hour=19,e_min=27,e_sec=41;
+ int s_year=2016,s_month=12,s_day=8,s_hour=10,s_min=27,s_sec=41;
+ int e_year=2016,e_month=12,e_day=8,e_hour=14,e_min=27,e_sec=41;
printf("========================start============\n");
result=GetPHPSearchMetaInfo(AnaylserIP,user,pass,Channel,s_year,s_month,s_day,s_hour,s_min,s_sec,e_year,e_month,e_day,e_hour,e_min,e_sec); //potection function
//result=GetDeviceInfo(AnaylserIP);
printf("serchresult=%s\n",result);
+ //Channel=1;
+ //s_day=7;
+ //printf("========================start============\n");
+ //result=GetPHPSearchMetaInfo(AnaylserIP,user,pass,Channel,s_year,s_month,s_day,s_hour,s_min,s_sec,e_year,e_month,e_day,e_hour,e_min,e_sec); //potection function
+ ////result=GetDeviceInfo(AnaylserIP);
+ //printf("serchresult=%s\n",result);
+ //
+ //Channel=0;
+ //s_day=8;
+ //printf("========================start============\n");
+ //result=GetPHPSearchMetaInfo(AnaylserIP,user,pass,Channel,s_year,s_month,s_day,s_hour,s_min,s_sec,e_year,e_month,e_day,e_hour,e_min,e_sec); //potection function
+ ////result=GetDeviceInfo(AnaylserIP);
+ //printf("serchresult=%s\n",result);
+ //
+ //
+ //Channel=1;
+ //s_day=7;
+ //printf("========================start============\n");
+ //result=GetPHPSearchMetaInfo(AnaylserIP,user,pass,Channel,s_year,s_month,s_day,s_hour,s_min,s_sec,e_year,e_month,e_day,e_hour,e_min,e_sec); //potection function
+ ////result=GetDeviceInfo(AnaylserIP);
+ //printf("serchresult=%s\n",result);
+
return 1;
}
diff --git a/ProxyServer/make.sh b/ProxyServer/make.sh
index 69ab9db..df475bb 100644
--- a/ProxyServer/make.sh
+++ b/ProxyServer/make.sh
@@ -4,11 +4,17 @@
rm /tmp/tmpZip -r
rm demo *.o *.so
+rm /usr/local/lib/libproxy.so
-gcc -g -c -fPIC -o proxy.o proxyserver.c
-gcc -shared -pthread -o libproxy.so proxy.o -lmysqlclient
+gcc -std=gnu99 -g -c -fPIC -o proxy.o proxyserver.c
+gcc -std=gnu99 -shared -pthread -o libproxy.so proxy.o -lmysqlclient
+
+if [ $? -ne 0 ]; then
+ exit
+fi
+
cp libproxy.so /usr/local/lib
/sbin/ldconfig
-gcc -g -o demo main.c -lproxy
+gcc -std=gnu99 -g -o demo main.c -lproxy
service apache2 restart
diff --git a/ProxyServer/proxyserver.c b/ProxyServer/proxyserver.c
index bf2718f..c5a81da 100644
--- a/ProxyServer/proxyserver.c
+++ b/ProxyServer/proxyserver.c
@@ -7,6 +7,9 @@
#include<dirent.h>
#include"proxyserver.h"
+#include <syslog.h>
+
+
int RequestChannel;
char* gAnalyzerIP;
char* gUser;
@@ -28,8 +31,8 @@
int ZipSerFileNum=0;
int ZipCountidx;
char NetInfo[128];
-char EventString[5000 * 1024];
-EVENT_LOG myEventLogs[1000 * 1024];
+char EventString[1 * 1024 * 1024];
+EVENT_LOG myEventLogs[2000];
int EventCount=0;
int EventCountInSearchRange=0;
@@ -44,7 +47,7 @@
#define fileread_buf 128
AlarmInfo RealAlarmEvent[16][1000];
-//#define DBG_LOG
+#define DBG_LOG
#define ZIP_HOME "/tmp"
/////////////////////////////////////////////////
@@ -70,7 +73,7 @@
}
char* GetDeviceInfo(char* AnalyserIP)
{
- memset(EventString,0,100000);
+ memset(EventString,0,sizeof(EventString));
gAnalyzerIP = AnalyserIP;
if(AnalyserIP==NULL || AnalyserIP[0]==0) return "Param Error";
@@ -94,7 +97,7 @@
length = sprintf(byte_array,"GET /PSIA/System/deviceInfo HTTP/1.1\r\nContent-Type: text/xml\r\nHost: %s\r\nContent-Length: 0\r\nConnection: Keep-Alive\r\n\r\n",AnalyserIP);
write(GSocket,byte_array,length);
// printf("%s",byte_array);
- memset(EventString,0,100000);
+ memset(EventString,0,sizeof(EventString));
while(1){
memset(buff,0,sizeof(buff));
length=read(GSocket,&buff,sizeof(buff));
@@ -164,21 +167,21 @@
return ret;
}
-char* GetAnalyserAll() //9.鏌ヨ璁惧 鍙傛暟锛氭棤 杩斿洖锛氬垎鏋愬櫒鐨勫悕绉板拰ip
+char* GetAnalyserAll() //9.閺屻儴顕楃拋鎯ь槵 閸欏倹鏆熼敍姘¥ 鏉╂柨娲栭敍姘瀻閺嬫劕娅掗惃鍕倳缁夋澘鎷癷p
{
- memset(EventString,0,100000);
+ memset(EventString,0,sizeof(EventString));
int ret = Read_MysqlData();
if(ret==0) return EventString;
else return "fail";
}
-char* GetAnalyserNet(void) //5.鑾峰彇褰撳墠杞彂鍣ㄧ殑ip 鍙傛暟锛氭棤銆傝繑鍥烇細褰撳墠鐨刬p鍦板潃瀛愮綉鎺╃爜鍜岀綉鍏�
+char* GetAnalyserNet(void) //5.閼惧嘲褰囪ぐ鎾冲鏉烆剙褰傞崳銊ф畱ip 閸欏倹鏆熼敍姘¥閵嗗倽绻戦崶鐑囩窗瑜版挸澧犻惃鍒琾閸︽澘娼冪�涙劗缍夐幒鈺冪垳閸滃瞼缍夐崗?
{
memset(NetInfo,0,128);
/// function
return NetInfo;
}
-int SetAnalyserNet(char* NetInfo) //6.鎵嬪姩璁剧疆杞彂鍣ㄧ殑ip 鍙傛暟锛歩p锛屽瓙缃戞帺鐮侊紝榛樿缃戝叧 銆� 杩斿洖锛氫慨鏀圭姸鎬�(鎴愬姛鎴栬�呭け璐�)
+int SetAnalyserNet(char* NetInfo) //6.閹靛濮╃拋鍓х枂鏉烆剙褰傞崳銊ф畱ip 閸欏倹鏆熼敍姝﹑閿涘苯鐡欑純鎴炲负閻緤绱濇妯款吇缂冩垵鍙� 閵�?鏉╂柨娲栭敍姘叏閺�鍦Ц閹�?閹存劕濮涢幋鏍偓鍛亼鐠�?
{
int ret=0;
/// function
@@ -416,7 +419,7 @@
char* GetRealEvent(char* AnalyserIP) //3.鏌ョ湅瀹炴椂鐩戞帶 鍙傛暟锛氬垎鏋愬櫒IP銆傝繑鍥烇細淇¢亾鍙峰強鍏跺搴旂殑瑙嗛娴佸湴鍧�
{
int Idx=FindIdx(AnalyserIP);
- memset(EventString,0,100000);
+ memset(EventString,0,sizeof(EventString));
if(Idx>=0 && Idx<16 && RealAlarmEventNum[Idx]>0){
for (int i=0;i<RealAlarmEventNum[Idx];i++)
{
@@ -457,6 +460,8 @@
//// 杈撳嚭锛氭煡璇㈢粨鏋溿�傦紙鍖呮嫭淇¢亾鍙凤紝鎶ヨ鏃堕棿锛屾挱鏀惧湴鍧�锛岀瓑銆傦級
char* GetPHPSearchMetaInfo(char* AnalyserIP,char* user,char* pass,int Channel,int s_year,int s_month,int s_day,int s_hour,int s_minute,int s_sec,int e_year,int e_month,int e_day,int e_hour,int e_minute,int e_sec)
{
+ openlog("proxyserver", LOG_CONS | LOG_PID, 0);
+
char* result;
MyTime mstart_time;
mstart_time.Year=s_year;
@@ -607,7 +612,15 @@
}
-
+void DownloadSerFile(const char* uri)
+{
+ return;
+ char buff[1024];
+ sprintf(buff, "cd " ZIP_HOME "/tmpZip/;" " curl -u supervisor:supervisor 'http://%s%s' -O" , gAnalyzerIP, uri);
+ int ret = system(buff);
+ printf("DownloadSerFile, ret=%d, %s\n", ret, buff);
+
+}
//// 鏌ヨ鎶ヨ璁板綍
@@ -615,6 +628,17 @@
//// 杈撳嚭锛氭煡璇㈢粨鏋溿�傦紙鍖呮嫭淇¢亾鍙凤紝鎶ヨ鏃堕棿锛屾挱鏀惧湴鍧�锛岀瓑銆傦級
char* GetSearchMetaInfo(char* AnalyserIP,char* user,char* pass,int Channel,lpMyTime StartTm,lpMyTime EndTm)
{
+ //reset
+ memset(ZipSerFileName, 0, sizeof(ZipSerFileName));
+ ZipSerFileNum=0;
+ ZipCountidx;
+ EventCount = 0;
+ EventCountInSearchRange = 0;
+ RequestChannel = -1;
+ memset(myEventLogs, 0, sizeof(myEventLogs));
+ memset(EventString, 0, sizeof(EventString));
+ memset(byte_array, 0, sizeof(byte_array));
+
RequestChannel = Channel;
gAnalyzerIP = AnalyserIP;
gUser = user;
@@ -623,8 +647,8 @@
if(AnalyserIP==NULL || AnalyserIP[0]==0) return "-1";
// if(gGettingStep>0) return -2;
- chmod(ZIP_HOME,0777);
- //delete_file(ZIP_HOME "/tmp/tmp.zip");
+ //chmod(ZIP_HOME,0777);
+ //delete_file(ZIP_HOME "/tmp.zip");
//delete_file(ZIP_HOME "/tmpZip/*");
struct tm ttm;
@@ -632,20 +656,20 @@
int length;
char* httpUri;
char sss[24],eee[24];
- chmod("/home",0777);//#todo ZIP_HOME
+ chmod(ZIP_HOME,0777);
const char* folderr;
const char* filename1;
- folderr="/home/tmpZip";
- filename1="/home/tmp.zip";
+ folderr=ZIP_HOME "/tmpZip";
+ filename1=ZIP_HOME "/tmp.zip";
struct stat sb;
- if(stat(folderr,&sb)==0 && S_ISDIR(sb.st_mode))
- {
- delete_folder("/home/tmpZip");
- }
- if (doesFileExist(filename1))
- {
- delete_file("/home/tmp.zip");
- }
+ //if(stat(folderr,&sb)==0 && S_ISDIR(sb.st_mode))
+ // {
+ delete_folder(ZIP_HOME "/tmpZip");
+ // }
+ //if (doesFileExist(filename1))
+ // {
+ delete_file(ZIP_HOME "/tmp.zip");
+ // }
if(RequestChannel==0) httpUri= "/PSIA/VIQ/Event/metadata/0/files";
if(RequestChannel==1) httpUri= "/PSIA/VIQ/Event/metadata/1/files";
if(RequestChannel==2) httpUri= "/PSIA/VIQ/Event/metadata/2/files";
@@ -670,7 +694,7 @@
SearchEndTm -= 8 * 60 * 60;
#ifdef DBG_LOG
- printf("stm=%d,etm=%d\n",(int)SearchStartTm,(int)SearchEndTm);
+ syslog(LOG_USER | LOG_INFO, "SearchStartTm=%d,SearchEndTm=%d\n",(int)SearchStartTm,(int)SearchEndTm);
#endif
//for (StepTm=SearchEndTm; StepTm>SearchStartTm; StepTm-=1*3600)
@@ -680,7 +704,7 @@
struct sockaddr_in servaddr;
int strlen1=sizeof(servaddr);
if((GSocket=socket(PF_INET,SOCK_STREAM,0))<0){
- perror("socket fail2");
+ syslog(LOG_USER | LOG_INFO, "socket fail2");
return "-3";
}
memset(&servaddr,0,strlen1);
@@ -689,7 +713,7 @@
servaddr.sin_port=htons(80);
if(connect(GSocket,(struct sockaddr*)&servaddr,strlen1)<0){
- printf("Equipment connect fail-%s:%d\n",gAnalyzerIP,80);
+ syslog(LOG_USER | LOG_INFO, "Equipment connect fail-%s:%d\n",gAnalyzerIP,80);
close(GSocket);
return "-4";
}
@@ -706,7 +730,7 @@
sprintf(eee,"%d-%02d-%02dT%02d:%02d:%02d.000",t->tm_year+1900,t->tm_mon+1,t->tm_mday,t->tm_hour,t->tm_min,t->tm_sec);// = "2016-08-26T07:31:00.000";
eee[23]=0;
#ifdef DBG_LOG
- printf("sss=%s, eee=%s\n", sss, eee);
+ syslog(LOG_USER | LOG_INFO, "SearchStartTm=%s, SearchEndTm=%s\n", sss, eee);
#endif
RequestMetaFiles(gAnalyzerIP,httpUri,sss,eee);
write(GSocket,byte_array,strlen(byte_array));
@@ -750,7 +774,7 @@
memcpy(buff,tmpp,SSize);
free(tmpp);
goto lpp123;
- printf("**********Special*******************************ZipSerFileNum = %d",ZipSerFileNum);
+ syslog(LOG_USER | LOG_INFO, "**********Special*******************************ZipSerFileNum = %d",ZipSerFileNum);
}
}
else{
@@ -767,7 +791,7 @@
free(memoryband[0]);
bandCount = 0;
bMetadataSaving = 0;
- buff[eidx]=0;
+ buff[eidx]=0; //meta buff complete
int ptr=0;
////// analyze buffer
lpp123: sidx = stringcmp((char*)&buff[ptr],"http://changeit:80/media",24);
@@ -791,6 +815,7 @@
char pathbuf[250] ;
strncpy(pathbuf,(char*)&buff[ptr+sidx+18],kkk-sidx-18+4);
pathbuf[kkk-sidx-18+4]=0;
+ syslog(LOG_USER | LOG_INFO, "pathbuf=%s\n", pathbuf);
int i;
for (i=0;i<ZipSerFileNum;i++)
{
@@ -811,15 +836,28 @@
}//for
//////// get
+#ifdef DBG_LOG
+ syslog(LOG_USER | LOG_INFO, "ZipSerFileNum=%d\n", ZipSerFileNum);
+#endif
+
for(ZipCountidx = 0; ZipCountidx<ZipSerFileNum; ZipCountidx++)
{
- if(stringcmp((char*)ZipSerFileName[ZipCountidx],".ser",4)>=0) continue;
+#ifdef DBG_LOG
+ syslog(LOG_USER | LOG_INFO, "ZipSerFileName[%d]=%s\n", ZipCountidx, (char*)ZipSerFileName[ZipCountidx]);
+#endif
+
+ if(stringcmp((char*)ZipSerFileName[ZipCountidx],".ser",4)>=0)
+ {
+ DownloadSerFile(ZipSerFileName[ZipCountidx]);
+ continue;
+ }
+
zclock_sleep(200);
// printf(" ==== Search loop function execution =================%d,%d \n",(int)StepTm,(int)SearchStartTm);
struct sockaddr_in servaddr;
int strlen1=sizeof(servaddr);
if((GSocket=socket(PF_INET,SOCK_STREAM,0))<0){
- perror("socket fail2");
+ syslog(LOG_USER | LOG_INFO, "socket fail2");
return "-3";
}
memset(&servaddr,0,strlen1);
@@ -828,13 +866,13 @@
servaddr.sin_port=htons(80);
if(connect(GSocket,(struct sockaddr*)&servaddr,strlen1)<0){
- printf("Equipment connect fail-%s:%d\n",gAnalyzerIP,80);
+ syslog(LOG_USER | LOG_INFO, "Equipment connect fail-%s:%d\n",gAnalyzerIP,80);
close(GSocket);
return "-4";
}
httpUri = ZipSerFileName[ZipCountidx];//"/media/metadata/0/2016/8/25/1/2/s_5b4103706a6411e6855e574ec330e01d_20160825_013633_93003.zip";
- RequestZipSerFiles(gAnalyzerIP,httpUri);
+ RequestZipSerFiles(gAnalyzerIP, httpUri);
write(GSocket,byte_array,strlen(byte_array));
// printf("==========================================================================================================================>>>>>>>>\n");
// printf("%s",byte_array);
@@ -872,7 +910,10 @@
bZipFileSaving = 0;
close(GSocket);
//Convert Zip file to Ser file
- system("unzip -o " ZIP_HOME "/tmp.zip -d " ZIP_HOME "/tmpZip");
+ int ret=system("unzip -o " ZIP_HOME "/tmp.zip -d " ZIP_HOME "/tmpZip");
+#ifdef DBG_LOG
+ syslog(LOG_USER | LOG_INFO, "unzip1 ret=%d\n", ret);
+#endif
}
}
else{
@@ -894,7 +935,10 @@
bZipFileSaving = 0;
close(GSocket);
//Convert Zip file to Ser file
- system("unzip -o " ZIP_HOME "/tmp.zip -d " ZIP_HOME "/tmpZip");
+ int ret=system("unzip -o " ZIP_HOME "/tmp.zip -d " ZIP_HOME "/tmpZip");
+#ifdef DBG_LOG
+ syslog(LOG_USER | LOG_INFO, "unzip0 ret=%d\n", ret);
+#endif
}
}
}
@@ -906,7 +950,7 @@
char stringpath[1024];
unsigned char p_save_buf[6144000];
- for(i=0;i<num;i++)
+ for(int i=0;i<num;i++)
{
if(filename[i].name[0]=='.') continue;
memset(stringpath,0,1024);
@@ -922,13 +966,13 @@
memset(EventString,0,sizeof(EventString));
//for(i=0;i<1000;i++)
#ifdef DBG_LOG
- printf("EventCount===========================%d\n",EventCount);
- printf("EventCountInSearchRange==============%d\n",EventCountInSearchRange);
+ syslog(LOG_USER | LOG_INFO, "EventCount===========================%d\n",EventCount);
+ syslog(LOG_USER | LOG_INFO, "EventCountInSearchRange==============%d\n",EventCountInSearchRange);
#endif
strcat(EventString,"[");
- for (i=0;i<EventCount;i++)
+ for (int i=0;i<EventCount;i++)
{
#ifndef DBG_LOG
if (! myEventLogs[i].InSearchRange)
@@ -965,12 +1009,6 @@
}
strcat(EventString,"]");
-
- //reset
- //EventCount = 0;//#todo
- //EventCountInSearchRange = 0;
- //RequestChannel = -1;
- //memset(&myEventLogs, 0, sizeof(myEventLogs));
return EventString;
//return "333333333333333333333333333333333333333333333333333333333333333333789";
@@ -991,7 +1029,7 @@
struct sockaddr_in servaddr;
int strlen1=sizeof(servaddr);
if((GSocket=socket(PF_INET,SOCK_STREAM,0))<0){
- perror("socket fail2");
+ syslog(LOG_USER | LOG_INFO, "socket fail2");
return -1;
}
memset(&servaddr,0,strlen1);
@@ -1000,7 +1038,7 @@
servaddr.sin_port=htons(80);
if(connect(GSocket,(struct sockaddr*)&servaddr,strlen1)<0){
- printf("Equipment connect fail-%s:%d\n",gAnalyzerIP,80);
+ syslog(LOG_USER | LOG_INFO, "Equipment connect fail-%s:%d\n",gAnalyzerIP,80);
close(GSocket);
return -2;
}
@@ -1029,10 +1067,14 @@
}
close(GSocket);
- if (bbbb==0) return -1;
+ if (bbbb==0)
+ {
+ syslog(LOG_USER | LOG_INFO, "bbbb==0");
+ return -1;
+ }
// zclock_sleep(200);
if((GSocket=socket(PF_INET,SOCK_STREAM,0))<0){
- perror("socket fail2");
+ syslog(LOG_USER | LOG_INFO, "socket fail2");
return -1;
}
memset(&servaddr,0,strlen1);
@@ -1041,7 +1083,7 @@
servaddr.sin_port=htons(80);
if(connect(GSocket,(struct sockaddr*)&servaddr,strlen1)<0){
- printf("Equipment connect fail-%s:%d\n",gAnalyzerIP,80);
+ syslog(LOG_USER | LOG_INFO, "Equipment connect fail-%s:%d\n",gAnalyzerIP,80);
close(GSocket);
return -2;
}
@@ -1063,9 +1105,13 @@
void RequestMetaFiles(char* AnaylyIP,char* httpUri,char* Tm1,char* Tm2)
{
+#ifdef DBG_LOG
+ syslog(LOG_USER | LOG_INFO, "RequestMetaFiles, httpUri=%s\n", httpUri);
+#endif
+
char byte_arrayxxx[1600];
int lengthxxx = 0;
- memset(byte_array,0,1600);
+ memset(byte_array,0,sizeof(byte_array));
UrnStringToBytes(byte_arrayxxx,&lengthxxx,Tm1,Tm2);// xml
int iidx =0,llen=0;;
@@ -1075,11 +1121,14 @@
llen = sprintf(&byte_array[iidx],"Host: %s:%d\r\n",AnaylyIP,80); iidx+=llen;
llen = sprintf(&byte_array[iidx],"%s","Connection: Keep_Alive\r\n\r\n"); iidx+=llen;
strncpy(&byte_array[iidx],byte_arrayxxx,lengthxxx); iidx+=lengthxxx;
-
}
void RequestZipSerFiles(char* AnaylyIP,char* httpUri)
{
- memset(byte_array,0,1600);
+#ifdef DBG_LOG
+ syslog(LOG_USER | LOG_INFO, "RequestZipSerFiles, httpUri=%s\n", httpUri);
+#endif
+
+ memset(byte_array,0,sizeof(byte_array));
int iidx =0,llen=0;;
llen = sprintf(byte_array,"GET %s %s",httpUri,"HTTP/1.1\r\n"); iidx+=llen;
@@ -1675,7 +1724,7 @@
if((myEventLogs[EventCount].DebugMessageE[0]!=0|| myEventLogs[EventCount].DebugMessageS[0]!=0) && myEventLogs[EventCount].Rule[0]==0 && myEventLogs[EventCount].Region[0]==0){
memcpy(ttmp,(unsigned char*)p_save_buf,5000);
}
- if(somewhat && EventCount<200-1){///repair //#todo 12.7
+ if(somewhat && EventCount<2000-1){///repair //#todo 12.7
sprintf(myEventLogs[EventCount].Camera,"%d",RequestChannel+1);
int i;
for (i=0;i<EventCount;i++)
@@ -1978,14 +2027,20 @@
char cmd[30];
memset(cmd,0,30);
sprintf(cmd,"rm -f %s",path);
- system(cmd);
+ int ret = system(cmd);
+#ifdef DBG_LOG
+ syslog(LOG_USER | LOG_INFO, "delete_file, ret=%d, %s\n", ret, path);
+#endif
}
void delete_folder(const char *path)
{
char cmd[30];
memset(cmd,0,30);
sprintf(cmd,"rm -r %s",path);
- system(cmd);
+ int ret = system(cmd);
+#ifdef DBG_LOG
+ syslog(LOG_USER | LOG_INFO, "delete_folder, ret=%d, %s\n", ret, path);
+#endif
}
int doesFileExist(const char *filename)
{
@@ -2502,6 +2557,12 @@
return output;
}
-
+void zclock_sleep (int msecs)
+{
+ struct timespec t;
+ t.tv_sec = msecs / 1000;
+ t.tv_nsec = (msecs % 1000) * 1000000;
+ nanosleep (&t, NULL);
+}
diff --git a/ProxyServer/proxyserver.h b/ProxyServer/proxyserver.h
index 82fddec..c75e125 100644
--- a/ProxyServer/proxyserver.h
+++ b/ProxyServer/proxyserver.h
@@ -1,25 +1,26 @@
#include<sys/socket.h>
#include<sys/types.h>
#include<netinet/in.h>
-#include<netdb.h>
-#include<stdio.h>
-#include<string.h>
-#include<stdlib.h>
-#include<unistd.h>
-#include<errno.h>
-#include<arpa/inet.h>
-#include<time.h>
-#include<signal.h>
-#include<pthread.h>
-#include<sys/time.h>
-#include<stdbool.h>
-#include<fcntl.h>
-#include<sys/stat.h>
+#include <netdb.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <errno.h>
+#include <arpa/inet.h>
+#include <time.h>
+#include <signal.h>
+#include <pthread.h>
+#include <sys/time.h>
+#include <stdbool.h>
+#include <fcntl.h>
+#include "/usr/include/mysql/mysql.h"
+#include <sys/stat.h>
#define _DELETE_FILE
-#include<dirent.h>
-#include<limits.h>
-#include<sys/io.h>
-#include<signal.h>
+#include <dirent.h>
+#include <limits.h>
+#include <sys/io.h>
+#include <signal.h>
int RealAlarmEventNum[16];
typedef struct{
int Year;
@@ -91,16 +92,6 @@
void UrnStringToBytes(char* byte_array_out,int * byte_array_length_out,char* StartTim,char* EndTime);
void zclock_sleep (int msecs);
-
-
-
-void zclock_sleep (int msecs)
-{
- struct timespec t;
- t.tv_sec = msecs / 1000;
- t.tv_nsec = (msecs % 1000) * 1000000;
- nanosleep (&t, NULL);
-}
typedef struct{
char name[1024];
--
Gitblit v1.8.0