xref: /illumos-gate/usr/src/lib/libshare/nfs/libshare_nfs.h (revision 549ec3fff108310966327d1dc9004551b63210b7)
1*549ec3ffSdougm /*
2*549ec3ffSdougm  * CDDL HEADER START
3*549ec3ffSdougm  *
4*549ec3ffSdougm  * The contents of this file are subject to the terms of the
5*549ec3ffSdougm  * Common Development and Distribution License (the "License").
6*549ec3ffSdougm  * You may not use this file except in compliance with the License.
7*549ec3ffSdougm  *
8*549ec3ffSdougm  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*549ec3ffSdougm  * or http://www.opensolaris.org/os/licensing.
10*549ec3ffSdougm  * See the License for the specific language governing permissions
11*549ec3ffSdougm  * and limitations under the License.
12*549ec3ffSdougm  *
13*549ec3ffSdougm  * When distributing Covered Code, include this CDDL HEADER in each
14*549ec3ffSdougm  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*549ec3ffSdougm  * If applicable, add the following below this CDDL HEADER, with the
16*549ec3ffSdougm  * fields enclosed by brackets "[]" replaced with your own identifying
17*549ec3ffSdougm  * information: Portions Copyright [yyyy] [name of copyright owner]
18*549ec3ffSdougm  *
19*549ec3ffSdougm  * CDDL HEADER END
20*549ec3ffSdougm  */
21*549ec3ffSdougm 
22*549ec3ffSdougm /*
23*549ec3ffSdougm  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
24*549ec3ffSdougm  * Use is subject to license terms.
25*549ec3ffSdougm  */
26*549ec3ffSdougm 
27*549ec3ffSdougm /*
28*549ec3ffSdougm  * basic API declarations for share management
29*549ec3ffSdougm  */
30*549ec3ffSdougm 
31*549ec3ffSdougm #ifndef _LIBSHARE_NFS_H
32*549ec3ffSdougm #define	_LIBSHARE_NFS_H
33*549ec3ffSdougm 
34*549ec3ffSdougm #pragma ident	"%Z%%M%	%I%	%E% SMI"
35*549ec3ffSdougm 
36*549ec3ffSdougm #ifdef	__cplusplus
37*549ec3ffSdougm extern "C" {
38*549ec3ffSdougm #endif
39*549ec3ffSdougm 
40*549ec3ffSdougm /* property names used by NFS */
41*549ec3ffSdougm #define	SHOPT_RO	"ro"
42*549ec3ffSdougm #define	SHOPT_RW	"rw"
43*549ec3ffSdougm 
44*549ec3ffSdougm #define	SHOPT_SEC	"sec"
45*549ec3ffSdougm #define	SHOPT_SECURE	"secure"
46*549ec3ffSdougm #define	SHOPT_ROOT	"root"
47*549ec3ffSdougm #define	SHOPT_ANON	"anon"
48*549ec3ffSdougm #define	SHOPT_WINDOW	"window"
49*549ec3ffSdougm #define	SHOPT_NOSUB	"nosub"
50*549ec3ffSdougm #define	SHOPT_NOSUID	"nosuid"
51*549ec3ffSdougm #define	SHOPT_ACLOK	"aclok"
52*549ec3ffSdougm #define	SHOPT_PUBLIC	"public"
53*549ec3ffSdougm #define	SHOPT_INDEX	"index"
54*549ec3ffSdougm #define	SHOPT_LOG	"log"
55*549ec3ffSdougm #define	SHOPT_CKSUM	"cksum"
56*549ec3ffSdougm 
57*549ec3ffSdougm /*
58*549ec3ffSdougm  * defined options types. These should be in a file rather than
59*549ec3ffSdougm  * compiled in. Until there is a plugin mechanism to add new types,
60*549ec3ffSdougm  * this is sufficient.
61*549ec3ffSdougm  */
62*549ec3ffSdougm #define	OPT_TYPE_ANY		0
63*549ec3ffSdougm #define	OPT_TYPE_STRING		1
64*549ec3ffSdougm #define	OPT_TYPE_BOOLEAN	2
65*549ec3ffSdougm #define	OPT_TYPE_NUMBER		3
66*549ec3ffSdougm #define	OPT_TYPE_RANGE		4
67*549ec3ffSdougm #define	OPT_TYPE_USER		5
68*549ec3ffSdougm #define	OPT_TYPE_ACCLIST	6
69*549ec3ffSdougm #define	OPT_TYPE_DEPRECATED	7
70*549ec3ffSdougm #define	OPT_TYPE_SECURITY	8
71*549ec3ffSdougm #define	OPT_TYPE_PATH		9
72*549ec3ffSdougm #define	OPT_TYPE_FILE		10
73*549ec3ffSdougm #define	OPT_TYPE_LOGTAG		11
74*549ec3ffSdougm #define	OPT_TYPE_STRINGSET	12
75*549ec3ffSdougm #define	OPT_TYPE_DOMAIN		13
76*549ec3ffSdougm #define	OPT_TYPE_ONOFF		14
77*549ec3ffSdougm #define	OPT_TYPE_PROTOCOL	15
78*549ec3ffSdougm 
79*549ec3ffSdougm #define	OPT_SHARE_ONLY		1
80*549ec3ffSdougm 
81*549ec3ffSdougm struct option_defs {
82*549ec3ffSdougm 	char *tag;
83*549ec3ffSdougm 	int index;
84*549ec3ffSdougm 	int type;
85*549ec3ffSdougm 	int share;	/* share only option */
86*549ec3ffSdougm 	int (*check)(char *);
87*549ec3ffSdougm };
88*549ec3ffSdougm 
89*549ec3ffSdougm /*
90*549ec3ffSdougm  * service bit mask values
91*549ec3ffSdougm  */
92*549ec3ffSdougm #define	SVC_LOCKD	0x0001
93*549ec3ffSdougm #define	SVC_STATD	0x0002
94*549ec3ffSdougm #define	SVC_NFSD	0x0004
95*549ec3ffSdougm #define	SVC_MOUNTD	0x0008
96*549ec3ffSdougm #define	SVC_NFS4CBD	0x0010
97*549ec3ffSdougm #define	SVC_NFSMAPID	0x0020
98*549ec3ffSdougm #define	SVC_RQUOTAD	0x0040
99*549ec3ffSdougm #define	SVC_NFSLOGD	0x0080
100*549ec3ffSdougm 
101*549ec3ffSdougm /*
102*549ec3ffSdougm  * place holder for future service -- will move to daemon_utils.h when
103*549ec3ffSdougm  * fully implemented.
104*549ec3ffSdougm  */
105*549ec3ffSdougm #define	NFSLOGD	"svc:/network/nfs/log:default"
106*549ec3ffSdougm 
107*549ec3ffSdougm /* The NFS export structure flags for read/write modes */
108*549ec3ffSdougm #define	NFS_RWMODES	(M_RO|M_ROL|M_RW|M_RWL)
109*549ec3ffSdougm 
110*549ec3ffSdougm /* other values */
111*549ec3ffSdougm /* max size of 64-bit integer in digits plus a bit extra */
112*549ec3ffSdougm #define	MAXDIGITS	32
113*549ec3ffSdougm 
114*549ec3ffSdougm /* external variable */
115*549ec3ffSdougm extern boolean_t nfsl_errs_to_syslog;
116*549ec3ffSdougm 
117*549ec3ffSdougm /* imported functions */
118*549ec3ffSdougm extern int exportfs(char *, struct exportdata *);
119*549ec3ffSdougm extern void _check_services(char **);
120*549ec3ffSdougm extern int nfs_getseconfig_default(seconfig_t *);
121*549ec3ffSdougm extern int nfs_getseconfig_byname(char *, seconfig_t *);
122*549ec3ffSdougm extern bool_t nfs_get_root_principal(seconfig_t *, char *, caddr_t *);
123*549ec3ffSdougm extern int nfsl_getconfig_list(nfsl_config_t **);
124*549ec3ffSdougm extern void nfsl_freeconfig_list(nfsl_config_t **);
125*549ec3ffSdougm extern nfsl_config_t *nfsl_findconfig(nfsl_config_t *, char *, int *);
126*549ec3ffSdougm 
127*549ec3ffSdougm #ifdef	__cplusplus
128*549ec3ffSdougm }
129*549ec3ffSdougm #endif
130*549ec3ffSdougm 
131*549ec3ffSdougm #endif /* _LIBSHARE_NFS_H */
132