Sun RPC is a remote procedure call mechanism originally defined to support NFS. The mechanism defines an interface definition language and data encoding, together called External Data Representation (XDR).
const MNTPATHLEN = 1024; /* maximum bytes in a pathname argument */ const MNTNAMLEN = 255; /* maximum bytes in a name argument */ const FHSIZE = 32; /* size in bytes of a file handle */ typedef opaque fhandle [FHSIZE]; typedef string name <MNTNAMLEN>; typedef string dirpath <MNTPATHLEN>; union fhstatus switch (unsigned fhs_status) { case 0: fhandle fhs_fhandle; default: void; }; typedef struct mountbody *mountlist; struct mountbody { name ml_hostname; dirpath ml_directory; mountlist ml_next; }; typedef struct groupnode *groups; struct groupnode { name gr_name; groups gr_next; }; typedef struct exportnode *exports; struct exportnode { dirpath ex_dir; groups ex_groups; exports ex_next; }; program MOUNTPROG { version MOUNTVERS { void MOUNTPROC_NULL (void) = 0; fhstatus MOUNTPROC_MNT (dirpath) = 1; mountlist MOUNTPROC_DUMP (void) = 2; void MOUNTPROC_UMNT (dirpath) = 3; void MOUNTPROC_UMNTALL (void) = 4; exports MOUNTPROC_EXPORT (void) = 5; exports MOUNTPROC_EXPORTALL (void) = 6; } = 1; } = 100005;
Each function is identified by a unique combination of service ID, version ID and function ID. Servers are registered in the RPC port mapper service, which provides standard registry features.
> rpcinfo -p program vers proto port 100000 2 tcp 111 portmapper 100000 2 udp 111 portmapper 100011 1 udp 892 rquotad 100011 2 udp 892 rquotad 100011 1 tcp 895 rquotad 100011 2 tcp 895 rquotad 100003 2 udp 2049 nfs 100003 3 udp 2049 nfs 100021 1 udp 39968 nlockmgr 100021 3 udp 39968 nlockmgr 100021 4 udp 39968 nlockmgr 100005 1 udp 39969 mountd 100005 1 tcp 45529 mountd 100005 2 udp 39969 mountd 100005 2 tcp 45529 mountd 100005 3 udp 39969 mountd 100005 3 tcp 45529 mountd 100024 1 udp 39970 status 100024 1 tcp 45530 status 391002 2 tcp 45533 sgi_fam
RFC 5531: Remote Procedure Call Protocol Specification Version 2. https://tools.ietf.org/html/rfc5531