JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
ONC+ Developer's Guide     Oracle Solaris 11.1 Information Library
search filter icon
search icon

Document Information


1.  Introduction to ONC+ Technologies

2.  Introduction to TI-RPC

3.  rpcgen Programming Guide

4.  Programmer's Interface to RPC

5.  Advanced RPC Programming Techniques

6.  Porting From TS-RPC to TI-RPC

7.  Multithreaded RPC Programming

8.  Extensions to the Oracle Solaris RPC Library

A.  XDR Technical Note

B.  RPC Protocol and Language Specification

C.  XDR Protocol Specification

D.  RPC Code Examples

E.  portmap Utility

System Registration Overview

portmap Protocol

portmap Operation









portmap Protocol

The portmap program maps RPC program and version numbers to transport-specific port numbers. This program makes dynamic binding of remote programs possible.

Figure E-1 Typical Portmap Sequence (For TCP/IP Only)

image:Text describes graphic.

The figure illustrates the following process:

  1. The server registers with portmap.

  2. The client gets the server's port from portmap.

  3. The client calls the server.

The range of reserved port numbers is small and the number of potential remote programs is very large. By running only the port mapper on a well-known port, the port numbers of other remote programs can be ascertained by querying the port mapper. In Figure E-1, a, 111, b, and c represent port numbers, and 111 is the assigned port-mapper port number.

The port mapper also aids in broadcast RPC. A given RPC program usually has different port number bindings on different machines, so no direct broadcasts are possible to all of these programs. The port mapper, however, does have a fixed port number. So, to broadcast to a given program, the client sends its message to the port mapper located at the broadcast address. Each port mapper that receives the broadcast then calls the local service specified by the client. When portmap gets the reply from the local service, it returns the reply to the client. The portmap protocol specification is shown in the following code example.

Example E-1 portmap Protocol Specification (in RPC Language)

const PMAP_PORT = 111;       /* portmapper port number */
  * A mapping of (program, version, protocol) to port number
 struct pmap {
     rpcprog_t prog;
     rpcvers_t vers;
     rpcprot_t prot;
     rpcport_t port;
  * Supported values for the "prot" field
 const IPPROTO_TCP = 6; /* protocol number for TCP/IP */
 const IPPROTO_UDP = 17; /* protocol number for UDP/IP */
  * A list of mappings
 struct pmaplist {
     pmap map;
     pmaplist *next;
  * Arguments to callit
 struct call_args {
     rpcprog_t prog;
 rpcvers_t vers;
 rpcproc_t proc;
     opaque args<>;
 * Results of callit
 struct call_result {
     rpcport_t port;
     opaque res<>;
 * Port mapper procedures
 program PMAP_PROG {
     version PMAP_VERS {
         PMAPPROC_NULL(void) = 0;
         PMAPPROC_SET(pmap) = 1;
         PMAPPROC_UNSET(pmap) = 2;
         unsigned int
         PMAPPROC_GETPORT(pmap) = 3;
         PMAPPROC_DUMP(void) = 4;
         PMAPPROC_CALLIT(call_args) = 5;
     } = 2;
 } = 100000;