xref: /titanic_51/usr/src/lib/libshare/smbfs/libshare_smbfs.h (revision b9bd317cda1afb3a01f4812de73e8cec888cbbd7)
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 #pragma ident	"%Z%%M%	%I%	%E% SMI"
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 
64 #ifdef NOT_DEFINED
65 #define	PROTO_OPT_NBSCOPE		11
66 #define	PROTO_OPT_NBTIMEOUT		12
67 #define	PROTO_OPT_RETRY_COUNT		13
68 #define	PROTO_OPT_USE_NEGPROT_DOMAIN	14
69 #define	PROTO_OPT_CHARSETS		15
70 #endif
71 
72 #define	SMBC_OPT_MAX	PROTO_OPT_WORKGROUP
73 
74 /*
75  * Flags values
76  */
77 #define	SMBC_MODIFIED			0x01
78 
79 /* Max value length of all SMB properties */
80 #define	MAX_VALUE_BUFLEN	600
81 
82 /*
83  * SMF access
84  */
85 
86 #define	SMBC_FMRI_PREFIX		"network/smb/client"
87 #define	SMBC_DEFAULT_INSTANCE_FMRI	"svc:/network/smb/client:default"
88 #define	SMBC_PG_PREFIX			"S-"
89 #define	SMBC_PG_PREFIX_LEN		2
90 #define	SMBC_PG_INSTANCE		"default"
91 
92 #define	SMBC_SMF_OK		0
93 #define	SMBC_SMF_NO_MEMORY	1	/* no memory for data structures */
94 #define	SMBC_SMF_SYSTEM_ERR	2	/* system error, use errno */
95 #define	SMBC_SMF_NO_PERMISSION	3	/* no permission for operation */
96 
97 #define	SCH_STATE_UNINIT	0
98 #define	SCH_STATE_INITIALIZING	1
99 #define	SCH_STATE_INIT		2
100 
101 typedef struct smb_scfhandle {
102 	scf_handle_t		*scf_handle;
103 	int			scf_state;
104 	scf_service_t		*scf_service;
105 	scf_scope_t		*scf_scope;
106 	scf_transaction_t	*scf_trans;
107 	scf_transaction_entry_t	*scf_entry;
108 	scf_propertygroup_t	*scf_pg;
109 	scf_instance_t		*scf_instance;
110 	scf_iter_t		*scf_inst_iter;
111 	scf_iter_t		*scf_pg_iter;
112 } smb_scfhandle_t;
113 
114 extern void smb_smf_scf_fini(smb_scfhandle_t *);
115 extern smb_scfhandle_t *smb_smf_scf_init(char *);
116 extern int smb_smf_get_instance(smb_scfhandle_t *, char *);
117 extern int smb_smf_create_instance(smb_scfhandle_t *, char *);
118 extern int smb_smf_start_transaction(smb_scfhandle_t *);
119 extern int smb_smf_end_transaction(smb_scfhandle_t *);
120 
121 extern int smb_smf_set_string_property(smb_scfhandle_t *, char *, char *);
122 extern int smb_smf_get_string_property(smb_scfhandle_t *, char *,
123     char *, size_t);
124 extern int smb_smf_set_integer_property(smb_scfhandle_t *, char *, int64_t);
125 extern int smb_smf_get_integer_property(smb_scfhandle_t *, char *, int64_t *);
126 extern int smb_smf_set_boolean_property(smb_scfhandle_t *, char *, uint8_t);
127 extern int smb_smf_get_boolean_property(smb_scfhandle_t *, char *, uint8_t *);
128 extern int smb_smf_set_opaque_property(smb_scfhandle_t *, char *,
129     void *, size_t);
130 extern int smb_smf_get_opaque_property(smb_scfhandle_t *, char *,
131     void *, size_t);
132 
133 extern int smb_smf_create_service_pgroup(smb_scfhandle_t *, char *);
134 extern int smb_smf_delete_service_pgroup(smb_scfhandle_t *, char *);
135 extern int smb_smf_create_instance_pgroup(smb_scfhandle_t *, char *);
136 extern int smb_smf_delete_instance_pgroup(smb_scfhandle_t *, char *);
137 extern int smb_smf_delete_property(smb_scfhandle_t *, char *);
138 extern int smb_smf_instance_exists(smb_scfhandle_t *, char *);
139 extern int smb_smf_instance_create(smb_scfhandle_t *, char *, char *);
140 extern int smb_smf_instance_delete(smb_scfhandle_t *, char *);
141 extern smb_scfhandle_t *smb_smf_get_iterator(char *);
142 
143 #ifdef	__cplusplus
144 }
145 #endif
146 
147 #endif /* _LIBSHARE_SMBFS_H */
148