xref: /illumos-gate/usr/src/cmd/dfs.cmds/sharemgr/sharemgr.h (revision 42b53e0fbc5c05289c3d334bb864b784fafe5ce4)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 
22 /*
23  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef _SHAREMGR_H
28 #define	_SHAREMGR_H
29 
30 #ifdef	__cplusplus
31 extern "C" {
32 #endif
33 #include <libshare.h>
34 
35 /*
36  * shareadm internal interfaces
37  */
38 
39 typedef enum {
40 	USAGE_ADD_SHARE,
41 	USAGE_CREATE,
42 	USAGE_DELETE,
43 	USAGE_DISABLE,
44 	USAGE_ENABLE,
45 	USAGE_LIST,
46 	USAGE_MOVE_SHARE,
47 	USAGE_REMOVE_SHARE,
48 	USAGE_SET,
49 	USAGE_SET_SECURITY,
50 	USAGE_SET_SHARE,
51 	USAGE_SHOW,
52 	USAGE_SHARE,
53 	USAGE_START,
54 	USAGE_STOP,
55 	USAGE_UNSET,
56 	USAGE_UNSET_SECURITY,
57 	USAGE_UNSHARE
58 } sa_usage_t;
59 
60 /* sharectl specific usage message values */
61 typedef enum {
62 	USAGE_CTL_GET,
63 	USAGE_CTL_SET,
64 	USAGE_CTL_STATUS,
65 	USAGE_CTL_DELSECT
66 } sc_usage_t;
67 
68 typedef struct sa_command {
69 	char	*cmdname;
70 	int	flags;
71 	int	(*cmdfunc)(sa_handle_t, int, int, char **);
72 	int	cmdidx;
73 	int	priv;	/* requires RBAC authorizations */
74 } sa_command_t;
75 
76 #define	CMD_ALIAS	0x0001
77 #define	CMD_NODISPLAY	0x0002	/* don't display command */
78 
79 #define	SVC_AUTH_VALUE	"value_authorization"
80 #define	SVC_AUTH_ACTION	"action_authorization"
81 #define	SVC_SET		0x01 /* need value permissions */
82 #define	SVC_ACTION	0x02 /* need action permissions */
83 
84 #define	ZFS_SHAREALL	"/usr/sbin/zfs share -a nfs"
85 
86 /*
87  * functions/values for manipulating options
88  */
89 #define	OPT_ADD_OK		0
90 #define	OPT_ADD_SYNTAX		-1
91 #define	OPT_ADD_SECURITY	-2
92 #define	OPT_ADD_PROPERTY	-3
93 #define	OPT_ADD_MEMORY		-4
94 
95 /* option list structure */
96 struct options {
97 	struct options *next;
98 	char *optname;
99 	char *optvalue;
100 };
101 
102 /* general list structure */
103 struct list {
104 	struct list *next;
105 	void *item;
106 	void *itemdata;
107 	char *proto;
108 };
109 
110 /* shareutil entry points */
111 extern int add_opt(struct options **, char *, int);
112 
113 
114 #ifdef	__cplusplus
115 }
116 #endif
117 
118 #endif /* _SHAREMGR_H */
119