JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
ONC+ Developer's Guide     Oracle Solaris 11 Information Library
search filter icon
search icon

Document Information

Preface

1.  Introduction to ONC+ Technologies

2.  Introduction to TI-RPC

3.  rpcgen Programming Guide

4.  Programmer's Interface to RPC

5.  Advanced RPC Programming Techniques

poll() on the Server Side

Broadcast RPC

Batching

Authentication

AUTH_SYS Authentication

AUTH_DES Authentication

AUTH_KERB Authentication

Authentication Using RPCSEC_GSS

RPCSEC_GSS API

RPCSEC_GSS Routines

Creating a Context

Changing Values and Destroying a Context

Principal Names

Setting Server Principal Names

Generating Client Principal Names

Freeing Principal Names

Receiving Credentials at the Server

Cookies

Callbacks

Maximum Data Size

Miscellaneous Functions

Associated Files

gsscred Table

/etc/gss/qop and /etc/gss/mech

Using Port Monitors

Using inetd

Using the Listener

Multiple Server Versions

Multiple Client Versions

Using Transient RPC Program Numbers

6.  Porting From TS-RPC to TI-RPC

7.  Multithreaded RPC Programming

8.  Extensions to the Oracle Solaris RPC Library

A.  XDR Technical Note

B.  RPC Protocol and Language Specification

C.  XDR Protocol Specification

D.  RPC Code Examples

E.  portmap Utility

Glossary

Index

Using Transient RPC Program Numbers

Occasionally, an application could use RPC program numbers that are generated dynamically. This technique could be used for implementing callback procedures, for example. In the callback example, a client program typically registers an RPC service using a dynamically generated, or transient, RPC program number. The program then passes this number on to a server along with a request. The server then calls back the client program using the transient RPC program number in order to supply the results.

This mechanism might be necessary if processing the client's request takes an excessive amount of time and the client cannot block, assuming it is single threaded. In this case, the server acknowledges the client's request, and calls back later with the results.

Another use of callbacks is to generate periodic reports from a server. The client makes an RPC call to start the reporting, and the server periodically calls back the client with reports using the transient RPC program number supplied by the client program.

Dynamically generated, or transient, RPC program numbers are in the transient range 0x40000000 - 0x5fffffff. The following routine creates a service based on a transient RPC program for a given transport type. The service handle and the transient RPC program number are returned. The caller supplies the service dispatch routine, the version, and the transport type.

Example 5-18 Transient RPC Program–Server Side

SVCXPRT *register_transient_prog(dispatch, program, version, netid)
    void (*dispatch)(); /* service dispatch routine */
    rpcproc_t *program;    /* returned transient RPC number */
    rpcvers_t version;     /* program version */
    char *netid;        /* transport id */
{
    SVCXPRT  *transp;
    struct netconfig *nconf;
    rpcprog_t prognum;
    if ((nconf = getnetconfigent(netid)) == (struct netconfig *)NULL)
        return ((SVCXPRT *)NULL);
    if ((transp = svc_tli_create(RPC_ANYFD, nconf,
            (struct t_bind *)NULL, 0, 0)) == (SVCXPRT *)NULL) {
        freenetconfigent(nconf);
        return ((SVCXPRT *)NULL);
    }
    prognum = 0x40000000;
    while (prognum < 0x60000000 && svc_reg(transp, prognum,
               version, dispatch, nconf) == 0) {
        prognum++;
    }
    freenetconfigent(nconf);
    if (prognum >= 0x60000000) {
        svc_destroy(transp);
        return ((SVCXPRT *)NULL);
    }
    *program = prognum;
    return (transp);
}