BPicture: Fix archive constructor.
[haiku.git] / src / add-ons / kernel / file_systems / nfs4 / RPCCall.cpp
blobd0c009945a2f407b95a03a63cb8988aa91ffd561
1 /*
2 * Copyright 2012 Haiku, Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
5 * Authors:
6 * Paweł Dziepak, pdziepak@quarnos.org
7 */
10 #include "RPCCall.h"
12 #include <debug.h>
13 #include <util/kernel_cpp.h>
15 #include "RPCDefs.h"
18 using namespace RPC;
21 Call::Call()
26 Call*
27 Call::Create(uint32 proc, const Auth* creds, const Auth* ver)
29 ASSERT(creds != NULL);
30 ASSERT(ver != NULL);
32 Call* call = new(std::nothrow) Call;
33 if (call == NULL)
34 return NULL;
36 // XID will be determined and set by RPC::Server
37 call->fXIDPosition = call->fStream.Current();
38 call->fStream.AddUInt(0);
40 call->fStream.AddInt(CALL);
41 call->fStream.AddUInt(VERSION);
42 call->fStream.AddUInt(PROGRAM_NFS);
43 call->fStream.AddUInt(NFS_VERSION);
44 call->fStream.AddUInt(proc);
46 call->fStream.Append(creds->Stream());
47 delete creds;
49 call->fStream.Append(ver->Stream());
50 delete ver;
52 if (call->fStream.Error() != B_OK) {
53 delete call;
54 return NULL;
57 return call;
61 Call::~Call()
66 void
67 Call::SetXID(uint32 xid)
69 fStream.InsertUInt(fXIDPosition, xid);