xref: /haiku/src/add-ons/kernel/file_systems/nfs4/RequestInterpreter.h (revision 22440f4105cafc95cc1d49f9bc65bb395c527d86)
1 /*
2  * Copyright 2012 Haiku, Inc. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  *
5  * Authors:
6  *		Paweł Dziepak, pdziepak@quarnos.org
7  */
8 #ifndef REQUESTINTERPRETER_H
9 #define REQUESTINTERPRETER_H
10 
11 
12 #include <SupportDefs.h>
13 
14 #include "FileInfo.h"
15 #include "NFS4Defs.h"
16 #include "RPCCallbackRequest.h"
17 
18 
19 class RequestInterpreter {
20 public:
21 						RequestInterpreter(RPC::CallbackRequest* request);
22 						~RequestInterpreter();
23 
24 	inline	uint32		OperationCount();
25 	inline	uint32		Operation();
26 
27 			status_t	GetAttr(FileHandle* handle, int* mask);
28 			status_t	Recall(FileHandle* handle, bool& truncate,
29 							uint32* stateSeq, uint32* stateID);
30 
31 private:
32 			uint32		fOperationCount;
33 			uint32		fLastOperation;
34 
35 			RPC::CallbackRequest*	fRequest;
36 };
37 
38 
39 inline uint32
40 RequestInterpreter::OperationCount()
41 {
42 	return fOperationCount;
43 }
44 
45 
46 inline uint32
47 RequestInterpreter::Operation()
48 {
49 	fLastOperation = fRequest->Stream().GetUInt();
50 	return fLastOperation;
51 }
52 
53 
54 #endif	// REQUESTINTERPRETER_H
55 
56