Obtains a unique systemwide procedure identification number. Format #include <rpc/rpc.h> int registerrpc(u_long prognum, u_long versnum, u_long procnum, char *(*progname)(), xdrproc_t inproc, xdrproc_t outproc );
1 – Arguments
prognum The program number associated with the service procedure. versnum The version number associated with the service procedure. procnum The procedure number associated with the service procedure. progname The address of the service procedure being registered with the ONC RPC service package. inproc The XDR routine used to decode the service procedure's arguments. outproc The XDR routine used to encode the service procedure's results.
2 – Description
The registerrpc routine performs the following tasks for a server: o Creates a UDP server handle. See the svcudp_create routine for restrictions. o Calls the svc_register routine to register the program with the Portmapper. o Adds prognum, versnum, and procnum to an internal list of registered procedures. When the server receives a request, it uses this list to determine which routine to call. A server should call registerrpc for every procedure it implements, except for the NULL procedure. If a request arrives for program prognum, version versnum, and procedure procnum, progname is called with a pointer to its parameters.
3 – Return Values
0 Indicates success. -1 Indicates failure.