14bff34ethurlow/*
24bff34ethurlow * CDDL HEADER START
34bff34ethurlow *
44bff34ethurlow * The contents of this file are subject to the terms of the
54bff34ethurlow * Common Development and Distribution License (the "License").
64bff34ethurlow * You may not use this file except in compliance with the License.
74bff34ethurlow *
84bff34ethurlow * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
94bff34ethurlow * or http://www.opensolaris.org/os/licensing.
104bff34ethurlow * See the License for the specific language governing permissions
114bff34ethurlow * and limitations under the License.
124bff34ethurlow *
134bff34ethurlow * When distributing Covered Code, include this CDDL HEADER in each
144bff34ethurlow * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
154bff34ethurlow * If applicable, add the following below this CDDL HEADER, with the
164bff34ethurlow * fields enclosed by brackets "[]" replaced with your own identifying
174bff34ethurlow * information: Portions Copyright [yyyy] [name of copyright owner]
184bff34ethurlow *
194bff34ethurlow * CDDL HEADER END
204bff34ethurlow */
214bff34ethurlow
224bff34ethurlow/*
234bff34ethurlow * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
244bff34ethurlow * Use is subject to license terms.
25adee678Gordon Ross *
26adee678Gordon Ross * Copyright 2018 Nexenta Systems, Inc.  All rights reserved.
274bff34ethurlow */
284bff34ethurlow
294bff34ethurlow/*
304bff34ethurlow * basic API declarations for share management
314bff34ethurlow */
324bff34ethurlow
334bff34ethurlow#ifndef _LIBSHARE_SMBFS_H
344bff34ethurlow#define	_LIBSHARE_SMBFS_H
354bff34ethurlow
364bff34ethurlow#ifdef	__cplusplus
374bff34ethurlowextern "C" {
384bff34ethurlow#endif
394bff34ethurlow
404bff34ethurlowstruct smbclnt_proto_option_defs {
414bff34ethurlow	char *name;	/* display name -- remove protocol identifier */
424bff34ethurlow	char *value;
434bff34ethurlow	int index;
444bff34ethurlow	int flags;
454bff34ethurlow	int32_t minval;
464bff34ethurlow	int32_t maxval; /* In case of length of string this should be max */
474bff34ethurlow	int (*validator)(int, char *, char *);
484bff34ethurlow};
494bff34ethurlow
504bff34ethurlowextern struct smbclnt_proto_option_defs smbclnt_proto_options[];
514bff34ethurlow
524bff34ethurlow#define	PROTO_OPT_SECTION		0
534bff34ethurlow#define	PROTO_OPT_ADDR			1
544bff34ethurlow#define	PROTO_OPT_MINAUTH		2
554bff34ethurlow#define	PROTO_OPT_NBNS_BROADCAST	3
564bff34ethurlow#define	PROTO_OPT_NBNS_ENABLE		4
574bff34ethurlow#define	PROTO_OPT_NBNSADDR		5
584bff34ethurlow#define	PROTO_OPT_PASSWORD		6
594bff34ethurlow#define	PROTO_OPT_TIMEOUT		7
604bff34ethurlow#define	PROTO_OPT_USER			8
614bff34ethurlow#define	PROTO_OPT_DOMAIN		9
624bff34ethurlow#define	PROTO_OPT_WORKGROUP		10
639c9af25Gordon Ross#define	PROTO_OPT_SIGNING		11
64adee678Gordon Ross#define	PROTO_OPT_MIN_PROTOCOL		12
65adee678Gordon Ross#define	PROTO_OPT_MAX_PROTOCOL		13
664bff34ethurlow
67adee678Gordon Ross#define	SMBC_OPT_MAX	PROTO_OPT_MAX_PROTOCOL
684bff34ethurlow
694bff34ethurlow/*
704bff34ethurlow * Flags values
714bff34ethurlow */
724bff34ethurlow#define	SMBC_MODIFIED			0x01
734bff34ethurlow
744bff34ethurlow/* Max value length of all SMB properties */
754bff34ethurlow#define	MAX_VALUE_BUFLEN	600
764bff34ethurlow
774bff34ethurlow/*
784bff34ethurlow * SMF access
794bff34ethurlow */
804bff34ethurlow
814bff34ethurlow#define	SMBC_FMRI_PREFIX		"network/smb/client"
824bff34ethurlow#define	SMBC_DEFAULT_INSTANCE_FMRI	"svc:/network/smb/client:default"
834bff34ethurlow#define	SMBC_PG_PREFIX			"S-"
844bff34ethurlow#define	SMBC_PG_PREFIX_LEN		2
854bff34ethurlow#define	SMBC_PG_INSTANCE		"default"
864bff34ethurlow
874bff34ethurlow#define	SMBC_SMF_OK		0
884bff34ethurlow#define	SMBC_SMF_NO_MEMORY	1	/* no memory for data structures */
894bff34ethurlow#define	SMBC_SMF_SYSTEM_ERR	2	/* system error, use errno */
904bff34ethurlow#define	SMBC_SMF_NO_PERMISSION	3	/* no permission for operation */
914bff34ethurlow
924bff34ethurlow#define	SCH_STATE_UNINIT	0
934bff34ethurlow#define	SCH_STATE_INITIALIZING	1
944bff34ethurlow#define	SCH_STATE_INIT		2
954bff34ethurlow
964bff34ethurlowtypedef struct smb_scfhandle {
974bff34ethurlow	scf_handle_t		*scf_handle;
984bff34ethurlow	int			scf_state;
994bff34ethurlow	scf_service_t		*scf_service;
1004bff34ethurlow	scf_scope_t		*scf_scope;
1014bff34ethurlow	scf_transaction_t	*scf_trans;
1024bff34ethurlow	scf_transaction_entry_t	*scf_entry;
1034bff34ethurlow	scf_propertygroup_t	*scf_pg;
1044bff34ethurlow	scf_instance_t		*scf_instance;
1054bff34ethurlow	scf_iter_t		*scf_inst_iter;
1064bff34ethurlow	scf_iter_t		*scf_pg_iter;
1074bff34ethurlow} smb_scfhandle_t;
1084bff34ethurlow
1094bff34ethurlowextern void smb_smf_scf_fini(smb_scfhandle_t *);
1104bff34ethurlowextern smb_scfhandle_t *smb_smf_scf_init(char *);
1114bff34ethurlowextern int smb_smf_get_instance(smb_scfhandle_t *, char *);
1124bff34ethurlowextern int smb_smf_create_instance(smb_scfhandle_t *, char *);
1134bff34ethurlowextern int smb_smf_start_transaction(smb_scfhandle_t *);
1144bff34ethurlowextern int smb_smf_end_transaction(smb_scfhandle_t *);
1154bff34ethurlow
1164bff34ethurlowextern int smb_smf_set_string_property(smb_scfhandle_t *, char *, char *);
1174bff34ethurlowextern int smb_smf_get_string_property(smb_scfhandle_t *, char *,
1184bff34ethurlow    char *, size_t);
1194bff34ethurlowextern int smb_smf_set_integer_property(smb_scfhandle_t *, char *, int64_t);
1204bff34ethurlowextern int smb_smf_get_integer_property(smb_scfhandle_t *, char *, int64_t *);
1214bff34ethurlowextern int smb_smf_set_boolean_property(smb_scfhandle_t *, char *, uint8_t);
1224bff34ethurlowextern int smb_smf_get_boolean_property(smb_scfhandle_t *, char *, uint8_t *);
1234bff34ethurlowextern int smb_smf_set_opaque_property(smb_scfhandle_t *, char *,
1244bff34ethurlow    void *, size_t);
1254bff34ethurlowextern int smb_smf_get_opaque_property(smb_scfhandle_t *, char *,
1264bff34ethurlow    void *, size_t);
1274bff34ethurlow
1284bff34ethurlowextern int smb_smf_create_service_pgroup(smb_scfhandle_t *, char *);
1294bff34ethurlowextern int smb_smf_delete_service_pgroup(smb_scfhandle_t *, char *);
1304bff34ethurlowextern int smb_smf_create_instance_pgroup(smb_scfhandle_t *, char *);
1314bff34ethurlowextern int smb_smf_delete_instance_pgroup(smb_scfhandle_t *, char *);
1324bff34ethurlowextern int smb_smf_delete_property(smb_scfhandle_t *, char *);
1334bff34ethurlowextern int smb_smf_instance_exists(smb_scfhandle_t *, char *);
1344bff34ethurlowextern int smb_smf_instance_create(smb_scfhandle_t *, char *, char *);
1354bff34ethurlowextern int smb_smf_instance_delete(smb_scfhandle_t *, char *);
1364bff34ethurlowextern smb_scfhandle_t *smb_smf_get_iterator(char *);
1374bff34ethurlow
1384bff34ethurlow#ifdef	__cplusplus
1394bff34ethurlow}
1404bff34ethurlow#endif
1414bff34ethurlow
1424bff34ethurlow#endif /* _LIBSHARE_SMBFS_H */
143