nfs4: Add stub RPC reply code

RPC::Reply interprets incoming RPC replies. Currently only XID is
read.
This commit is contained in:
Pawel Dziepak 2012-05-25 20:47:03 +02:00
parent 313da82b9f
commit da59bc46d9
3 changed files with 99 additions and 0 deletions

View File

@ -7,5 +7,6 @@ KernelAddon nfs4 :
kernel_interface.cpp
RPCAuth.cpp
RPCCall.cpp
RPCReply.cpp
XDR.cpp
;

View File

@ -0,0 +1,38 @@
/*
* Copyright 2012 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* Paweł Dziepak, pdziepak@quarnos.org
*/
#include "RPCReply.h"
#include <util/kernel_cpp.h>
using namespace RPC;
Reply::Reply(void *buffer, int size)
:
fError(B_OK),
fStream(buffer, size),
fBuffer(buffer)
{
fXID = fStream.GetUInt();
#if 0
int32 type = fStream.GetInt();
int32 state = fStream.GetInt();
int32 auth = fStream.GetInt();
fStream.GetOpaque(NULL);
#endif
}
Reply::~Reply()
{
free(fBuffer);
}

View File

@ -0,0 +1,60 @@
/*
* Copyright 2012 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* Paweł Dziepak, pdziepak@quarnos.org
*/
#ifndef RPCREPLY_H
#define RPCREPLY_H
#include "XDR.h"
namespace RPC {
class Reply {
public:
Reply(void *buffer, int size);
~Reply();
inline uint32 GetXID();
inline status_t GetError();
inline XDR::ReadStream& GetStream();
private:
uint32 fXID;
status_t fError;
XDR::ReadStream fStream;
void* fBuffer;
};
inline uint32
Reply::GetXID()
{
return fXID;
}
inline status_t
Reply::GetError()
{
return fError;
}
inline XDR::ReadStream&
Reply::GetStream()
{
return fStream;
}
} // namespace RPC
#endif // RPCREPLY_H