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 #ifndef _CAVERNnet_remoteFileIO64_c
00019 #define _CAVERNnet_remoteFileIO64_c
00020
00021 #include "CAVERN.hxx"
00022 #include "CAVERNnet_extendedTcp_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_remoteFileIOServer64_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_remoteFileIOServer64_c::DEFAULT_PORT,
00056 char* neighborServer = NULL,
00057 int neighborPort = CAVERNnet_remoteFileIOServer64_c::DEFAULT_PORT,
00058 int storeLocally = 1);
00059
00069 void process(int threaded = CAVERNnet_remoteFileIOServer64_c::NON_THREADED);
00070
00071 void setRemotePort(int port=CAVERNnet_remoteFileIOServer64_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_remoteFileIOClient64_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_remoteFileIOClient64_c();
00136
00138 void setRemotePort(int port = CAVERNnet_remoteFileIOServer64_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
00171 static int getLocalDateTime(char* filename,
00172 int *day,
00173 int *month,
00174 int *year,
00175 int *hour,
00176 int *minute,
00177 int *second);
00178
00185 int compareDateTime(int day1, int month1, int year1,
00186 int hour1, int minute1, int second1,
00187 int day2, int month2, int year2,
00188 int hour2, int minute2, int second2);
00189
00190
00191
00205 void showStats(char* streamInfo, char* comment);
00206
00223 int logStats(char* streamInfo, char* comment, FILE* filePtr);
00224
00239 int sendStats(char* streamInfo, char* comment);
00240
00254 int initSendStats(char* monitorClientIP, int port = PERF_DAEMON_DEFAULT_PORT);
00255
00260 void exitSendStats();
00261
00262 private:
00263 int remotePort;
00264 CAVERNnet_extendedTcpClient_c client;
00265 CAVERNnet_perfMonitor_c pmonitor;
00266 };
00267
00268
00269
00270
00271
00272
00273
00274
00275
00276
00277
00278
00279
00280
00281
00282
00283
00284
00285
00286
00287
00288
00289
00290
00291
00292
00293
00294
00295
00296
00297
00298 #endif
00299 #endif