1 // Sun, 18 Jun 2000 2 // Y.Takagi 3 4 #ifndef __LPSCLIENT_H 5 #define __LPSCLIENT_H 6 7 #ifdef WIN32 8 #include <istream> 9 #include <ostream> 10 #else 11 #include <istream.h> 12 #include <ostream.h> 13 #endif 14 #include <string> 15 16 #if (!__MWERKS__ || defined(WIN32)) 17 using namespace std; 18 #else 19 #define std 20 #endif 21 22 class Socket; 23 24 class LPSException { 25 private: 26 string str; 27 public: 28 LPSException(const string &what_arg) : str(what_arg) {} 29 const char *what() const { return str.c_str(); } 30 }; 31 32 class LpsClient { 33 public: 34 LpsClient(const char *host); 35 ~LpsClient(); 36 void connect() throw(LPSException); 37 void close(); 38 void receiveJob(const char *queue) throw(LPSException); 39 void receiveControlFile(int cfsize, const char *cfname) throw(LPSException); 40 void receiveDataFile(int dfsize, const char *dfname) throw(LPSException); 41 void transferData(const char *buffer, int size = -1) throw(LPSException); 42 void transferData(istream &is, int size = -1) throw(LPSException); 43 void endTransfer() throw(LPSException); 44 void checkAck() throw(LPSException); 45 46 protected: 47 bool connected; 48 49 private: 50 string __host; 51 Socket *__sock; 52 istream *__is; 53 ostream *__os; 54 }; 55 56 #endif /* __LPSCLIENT_H */ 57