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