Port Mapper Protocol

This section explains the port mapper protocol specification.

The following is the port mapper protocol specification in RPC language:

const PMAP_PORT = 111;     /* port mapper port number     */
The mapping of program (prog), version (vers), and protocol (prot) to the port number (port) is shown by the following structure:

struct mapping {
     unsigned int prog;
     unsigned int vers;
     unsigned int prot;
     unsigned int port;
};
The values supported for the prot parameter are:

const IPPROTO_TCP = 6;      /* protocol number for TCP/IP     */
const IPPROTO_UDP = 17;     /* protocol number for UDP        */
The list of mappings takes the following structure:

struct *pmaplist {
     mapping map;
     pmaplist next;
};
The structure for arguments to the callit parameter follows:

struct call_args {
     unsigned int prog;
     unsigned int vers;
     unsigned int proc;
     opaque args<>;
};
The results of the callit parameter have the following structure:

struct call_result {
     unsigned int port;
     opaque res<>;
};
The structure for port mapper procedures follows:

program PMAP_PROG {
     version PMAP_VERS {
          void
          PMAPPROC_NULL(void)          = 0;

     bool
     PMAPPROC_SET(mapping)             = 1;

     bool
     PMAPPROC_UNSET(mapping)           = 2;

     unsigned int
     PMAPPROC_GETPORT(mapping)         = 3;

     pmaplist
     PMAPPROC_DUMP(void)               = 4;

          call_result
          PMAPPROC_CALLIT(call_args)   = 5;
     } = 2;
} = 100000;