00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef _CAVERNnet_remoteParallelFileIO32_c
00018 #define _CAVERNnet_remoteParallelFileIO32_c
00019
00020 #include "CAVERN.hxx"
00021 #include "CAVERNnet_extendedParallelTcp_c.hxx"
00022 #include "CAVERNnet_datapack_c.hxx"
00023 #include "CAVERNmisc_fileList_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_remoteParallelFileIOServer32_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_remoteParallelFileIOServer32_c::DEFAULT_PORT,
00062 char* neighborServer = NULL,
00063 int neighborPort = CAVERNnet_remoteParallelFileIOServer32_c::DEFAULT_PORT,
00064 int storeLocally = 1, int numOfSockets = 5);
00065
00075 void process(int threaded = CAVERNnet_remoteParallelFileIOServer32_c::NON_THREADED);
00076
00077 void setRemotePort(int port = CAVERNnet_remoteParallelFileIOServer32_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_remoteParallelFileIOClient32_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_remoteParallelFileIOClient32_c();
00143
00145 void setRemotePort(int port = CAVERNnet_remoteParallelFileIOServer32_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 #if (defined(__sgi) || defined(linux) || defined(sun))
00180
00190 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, int numberOfSockets = 1);
00191 #endif
00192
00197 static int getLocalDateTime(char* filename,
00198 int *day,
00199 int *month,
00200 int *year,
00201 int *hour,
00202 int *minute,
00203 int *second);
00204
00211 int compareDateTime(int day1, int month1, int year1,
00212 int hour1, int minute1, int second1,
00213 int day2, int month2, int year2,
00214 int hour2, int minute2, int second2);
00215
00216
00217
00230 void showStats(char* streamInfo, char* comment);
00231
00248 int logStats(char* streamInfo, char* comment, FILE* filePtr);
00249
00264 int sendStats(char* streamInfo, char* comment);
00265
00279 int initSendStats(char* monitorClientIP, int port = PERF_DAEMON_DEFAULT_PORT);
00280
00285 void exitSendStats();
00286
00287
00288 private:
00289 int remotePort;
00290 CAVERNnet_extendedParallelTcpClient_c client;
00291 CAVERNnet_perfMonitor_c pmonitor;
00292 };
00293
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303
00304
00305
00306
00307 #endif