端口映射器协议

本节说明了端口映射器协议规范。

以下是 RPC 语言的端口映射器协议规范:

const PMAP_PORT = 111;     /* port mapper port number     */
以下结构显示程序 (prog) ,版本 (vers) 和协议 (prot) 到端口号 (port) 的映射:

struct mapping {
     unsigned int prog;
     unsigned int vers;
     unsigned int prot;
     unsigned int port;
};
支持的值prot参数为:

const IPPROTO_TCP = 6;      /* protocol number for TCP/IP     */
const IPPROTO_UDP = 17;     /* protocol number for UDP        */
映射列表采用以下结构:

struct *pmaplist {
     mapping map;
     pmaplist next;
};
参数的结构callit参数如下:

struct call_args {
     unsigned int prog;
     unsigned int vers;
     unsigned int proc;
     opaque args<>;
};
结果callit参数具有以下结构:

struct call_result {
     unsigned int port;
     opaque res<>;
};
端口映射器过程的结构如下所示:

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;