xref: /haiku/src/add-ons/kernel/file_systems/netfs/headers/shared/RequestConnection.h (revision f0d46bd83cd4b50fc63fdff30bd71400a608aaed)
1 // RequestConnection.h
2 
3 #ifndef NET_FS_REQUEST_CONNECTION_H
4 #define NET_FS_REQUEST_CONNECTION_H
5 
6 #include <SupportDefs.h>
7 
8 class Connection;
9 class Request;
10 class RequestHandler;
11 
12 class RequestConnection {
13 public:
14 								RequestConnection(Connection* connection,
15 									RequestHandler* requestHandler,
16 									bool ownsRequestHandler = false);
17 								~RequestConnection();
18 
19 			status_t			Init();
20 
21 			void				Close();
22 
23 			status_t			SendRequest(Request* request,
24 									Request** reply = NULL);
25 			status_t			SendRequest(Request* request,
26 									RequestHandler* replyHandler);
27 private:
28 			class DownStreamThread;
29 			friend class DownStreamThread;
30 
31 private:
32 			bool				DownStreamChannelError(DownStreamThread* thread,
33 									status_t error);
34 
35 			status_t			_SendRequest(Request* request, Request** reply,
36 									RequestHandler* replyHandler);
37 
38 private:
39 			Connection*			fConnection;
40 			RequestHandler*		fRequestHandler;
41 			bool				fOwnsRequestHandler;
42 			DownStreamThread*	fThreads;
43 			int32				fThreadCount;
44 			int32				fTerminationCount;
45 };
46 
47 #endif	// NET_FS_REQUEST_CONNECTION_H
48