{
    "mode": "man",
    "parameter": "RPC",
    "section": "3",
    "url": "https://www.chedong.com/phpMan.php/man/RPC/3/json",
    "generated": "2026-05-30T13:38:47Z",
    "synopsis": "",
    "sections": {
        "NAME": {
            "content": "rpc — library routines for remote procedure calls\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "",
            "subsections": [
                {
                    "name": "#include <rpc/rpc.h>",
                    "content": ""
                },
                {
                    "name": "#include <netconfig.h>",
                    "content": ""
                }
            ]
        },
        "DESCRIPTION": {
            "content": "These routines allow C language programs to make procedure calls on other machines across a\nnetwork.  First, the client sends a request to the server.  On receipt of the request, the\nserver calls a dispatch routine to perform the requested service, and then sends back a reply.\n\nAll RPC routines require the header <rpc/rpc.h>.  Routines that take a struct netconfig also\nrequire that <netconfig.h> be included.\n",
            "subsections": []
        },
        "Nettype": {
            "content": "Some of the high-level RPC interface routines take a nettype string as one of the arguments\n(for example, clntcreate(), svccreate(), rpcreg(), rpccall()).  This string defines a class\nof transports which can be used for a particular application.\n\nThe nettype argument can be one of the following:\n\nnetpath     Choose from the transports which have been indicated by their token names in the\nNETPATH environment variable.  NETPATH is unset or NULL, it defaults to \"visible\".\n\"netpath\" is the default nettype.\n\nvisible     Choose the transports which have the visible flag (v) set in the /etc/netconfig\nfile.\n\ncircuitv   This is same as \"visible\" except that it chooses only the connection oriented\ntransports (semantics \"tpicots\" or \"tpicotsord\") from the entries in the\n/etc/netconfig file.\n\ndatagramv  This is same as \"visible\" except that it chooses only the connectionless datagram\ntransports (semantics \"tpiclts\") from the entries in the /etc/netconfig file.\n\ncircuitn   This is same as \"netpath\" except that it chooses only the connection oriented data‐\ngram transports (semantics \"tpicots\" or \"tpicotsord\").\n\ndatagramn  This is same as \"netpath\" except that it chooses only the connectionless datagram\ntransports (semantics \"tpiclts\").\n\nudp         This refers to Internet UDP, both version 4 and 6.\n\ntcp         This refers to Internet TCP, both version 4 and 6.\n\nIf nettype is NULL, it defaults to \"netpath\".  The transports are tried in left to right order\nin the NETPATH variable or in top to down order in the /etc/netconfig file.\n",
            "subsections": [
                {
                    "name": "Derived Types",
                    "content": "The derived types used in the RPC interfaces are defined as follows:\n\ntypedef uint32t rpcprogt;\ntypedef uint32t rpcverst;\ntypedef uint32t rpcproct;\ntypedef uint32t rpcprott;\ntypedef uint32t rpcportt;\ntypedef   int32t rpcinlinet;\n"
                },
                {
                    "name": "Data Structures",
                    "content": "Some of the data structures used by the RPC package are shown below.\n"
                },
                {
                    "name": "The AUTH Structure",
                    "content": "/*\n* Authentication info. Opaque to client.\n*/\nstruct opaqueauth {\nenumt    oaflavor;    /* flavor of auth */\ncaddrt    oabase;    /* address of more auth stuff */\nuint    oalength;    /* not to exceed MAXAUTHBYTES */\n};\n\n/*\n* Auth handle, interface to client side authenticators.\n*/\ntypedef struct {\nstruct    opaqueauth    ahcred;\nstruct    opaqueauth    ahverf;\nstruct authops {\nvoid    (*ahnextverf)();\nint    (*ahmarshal)();    /* nextverf & serialize */\nint    (*ahvalidate)();    /* validate verifier */\nint    (*ahrefresh)();    /* refresh credentials */\nvoid    (*ahdestroy)();    /* destroy this structure */\n} *ahops;\ncaddrt ahprivate;\n} AUTH;\n"
                },
                {
                    "name": "The CLIENT Structure",
                    "content": "/*\n* Client rpc handle.\n* Created by individual implementations.\n* Client is responsible for initializing auth.\n*/\n\ntypedef struct {\nAUTH    *clauth;    /* authenticator */\nstruct clntops {\nenum clntstat    (*clcall)();    /* call remote procedure */\nvoid    (*clabort)();        /* abort a call */\nvoid    (*clgeterr)();        /* get specific error code */\nboolt    (*clfreeres)();    /* frees results */\nvoid    (*cldestroy)();    /* destroy this structure */\nboolt    (*clcontrol)();    /* the ioctl() of rpc */\n} *clops;\ncaddrt    clprivate;    /* private stuff */\nchar    *clnetid;    /* network identifier */\nchar    *cltp;        /* device name */\n} CLIENT;\n"
                },
                {
                    "name": "The SVCXPRT structure",
                    "content": "enum xprtstat {\nXPRTDIED,\nXPRTMOREREQS,\nXPRTIDLE\n};\n\n/*\n* Server side transport handle\n*/\ntypedef struct {\nint    xpfd;    /* file descriptor for the server handle */\nushort    xpport;    /* obsolete */\nconst struct xpops {\nboolt    (*xprecv)();    /* receive incoming requests */\nenum xprtstat    (*xpstat)();    /* get transport status */\nboolt    (*xpgetargs)();    /* get arguments */\nboolt    (*xpreply)();      /* send reply */\nboolt    (*xpfreeargs)(); /* free mem allocated for args */\nvoid    (*xpdestroy)();    /* destroy this struct */\n} *xpops;\nint    xpaddrlen;    /* length of remote addr.  Obsolete */\nstruct sockaddrin    xpraddr; /* Obsolete */\nconst struct xpops2 {\nboolt    (*xpcontrol)();    /* catch-all function */\n} *xpops2;\nchar    *xptp;    /* transport provider device name */\nchar    *xpnetid;    /* network identifier */\nstruct netbuf    xpltaddr;    /* local transport address */\nstruct netbuf    xprtaddr;    /* remote transport address */\nstruct opaqueauth    xpverf;    /* raw response verifier */\ncaddrt    xpp1;    /* private: for use by svc ops */\ncaddrt    xpp2;    /* private: for use by svc ops */\ncaddrt    xpp3;    /* private: for use by svc lib */\nint    xptype    /* transport type */\n} SVCXPRT;\n"
                }
            ]
        },
        "The svcreg structure": {
            "content": "struct svcreq {\nrpcprogt    rqprog;    /* service program number */\nrpcverst    rqvers;    /* service protocol version */\nrpcproct    rqproc;    /* the desired procedure */\nstruct opaqueauth    rqcred;    /* raw creds from the wire */\ncaddrt    rqclntcred;    /* read only cooked cred */\nSVCXPRT    *rqxprt;    /* associated transport */\n};\n",
            "subsections": [
                {
                    "name": "The XDR structure",
                    "content": "/*\n* XDR operations.\n* XDRENCODE causes the type to be encoded into the stream.\n* XDRDECODE causes the type to be extracted from the stream.\n* XDRFREE can be used to release the space allocated by an XDRDECODE\n* request.\n*/\nenum xdrop {\nXDRENCODE=0,\nXDRDECODE=1,\nXDRFREE=2\n};\n/*\n* This is the number of bytes per unit of external data.\n*/\n#define BYTESPERXDRUNIT    (4)\n#define RNDUP(x)  ((((x) + BYTESPERXDRUNIT - 1) /\nBYTESPERXDRUNIT) \\ * BYTESPERXDRUNIT)\n\n/*\n* A xdrproct exists for each data type which is to be encoded or\n* decoded.  The second argument to the xdrproct is a pointer to\n* an opaque pointer.  The opaque pointer generally points to a\n* structure of the data type to be decoded.  If this points to 0,\n* then the type routines should allocate dynamic storage of the\n* appropriate size and return it.\n* boolt  (*xdrproct)(XDR *, caddrt *);\n*/\ntypedef  boolt (*xdrproct)();\n\n/*\n* The XDR handle.\n* Contains operation which is being applied to the stream,\n* an operations vector for the particular implementation\n*/\ntypedef struct {\nenum xdrop    xop;    /* operation; fast additional param */\nstruct xdrops {\nboolt    (*xgetlong)();    /* get a long from underlying stream */\nboolt    (*xputlong)();    /* put a long to underlying stream */\nboolt    (*xgetbytes)(); /* get bytes from underlying stream */\nboolt    (*xputbytes)(); /* put bytes to underlying stream */\nuint    (*xgetpostn)(); /* returns bytes off from beginning */\nboolt    (*xsetpostn)(); /* lets you reposition the stream */\nlong *    (*xinline)();    /* buf quick ptr to buffered data */\nvoid    (*xdestroy)();    /* free privates of this xdrstream */\n} *xops;\ncaddrt    xpublic;    /* users' data */\ncaddrt    xprivate;    /* pointer to private data */\ncaddrt    xbase;    /* private used for position info */\nuint    xhandy;    /* extra private word */\n} XDR;\n\n/*\n* The netbuf structure. This structure is defined in <xti.h> on SysV\n* systems, but NetBSD / FreeBSD do not use XTI.\n*\n* Usually, buf will point to a struct sockaddr, and len and maxlen\n* will contain the length and maximum length of that socket address,\n* respectively.\n*/\nstruct netbuf {\nunsigned int maxlen;\nunsigned int len;\nvoid *buf;\n};\n\n/*\n* The format of the address and options arguments of the XTI tbind call.\n* Only provided for compatibility, it should not be used other than\n* as an argument to svctlicreate().\n*/\n\nstruct tbind {\nstruct netbuf   addr;\nunsigned int    qlen;\n};\n"
                },
                {
                    "name": "Index to Routines",
                    "content": "The following table lists RPC routines and the manual reference pages on which they are de‐\nscribed:\n\nRPC Routine                Manual Reference Page\n\nauthdestroy()             rpcclntauth(3)\nauthdescreate()           rpcsoc(3)\nauthnonecreate()          rpcclntauth(3)\nauthsyscreate()           rpcclntauth(3)\nauthsyscreatedefault()   rpcclntauth(3)\nauthunixcreate()          rpcsoc(3)\nauthunixcreatedefault()  rpcsoc(3)\ncallrpc()                  rpcsoc(3)\nclntbroadcast()           rpcsoc(3)\nclntcall()                rpcclntcalls(3)\nclntcontrol()             rpcclntcreate(3)\nclntcreate()              rpcclntcreate(3)\nclntcreatetimed()        rpcclntcreate(3)\nclntcreatevers()         rpcclntcreate(3)\nclntcreateverstimed()   rpcclntcreate(3)\nclntdestroy()             rpcclntcreate(3)\nclntdgcreate()           rpcclntcreate(3)\nclntfreeres()             rpcclntcalls(3)\nclntgeterr()              rpcclntcalls(3)\nclntpcreateerror()        rpcclntcreate(3)\nclntperrno()              rpcclntcalls(3)\nclntperror()              rpcclntcalls(3)\nclntrawcreate()          rpcclntcreate(3)\nclntspcreateerror()       rpcclntcreate(3)\nclntsperrno()             rpcclntcalls(3)\nclntsperror()             rpcclntcalls(3)\nclnttlicreate()          rpcclntcreate(3)\nclnttpcreate()           rpcclntcreate(3)\nclnttpcreatetimed()     rpcclntcreate(3)\nclntudpcreate()           rpcsoc(3)\nclntvccreate()           rpcclntcreate(3)\nclntrawcreate()           rpcsoc(3)\nclnttcpcreate()           rpcsoc(3)\nclntudpbufcreate()        rpcsoc(3)\ngetmyaddress()            rpcsoc(3)\npmapgetmaps()             rpcsoc(3)\npmapgetport()             rpcsoc(3)\npmaprmtcall()             rpcsoc(3)\npmapset()                 rpcsoc(3)\npmapunset()               rpcsoc(3)\nregisterrpc()              rpcsoc(3)\nrpcbroadcast()            rpcclntcalls(3)\nrpcbroadcastexp()        rpcclntcalls(3)\nrpccall()                 rpcclntcalls(3)\nrpcreg()                  rpcsvccalls(3)\nsvccreate()               rpcsvccreate(3)\nsvcdestroy()              rpcsvccreate(3)\nsvcdgcreate()            rpcsvccreate(3)\nsvcdgenablecache()       rpcsvccalls(3)\nsvcfdcreate()            rpcsvccreate(3)\nsvcfds()                  rpcsoc(3)\nsvcfreeargs()             rpcsvcreg(3)\nsvcgetargs()              rpcsvcreg(3)\nsvcgetcaller()            rpcsoc(3)\nsvcgetreq()               rpcsoc(3)\nsvcgetreqset()            rpcsvccalls(3)\nsvcgetrpccaller()         rpcsvccalls(3)\nsvckerbreg()             kerberosrpc(3)\nsvcrawcreate()           rpcsvccreate(3)\nsvcreg()                  rpcsvccalls(3)\nsvcregister()             rpcsoc(3)\nsvcrun()                  rpcsvcreg(3)\nsvcsendreply()            rpcsvcreg(3)\nsvctlicreate()           rpcsvccreate(3)\nsvctpcreate()            rpcsvccreate(3)\nsvcunreg()                rpcsvccalls(3)\nsvcunregister()           rpcsoc(3)\nsvcvccreate()            rpcsvccreate(3)\nsvcerrauth()              rpcsvcerr(3)\nsvcerrdecode()            rpcsvcerr(3)\nsvcerrnoproc()            rpcsvcerr(3)\nsvcerrnoprog()            rpcsvcerr(3)\nsvcerrprogvers()          rpcsvcerr(3)\nsvcerrsystemerr()         rpcsvcerr(3)\nsvcerrweakauth()          rpcsvcerr(3)\nsvcfdcreate()             rpcsoc(3)\nsvcrawcreate()            rpcsoc(3)\nsvctcpcreate()            rpcsoc(3)\nsvcudpbufcreate()         rpcsoc(3)\nsvcudpcreate()            rpcsoc(3)\nxdracceptedreply()       rpcxdr(3)\nxdrauthsysparms()        rpcxdr(3)\nxdrauthunixparms()       rpcsoc(3)\nxdrcallhdr()              rpcxdr(3)\nxdrcallmsg()              rpcxdr(3)\nxdropaqueauth()          rpcxdr(3)\nxdrrejectedreply()       rpcxdr(3)\nxdrreplymsg()             rpcxdr(3)\nxprtregister()            rpcsvccalls(3)\nxprtunregister()          rpcsvccalls(3)\n"
                }
            ]
        },
        "FILES": {
            "content": "/etc/netconfig\n",
            "subsections": []
        },
        "AVAILABILITY": {
            "content": "These functions are part of libtirpc.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "getnetconfig(3), getnetpath(3), rpcbind(3), rpcclntauth(3), rpcclntcalls(3),\nrpcclntcreate(3), rpcsvccalls(3), rpcsvccreate(3), rpcsvcerr(3), rpcsvcreg(3),\nrpcxdr(3), xdr(3), netconfig(5)\n\nBSD                               May 7, 1993                              BSD",
            "subsections": []
        }
    },
    "summary": "rpc — library routines for remote procedure calls",
    "flags": [],
    "examples": [],
    "see_also": [
        {
            "name": "getnetconfig",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/getnetconfig/3/json"
        },
        {
            "name": "getnetpath",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/getnetpath/3/json"
        },
        {
            "name": "rpcbind",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/rpcbind/3/json"
        },
        {
            "name": "rpcclntauth",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/rpcclntauth/3/json"
        },
        {
            "name": "rpcclntcalls",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/rpcclntcalls/3/json"
        },
        {
            "name": "rpcclntcreate",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/rpcclntcreate/3/json"
        },
        {
            "name": "rpcsvccalls",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/rpcsvccalls/3/json"
        },
        {
            "name": "rpcsvccreate",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/rpcsvccreate/3/json"
        },
        {
            "name": "rpcsvcerr",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/rpcsvcerr/3/json"
        },
        {
            "name": "rpcsvcreg",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/rpcsvcreg/3/json"
        },
        {
            "name": "rpcxdr",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/rpcxdr/3/json"
        },
        {
            "name": "xdr",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/xdr/3/json"
        },
        {
            "name": "netconfig",
            "section": "5",
            "url": "https://www.chedong.com/phpMan.php/man/netconfig/5/json"
        }
    ]
}