nfs4: Add stub RPC reply code
RPC::Reply interprets incoming RPC replies. Currently only XID is read.
This commit is contained in:
@@ -7,5 +7,6 @@ KernelAddon nfs4 :
|
|||||||
kernel_interface.cpp
|
kernel_interface.cpp
|
||||||
RPCAuth.cpp
|
RPCAuth.cpp
|
||||||
RPCCall.cpp
|
RPCCall.cpp
|
||||||
|
RPCReply.cpp
|
||||||
XDR.cpp
|
XDR.cpp
|
||||||
;
|
;
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2012 Haiku, Inc. All rights reserved.
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*
|
||||||
|
* Authors:
|
||||||
|
* Paweł Dziepak, [email protected]
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#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);
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2012 Haiku, Inc. All rights reserved.
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*
|
||||||
|
* Authors:
|
||||||
|
* Paweł Dziepak, [email protected]
|
||||||
|
*/
|
||||||
|
#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
|
||||||
|
|
||||||
Reference in New Issue
Block a user