Main Page   Class Hierarchy   Compound List   File List   Compound Members  

CAVERNnet_remoteParallelFileIO64_c.hxx

00001 /******************************************************************
00002  * CAVERNsoft
00003  * Copyright (C) 1994-2000 Electronic Visualization Laboratory,
00004  * all rights reserved
00005  * By Jason Leigh, Yong-joo Cho, Naveen Krishnaprasad, Chris Scharver,
00006  * Stuart Bailey, Atul NAyak, Shalini Venkataraman
00007  * University of Illinois at Chicago
00008  * 
00009  * This publication and its text and code may not be copied for commercial 
00010  * use without the express written permission of the University of Illinois
00011  * at Chicago.
00012  * The contributors disclaim any representation of warranty: use this
00013  * code at your own risk.
00014  * Direct questions, comments etc to cavern@evl.uic.edu
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/* = 7673*/;
00053 
00055         static const int THREADED/* = 1*/;
00056 
00058         static const int NON_THREADED/* = 0*/;
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/* = 30000*/;
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/* = 1*/;
00109 
00111         static const int FAILED/* = 0*/;
00112 
00114         static const int CANNOT_CONNECT/* = 2*/;
00115 
00117         static const int CANNOT_READ_LOCAL_FILE/* = 3*/;
00118 
00120         static const int CANNOT_WRITE_LOCAL_FILE/* = 3*/;
00121 
00123         static const int INVALID_COMMAND/* = 4*/;
00124 
00126         static const int MEM_ALLOC_ERR/* = 5*/;
00127 
00129         static const int FILE_ERROR/* = 6*/;
00130 
00132         static const int EARLIER/* = 7*/;
00133 
00135         static const int LATER/* = 8*/;
00136 
00138         static const int SAME/* = 9*/;
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         //Functions added for performance monitoring interface
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;   //for performance monitoring     
00278 };
00279 
00280 /*
00281 FORMAT:There are no spaces between fields
00282 CLIENT -> SERVER
00283 u fileNameLen fileName dataSize data
00284 d fileNameLen fileName
00285 
00286 SERVER->CLIENT
00287 d dataSize data
00288 
00289 What if download file not found?
00290 need to delete thread somehow
00291 */
00292 #endif
00293 
00294 #endif

Generated at Mon Jul 2 14:24:42 2001 for CAVERNsoft by doxygen1.2.8-20010617 written by Dimitri van Heesch, © 1997-2001