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
instances.
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,
-keith
----
multimedia computing group / georgia tech 404.894.6266
graphics, visualization, & usability center atlanta, ga 30332-0280