xref: /haiku/src/add-ons/print/transports/lpr/LpsClient.h (revision 4c8e85b316c35a9161f5a1c50ad70bc91c83a76f)
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();
41 	void			close();
42 	void			receiveJob(const char* queue);
43 	void			receiveControlFile(int cfsize, const char* cfname);
44 	void			receiveDataFile(int dfsize, const char* dfname);
45 	void			transferData(const char* buffer, int size = -1);
46 	void			transferData(istream& is, int size = -1);
47 	void			endTransfer();
48 	void			checkAck();
49 
50 private:
51 	bool		fConnected;
52 	string  	fHost;
53 	Socket* 	fSock;
54 	istream*	fInput;
55 	ostream*	fOutput;
56 };
57 
58 
59 #endif	/* __LPSCLIENT_H */
60