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