Main Page   Class Hierarchy   Compound List   File List   Compound Members  

CAVERNnet_remoteFileIO64_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 #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/* = 8000*/;
00047 
00049         static const int THREADED/* = 1*/;
00050 
00052         static const int NON_THREADED/* = 0*/;
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/* = 30000*/;
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/* = 1*/;
00102 
00104         static const int FAILED/* = 0*/;
00105 
00107         static const int CANNOT_CONNECT/* = 2*/;
00108 
00110         static const int CANNOT_READ_LOCAL_FILE/* = 3*/;
00111 
00113         static const int CANNOT_WRITE_LOCAL_FILE/* = 3*/;
00114 
00116         static const int INVALID_COMMAND/* = 4*/;
00117 
00119         static const int MEM_ALLOC_ERR/* = 5*/;
00120 
00122         static const int FILE_ERROR/* = 6*/;
00123 
00125         static const int EARLIER/* = 7*/;
00126 
00128         static const int LATER/* = 8*/;
00129 
00131         static const int SAME/* = 9*/;
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     //Functions added for performance monitoring interface
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;   //for performance monitoring
00266 };
00267 
00268 
00269 /*
00270 
00271 FORMAT:There are no spaces between fields
00272 
00273 UPLOAD
00274 ------
00275 CLIENT -> SERVER
00276 u fileNameLen fileName dataSize data
00277 
00278 DOWNLOAD
00279 --------
00280 CLIENT -> SERVER
00281 d fileNameLen  fileName
00282 SERVER->CLIENT
00283 d (dataSize, timeStamp) data
00284 
00285 CHECK REMOTE TIMESTAMP ON FILE
00286 -----------------------------
00287 CLIENT->SERVER
00288 c fileNameLen fileName
00289 SERVER->CLIENT
00290 c (time, timestamp)
00291 
00292 REPLY:SERVER->CLIENT (For all commands)
00293 
00294 File Not found:  'n'
00295 Invalid command: 't' 
00296 
00297 */
00298 #endif
00299 #endif

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