xref: /illumos-gate/usr/src/lib/libshare/smbfs/libshare_smbfs.h (revision 0245b61fd282e95735b173b8d95be0d6688163b4)
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  * Copyright 2018 Nexenta Systems, Inc.  All rights reserved.
27  */
28 
29 /*
30  * basic API declarations for share management
31  */
32 
33 #ifndef _LIBSHARE_SMBFS_H
34 #define	_LIBSHARE_SMBFS_H
35 
36 #ifdef	__cplusplus
37 extern "C" {
38 #endif
39 
40 struct smbclnt_proto_option_defs {
41 	char *name;	/* display name -- remove protocol identifier */
42 	char *value;
43 	int index;
44 	int flags;
45 	int32_t minval;
46 	int32_t maxval; /* In case of length of string this should be max */
47 	int (*validator)(int, char *, char *);
48 };
49 
50 extern struct smbclnt_proto_option_defs smbclnt_proto_options[];
51 
52 #define	PROTO_OPT_SECTION		0
53 #define	PROTO_OPT_ADDR			1
54 #define	PROTO_OPT_MINAUTH		2
55 #define	PROTO_OPT_NBNS_BROADCAST	3
56 #define	PROTO_OPT_NBNS_ENABLE		4
57 #define	PROTO_OPT_NBNSADDR		5
58 #define	PROTO_OPT_PASSWORD		6
59 #define	PROTO_OPT_TIMEOUT		7
60 #define	PROTO_OPT_USER			8
61 #define	PROTO_OPT_DOMAIN		9
62 #define	PROTO_OPT_WORKGROUP		10
63 #define	PROTO_OPT_SIGNING		11
64 #define	PROTO_OPT_MIN_PROTOCOL		12
65 #define	PROTO_OPT_MAX_PROTOCOL		13
66 
67 #define	SMBC_OPT_MAX	PROTO_OPT_MAX_PROTOCOL
68 
69 /*
70  * Flags values
71  */
72 #define	SMBC_MODIFIED			0x01
73 
74 /* Max value length of all SMB properties */
75 #define	MAX_VALUE_BUFLEN	600
76 
77 /*
78  * SMF access
79  */
80 
81 #define	SMBC_FMRI_PREFIX		"network/smb/client"
82 #define	SMBC_DEFAULT_INSTANCE_FMRI	"svc:/network/smb/client:default"
83 #define	SMBC_PG_PREFIX			"S-"
84 #define	SMBC_PG_PREFIX_LEN		2
85 #define	SMBC_PG_INSTANCE		"default"
86 
87 #define	SMBC_SMF_OK		0
88 #define	SMBC_SMF_NO_MEMORY	1	/* no memory for data structures */
89 #define	SMBC_SMF_SYSTEM_ERR	2	/* system error, use errno */
90 #define	SMBC_SMF_NO_PERMISSION	3	/* no permission for operation */
91 
92 #define	SCH_STATE_UNINIT	0
93 #define	SCH_STATE_INITIALIZING	1
94 #define	SCH_STATE_INIT		2
95 
96 typedef struct smb_scfhandle {
97 	scf_handle_t		*scf_handle;
98 	int			scf_state;
99 	scf_service_t		*scf_service;
100 	scf_scope_t		*scf_scope;
101 	scf_transaction_t	*scf_trans;
102 	scf_transaction_entry_t	*scf_entry;
103 	scf_propertygroup_t	*scf_pg;
104 	scf_instance_t		*scf_instance;
105 	scf_iter_t		*scf_inst_iter;
106 	scf_iter_t		*scf_pg_iter;
107 } smb_scfhandle_t;
108 
109 extern void smb_smf_scf_fini(smb_scfhandle_t *);
110 extern smb_scfhandle_t *smb_smf_scf_init(char *);
111 extern int smb_smf_get_instance(smb_scfhandle_t *, char *);
112 extern int smb_smf_create_instance(smb_scfhandle_t *, char *);
113 extern int smb_smf_start_transaction(smb_scfhandle_t *);
114 extern int smb_smf_end_transaction(smb_scfhandle_t *);
115 
116 extern int smb_smf_set_string_property(smb_scfhandle_t *, char *, char *);
117 extern int smb_smf_get_string_property(smb_scfhandle_t *, char *,
118     char *, size_t);
119 extern int smb_smf_set_integer_property(smb_scfhandle_t *, char *, int64_t);
120 extern int smb_smf_get_integer_property(smb_scfhandle_t *, char *, int64_t *);
121 extern int smb_smf_set_boolean_property(smb_scfhandle_t *, char *, uint8_t);
122 extern int smb_smf_get_boolean_property(smb_scfhandle_t *, char *, uint8_t *);
123 extern int smb_smf_set_opaque_property(smb_scfhandle_t *, char *,
124     void *, size_t);
125 extern int smb_smf_get_opaque_property(smb_scfhandle_t *, char *,
126     void *, size_t);
127 
128 extern int smb_smf_create_service_pgroup(smb_scfhandle_t *, char *);
129 extern int smb_smf_delete_service_pgroup(smb_scfhandle_t *, char *);
130 extern int smb_smf_create_instance_pgroup(smb_scfhandle_t *, char *);
131 extern int smb_smf_delete_instance_pgroup(smb_scfhandle_t *, char *);
132 extern int smb_smf_delete_property(smb_scfhandle_t *, char *);
133 extern int smb_smf_instance_exists(smb_scfhandle_t *, char *);
134 extern int smb_smf_instance_create(smb_scfhandle_t *, char *, char *);
135 extern int smb_smf_instance_delete(smb_scfhandle_t *, char *);
136 extern smb_scfhandle_t *smb_smf_get_iterator(char *);
137 
138 #ifdef	__cplusplus
139 }
140 #endif
141 
142 #endif /* _LIBSHARE_SMBFS_H */
143