com.distinct.rpc
Class RPCBind

java.lang.Object
  |
  +--com.distinct.rpc.JRPCServer
        |
        +--com.distinct.rpc.RPCBind
All Implemented Interfaces:
java.lang.Runnable, java.io.Serializable

public class RPCBind
extends JRPCServer

The RPCBind server

See Also:
Serialized Form

Field Summary
static int RPCB_PORT
           
static int RPCBPROC_BCAST
           
static int RPCBPROC_CALLIT
           
static int RPCBPROC_DUMP
           
static int RPCBPROC_GETADDR
           
static int RPCBPROC_GETADDRLIST
           
static int RPCBPROC_GETSTAT
           
static int RPCBPROC_GETTIME
           
static int RPCBPROC_GETVERSADDR
           
static int RPCBPROC_INDIRECT
           
static int RPCBPROC_SET
           
static int RPCBPROC_TADDR2UADDR
           
static int RPCBPROC_UADDR2TADDR
           
static int RPCBPROC_UNSET
           
static int RPCBPROG
          Program ID of the interface.
static int RPCBSTAT_HIGHPROC
           
static int RPCBVERS
          Version ID of the interface.
static int RPCBVERS_2_STAT
           
static int RPCBVERS_3_STAT
           
static int RPCBVERS_4_STAT
           
static int RPCBVERS_STAT
           
static int RPCBVERS4
          Version ID of the interface.
 
Constructor Summary
RPCBind()
          Constructor that creates and starts the RPCBind service.
 
Method Summary
 Auth DoAuth(int proc, Auth cred, Auth verf)
          Overwrite this method only if you want your server to check authentication (Default are no checks).
 boolean DoCall(int proc, XDRStream xin, XDRStream xout)
          Dispatcher Routine that interpretes the call requests.
 boolean DoVersionCheck(int vers)
          Overwrite this method only if you want your server to handle versions explicitly (by default the version of server and request have to be identical).
static java.lang.String encodeAddress(java.net.InetAddress host, int port)
          Encodes a pair Internet address a and a port number p into a string with format "a.a.a.a.p.p".
 boolean IsBatched(int proc)
          Overwrite this method only if you want to implement batched RPCs.
static void main(java.lang.String[] args)
          Starts a stand-alone RPCBind service (no parameters).
 
Methods inherited from class com.distinct.rpc.JRPCServer
EnumerateConnections, getAddress, getCallVersion, getClientData, GetConnectionState, getPort, getVersion, isMultithreaded, isTCPServer, RegisterServer, RegisterServer, run, setClientData, setMultithreaded, setStreamed, StartTCP, StartTCP, StartUDP, StartUDP, Stop, UnregisterServer, UnregisterServer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RPCB_PORT

public static final int RPCB_PORT
See Also:
Constant Field Values

RPCBSTAT_HIGHPROC

public static final int RPCBSTAT_HIGHPROC
See Also:
Constant Field Values

RPCBVERS_STAT

public static final int RPCBVERS_STAT
See Also:
Constant Field Values

RPCBVERS_4_STAT

public static final int RPCBVERS_4_STAT
See Also:
Constant Field Values

RPCBVERS_3_STAT

public static final int RPCBVERS_3_STAT
See Also:
Constant Field Values

RPCBVERS_2_STAT

public static final int RPCBVERS_2_STAT
See Also:
Constant Field Values

RPCBPROG

public static final int RPCBPROG
Program ID of the interface.

See Also:
Constant Field Values

RPCBVERS

public static final int RPCBVERS
Version ID of the interface.

See Also:
Constant Field Values

RPCBPROC_SET

public static final int RPCBPROC_SET
See Also:
Constant Field Values

RPCBPROC_UNSET

public static final int RPCBPROC_UNSET
See Also:
Constant Field Values

RPCBPROC_GETADDR

public static final int RPCBPROC_GETADDR
See Also:
Constant Field Values

RPCBPROC_DUMP

public static final int RPCBPROC_DUMP
See Also:
Constant Field Values

RPCBPROC_CALLIT

public static final int RPCBPROC_CALLIT
See Also:
Constant Field Values

RPCBPROC_GETTIME

public static final int RPCBPROC_GETTIME
See Also:
Constant Field Values

RPCBPROC_UADDR2TADDR

public static final int RPCBPROC_UADDR2TADDR
See Also:
Constant Field Values

RPCBPROC_TADDR2UADDR

public static final int RPCBPROC_TADDR2UADDR
See Also:
Constant Field Values

RPCBVERS4

public static final int RPCBVERS4
Version ID of the interface.

See Also:
Constant Field Values

RPCBPROC_BCAST

public static final int RPCBPROC_BCAST
See Also:
Constant Field Values

RPCBPROC_GETVERSADDR

public static final int RPCBPROC_GETVERSADDR
See Also:
Constant Field Values

RPCBPROC_INDIRECT

public static final int RPCBPROC_INDIRECT
See Also:
Constant Field Values

RPCBPROC_GETADDRLIST

public static final int RPCBPROC_GETADDRLIST
See Also:
Constant Field Values

RPCBPROC_GETSTAT

public static final int RPCBPROC_GETSTAT
See Also:
Constant Field Values
Constructor Detail

RPCBind

public RPCBind()
        throws RPCError
Constructor that creates and starts the RPCBind service. If another already running RPCBind is detected on the local host, creation is aborted.

Throws:
RPCError - If the RPCBBind could not be started.
Method Detail

main

public static void main(java.lang.String[] args)
Starts a stand-alone RPCBind service (no parameters).


encodeAddress

public static java.lang.String encodeAddress(java.net.InetAddress host,
                                             int port)
Encodes a pair Internet address a and a port number p into a string with format "a.a.a.a.p.p".

Parameters:
host - the Internet address to be encoded.
port - the port number to be encoded.
Returns:
the string with format "a.a.a.a.p.p".

DoCall

public boolean DoCall(int proc,
                      XDRStream xin,
                      XDRStream xout)
Dispatcher Routine that interpretes the call requests.

Overrides:
DoCall in class JRPCServer
Parameters:
proc - The index of the requested function.
xin - read the input-parameter from this XDR stream.
xout - write the return-parameter to this XDR stream.
Returns:
true, if the function with the index proc can be served, false otherwise.

DoVersionCheck

public boolean DoVersionCheck(int vers)
Overwrite this method only if you want your server to handle versions explicitly (by default the version of server and request have to be identical).

Overrides:
DoVersionCheck in class JRPCServer
Parameters:
vers - Version of the server requested by the call.
Returns:
True if the call is accepted, else false.

DoAuth

public Auth DoAuth(int proc,
                   Auth cred,
                   Auth verf)
            throws RPCError
Overwrite this method only if you want your server to check authentication (Default are no checks). Throw an RPCAuthError exception to indicate an authentication failure.

Overrides:
DoAuth in class JRPCServer
Parameters:
proc - The ID of the requested function.
cred - Authentication parameter provided by the client.
verf - Verifier parameter provided by the client.
Returns:
Verifier to send back to the client with the response ("null" means AuthNull).
Throws:
RPCError - If the authentication fails.

IsBatched

public boolean IsBatched(int proc)
Overwrite this method only if you want to implement batched RPCs. Return true for all procedures that are called in batched mode (i.e. no reply message).

Overrides:
IsBatched in class JRPCServer
Parameters:
proc - The ID of the executed function.
Returns:
true if the procedure is called in batched mode.