lmshare.h revision da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SMBSRV_LMSHARE_H
#define _SMBSRV_LMSHARE_H
#pragma ident "%Z%%M% %I% %E% SMI"
/*
*/
#include <smbsrv/hash_table.h>
#include <smbsrv/wintypes.h>
#ifndef _KERNEL
#include <libshare.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
#define SHOPT_AD_CONTAINER "ad-container"
#define SMB_DEFAULT_SHARE_GROUP "smb"
#define SMB_PROTOCOL_NAME "smb"
/*
* Despite the fact that the MAXNAMELEN is 256, we only
* support a maximum share name length of 15 characters.
*/
#define LMSHR_VALID_NAME_MAX 15
#define LMSHR_VALID_NAME_BUFSIZ 16
/*
* Mode should be renamed to flags.
*
* LMSHRM_TRANS Transient share
* LMSHRM_PERM Permanent share
*/
#define LMSHRM_TRANS 0x0001
#define LMSHRM_PERM 0x0002
#define LMSHR_PUBLISH 0
#define LMSHR_UNPUBLISH 1
#define LMSHR_ADD 0
#define LMSHR_DELETE 1
/*
* refcnt is currently only used for autohome. autohome needs a refcnt
* because a user can map his autohome share from more than one client
* at the same time and the share should only be removed when the last
* one is disconnected
*/
typedef struct lmshare_info {
char share_name[MAXNAMELEN];
char directory[MAXPATHLEN];
char comment[LMSHR_COMMENT_MAX];
char container[MAXPATHLEN];
int mode;
int stype;
int refcnt;
typedef struct lmshare_iterator {
unsigned int iteration;
int mode;
#define LMSHARES_PER_REQUEST 10
typedef struct lmshare_list {
int no;
#ifndef _KERNEL
/*
* CIFS share management functions (private to the smb daemon).
*/
extern int lmshare_start(void);
extern void lmshare_stop(void);
extern int lmshare_num_transient(void);
extern int lmshare_num_shares(void);
extern void lmshare_do_publish(lmshare_info_t *, char, int);
extern int lmshare_exists(char *share_name);
extern int lmshare_is_special(char *share_name);
extern int lmshare_is_restricted(char *share_name);
extern int lmshare_is_admin(char *share_name);
extern int lmshare_is_valid(char *share_name);
extern int lmshare_is_dir(char *path);
/* XXX Move these 2 functions in mlsvc_util.h, after the libmlsvc cleanup */
/* The following 3 functions are called by FSD user-space library */
#endif /* _KERNEL */
/*
*
* NOTE: If any error is encounted by either the door server or client,
* NERR_InternalError will be returned by most functions.
* lmshrd_num_shares will return -1 while the lmshrd_open_iterator/
* lmshrd_close_iterator will return NULL.
*/
#ifndef _KERNEL
extern DWORD lmshrd_num_transient(void);
extern int lmshrd_dump_hash(char *logfname);
#endif
extern int lmshrd_num_shares(void);
extern int lmshrd_exists(char *share_name);
extern int lmshrd_is_special(char *share_name);
extern int lmshrd_is_restricted(char *share_name);
extern int lmshrd_is_admin(char *share_name);
extern int lmshrd_is_valid(char *share_name);
extern int lmshrd_is_dir(char *path);
/*
* the LanMan share door client.
*/
#ifdef _KERNEL
extern int lmshrd_kclient_start(void);
extern void lmshrd_kclient_stop(void);
#endif
#ifdef __cplusplus
}
#endif
#endif /* _SMBSRV_LMSHARE_H */