Usenet comp.unix.osf.misc (1992-2004)
 help / color / mirror / Atom feed
From: jad@pimlico.nsa.hp.com (John Dilley)
Subject: Re: DCE: How to get host names
Date: Thu, 22 Sep 1994 20:35:29 GMT	[thread overview]
Message-ID: <JAD.94Sep22133529@pimlico.nsa.hp.com> (raw)
In-Reply-To: kaiser@slbwf0.bln.sel.alcatel.de's message of 21 Sep 94 07:03:04 -0700

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


       reply	other threads:[~1994-09-22 20:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <KAISER.94Sep21160304@slbwf0.bln.sel.alcatel.de>
1994-09-22 20:35 ` John Dilley [this message]
1994-09-23 18:06   ` DCE: How to get host names Andrew Hastings
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox