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 REQUESTBUILDER_H
9 #define REQUESTBUILDER_H
12 #include <SupportDefs.h>
16 #include "ReplyInterpreter.h"
18 #include "RPCServer.h"
26 class RequestBuilder
{
28 RequestBuilder(Procedure p
= ProcCompound
);
31 inline void Reset(Procedure proc
= ProcCompound
);
34 status_t
Close(uint32 seq
, const uint32
* id
,
36 status_t
Commit(uint64 offset
, uint32 count
);
37 status_t
Create(FileType type
, const char* name
,
38 AttrValue
* attr
, uint32 count
,
39 const char* path
= NULL
);
40 status_t
DelegReturn(const uint32
* id
, uint32 seq
);
41 status_t
GetAttr(Attribute
* attrs
, uint32 count
);
43 status_t
Link(const char* name
);
44 status_t
Lock(OpenState
* state
, LockInfo
* lock
,
45 uint32
* sequence
, bool reclaim
= false);
46 status_t
LockT(LockType type
, uint64 pos
,
47 uint64 len
, OpenState
* state
);
48 status_t
LockU(LockInfo
* lock
);
49 status_t
LookUp(const char* name
);
51 status_t
Nverify(AttrValue
* attr
, uint32 count
);
52 status_t
Open(OpenClaim claim
, uint32 seq
,
53 uint32 access
, uint64 id
, OpenCreate oc
,
54 uint64 ownerId
, const char* name
,
55 AttrValue
* attr
= NULL
,
56 uint32 count
= 0, bool excl
= false,
57 OpenDelegation delegType
58 = OPEN_DELEGATE_NONE
);
59 status_t
OpenAttrDir(bool create
);
60 status_t
OpenConfirm(uint32 seq
, const uint32
* id
,
62 status_t
PutFH(const FileHandle
& fh
);
64 status_t
Read(const uint32
* id
, uint32 stateSeq
,
65 uint64 pos
, uint32 len
);
66 status_t
ReadDir(uint64 cookie
, uint64 cookieVerf
,
67 Attribute
* attrs
, uint32 attrCount
);
69 status_t
Remove(const char* file
);
70 status_t
Rename(const char* from
, const char* to
);
71 status_t
Renew(uint64 clientId
);
73 status_t
SetAttr(const uint32
* id
, uint32 stateSeq
,
74 AttrValue
* attr
, uint32 count
);
75 status_t
SetClientID(RPC::Server
* server
);
76 status_t
SetClientIDConfirm(uint64 id
, uint64 ver
);
77 status_t
Verify(AttrValue
* attr
, uint32 count
);
78 status_t
Write(const uint32
* id
, uint32 stateSeq
,
79 const void* buffer
, uint64 pos
,
80 uint32 len
, bool stable
= false);
81 status_t
ReleaseLockOwner(OpenState
* state
,
89 void _GenerateLockOwner(XDR::WriteStream
& stream
,
90 OpenState
* state
, LockOwner
* owner
);
91 status_t
_GenerateClientId(XDR::WriteStream
& stream
,
92 const RPC::Server
* server
);
94 void _EncodeAttrs(XDR::WriteStream
& stream
,
95 AttrValue
* attr
, uint32 count
);
96 void _AttrBitmap(XDR::WriteStream
& stream
,
97 Attribute
* attrs
, uint32 count
);
100 XDR::Stream::Position fOpCountPosition
;
102 Procedure fProcedure
;
109 RequestBuilder::Reset(Procedure proc
)
111 fRequest
->Stream().Clear();
120 #endif // REQUESTBUILDER_H