/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License (the "Licence").
 * You may not use this file except in compliance with the Licence.
 *
 * You can obtain a copy of the licence at RISC OS path @.^.LICENCE
 * or  http://www.riscosdev.com/lanman98/LICENCE.CDDL
 * See the Licence for the specific language governing permissions
 * and limitations under the Licence.
 *
 * CDDL HEADER END
 */

/*
 *   Portions Copyright RISC OS Developments 2019+, credited to the RISC OS One Project.
 */

/*
 *   Portions Copyright RISC OS Developments 2019+, credited to the RISC OS One Project.
 */

/*
 *   Asking a server what else is on the network.
 *
 *   The multicast question in h.discover only finds machines that answer
 *   it, which means machines running a responder for it.  A Windows box,
 *   or a Samba built without one, is perfectly reachable and completely
 *   silent - and no amount of asking the network at large will turn it up.
 *
 *   The older way round that is to ask one machine that already knows.  A
 *   workgroup elects a master browser, which collects the announcements
 *   every server makes and will hand over the whole list to anybody who
 *   asks.  One name lookup finds it, one connection asks it, and back
 *   comes every server it has heard of - including ones on the other side
 *   of a router, which multicast never crosses.
 *
 *   The catch is that the call is RAP, a transaction down \\PIPE\LANMAN,
 *   and RAP exists only in SMB1.  A network whose servers have all turned
 *   SMB1 off has no browse list to read, and there is nothing to be done
 *   about that from here - see h.discover for the question that does still
 *   get answered on such a network.
 */

#ifndef _BROWSE_
#define _BROWSE_

#include "discover.h"

found_t BrowseServers(char *workgroup, char *user, char *passwd);
/*
    Every server the workgroup's master browser has heard of, or NULL if
    there is no master browser to ask, or it would not be talked to.

    workgroup may be NULL, in which case LanMan98$Workgroup is used, then
    LanMan98$Domain, then "WORKGROUP".  Addresses are filled in where a
    name resolves and left as the name where it does not; either is enough
    to connect with.

    This talks to a server and logs on to it, so it belongs to a command
    somebody typed and not to anything on a timer.
*/

char *BrowseMaster(char *workgroup);
/*
    The name of the machine holding <workgroup><1D>, the master browser, or
    <workgroup><1B>, the domain controller, if there is no browser.  NULL if
    neither answers.  For the caller to free.
*/

#endif
