TI-RPC programming question (yet another...)

TI-RPC programming question (yet another...)

Post by Keith Edwar » Wed, 04 Aug 1993 02:40:51

I've got (what I think is) an interesting design problem.  Pardon me if
my description is too long-winded.  :-)  Jump to the bottom if you don't want
the lead-in and would rather cut to the chase.  Any help would be appreciated.

I'm developing an application using TI-RPC under Solaris 2.2.  In my app
(which is written in C++), I've got a Client class which manages connections
to an RPC server; the application may have multiple instances of Clients.
Each Client establishes a transient program number for callbacks from the
server, and creates a server handle for that program number.

What I want to be able to do is tell which Client instance (more exactly,
which server handle) an RPC callback is destined for.  That is, I want to
be able to run the code to handle the callback within the context of a
particular instance, rather than from some static class member function.

Here's how I'm trying to do this:  whenever Client instances get created,
they create they're own server handle for callbacks via svc_tli_create.
They then stash the local transport address (xprt->xp_ltaddr) in a class-
maintained (static) data structure which maps from struct netbufs to Client

Whenever an RPC callback comes in, it gets sent to a static class member
function for dispatch (the svc_reg call in the Client constructor specifies
the same static class member function to be the handler for all instances).
This dispatch function gets called with an SVCXPRT argument.  It tries to
take the local address out of this (xp_ltaddr) and use it to look up the
Client instance associated with this netbuf, and then call some member
function on that instance.  Essentially, I've got a central class-wide
dispatch function that takes in all of the RPC callbacks and then runs a
member function on a particular instance to handle the callbacks.

The problem is that using xp_ltaddr doesn't seem to be a reliable way of
determining if two Client instances "match."  The xp_ltaddr that comes in
to the dispatch function is zero length.

The essential question is, if I have multiple server handles and I get an
RPC message, is there some particular thing I can look at in the message
or the SVCXPRT that gets passed to me to determine which server handle the
message is associated with?

You'll probably say, "Why install a static class member function to catch all
the incoming RPC messages?"  Good question.  I can't use a non-static member
function because I have to use a pointer to the function in a call to
svc_reg.  Pointers to non-static members are of a different type and won't work
in this call.

Does anyone have any suggestions?

Thanks a lot for any help,


multimedia computing group / georgia tech       404.894.6266
graphics, visualization, & usability center         atlanta, ga  30332-0280


1. RPC Callbacks in TI-RPC [Solaris 2.2]

Hopefully this is a simple question for the TI-RPC knowledgable.

I'm trying to migrate an application from the old non-TI RPC to TI-RPC
under Solaris 2.2.  I'm having some trouble with RPC callbacks.

The older version of the system uses a code fragment from the old SunOS
docs that returns a transient program number by iteratively doing a
pmap_set until it hits an unused program number (pmap_set takes a protocol,
such as IPPROTO_UDP, and so is not transport-independent).

I'm trying to replace this with a bit of code which uses rpcb_set.  I've
got all of the arguments to rpcb_set down, except for the struct netbuf *
that gets passed in.  I'm assuming that this is the address of the server+
service that I'm trying to establish, but I don't know how to get this netbuf.

netdir_getbyname() looks like it would do the trick, except that I have
to pass it the name of the service I'm looking for as a member of its
nd_hostserv argument.  Since this is a transient service used for callbacks,
it doesn't have a registered name.

There may be multiple clients (acting as transient servers for the purpose
of answering callbacks) on a host at a given time, so I can't do something
like hardcode in a program number; I really do need a transient program
number that I can guarantee is not in use.

Unfortunately, the RPC docs no longer have a section on RPC callbacks. :-)

Can anyone offer a clue as to how to do this?



multimedia computing group / georgia tech       404.894.6266
graphics, visualization, & usability center         atlanta, ga  30332-0280

2. Laptop XF86Config: Panasonic CF-41 mk III, 12.1" LCD

3. TI-RPC (ONC+ RPC) for Linux

4. conversion of solaris ASCII file to DOS/mswindows

5. RPC 4.0 vs RPC 4.1 vs TI RPC

6. Help: ODS + Diskarrays on E5000

7. newer TI-RPC (RPCSEC_GSS) distribution?

8. Port reusage in Streams

9. TI-RPC, Has anyone ported it to Linux?

10. which is better? Socket or ONC TI-RPC

11. where the ONC TI-RPC rpcgen for ULTRIX can be find?

12. Sun TI-RPC problem

13. TI-RPC