{
    "mode": "man",
    "parameter": "rpc_svc_reg",
    "section": "3",
    "url": "https://www.chedong.com/phpMan.php/man/rpc_svc_reg/3/json",
    "generated": "2026-06-15T13:16:38Z",
    "synopsis": "",
    "sections": {
        "NAME": {
            "content": "rpcsvcreg, rpcreg, svcreg, svcunreg, svcauthreg, xprtregister, xprtunregister — li‐\nbrary routines for registering servers\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "",
            "subsections": [
                {
                    "name": "#include <rpc/rpc.h>",
                    "content": "int\nrpcreg(rpcprogt prognum, rpcverst versnum, rpcproct procnum, char *(*procname)(),\nxdrproct inproc, xdrproct outproc, char *nettype);\n\nboolt\nsvcreg(SVCXPRT *xprt, const rpcprogt prognum, const rpcverst versnum,\nvoid (*dispatch)(struct svcreq *, SVCXPRT *), const struct netconfig *netconf);\n\nvoid\nsvcunreg(const rpcprogt prognum, const rpcverst versnum);\n\nint\nsvcauthreg(int credflavor, enum authstat (*handler)(struct svcreq *, struct rpcmsg *));\n\nvoid\nxprtregister(SVCXPRT *xprt);\n\nvoid\nxprtunregister(SVCXPRT *xprt);\n"
                }
            ]
        },
        "DESCRIPTION": {
            "content": "These routines are a part of the RPC library which allows the RPC servers to register them‐\nselves with rpcbind (see rpcbind(8)), and associate the given program and version number with\nthe dispatch function.  When the RPC server receives a RPC request, the library invokes the\ndispatch routine with the appropriate arguments.\n",
            "subsections": []
        },
        "Routines": {
            "content": "See rpc(3) for the definition of the SVCXPRT data structure.\n\nrpcreg()\nRegister program prognum, procedure procname, and version versnum with the RPC service\npackage.  If a request arrives for program prognum, version versnum, and procedure\nprocnum, procname is called with a pointer to its argument(s); procname should return a\npointer to its static result(s); inproc is the XDR function used to decode the arguments\nwhile outproc is the XDR function used to encode the results.  Procedures are registered\non all available transports of the class nettype.  See rpc(3).  This routine returns 0\nif the registration succeeded, -1 otherwise.\n\nsvcreg()\nAssociates prognum and versnum with the service dispatch procedure, dispatch.  If\nnetconf is NULL, the service is not registered with the rpcbind(8) service.  If netconf\nis non-zero, then a mapping of the triple [prognum, versnum, netconf->ncnetid] to\nxprt->xpltaddr is established with the local rpcbind service.\n\nThe svcreg() routine returns 1 if it succeeds, and 0 otherwise.\n\nsvcunreg()\nRemove from the rpcbind service, all mappings of the triple [prognum, versnum,\nall-transports] to network address and all mappings within the RPC service package of\nthe double [prognum, versnum] to dispatch routines.\n\nsvcauthreg()\nRegisters the service authentication routine handler with the dispatch mechanism so that\nit can be invoked to authenticate RPC requests received with authentication type\ncredflavor.  This interface allows developers to add new authentication types to their\nRPC applications without needing to modify the libraries.  Service implementors usually\ndo not need this routine.\n\nTypical service application would call svcauthreg() after registering the service and\nprior to calling svcrun().  When needed to process an RPC credential of type\ncredflavor, the handler procedure will be called with two arguments, struct svcreq\n*rqst and struct rpcmsg *msg, and is expected to return a valid enum authstat value.\nThere is no provision to change or delete an authentication handler once registered.\n\nThe svcauthreg() routine returns 0 if the registration is successful, 1 if credflavor\nalready has an authentication handler registered for it, and -1 otherwise.\n\nxprtregister()\nAfter RPC service transport handle xprt is created, it is registered with the RPC ser‐\nvice package.  This routine modifies the global variable svcfdset (see\nrpcsvccalls(3)).  Service implementors usually do not need this routine.\n\nxprtunregister()\nBefore an RPC service transport handle xprt is destroyed, it unregisters itself with the\nRPC service package.  This routine modifies the global variable svcfdset (see\nrpcsvccalls(3)).  Service implementors usually do not need this routine.\n",
            "subsections": []
        },
        "AVAILABILITY": {
            "content": "These functions are part of libtirpc.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "select(2), rpc(3), rpcbind(3), rpcsvccalls(3), rpcsvccreate(3), rpcsvcerr(3), rpcbind(8)\n\nBSD                               May 3, 1993                              BSD",
            "subsections": []
        }
    },
    "summary": "rpcsvcreg, rpcreg, svcreg, svcunreg, svcauthreg, xprtregister, xprtunregister — li‐ brary routines for registering servers",
    "flags": [],
    "examples": [],
    "see_also": [
        {
            "name": "select",
            "section": "2",
            "url": "https://www.chedong.com/phpMan.php/man/select/2/json"
        },
        {
            "name": "rpc",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/rpc/3/json"
        },
        {
            "name": "rpcbind",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/rpcbind/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": "rpcbind",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/rpcbind/8/json"
        }
    ]
}