Barrelfish
Data Structures | Typedefs | Enumerations | Functions
rpc.h File Reference

RPC definitions. More...

Data Structures

struct  rpc_client
 RPC client instance data. More...
 

Typedefs

typedef void(* rpc_callback_t) (struct rpc_client *rpc_client, void *arg1, void *arg2, uint32_t replystat, uint32_t acceptstat, XDR *reply_xdr)
 Callback function for RPC reply handlers. More...
 

Enumerations

Functions

err_t rpc_init (struct rpc_client *client, struct ip_addr server)
 Initialise a new RPC client instance. More...
 
void rpc_destroy (struct rpc_client *client)
 Destroy the given client, freeing any associated memory.
 
err_t rpc_call (struct rpc_client *client, uint16_t port, uint32_t prog, uint32_t vers, uint32_t proc, xdrproc_t args_xdrproc, void *args, size_t args_size, rpc_callback_t callback, void *cbarg1, void *cbarg2)
 Initiate an RPC Call. More...
 

Detailed Description

RPC definitions.

Typedef Documentation

typedef void(* rpc_callback_t) (struct rpc_client *rpc_client, void *arg1, void *arg2, uint32_t replystat, uint32_t acceptstat, XDR *reply_xdr)

Callback function for RPC reply handlers.

Parameters
rpc_clientRPC client instance pointer
arg1,arg2Opaque argument values provided to rpc_call()
replystatReply status (RPC_MSG_ACCEPTED on success)
acceptstatAccept status (RPC_SUCCESS on success)
reply_xdrXDR pointer for deserialising any return values
Note
Two opaque argument values are provided to the callback, as this allows the NFS code to use them to store the callback pointer and argument for its own callbacks without further memory allocation.

Enumeration Type Documentation

Given that a call message was accepted, the following is the status of an attempt to call a remote procedure.

Enumerator
RPC_SUCCESS 

RPC executed successfully.

RPC_PROG_UNAVAIL 

remote hasn't exported program

RPC_PROG_MISMATCH 

remote can't support version #

RPC_PROC_UNAVAIL 

program can't support procedure

RPC_GARBAGE_ARGS 

procedure can't decode params

Why authentication failed.

Enumerator
RPC_AUTH_BADCRED 

bad credentials (seal broken)

RPC_AUTH_REJECTEDCRED 

client must begin new session

RPC_AUTH_BADVERF 

bad verifier (seal broken)

RPC_AUTH_REJECTEDVERF 

verifier expired or replayed

RPC_AUTH_TOOWEAK 

rejected for security reasons

Reasons why a call message was rejected.

Enumerator
RPC_RPC_MISMATCH 

RPC version number != 2.

RPC_AUTH_ERROR 

remote can't authenticate caller

A reply to a call message can take on two forms: The message was either accepted or rejected.

Function Documentation

err_t rpc_call ( struct rpc_client client,
uint16_t  port,
uint32_t  prog,
uint32_t  vers,
uint32_t  proc,
xdrproc_t  args_xdrproc,
void *  args,
size_t  args_size,
rpc_callback_t  callback,
void *  cbarg1,
void *  cbarg2 
)

Initiate an RPC Call.

Parameters
clientRPC client, previously initialised by a call to rpc_init()
portUDP port on server to call
progRPC program number
versRPC program version
procRPC procedure number
args_xdrprocXDR serialisation function for arguments to call
argsArgument data to be passed to #args_xdrproc
args_sizeUpper bound on size of serialised argument data
callbackCallback function to be invoked when call either completes or fails
cbarg1,cbarg2Opaque arguments to be passed to callback function
Returns
Error code (ERR_OK on success)
err_t rpc_init ( struct rpc_client client,
struct ip_addr  server 
)

Initialise a new RPC client instance.

Parameters
clientPointer to memory for RPC client data, to be initialised
serverIP address of server to be called
Returns
Error code (ERR_OK on success)