xref: /haiku/src/add-ons/print/transports/lpr/LpsClient.h (revision 1deede7388b04dbeec5af85cae7164735ea9e70d)
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 
11 using namespace std;
12 
13 
14 class Socket;
15 
16 
17 class LPSException {
18 public:
19 					LPSException(const string& what)
20 						:
21 						fWhat(what)
22 					{
23 					}
24 
25 	const char *	what() const
26 					{
27 						return fWhat.c_str();
28 					}
29 
30 private:
31 	string fWhat;
32 
33 };
34 
35 
36 class LpsClient {
37 public:
38 					LpsClient(const char* host);
39 					~LpsClient();
40 	void			connect() throw(LPSException);
41 	void			close();
42 	void			receiveJob(const char* queue) throw(LPSException);
43 	void			receiveControlFile(int cfsize, const char* cfname)
44 						throw(LPSException);
45 	void			receiveDataFile(int dfsize, const char* dfname)
46 						throw(LPSException);
47 	void			transferData(const char* buffer, int size = -1)
48 						throw(LPSException);
49 	void			transferData(istream& is, int size = -1)
50 						throw(LPSException);
51 	void			endTransfer() throw(LPSException);
52 	void			checkAck() throw(LPSException);
53 
54 private:
55 	bool		fConnected;
56 	string  	fHost;
57 	Socket* 	fSock;
58 	istream*	fInput;
59 	ostream*	fOutput;
60 };
61 
62 
63 #endif	/* __LPSCLIENT_H */
64