16185db85Sdougm /*
26185db85Sdougm  * CDDL HEADER START
36185db85Sdougm  *
46185db85Sdougm  * The contents of this file are subject to the terms of the
56185db85Sdougm  * Common Development and Distribution License (the "License").
66185db85Sdougm  * You may not use this file except in compliance with the License.
76185db85Sdougm  *
86185db85Sdougm  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
96185db85Sdougm  * or http://www.opensolaris.org/os/licensing.
106185db85Sdougm  * See the License for the specific language governing permissions
116185db85Sdougm  * and limitations under the License.
126185db85Sdougm  *
136185db85Sdougm  * When distributing Covered Code, include this CDDL HEADER in each
146185db85Sdougm  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
156185db85Sdougm  * If applicable, add the following below this CDDL HEADER, with the
166185db85Sdougm  * fields enclosed by brackets "[]" replaced with your own identifying
176185db85Sdougm  * information: Portions Copyright [yyyy] [name of copyright owner]
186185db85Sdougm  *
196185db85Sdougm  * CDDL HEADER END
206185db85Sdougm  */
216185db85Sdougm 
226185db85Sdougm /*
23*4bff34e3Sthurlow  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
246185db85Sdougm  * Use is subject to license terms.
256185db85Sdougm  */
266185db85Sdougm 
276185db85Sdougm #ifndef _SHAREMGR_H
286185db85Sdougm #define	_SHAREMGR_H
296185db85Sdougm 
306185db85Sdougm #ifdef	__cplusplus
316185db85Sdougm extern "C" {
326185db85Sdougm #endif
33549ec3ffSdougm #include <libshare.h>
346185db85Sdougm 
356185db85Sdougm /*
366185db85Sdougm  * shareadm internal interfaces
376185db85Sdougm  */
386185db85Sdougm 
396185db85Sdougm typedef enum {
406185db85Sdougm 	USAGE_ADD_SHARE,
416185db85Sdougm 	USAGE_CREATE,
426185db85Sdougm 	USAGE_DELETE,
436185db85Sdougm 	USAGE_DISABLE,
446185db85Sdougm 	USAGE_ENABLE,
456185db85Sdougm 	USAGE_LIST,
466185db85Sdougm 	USAGE_MOVE_SHARE,
476185db85Sdougm 	USAGE_REMOVE_SHARE,
486185db85Sdougm 	USAGE_SET,
496185db85Sdougm 	USAGE_SET_SECURITY,
506185db85Sdougm 	USAGE_SET_SHARE,
516185db85Sdougm 	USAGE_SHOW,
526185db85Sdougm 	USAGE_SHARE,
536185db85Sdougm 	USAGE_START,
546185db85Sdougm 	USAGE_STOP,
556185db85Sdougm 	USAGE_UNSET,
566185db85Sdougm 	USAGE_UNSET_SECURITY,
576185db85Sdougm 	USAGE_UNSHARE
586185db85Sdougm } sa_usage_t;
596185db85Sdougm 
606185db85Sdougm /* sharectl specific usage message values */
616185db85Sdougm typedef enum {
626185db85Sdougm 	USAGE_CTL_GET,
636185db85Sdougm 	USAGE_CTL_SET,
64*4bff34e3Sthurlow 	USAGE_CTL_STATUS,
65*4bff34e3Sthurlow 	USAGE_CTL_DELSECT
666185db85Sdougm } sc_usage_t;
676185db85Sdougm 
686185db85Sdougm typedef struct sa_command {
696185db85Sdougm 	char	*cmdname;
706185db85Sdougm 	int	flags;
71549ec3ffSdougm 	int	(*cmdfunc)(sa_handle_t, int, int, char **);
726185db85Sdougm 	int	cmdidx;
736185db85Sdougm 	int	priv;	/* requires RBAC authorizations */
746185db85Sdougm } sa_command_t;
756185db85Sdougm 
766185db85Sdougm #define	CMD_ALIAS	0x0001
776185db85Sdougm #define	CMD_NODISPLAY	0x0002	/* don't display command */
786185db85Sdougm 
796185db85Sdougm #define	SVC_AUTH_VALUE	"value_authorization"
806185db85Sdougm #define	SVC_AUTH_ACTION	"action_authorization"
816185db85Sdougm #define	SVC_SET		0x01 /* need value permissions */
826185db85Sdougm #define	SVC_ACTION	0x02 /* need action permissions */
836185db85Sdougm 
84f3861e1aSahl #define	ZFS_SHAREALL	"/usr/sbin/zfs share -a nfs"
856185db85Sdougm 
866185db85Sdougm /*
876185db85Sdougm  * functions/values for manipulating options
886185db85Sdougm  */
896185db85Sdougm #define	OPT_ADD_OK		0
906185db85Sdougm #define	OPT_ADD_SYNTAX		-1
916185db85Sdougm #define	OPT_ADD_SECURITY	-2
926185db85Sdougm #define	OPT_ADD_PROPERTY	-3
936185db85Sdougm #define	OPT_ADD_MEMORY		-4
946185db85Sdougm 
956185db85Sdougm /* option list structure */
966185db85Sdougm struct options {
976185db85Sdougm 	struct options *next;
986185db85Sdougm 	char *optname;
996185db85Sdougm 	char *optvalue;
1006185db85Sdougm };
1016185db85Sdougm 
1026185db85Sdougm /* general list structure */
1036185db85Sdougm struct list {
1046185db85Sdougm 	struct list *next;
1056185db85Sdougm 	void *item;
1066185db85Sdougm 	void *itemdata;
107da6c28aaSamw 	char *proto;
1086185db85Sdougm };
1096185db85Sdougm 
1106185db85Sdougm /* shareutil entry points */
111549ec3ffSdougm extern int add_opt(struct options **, char *, int);
1126185db85Sdougm 
1136185db85Sdougm 
1146185db85Sdougm #ifdef	__cplusplus
1156185db85Sdougm }
1166185db85Sdougm #endif
1176185db85Sdougm 
1186185db85Sdougm #endif /* _SHAREMGR_H */
119