* Re: DCE: How to get host names
[not found] <KAISER.94Sep21160304@slbwf0.bln.sel.alcatel.de>
@ 1994-09-22 20:35 ` John Dilley
1994-09-23 18:06 ` Andrew Hastings
0 siblings, 1 reply; 2+ messages in thread
From: John Dilley @ 1994-09-22 20:35 UTC (permalink / raw)
In article <KAISER.94Sep21160304@slbwf0.bln.sel.alcatel.de> kaiser@slbwf0.bln.sel.alcatel.de (Rajk Kaiser) writes:
> How can I get a list of all hosts configured in a DCE cell (in a program)? Is
> there an API in DCE (HP DCE 1.2) for this (probably it should be a CDS API)?
Use alternative (3): "cdscp list directory '/.:/hosts/*'" to get
the list of the subdirectories of /.:/hosts. As you know, each client
in a DCE cell is supposed to have its host information registered there.
Note that this is not authoritative: if anyone else creates a directory
or stores entries in /.:/hosts, the information will be incorrect. You
can use 'cdscp show object /.:/hosts/<HOST>/self' to determine if the
CDS clerk entry is present in the directory; you could then determine if
it is running on the remote host by snagging the Tower string, treating
it as a string binding, and using rpc_mgmt_is_server_listening() on it.
It all depends how sure you want to be.
The way I would do this from a program is to use popen(3), and
suffer with the performance problem you noticed (due, presumably, to the
extra fork() call required to open the pipe). If you want to examine
contents of a CDS directory directly you have to use the undocumented
CDSPI... Even if CDSPI were documented, the popen() route is much, much
simpler.
There may be a better way (more reliable or more clever) to get
a list of hosts in a cell; perhaps someone else has that information.
It may be platform-dependent, though...
> 1) use the RPC_NS interface as defined in rpc.idl
> Since every host has to have its own CDS entry in '/.:/hosts/'
> (right?) there should be a function returning all entrys below
> '/.:/hosts/'. So far I couldn't find such a function. I tried
> rpc_ns_entry_expand_name() but the host names were never contained in
> the path returned.
The NSI does not allow you to examine directory contents; it is
strictly for use by RPC to retrieve server binding information. The
only access to this information is through CDSPI, which cdscp and NSI
both use.
> 3) use the 'cdscp' tool
> Perform "cdscp list directory "/.:/hosts/*"" (e.g. via popen()) and look for
> the host names in the command output.
>
> Currently I tend to choose the third way because it needs the least coding
> effort. But it doesn't meet the requirements completely (it consumes too much
> time and resources).
Time and resources due, presumably, to the extra fork() call.
Note that even using CDSPI, talking to the CDS is a fairly expensive
operation.
> Additionally it is at least rather clumsy so I ask you to suggest
> better solutions or to give me the name of the one and only function
> doing all the work.
If you find that function call, please let me know :-)
> Thanks in advance for your efforts
>
> Rajk
You bet. Regards,
-- jad --
John Dilley <jad@nsa.hp.com>
Hewlett-Packard // Networked Systems Architecture
19410 Homestead Road // Mailstop 43UA
Cupertino, CA 95014-9810 // USA
(408) 447-2419 // Fax: (408) 447-4928
________________
"I know of no safe depository of the ultimate powers of the society
but the people themselves, and if we think them not enlightened enough
to exercise that control with a wholesome discretion, the remedy is
not to take it from them, but to inform their discretion."
-- Thomas Jefferson, 1820
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: DCE: How to get host names
1994-09-22 20:35 ` DCE: How to get host names John Dilley
@ 1994-09-23 18:06 ` Andrew Hastings
0 siblings, 0 replies; 2+ messages in thread
From: Andrew Hastings @ 1994-09-23 18:06 UTC (permalink / raw)
In article <JAD.94Sep22133529@pimlico.nsa.hp.com> jad@pimlico.nsa.hp.com (John Dilley) writes:
:In article <KAISER.94Sep21160304@slbwf0.bln.sel.alcatel.de> kaiser@slbwf0.bln.sel.alcatel.de (Rajk Kaiser) writes:
:
:> How can I get a list of all hosts configured in a DCE cell (in a program)? Is
:> there an API in DCE (HP DCE 1.2) for this (probably it should be a CDS API)?
:
: The way I would do this from a program is to use popen(3), and
:suffer with the performance problem you noticed (due, presumably, to the
:extra fork() call required to open the pipe). If you want to examine
:contents of a CDS directory directly you have to use the undocumented
:CDSPI... Even if CDSPI were documented, the popen() route is much, much
:simpler.
DCE does have a documented way to query and update CDS: the XDS interface.
It's not for the faint of heart, however. I'd go with the popen suggestion.
I understand that OSF may be offering a more user-friendly interface in
the future.
-Andrew Hastings Transarc
P.S. No, I can't answer any questions about XDS. Read the OSF DCE
Application Development Guide and Application Development Reference.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~1994-09-23 18:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <KAISER.94Sep21160304@slbwf0.bln.sel.alcatel.de>
1994-09-22 20:35 ` DCE: How to get host names John Dilley
1994-09-23 18:06 ` Andrew Hastings
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox