public class Rpc
extends java.lang.Object
Connection
,
RpcException
,
MsgAcceptedException
,
MsgDeniedException
Modifier and Type | Field and Description |
---|---|
Connection |
conn |
Constructor and Description |
---|
Rpc(Connection conn,
int prog,
int vers)
Construct a new Rpc object - equivalent to a "client handle"
using an AUTH_NONE cred handle.
|
Rpc(Connection conn,
int prog,
int vers,
Cred cr)
Construct a new Rpc object - equivalent to a "client handle"
using a given cred handle "cr"
|
Rpc(java.lang.String server,
int port,
int prog,
int vers,
java.lang.String proto,
int maxReply)
Construct a new Rpc object - equivalent to a "client handle"
|
Modifier and Type | Method and Description |
---|---|
void |
delCred()
Delete the RPC credential data and destroy its security
context with the server.
|
Cred |
getCred()
Return the RPC credential
|
java.net.InetAddress |
getPeer()
Since this returns the address of the server it may
seem redundant - but if you receive a reply to a
broadcast RPC you need to know who is replying.
|
Xdr |
rpc_call_one(Xdr call,
byte[] arg,
int timeout)
Transmit the XDR call buffer containing an RPC header
followed by a protocol header and receive the
reply.
|
Xdr |
rpc_call(Xdr call,
int timeout,
int retries)
Make an RPC call but retry if necessary
Retries use exponential backoff up to MAX_TIMEOUT ms.
|
void |
rpc_header(Xdr call,
int proc)
Construct an RPC header in the XDR buffer
|
void |
setCred(Cred c)
Set the RPC credential
|
void |
setRpcHandler(RpcHandler r) |
public Connection conn
public Rpc(Connection conn, int prog, int vers)
conn
- A connection to the serverprog
- The program number of the servicevers
- The version number of the servicepublic Rpc(Connection conn, int prog, int vers, Cred cr)
conn
- A connection to the serverprog
- The program number of the servicevers
- The version number of the servicecr
- The cred to be used: CredUnix or CredGsspublic Rpc(java.lang.String server, int port, int prog, int vers, java.lang.String proto, int maxReply) throws java.io.IOException
server
- The hostname of the serverport
- The port number for the serviceprog
- The program number of the servicevers
- The version number of the serviceproto
- The protocol to be used: "tcp" or "udp"maxReply
- The maximum size of the RPC replyjava.io.IOException
- if an I/O error occurspublic void setCred(Cred c) throws RpcException
c
- - cred to be usedRpcException
public void delCred() throws RpcException
RpcException
public Cred getCred()
public void setRpcHandler(RpcHandler r)
public void rpc_header(Xdr call, int proc) throws RpcException
call
- The XDR buffer for the headerproc
- The service procedure to be calledRpcException
public Xdr rpc_call_one(Xdr call, byte[] arg, int timeout) throws java.io.IOException, RpcException
call
- XDR buffer containing RPC call to transmitarg
- (seq_num + RPC argument) if wraptimeout
- after this number of millisecondsRpcException
java.io.IOException
public Xdr rpc_call(Xdr call, int timeout, int retries) throws java.io.IOException
call
- XDR buffer containing RPC call to transmittimeout
- for the initial callretries
- the number of times to retry the call.
A value of zero implies forever.java.io.IOException
public java.net.InetAddress getPeer()