/*
 * 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.
 *
 *   Asking a server what it shares.
 *
 *   SMB2 has no command for this.  The list comes from a remote procedure
 *   call - NetrShareEnum, in the server service - carried over a named
 *   pipe on the IPC$ share.  That means a little of the call machinery
 *   underneath it: a bind to say which interface is wanted, then the call
 *   itself, with its arguments laid out the way that machinery expects.
 *
 *   Only the one call is implemented, and only at the level that returns a
 *   name, a type and a comment, which is all a list of shares needs.
 */

#ifndef _SRVSVC_
#define _SRVSVC_

#include "smb2.h"

#define SHARE_DISK    (0)
#define SHARE_PRINTER (1)
#define SHARE_DEVICE  (2)
#define SHARE_IPC     (3)
#define SHARE_HIDDEN  (0x80000000u)     /* set in the top bit of the type */

typedef struct share_s
{
    struct share_s *next;
    char *name;
    char *remark;
    unsigned int type;
} *share_t;

share_t SRVSVCEnumShares(smb2_conn_t c, char *server);
/*
    The shares a server offers, oldest first, or NULL if it offers none.
    Throws if the server will not say.
*/

void SRVSVCFreeShares(share_t list);

#endif
