# phpman > man > rpc_svc_reg(3)

[RPC_SVC_REG(3)](https://www.chedong.com/phpMan.php/man/RPCSVCREG/3/markdown)           BSD Library Functions Manual           [RPC_SVC_REG(3)](https://www.chedong.com/phpMan.php/man/RPCSVCREG/3/markdown)

## NAME
     **rpc**___**svc**___**reg**, **rpc**___**reg**, **svc**___**reg**, **svc**___**unreg**, **svc**___**auth**___**reg**, **xprt**___**register**, **xprt**___**unregister** — li‐
     brary routines for registering servers

## SYNOPSIS
### #include <rpc/rpc.h>

     _int_
     **rpc**___**reg**(_rpcprog_t_ _prognum_, _rpcvers_t_ _versnum_, _rpcproc_t_ _procnum_, _char_ _*(*procname)()_,
         _xdrproc_t_ _inproc_, _xdrproc_t_ _outproc_, _char_ _*nettype_);

     _bool_t_
     **svc**___**reg**(_SVCXPRT_ _*xprt_, _const_ _rpcprog_t_ _prognum_, _const_ _rpcvers_t_ _versnum_,
         _void_ _(*dispatch)(struct_ _svc_req_ _*,_ _SVCXPRT_ _*)_, _const_ _struct_ _netconfig_ _*netconf_);

     _void_
     **svc**___**unreg**(_const_ _rpcprog_t_ _prognum_, _const_ _rpcvers_t_ _versnum_);

     _int_
     **svc**___**auth**___**reg**(_int_ _cred_flavor_, _enum_ _auth_stat_ _(*handler)(struct_ _svc_req_ _*,_ _struct_ _rpc_msg_ _*)_);

     _void_
     **xprt**___**register**(_SVCXPRT_ _*xprt_);

     _void_
     **xprt**___**unregister**(_SVCXPRT_ _*xprt_);

## DESCRIPTION
     These routines are a part of the RPC library which allows the RPC servers to register them‐
     selves with rpcbind (see [rpcbind(8)](https://www.chedong.com/phpMan.php/man/rpcbind/8/markdown)), and associate the given program and version number with
     the dispatch function.  When the RPC server receives a RPC request, the library invokes the
     dispatch routine with the appropriate arguments.

## Routines
     See [rpc(3)](https://www.chedong.com/phpMan.php/man/rpc/3/markdown) for the definition of the _SVCXPRT_ data structure.

     **rpc**___**reg**()
            Register program _prognum_, procedure _procname_, and version _versnum_ with the RPC service
            package.  If a request arrives for program _prognum_, version _versnum_, and procedure
            _procnum_, _procname_ is called with a pointer to its argument(s); _procname_ should return a
            pointer to its static result(s); _inproc_ is the XDR function used to decode the arguments
            while _outproc_ is the XDR function used to encode the results.  Procedures are registered
            on all available transports of the class _nettype_.  See [rpc(3)](https://www.chedong.com/phpMan.php/man/rpc/3/markdown).  This routine returns 0
            if the registration succeeded, -1 otherwise.

     **svc**___**reg**()
            Associates _prognum_ and _versnum_ with the service dispatch procedure, _dispatch_.  If
            _netconf_ is NULL, the service is not registered with the [rpcbind(8)](https://www.chedong.com/phpMan.php/man/rpcbind/8/markdown) service.  If _netconf_
            is non-zero, then a mapping of the triple [_prognum_, _versnum_, _netconf->nc_netid_] to
            _xprt->xp_ltaddr_ is established with the local rpcbind service.

            The **svc**___**reg**() routine returns 1 if it succeeds, and 0 otherwise.

     **svc**___**unreg**()
            Remove from the rpcbind service, all mappings of the triple [_prognum_, _versnum_,
            all-transports] to network address and all mappings within the RPC service package of
            the double [_prognum_, _versnum_] to dispatch routines.

     **svc**___**auth**___**reg**()
            Registers the service authentication routine _handler_ with the dispatch mechanism so that
            it can be invoked to authenticate RPC requests received with authentication type
            _cred_flavor_.  This interface allows developers to add new authentication types to their
            RPC applications without needing to modify the libraries.  Service implementors usually
            do not need this routine.

            Typical service application would call **svc**___**auth**___**reg**() after registering the service and
            prior to calling **svc**___**run**().  When needed to process an RPC credential of type
            _cred_flavor_, the _handler_ procedure will be called with two arguments, _struct_ _svc_req_
            _*rqst_ and _struct_ _rpc_msg_ _*msg_, and is expected to return a valid _enum_ _auth_stat_ value.
            There is no provision to change or delete an authentication handler once registered.

            The **svc**___**auth**___**reg**() routine returns 0 if the registration is successful, 1 if _cred_flavor_
            already has an authentication handler registered for it, and -1 otherwise.

     **xprt**___**register**()
            After RPC service transport handle _xprt_ is created, it is registered with the RPC ser‐
            vice package.  This routine modifies the global variable _svc_fdset_ (see
            [rpc_svc_calls(3)](https://www.chedong.com/phpMan.php/man/rpcsvccalls/3/markdown)).  Service implementors usually do not need this routine.

     **xprt**___**unregister**()
            Before an RPC service transport handle _xprt_ is destroyed, it unregisters itself with the
            RPC service package.  This routine modifies the global variable _svc_fdset_ (see
            [rpc_svc_calls(3)](https://www.chedong.com/phpMan.php/man/rpcsvccalls/3/markdown)).  Service implementors usually do not need this routine.

## AVAILABILITY
     These functions are part of libtirpc.

## SEE ALSO
     [select(2)](https://www.chedong.com/phpMan.php/man/select/2/markdown), [rpc(3)](https://www.chedong.com/phpMan.php/man/rpc/3/markdown), [rpcbind(3)](https://www.chedong.com/phpMan.php/man/rpcbind/3/markdown), [rpc_svc_calls(3)](https://www.chedong.com/phpMan.php/man/rpcsvccalls/3/markdown), [rpc_svc_create(3)](https://www.chedong.com/phpMan.php/man/rpcsvccreate/3/markdown), [rpc_svc_err(3)](https://www.chedong.com/phpMan.php/man/rpcsvcerr/3/markdown), [rpcbind(8)](https://www.chedong.com/phpMan.php/man/rpcbind/8/markdown)

BSD                               May 3, 1993                              BSD
