xref: /onnv-gate/usr/src/lib/libshare/smbfs/libshare_smbfs.h (revision 8271:792589b3384f)
16007Sthurlow /*
26007Sthurlow  * CDDL HEADER START
36007Sthurlow  *
46007Sthurlow  * The contents of this file are subject to the terms of the
56007Sthurlow  * Common Development and Distribution License (the "License").
66007Sthurlow  * You may not use this file except in compliance with the License.
76007Sthurlow  *
86007Sthurlow  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
96007Sthurlow  * or http://www.opensolaris.org/os/licensing.
106007Sthurlow  * See the License for the specific language governing permissions
116007Sthurlow  * and limitations under the License.
126007Sthurlow  *
136007Sthurlow  * When distributing Covered Code, include this CDDL HEADER in each
146007Sthurlow  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
156007Sthurlow  * If applicable, add the following below this CDDL HEADER, with the
166007Sthurlow  * fields enclosed by brackets "[]" replaced with your own identifying
176007Sthurlow  * information: Portions Copyright [yyyy] [name of copyright owner]
186007Sthurlow  *
196007Sthurlow  * CDDL HEADER END
206007Sthurlow  */
216007Sthurlow 
226007Sthurlow /*
236007Sthurlow  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
246007Sthurlow  * Use is subject to license terms.
256007Sthurlow  */
266007Sthurlow 
276007Sthurlow /*
286007Sthurlow  * basic API declarations for share management
296007Sthurlow  */
306007Sthurlow 
316007Sthurlow #ifndef _LIBSHARE_SMBFS_H
326007Sthurlow #define	_LIBSHARE_SMBFS_H
336007Sthurlow 
346007Sthurlow #ifdef	__cplusplus
356007Sthurlow extern "C" {
366007Sthurlow #endif
376007Sthurlow 
386007Sthurlow struct smbclnt_proto_option_defs {
396007Sthurlow 	char *name;	/* display name -- remove protocol identifier */
406007Sthurlow 	char *value;
416007Sthurlow 	int index;
426007Sthurlow 	int flags;
436007Sthurlow 	int32_t minval;
446007Sthurlow 	int32_t maxval; /* In case of length of string this should be max */
456007Sthurlow 	int (*validator)(int, char *, char *);
466007Sthurlow };
476007Sthurlow 
486007Sthurlow extern struct smbclnt_proto_option_defs smbclnt_proto_options[];
496007Sthurlow 
506007Sthurlow #define	PROTO_OPT_SECTION		0
516007Sthurlow #define	PROTO_OPT_ADDR			1
526007Sthurlow #define	PROTO_OPT_MINAUTH		2
536007Sthurlow #define	PROTO_OPT_NBNS_BROADCAST	3
546007Sthurlow #define	PROTO_OPT_NBNS_ENABLE		4
556007Sthurlow #define	PROTO_OPT_NBNSADDR		5
566007Sthurlow #define	PROTO_OPT_PASSWORD		6
576007Sthurlow #define	PROTO_OPT_TIMEOUT		7
586007Sthurlow #define	PROTO_OPT_USER			8
596007Sthurlow #define	PROTO_OPT_DOMAIN		9
606007Sthurlow #define	PROTO_OPT_WORKGROUP		10
61*8271SGordon.Ross@Sun.COM #define	PROTO_OPT_SIGNING		11
626007Sthurlow 
63*8271SGordon.Ross@Sun.COM #define	SMBC_OPT_MAX	PROTO_OPT_SIGNING
646007Sthurlow 
656007Sthurlow /*
666007Sthurlow  * Flags values
676007Sthurlow  */
686007Sthurlow #define	SMBC_MODIFIED			0x01
696007Sthurlow 
706007Sthurlow /* Max value length of all SMB properties */
716007Sthurlow #define	MAX_VALUE_BUFLEN	600
726007Sthurlow 
736007Sthurlow /*
746007Sthurlow  * SMF access
756007Sthurlow  */
766007Sthurlow 
776007Sthurlow #define	SMBC_FMRI_PREFIX		"network/smb/client"
786007Sthurlow #define	SMBC_DEFAULT_INSTANCE_FMRI	"svc:/network/smb/client:default"
796007Sthurlow #define	SMBC_PG_PREFIX			"S-"
806007Sthurlow #define	SMBC_PG_PREFIX_LEN		2
816007Sthurlow #define	SMBC_PG_INSTANCE		"default"
826007Sthurlow 
836007Sthurlow #define	SMBC_SMF_OK		0
846007Sthurlow #define	SMBC_SMF_NO_MEMORY	1	/* no memory for data structures */
856007Sthurlow #define	SMBC_SMF_SYSTEM_ERR	2	/* system error, use errno */
866007Sthurlow #define	SMBC_SMF_NO_PERMISSION	3	/* no permission for operation */
876007Sthurlow 
886007Sthurlow #define	SCH_STATE_UNINIT	0
896007Sthurlow #define	SCH_STATE_INITIALIZING	1
906007Sthurlow #define	SCH_STATE_INIT		2
916007Sthurlow 
926007Sthurlow typedef struct smb_scfhandle {
936007Sthurlow 	scf_handle_t		*scf_handle;
946007Sthurlow 	int			scf_state;
956007Sthurlow 	scf_service_t		*scf_service;
966007Sthurlow 	scf_scope_t		*scf_scope;
976007Sthurlow 	scf_transaction_t	*scf_trans;
986007Sthurlow 	scf_transaction_entry_t	*scf_entry;
996007Sthurlow 	scf_propertygroup_t	*scf_pg;
1006007Sthurlow 	scf_instance_t		*scf_instance;
1016007Sthurlow 	scf_iter_t		*scf_inst_iter;
1026007Sthurlow 	scf_iter_t		*scf_pg_iter;
1036007Sthurlow } smb_scfhandle_t;
1046007Sthurlow 
1056007Sthurlow extern void smb_smf_scf_fini(smb_scfhandle_t *);
1066007Sthurlow extern smb_scfhandle_t *smb_smf_scf_init(char *);
1076007Sthurlow extern int smb_smf_get_instance(smb_scfhandle_t *, char *);
1086007Sthurlow extern int smb_smf_create_instance(smb_scfhandle_t *, char *);
1096007Sthurlow extern int smb_smf_start_transaction(smb_scfhandle_t *);
1106007Sthurlow extern int smb_smf_end_transaction(smb_scfhandle_t *);
1116007Sthurlow 
1126007Sthurlow extern int smb_smf_set_string_property(smb_scfhandle_t *, char *, char *);
1136007Sthurlow extern int smb_smf_get_string_property(smb_scfhandle_t *, char *,
1146007Sthurlow     char *, size_t);
1156007Sthurlow extern int smb_smf_set_integer_property(smb_scfhandle_t *, char *, int64_t);
1166007Sthurlow extern int smb_smf_get_integer_property(smb_scfhandle_t *, char *, int64_t *);
1176007Sthurlow extern int smb_smf_set_boolean_property(smb_scfhandle_t *, char *, uint8_t);
1186007Sthurlow extern int smb_smf_get_boolean_property(smb_scfhandle_t *, char *, uint8_t *);
1196007Sthurlow extern int smb_smf_set_opaque_property(smb_scfhandle_t *, char *,
1206007Sthurlow     void *, size_t);
1216007Sthurlow extern int smb_smf_get_opaque_property(smb_scfhandle_t *, char *,
1226007Sthurlow     void *, size_t);
1236007Sthurlow 
1246007Sthurlow extern int smb_smf_create_service_pgroup(smb_scfhandle_t *, char *);
1256007Sthurlow extern int smb_smf_delete_service_pgroup(smb_scfhandle_t *, char *);
1266007Sthurlow extern int smb_smf_create_instance_pgroup(smb_scfhandle_t *, char *);
1276007Sthurlow extern int smb_smf_delete_instance_pgroup(smb_scfhandle_t *, char *);
1286007Sthurlow extern int smb_smf_delete_property(smb_scfhandle_t *, char *);
1296007Sthurlow extern int smb_smf_instance_exists(smb_scfhandle_t *, char *);
1306007Sthurlow extern int smb_smf_instance_create(smb_scfhandle_t *, char *, char *);
1316007Sthurlow extern int smb_smf_instance_delete(smb_scfhandle_t *, char *);
1326007Sthurlow extern smb_scfhandle_t *smb_smf_get_iterator(char *);
1336007Sthurlow 
1346007Sthurlow #ifdef	__cplusplus
1356007Sthurlow }
1366007Sthurlow #endif
1376007Sthurlow 
1386007Sthurlow #endif /* _LIBSHARE_SMBFS_H */
139