From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f678f,897502692464f25e X-Google-Attributes: gidf678f,public X-Google-ArrivalTime: 1993-06-15 02:56:54 PST Path: gmd.de!xlink.net!howland.reston.ans.net!noc.near.net!uunet!pipex!uknet!zaphod.axion.bt.co.uk!nwinton From: nwinton@axion.bt.co.uk (Neil Winton) Newsgroups: comp.unix.osf.misc Subject: Re: Multiple DCE Servers with the same Interface Date: 15 Jun 1993 09:56:03 GMT Organization: BT Laboratories Distribution: world Message-ID: <1vk6bj$ooi@zaphod.axion.bt.co.uk> References: NNTP-Posting-Host: newton.axion.bt.co.uk In article , cs89bps@brunel.ac.uk (Barry P Sheward) writes: |> It's possible to have a single server export the same |> interface several times using different names in the DCE namespace, |> and have the RPC runtime "decide" which function to call to execute |> each RPC based on which name service entry the client used to find its |> binding. |> |> Could you give an example of how you would do this, or point me to |> an example somewhere please ? The behaviour of DCE with multiple instances of the same interface on the same machine confused me when I first came across it. If you look at the comments in /usr/include/dce/rpc.idl (a very useful source first port of call for information before delving into the full documentation!) you will see the following comment: /* * R P C _ E P _ R E G I S T E R * * Register entries with the local Endpoint Map. Endpoint map entries * logically consist of tuples. * The object_uuid_vec and annotation are optional; NULL may be * specified. * * Registrations tuples that differ only in the endpoint portion of the * address are defined to be duplicate registrations and the new * registration replaces the old registration. The old registration * is assumed to be stale (i.e. from a previous instance of the server * that exited without unregistering). */ So, in order to have multiple instances of a server you will have to supply an Object UUID or else subsequent registrations of the endpoint will overwrite each other. Basically the code goes something like this (with error checking and other stuff omitted): unsigned32 status; struct { unsigned32 count; uuid_t *uuid[1]; } uuid_vec; uuid_t *uuidp = NULL; /* Create UUID for interface */ uuidp = (uuid_t *) malloc(sizeof(uuid_t)); uuid_create(info->uuidp, &status); uuid_vec.count = 1; uuid_vec.uuid[0] = uuidp; /* Register server interface */ rpc_server_register_if(interface_spec, NULL, NULL, &status); if (*status != rpc_s_ok) goto cleanup; /* ... stuff to get binding vector (bvec) omitted ... */ /* Register end-points */ rpc_ep_register(interface_spec, bvec, &uuid_vec, NULL, &status); /* Export to name service */ rpc_ns_binding_export(rpc_c_ns_syntax_dce, name, interface_spec, bvec, &uuid_vec, status); Note that you don't have to associate a Type UUID with the Object UUID. If you export the interface with different names, the lookup will find the correct server associated with the name-service entry. The server code can be identical but for the name exported. (BTW, I'd be really grateful if someone could explain the rationale for having to associate Type UUIDs with Object UUIDs when you wish to select from multiple services within a single server. There seems to be a an unnecessary level of indirection, or am I missing something?) |> The reason I decided I would need a UUID, because I plan to have some |> facilities for replicating data, so a server could potentially |> provide the exact same results to as function call, but on a different |> machine. |> |> Would this work using the DCE namespace to do lookups ? Having given you all the information above, it is unnecessary if the servers are running on different machines. In this case the name-space lookup is sufficient. It will resolve to an interface/host-address tuple which will be sufficient to locate an instance of a server on a machine. |> Thanks, |> |> Barry. I'm glad to be able to help. Neil * Neil Winton G306a, SSTF Building This sentence * N.Winton@axion.bt.co.uk BT Laboratories has two missing, * Tel +44 473 646079 Martlesham Heath but you can still * Fax +44 473 643019 IPSWICH IP5 7RE, UK sense of it.