13910Sdougm /*
23910Sdougm  * CDDL HEADER START
33910Sdougm  *
43910Sdougm  * The contents of this file are subject to the terms of the
53910Sdougm  * Common Development and Distribution License (the "License").
63910Sdougm  * You may not use this file except in compliance with the License.
73910Sdougm  *
83910Sdougm  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
93910Sdougm  * or http://www.opensolaris.org/os/licensing.
103910Sdougm  * See the License for the specific language governing permissions
113910Sdougm  * and limitations under the License.
123910Sdougm  *
133910Sdougm  * When distributing Covered Code, include this CDDL HEADER in each
143910Sdougm  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
153910Sdougm  * If applicable, add the following below this CDDL HEADER, with the
163910Sdougm  * fields enclosed by brackets "[]" replaced with your own identifying
173910Sdougm  * information: Portions Copyright [yyyy] [name of copyright owner]
183910Sdougm  *
193910Sdougm  * CDDL HEADER END
203910Sdougm  */
213910Sdougm 
223910Sdougm /*
236214Sdougm  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
243910Sdougm  * Use is subject to license terms.
253910Sdougm  */
263910Sdougm 
273910Sdougm /*
283910Sdougm  * basic API declarations for share management
293910Sdougm  */
303910Sdougm 
313910Sdougm #ifndef _LIBSHARE_NFS_H
323910Sdougm #define	_LIBSHARE_NFS_H
333910Sdougm 
343910Sdougm #ifdef	__cplusplus
353910Sdougm extern "C" {
363910Sdougm #endif
373910Sdougm 
383910Sdougm /* property names used by NFS */
393910Sdougm #define	SHOPT_RO	"ro"
403910Sdougm #define	SHOPT_RW	"rw"
41*7961SNatalie.Li@Sun.COM #define	SHOPT_NONE	"none"
42*7961SNatalie.Li@Sun.COM #define	SHOPT_ROOT_MAPPING	"root_mapping"
433910Sdougm 
443910Sdougm #define	SHOPT_SEC	"sec"
453910Sdougm #define	SHOPT_SECURE	"secure"
463910Sdougm #define	SHOPT_ROOT	"root"
473910Sdougm #define	SHOPT_ANON	"anon"
483910Sdougm #define	SHOPT_WINDOW	"window"
493910Sdougm #define	SHOPT_NOSUB	"nosub"
503910Sdougm #define	SHOPT_NOSUID	"nosuid"
513910Sdougm #define	SHOPT_ACLOK	"aclok"
523910Sdougm #define	SHOPT_PUBLIC	"public"
533910Sdougm #define	SHOPT_INDEX	"index"
543910Sdougm #define	SHOPT_LOG	"log"
553910Sdougm #define	SHOPT_CKSUM	"cksum"
563910Sdougm 
573910Sdougm /*
583910Sdougm  * defined options types. These should be in a file rather than
593910Sdougm  * compiled in. Until there is a plugin mechanism to add new types,
603910Sdougm  * this is sufficient.
613910Sdougm  */
623910Sdougm #define	OPT_TYPE_ANY		0
633910Sdougm #define	OPT_TYPE_STRING		1
643910Sdougm #define	OPT_TYPE_BOOLEAN	2
653910Sdougm #define	OPT_TYPE_NUMBER		3
663910Sdougm #define	OPT_TYPE_RANGE		4
673910Sdougm #define	OPT_TYPE_USER		5
683910Sdougm #define	OPT_TYPE_ACCLIST	6
693910Sdougm #define	OPT_TYPE_DEPRECATED	7
703910Sdougm #define	OPT_TYPE_SECURITY	8
713910Sdougm #define	OPT_TYPE_PATH		9
723910Sdougm #define	OPT_TYPE_FILE		10
733910Sdougm #define	OPT_TYPE_LOGTAG		11
743910Sdougm #define	OPT_TYPE_STRINGSET	12
753910Sdougm #define	OPT_TYPE_DOMAIN		13
763910Sdougm #define	OPT_TYPE_ONOFF		14
773910Sdougm #define	OPT_TYPE_PROTOCOL	15
783910Sdougm 
793910Sdougm #define	OPT_SHARE_ONLY		1
803910Sdougm 
813910Sdougm struct option_defs {
823910Sdougm 	char *tag;
833910Sdougm 	int index;
843910Sdougm 	int type;
853910Sdougm 	int share;	/* share only option */
866214Sdougm 	int (*check)(sa_handle_t, char *);
873910Sdougm };
883910Sdougm 
893910Sdougm /*
903910Sdougm  * service bit mask values
913910Sdougm  */
923910Sdougm #define	SVC_LOCKD	0x0001
933910Sdougm #define	SVC_STATD	0x0002
943910Sdougm #define	SVC_NFSD	0x0004
953910Sdougm #define	SVC_MOUNTD	0x0008
963910Sdougm #define	SVC_NFS4CBD	0x0010
973910Sdougm #define	SVC_NFSMAPID	0x0020
983910Sdougm #define	SVC_RQUOTAD	0x0040
993910Sdougm #define	SVC_NFSLOGD	0x0080
1003910Sdougm 
1013910Sdougm /*
1023910Sdougm  * place holder for future service -- will move to daemon_utils.h when
1033910Sdougm  * fully implemented.
1043910Sdougm  */
1053910Sdougm #define	NFSLOGD	"svc:/network/nfs/log:default"
1063910Sdougm 
1073910Sdougm /* The NFS export structure flags for read/write modes */
1083910Sdougm #define	NFS_RWMODES	(M_RO|M_ROL|M_RW|M_RWL)
1093910Sdougm 
1103910Sdougm /* other values */
1113910Sdougm /* max size of 64-bit integer in digits plus a bit extra */
1123910Sdougm #define	MAXDIGITS	32
1133910Sdougm 
1143910Sdougm /* external variable */
1153910Sdougm extern boolean_t nfsl_errs_to_syslog;
1163910Sdougm 
1173910Sdougm /* imported functions */
1183910Sdougm extern int exportfs(char *, struct exportdata *);
1193910Sdougm extern void _check_services(char **);
1203910Sdougm extern int nfs_getseconfig_default(seconfig_t *);
1213910Sdougm extern int nfs_getseconfig_byname(char *, seconfig_t *);
1223910Sdougm extern bool_t nfs_get_root_principal(seconfig_t *, char *, caddr_t *);
1233910Sdougm extern int nfsl_getconfig_list(nfsl_config_t **);
1243910Sdougm extern void nfsl_freeconfig_list(nfsl_config_t **);
1253910Sdougm extern nfsl_config_t *nfsl_findconfig(nfsl_config_t *, char *, int *);
1263910Sdougm 
1273910Sdougm #ifdef	__cplusplus
1283910Sdougm }
1293910Sdougm #endif
1303910Sdougm 
1313910Sdougm #endif /* _LIBSHARE_NFS_H */
132