netbula.ORPC

Class Pmap

Implemented Interfaces:
XDT

public class Pmap
extends java.lang.Object
implements XDT

The Pmap class is the interface to the portmapper. It can query the portmapper, it can also perform broadcast RPCs.

Field Summary

static int
PMAPPORT
static int
PMAPPROC_CALLIT
static int
PMAPPROC_DUMP
static int
PMAPPROC_GETPORT
static int
PMAPPROC_NULL
static int
PMAPPROC_SET
static int
PMAPPROC_UNSET
static int
PMAPPROG
static int
PMAPVERS
static int
PMAPVERS_ORIG
static int
PMAPVERS_PROTO
int
port
int
prog
int
prot
int
vers

Constructor Summary

Pmap()
Pmap(int p, int v, int proto, int portno)
When adding an entry to portmapper, one needs to use this constructor and then call the set() method.

Method Summary

XDT
Clone()
static boolean
broadcastCall(InetAddress baddr, int prog, int vers, int proc, XDT args, XDT res, ReplyHandler handler)
Broadcast RPC (prog, vers, proc, UDP) through portmappers on the net.
static boolean
broadcastCall(String baddr, int prog, int vers, int proc, XDT args, XDT res, ReplyHandler handler)
Broadcast RPC (prog, vers, proc, UDP) through portmappers on the net
pmaplist
dump(InetAddress inetAddress)
Get the list of registered RPC servers from portmapper
XDT[]
getArray(int len)
int
getPort(InetAddress inetAddress)
Get the port number of the RPC defined by (prog, vers, proto)
static int
getPort(String host, int prog, int ver, int proto)
This function returns the server port number.
int
getPortTCP(InetAddress inetAddress)
Get the port number of the RPC defined by (prog, vers, proto), use TCP protocol when communicating with Portmapper
static int
rmtcall(InetAddress serv, int prog, int vers, int proc, XDT args, XDT res, int timeout)
Call the RPC (prog, vers, proc, UDP) through the remote portmapper
boolean
set(InetAddress inetAddress)
Add the entry (prog, ver, proto, port) to the portmapper service.
boolean
unset(InetAddress inetAddress)
Remove the entry (prog, ver, proto, port) from the portmapper service
void
xdr(XDR xdrs)

Field Details

PMAPPORT

public static final int PMAPPORT
Field Value:
111

PMAPPROC_CALLIT

public static final int PMAPPROC_CALLIT
Field Value:
5

PMAPPROC_DUMP

public static final int PMAPPROC_DUMP
Field Value:
4

PMAPPROC_GETPORT

public static final int PMAPPROC_GETPORT
Field Value:
3

PMAPPROC_NULL

public static final int PMAPPROC_NULL
Field Value:
0

PMAPPROC_SET

public static final int PMAPPROC_SET
Field Value:
1

PMAPPROC_UNSET

public static final int PMAPPROC_UNSET
Field Value:
2

PMAPPROG

public static final int PMAPPROG
Field Value:
100000

PMAPVERS

public static final int PMAPVERS
Field Value:
2

PMAPVERS_ORIG

public static final int PMAPVERS_ORIG
Field Value:
1

PMAPVERS_PROTO

public static final int PMAPVERS_PROTO
Field Value:
2

port

public int port

prog

public int prog

prot

public int prot

vers

public int vers

Constructor Details

Pmap

public Pmap()

Pmap

public Pmap(int p,
            int v,
            int proto,
            int portno)
When adding an entry to portmapper, one needs to use this constructor and then call the set() method.

Method Details

Clone

public XDT Clone()
Specified by:
Clone in interface XDT

broadcastCall

public static boolean broadcastCall(InetAddress baddr,
                                    int prog,
                                    int vers,
                                    int proc,
                                    XDT args,
                                    XDT res,
                                    ReplyHandler handler)
            throws rpc_err
Broadcast RPC (prog, vers, proc, UDP) through portmappers on the net.
Parameters:
baddr - broadcast address.
prog - program number of the RPC service
vers - version number of the RPC service
proc - procedure number to call
args - input argument
res - result argument
handler - the reply handler
See Also:
ReplyHandler

broadcastCall

public static boolean broadcastCall(String baddr,
                                    int prog,
                                    int vers,
                                    int proc,
                                    XDT args,
                                    XDT res,
                                    ReplyHandler handler)
            throws rpc_err
Broadcast RPC (prog, vers, proc, UDP) through portmappers on the net
Parameters:
baddr - broadcast address, if null, "255.255.255.255" will be used.
prog - program number of the RPC service
vers - version number of the RPC service
proc - procedure number to call
args - input argument
res - result argument
handler - the reply handler
See Also:
ReplyHandler

dump

public pmaplist dump(InetAddress inetAddress)
            throws rpc_err
Get the list of registered RPC servers from portmapper
Parameters:
inetAddress - internet address of the remote machine
Returns:
list of port map entries

getArray

public XDT[] getArray(int len)
Specified by:
getArray in interface XDT

getPort

public int getPort(InetAddress inetAddress)
            throws rpc_err
Get the port number of the RPC defined by (prog, vers, proto)
Parameters:
inetAddress - address at which the RPC server is running
Returns:
port number of the server

getPort

public static int getPort(String host,
                          int prog,
                          int ver,
                          int proto)
            throws rpc_err,
                   java.net.UnknownHostException
This function returns the server port number.
Parameters:
host - Server hostname
prog - RPC program number
ver - RPC version number
proto - Protocal number
Returns:
Server port number

getPortTCP

public int getPortTCP(InetAddress inetAddress)
            throws rpc_err
Get the port number of the RPC defined by (prog, vers, proto), use TCP protocol when communicating with Portmapper
Parameters:
inetAddress - address at which the RPC server is running
Returns:
port number of the server

rmtcall

public static int rmtcall(InetAddress serv,
                          int prog,
                          int vers,
                          int proc,
                          XDT args,
                          XDT res,
                          int timeout)
            throws rpc_err
Call the RPC (prog, vers, proc, UDP) through the remote portmapper
Parameters:
serv - remote server address
prog - program number of the RPC service
vers - version number of the RPC service
proc - procedure number to call
args - input argument
res - result argument
timeout - Timeout value

set

public boolean set(InetAddress inetAddress)
Add the entry (prog, ver, proto, port) to the portmapper service.
Parameters:
inetAddress - address of the server where portmapper is running
Returns:
true on success, false on failure

unset

public boolean unset(InetAddress inetAddress)
Remove the entry (prog, ver, proto, port) from the portmapper service
Parameters:
inetAddress - address of the server where portmapper is running
Returns:
true on success, false on failure

xdr

public void xdr(XDR xdrs)
            throws XDRError
Specified by:
xdr in interface XDT