From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f678f,7fcfb63d9eee11f9,start X-Google-Attributes: gidf678f,public X-Google-ArrivalTime: 1994-09-22 14:03:55 PST Newsgroups: comp.unix.osf.misc Path: bga.com!news.sprintlink.net!howland.reston.ans.net!europa.eng.gtefsd.com!newsxfer.itd.umich.edu!ncar!csn!col.hp.com!cello.hpl.hp.com!hplntx!hpscit.sc.hp.com!nsa.hp.com!news!jad From: jad@pimlico.nsa.hp.com (John Dilley) Subject: Re: DCE: How to get host names Sender: news@nsa.hp.com (News) Message-ID: In-Reply-To: kaiser@slbwf0.bln.sel.alcatel.de's message of 21 Sep 94 07:03:04 -0700 Date: Thu, 22 Sep 1994 20:35:29 GMT References: Nntp-Posting-Host: pimlico.nsa.hp.com Organization: Networked Systems Architecture In article 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//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 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