00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef _CAVERNnet_remoteFileIO32_c
00018 #define _CAVERNnet_remoteFileIO32_c
00019
00020 #include "CAVERN.hxx"
00021 #include "CAVERNnet_extendedTcp_c.hxx"
00022 #include "CAVERNmisc_fileList_c.hxx"
00023
00024 #ifdef WIN32
00025 #include <stdlib.h>
00026 #define MAXPATHLEN MAX_PATH
00027 #else
00028 #include <sys/param.h>
00029 #endif
00030
00041 class CAVERNnet_remoteFileIOServer32_c {
00042 public:
00046 static const int DEFAULT_PORT;
00047
00049 static const int THREADED;
00050
00052 static const int NON_THREADED;
00053
00055 int init(int inPort=CAVERNnet_remoteFileIOServer32_c::DEFAULT_PORT,
00056 char* neighborServer = NULL,
00057 int neighborPort = CAVERNnet_remoteFileIOServer32_c::DEFAULT_PORT,
00058 int storeLocally = 1);
00059
00069 void process(int threaded = CAVERNnet_remoteFileIOServer32_c::NON_THREADED);
00070
00071 void setRemotePort(int port=CAVERNnet_remoteFileIOServer32_c::DEFAULT_PORT) {
00072 neighborPortNumber = port;
00073 }
00074 void setNeighborServer(char* ServerName) {
00075 if (ServerName) strcpy(neighborServerName, ServerName);
00076 else neighborServerName[0] = '\0';
00077 }
00078 void setStore(int StoreLocally) { store = StoreLocally; }
00079
00080 long getFileSize(FILE* readFile);
00081
00082 static const int TRANSFERSIZE;
00083
00084 private:
00085 CAVERNnet_extendedTcpServer_c server;
00086 char neighborServerName[MAXPATHLEN];
00087 int neighborPortNumber;
00088 int store;
00089
00090 static int getHostIPNumber(char* hostNameOrIP);
00091 static void* threadHandler(void*);
00092 };
00093
00096 class CAVERNnet_remoteFileIOClient32_c {
00097 public:
00098
00100
00101 static const int OK;
00102
00104 static const int FAILED;
00105
00107 static const int CANNOT_CONNECT;
00108
00110 static const int CANNOT_READ_LOCAL_FILE;
00111
00113 static const int CANNOT_WRITE_LOCAL_FILE;
00114
00116 static const int INVALID_COMMAND;
00117
00119 static const int MEM_ALLOC_ERR;
00120
00122 static const int FILE_ERROR;
00123
00125 static const int EARLIER;
00126
00128 static const int LATER;
00129
00131 static const int SAME;
00132
00134
00135 CAVERNnet_remoteFileIOClient32_c();
00136
00138 void setRemotePort(int port = CAVERNnet_remoteFileIOServer32_c::DEFAULT_PORT);
00139
00147 int upload(char* ipAddress,char* localFileName, char* remoteFileName);
00148
00156 int download(char* ipAddress, char* localFilename, char* remoteFileName);
00157
00163 int getRemoteDateTime(char* ipAddress, char* remoteFileName,
00164 int *remDay, int *remMon, int *remYear,
00165 int* remHour, int* remMin, int* remSec);
00166
00167 #if (defined(__sgi) || defined(linux) || defined(sun))
00168
00177 int getRemoteFileList(char* ipAddress, char* remotePath, CAVERNmisc_fileInfo_c*& fileList, int* noObjects, int doRecursion = CAVERNmisc_fileList_c::SKIP_RECURSION, int linkTraversal = CAVERNmisc_fileList_c::DO_NOT_TRAVERSE_LINKS);
00178 #endif
00179
00184 static int getLocalDateTime(char* filename,
00185 int *day,
00186 int *month,
00187 int *year,
00188 int *hour,
00189 int *minute,
00190 int *second);
00191
00198 int compareDateTime(int day1, int month1, int year1,
00199 int hour1, int minute1, int second1,
00200 int day2, int month2, int year2,
00201 int hour2, int minute2, int second2);
00202
00203
00204
00217 void showStats(char* streamInfo, char* comment);
00218
00235 int logStats(char* streamInfo, char* comment, FILE* filePtr);
00236
00251 int sendStats(char* streamInfo, char* comment);
00252
00266 int initSendStats(char* monitorClientIP, int port = PERF_DAEMON_DEFAULT_PORT);
00267
00272 void exitSendStats();
00273
00274 private:
00275 int remotePort;
00276 CAVERNnet_extendedTcpClient_c client;
00277 CAVERNnet_perfMonitor_c pmonitor;
00278 };
00279
00280
00281
00282
00283
00284
00285
00286
00287
00288
00289
00290
00291
00292
00293
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303
00304
00305
00306
00307
00308
00309
00310
00311
00312
00313
00314
00315
00316
00317
00318 #endif
00319
00320
00321