00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #if (defined(__sgi) && (_MIPS_SZLONG==64)) || defined(CAVERN_SIXTY_FOUR_BIT_FILE_SYSTEM)
00018
00019 #ifndef _CAVERNnet_remoteParallelFileIO64_c
00020 #define _CAVERNnet_remoteParallelFileIO64_c
00021
00022 #include "CAVERN.hxx"
00023 #include "CAVERNnet_extendedParallelTcp_c.hxx"
00024
00025 #ifdef WIN32
00026 #include <stdlib.h>
00027 #define MAXPATHLEN MAX_PATH
00028 #else
00029 #include <sys/param.h>
00030 #endif
00031
00047 class CAVERNnet_remoteParallelFileIOServer64_c {
00048 public:
00052 static const int DEFAULT_PORT;
00053
00055 static const int THREADED;
00056
00058 static const int NON_THREADED;
00059
00061 int init(int incomingPort=CAVERNnet_remoteParallelFileIOServer64_c::DEFAULT_PORT,
00062 char* neighborServer = NULL,
00063 int neighborPort = CAVERNnet_remoteParallelFileIOServer64_c::DEFAULT_PORT,
00064 int storeLocally = 1, int numOfSockets = 5);
00065
00075 void process(int threaded = CAVERNnet_remoteParallelFileIOServer64_c::NON_THREADED);
00076
00077 void setRemotePort(int port = CAVERNnet_remoteParallelFileIOServer64_c::DEFAULT_PORT) {
00078 neighborPortNumber = port;
00079 }
00080 void setNeighborServer(char* ServerName) {
00081 if (ServerName) strcpy(neighborServerName, ServerName);
00082 else neighborServerName[0] = '\0';
00083 }
00084 void setStore(int StoreLocally) { store = StoreLocally; }
00085
00086 long getFileSize(FILE* readFile);
00087
00088 static const int TRANSFERSIZE;
00089
00090 private:
00091 CAVERNnet_extendedParallelTcpServer_c server;
00092 char neighborServerName[MAXPATHLEN];
00093 int neighborPortNumber;
00094 int store;
00095 int numberOfSockets;
00096
00097 static int getHostIPNumber(char* hostNameOrIP);
00098 static void* threadHandler(void*);
00099 };
00100
00103 class CAVERNnet_remoteParallelFileIOClient64_c {
00104 public:
00105
00107
00108 static const int OK;
00109
00111 static const int FAILED;
00112
00114 static const int CANNOT_CONNECT;
00115
00117 static const int CANNOT_READ_LOCAL_FILE;
00118
00120 static const int CANNOT_WRITE_LOCAL_FILE;
00121
00123 static const int INVALID_COMMAND;
00124
00126 static const int MEM_ALLOC_ERR;
00127
00129 static const int FILE_ERROR;
00130
00132 static const int EARLIER;
00133
00135 static const int LATER;
00136
00138 static const int SAME;
00139
00141
00142 CAVERNnet_remoteParallelFileIOClient64_c();
00143
00145 void setRemotePort(int port = CAVERNnet_remoteParallelFileIOServer64_c::DEFAULT_PORT);
00146
00155 int upload(char* ipAddress,char* localFileName, char* remoteFileName, int numberOfSockets = 5);
00156
00165 int download(char* ipAddress, char* localFilename, char* remoteFileName, int numberOfSockets = 5);
00166
00175 int getRemoteDateTime(char* ipAddress, char* remoteFileName,
00176 int *remDay, int *remMon, int *remYear,
00177 int* remHour, int* remMin, int* remSec,
00178 int numberOfSockets = 1);
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_extendedParallelTcpClient_c client;
00277 CAVERNnet_perfMonitor_c pmonitor;
00278 };
00279
00280
00281
00282
00283
00284
00285
00286
00287
00288
00289
00290
00291
00292 #endif
00293
00294 #endif