00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef _CAVERNPLUS_HTTP
00018 #define _CAVERNPLUS_HTTP
00019
00020 #include "CAVERNnet_tcp_c.hxx"
00021
00022 #include <sys/types.h>
00023 #include <sys/stat.h>
00024 #include <stdio.h>
00025
00026 #define INBUFFER_CONST 2048
00027 #define BUFFER_CONST 1024
00028
00047 class CAVERNnet_perfMonitor_c;
00048
00049 class CAVERNnet_http_c {
00050
00051 public:
00052
00054
00055
00056 static const int AUTO_LOAD;
00058 static const int CHECK_BUT_DONT_LOAD;
00060 static const int FORCED_LOAD;
00062
00064 static const int NO_TIME_OUT;
00065
00066 CAVERNnet_http_c(){
00067 itsMode = AUTO_LOAD;
00068 timeOutPeriod =NO_TIME_OUT;
00069 }
00070
00072 void setTimeOut(int timep) {timeOutPeriod = timep;}
00073
00075
00076
00077 void setRemoteSite(char *site) {strcpy(remoteSite, site);}
00079 void setRemotePath(char *path) {strcpy(remotePath, path);}
00081 void setRemoteFile(char *file) {strcpy(remoteFile, file);}
00082
00084 void setLocalPath(char *path) {strcpy(localPath, path);}
00086 void setLocalFile(char *file) {strcpy(localFile, file);}
00087
00093 void setMode(int mode) {itsMode = mode;}
00094
00096 int getTimeOut() {return timeOutPeriod;}
00097
00099 char* getRemoteSite() {return remoteSite;}
00101 char* getRemotePath() {return remotePath;}
00103 char* getRemoteFile() {return remoteFile;}
00104
00106 char* getLocalPath() {return localPath;}
00107
00109 char* getLocalFile() {return localFile;}
00110
00112 int getMode() { return itsMode;}
00114
00115
00116
00117
00118
00119
00120
00121
00136 int grabWEBFile();
00137
00138
00139
00152 void showStats(char* streamInfo, char* comment);
00153
00171 int logStats(char* streamInfo, char* comment, FILE* filePtr);
00172
00186 int sendStats(char* streamInfo, char* comment);
00187
00201 int initSendStats(char* monitorClientIP, int port = PERF_DAEMON_DEFAULT_PORT);
00202
00206 void exitSendStats();
00207
00208
00209
00210 private:
00211
00212 static const int INBUFFER;
00213 #ifndef WIN32
00214
00215 int min(int a, int b) {
00216 if (a < b) return a; else return b;
00217 }
00218 #endif
00219 int timeDateOfFile(char* filename, char *out,
00220 int *date,
00221 int *month,
00222 int *year,
00223 int *hour,
00224 int *minute,
00225 int *second);
00226
00227 char sendBuffer[INBUFFER_CONST];
00228 char receiveBuffer[INBUFFER_CONST];
00229
00230 static const int BUFFER;
00231
00232 char remoteSite[BUFFER_CONST];
00233 char remotePath[BUFFER_CONST];
00234 char remoteFile[BUFFER_CONST];
00235 char localPath[BUFFER_CONST];
00236 char localFile[BUFFER_CONST];
00237 int timeOutPeriod;
00238 int itsMode;
00239
00240
00241 CAVERNnet_perfMonitor_c pmonitor;
00242
00243
00244
00245 int indexIntoString(char **strlist, int len, char *searchstr);
00246
00247
00248
00249
00250 int compareDate(int date1, int month1, int year1,
00251 int hour1, int minute1, int second1,
00252 int date2, int month2, int year2,
00253 int hour2, int minute2, int second2);
00254
00255
00256 int webDateConvert(char *instring,
00257 int *date,
00258 int *month,
00259 int *year,
00260 int *hour,
00261 int *minute,
00262 int *second);
00263
00264 };
00265 #endif
00266
00267
00268
00269
00270
00271
00272
00273
00274
00275
00276
00277
00278
00279