2 * Copyright 2012 Haiku, Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
6 * Paweł Dziepak, pdziepak@quarnos.org
8 #ifndef REPLYINTERPRETER_H
9 #define REPLYINTERPRETER_H
12 #include <SupportDefs.h>
20 const char** fRootPath
;
22 const char** fLocations
;
29 const char** fRootPath
;
31 FSLocation
* fLocations
;
47 FSLocations
* fLocations
;
62 class ReplyInterpreter
{
64 ReplyInterpreter(RPC::Reply
* reply
= NULL
);
67 inline status_t
SetTo(RPC::Reply
* reply
);
70 inline uint32
NFS4Error();
72 status_t
Access(uint32
* supported
, uint32
* allowed
);
75 status_t
Create(uint64
* before
, uint64
* after
, bool& atomic
);
76 inline status_t
DelegReturn();
77 status_t
GetAttr(AttrValue
** attrs
, uint32
* count
);
78 status_t
GetFH(FileHandle
* fh
);
79 status_t
Link(uint64
* before
, uint64
* after
, bool& atomic
);
80 status_t
Lock(LockInfo
* linfo
);
81 status_t
LockT(uint64
* pos
, uint64
* len
, LockType
* type
);
82 status_t
LockU(LockInfo
* linfo
);
83 inline status_t
LookUp();
84 inline status_t
LookUpUp();
85 inline status_t
Nverify();
86 status_t
Open(uint32
* id
, uint32
* seq
, bool* confirm
,
87 OpenDelegationData
* delegData
,
88 ChangeInfo
* changeInfo
= NULL
);
89 inline status_t
OpenAttrDir();
90 status_t
OpenConfirm(uint32
* stateSeq
);
91 inline status_t
PutFH();
92 inline status_t
PutRootFH();
93 status_t
Read(void* buffer
, uint32
* size
, bool* eof
);
94 status_t
ReadDir(uint64
* cookie
, uint64
* cookieVerf
,
95 DirEntry
** dirents
, uint32
* count
, bool* eof
);
96 status_t
ReadLink(void* buffer
, uint32
* size
, uint32 maxSize
);
97 status_t
Remove(uint64
* before
, uint64
* after
, bool& atomic
);
98 status_t
Rename(uint64
* fromBefore
, uint64
* fromAfter
,
99 bool& fromAtomic
, uint64
* toBefore
, uint64
* toAfter
,
101 inline status_t
Renew();
102 inline status_t
SaveFH();
104 status_t
SetClientID(uint64
* clientid
, uint64
* verifier
);
105 inline status_t
SetClientIDConfirm();
106 inline status_t
Verify();
107 status_t
Write(uint32
* size
);
108 inline status_t
ReleaseLockOwner();
113 static const char** _GetPath(XDR::ReadStream
& stream
);
115 status_t
_DecodeAttrs(XDR::ReadStream
& stream
, AttrValue
** attrs
,
117 status_t
_OperationError(Opcode op
);
119 static status_t
_NFS4ErrorToHaiku(uint32 x
);
128 ReplyInterpreter::SetTo(RPC::Reply
* _reply
)
131 return B_DONT_DO_THAT
;
133 fDecodeError
= false;
144 ReplyInterpreter::Reset()
148 fDecodeError
= false;
153 ReplyInterpreter::NFS4Error()
160 ReplyInterpreter::DelegReturn()
162 return _OperationError(OpDelegReturn
);
167 ReplyInterpreter::LookUp()
169 return _OperationError(OpLookUp
);
174 ReplyInterpreter::LookUpUp()
176 return _OperationError(OpLookUpUp
);
181 ReplyInterpreter::OpenAttrDir()
183 return _OperationError(OpOpenAttrDir
);
188 ReplyInterpreter::Nverify()
190 return _OperationError(OpNverify
);
195 ReplyInterpreter::PutFH()
197 return _OperationError(OpPutFH
);
202 ReplyInterpreter::PutRootFH()
204 return _OperationError(OpPutRootFH
);
209 ReplyInterpreter::Renew()
211 return _OperationError(OpRenew
);
216 ReplyInterpreter::SaveFH()
218 return _OperationError(OpSaveFH
);
223 ReplyInterpreter::SetClientIDConfirm()
225 return _OperationError(OpSetClientIDConfirm
);
230 ReplyInterpreter::Verify()
232 return _OperationError(OpVerify
);
237 ReplyInterpreter::ReleaseLockOwner()
239 return _OperationError(OpReleaseLockOwner
);
243 #endif // REPLYINTERPRETER_H