Package org.acplt.oncrpc.apps.jportmap

# Class jportmap

java.lang.Object
org.acplt.oncrpc.server.OncRpcServerStub
org.acplt.oncrpc.apps.jportmap.jportmap

All Implemented Interfaces:
  `OncRpcDispatchable`

public class jportmap extends OncRpcServerStub implements OncRpcDispatchable
The class `jportmap` implements a Java-based ONC/RPC port mapper, speaking the widely deployed protocol version 2.

This class can be either used stand-alone (a static `main` is provided for this purpose) or as part of an application. In this case you should check first for another portmap already running before starting your own one.

Version:
  $Revision: 1.2 $ $Date: 2003/08/14 11:26:50 $ $State: Exp $ $Locker: $
Author:
  Harald Albrecht

## Field Summary

Fields
Modifier and Type
Field
Description
`InetAddress[]`
`locals`
List of IP addresses assigned to this host.
`static final int`
`PMAP_PORT`
Well-known port where the portmap process can be found on Internet hosts.
`static final int`
`PMAP_PROGRAM`
Program number of the portmapper as defined in RFC 1832.
`static final int`
`PMAP_VERSION`
Program version number of the portmapper as defined in RFC 1832.
`Vector`
`servers`
The list of registrated servers.

### Fields inherited from class org.acplt.oncrpc.server.OncRpcServerStub

`info, shutdownSignal, transports`

## Constructor Summary

Constructors
Constructor
Description
`jportmap()`
Create a new portmap instance, create the transport registration information and UDP and TCP-based transports, which will be bound later to port 111.

## Method Summary

Modifier and Type
Method
Description
`void`
`dispatchOncRpcCall(OncRpcCallInformation call, int program, int version, int procedure)`
Dispatch incomming ONC/RPC calls to the individual handler functions.
`static void`
`main(String[] args)`
Create an instance of an ONC/RPC portmapper and run it.

### Methods inherited from class org.acplt.oncrpc.server.OncRpcServerStub

`close, getCharacterEncoding, register, registerAuthenticationScheme, run, run, setCharacterEncoding, stopRpcProcessing, unregister`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### locals

public InetAddress[] locals
List of IP addresses assigned to this host. Will be filled later by constructor.

### servers

public Vector servers
The list of registrated servers.

### PMAP_PORT

public static final int PMAP_PORT
Well-known port where the portmap process can be found on Internet hosts.

See Also:
  - Constant Field Values

### PMAP_PROGRAM

public static final int PMAP_PROGRAM
Program number of the portmapper as defined in RFC 1832.

See Also:
  - Constant Field Values

### PMAP_VERSION

public static final int PMAP_VERSION
Program version number of the portmapper as defined in RFC 1832.

See Also:
  - Constant Field Values

## Constructor Details

### jportmap

public jportmap() throws OncRpcException, IOException
Create a new portmap instance, create the transport registration information and UDP and TCP-based transports, which will be bound later to port 111. The constructor does not start the dispatcher loop.

Throws:
  `OncRpcException` - in case of an RPC error.
  `IOException` - in case of an IO error.

## Method Details

### dispatchOncRpcCall

public void dispatchOncRpcCall(OncRpcCallInformation call, int program, int version, int procedure) throws OncRpcException, IOException
Dispatch incomming ONC/RPC calls to the individual handler functions. The CALLIT method is currently unimplemented.

Specified by:
  `dispatchOncRpcCall` in interface `OncRpcDispatchable`
Parameters:
  `call` - The ONC/RPC call, with references to the transport and XDR streams to use for retrieving parameters and sending replies.
  `program` - the portmap's program number, 100000
  `version` - the portmap's protocol version, 2
  `procedure` - the procedure to call.
Throws:
  `OncRpcException` - if an ONC/RPC error occurs.
  `IOException` - if an I/O error occurs.
See Also:
  - `OncRpcCallInformation`

### main

public static void main(String[] args)
Create an instance of an ONC/RPC portmapper and run it. As we have to bootstrap the ONC/RPC port information chain, we do not use the usual overloaded `run()` method without any parameters, but instead supply it the transports to handle. Registration and deregistration is not necessary and not possible.

Parameters:
  `args` - An array containing the command line arguments.