xref: /onnv-gate/usr/src/lib/libshare/common/scfutil.h (revision 3973:1e8fb2023770)
13034Sdougm /*
23034Sdougm  * CDDL HEADER START
33034Sdougm  *
43034Sdougm  * The contents of this file are subject to the terms of the
53034Sdougm  * Common Development and Distribution License (the "License").
63034Sdougm  * You may not use this file except in compliance with the License.
73034Sdougm  *
83034Sdougm  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
93034Sdougm  * or http://www.opensolaris.org/os/licensing.
103034Sdougm  * See the License for the specific language governing permissions
113034Sdougm  * and limitations under the License.
123034Sdougm  *
133034Sdougm  * When distributing Covered Code, include this CDDL HEADER in each
143034Sdougm  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
153034Sdougm  * If applicable, add the following below this CDDL HEADER, with the
163034Sdougm  * fields enclosed by brackets "[]" replaced with your own identifying
173034Sdougm  * information: Portions Copyright [yyyy] [name of copyright owner]
183034Sdougm  *
193034Sdougm  * CDDL HEADER END
203034Sdougm  */
213034Sdougm 
223034Sdougm /*
233910Sdougm  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
243034Sdougm  * Use is subject to license terms.
253034Sdougm  */
263034Sdougm 
273034Sdougm /*
283034Sdougm  * basic API declarations for share management
293034Sdougm  */
303034Sdougm 
313034Sdougm #ifndef _SCFUTIL_H
323034Sdougm #define	_SCFUTIL_H
333034Sdougm 
343034Sdougm #pragma ident	"%Z%%M%	%I%	%E% SMI"
353034Sdougm 
363034Sdougm #ifdef	__cplusplus
373034Sdougm extern "C" {
383034Sdougm #endif
393034Sdougm #include <libxml/tree.h>
403034Sdougm 
413034Sdougm typedef struct scfutilhandle {
423034Sdougm 	scf_handle_t		*handle;
433034Sdougm 	int			scf_state;
443034Sdougm 	scf_service_t		*service;
453034Sdougm 	scf_scope_t		*scope;
463034Sdougm 	scf_transaction_t	*trans;
473034Sdougm 	scf_transaction_entry_t	*entry;
483034Sdougm 	scf_propertygroup_t	*pg;
493034Sdougm 	scf_instance_t		*instance;
503034Sdougm } scfutilhandle_t;
513034Sdougm 
523034Sdougm #define	SCH_STATE_UNINIT	0
533034Sdougm #define	SCH_STATE_INITIALIZING	1
543034Sdougm #define	SCH_STATE_INIT	2
553034Sdougm 
563034Sdougm extern void sa_scf_fini(scfutilhandle_t *);
573034Sdougm extern scfutilhandle_t *sa_scf_init();
58*3973Sdougm extern int sa_get_config(scfutilhandle_t *, xmlNodePtr, sa_handle_t);
593034Sdougm extern int sa_get_instance(scfutilhandle_t *, char *);
603034Sdougm extern int sa_create_instance(scfutilhandle_t *, char *);
613034Sdougm 
623034Sdougm /*
633034Sdougm  * Shares are held in a property group with name of the form
643034Sdougm  * S-<GUID>.  The total length of the name is 38 characters.
653034Sdougm  */
663034Sdougm #define	SA_SHARE_PG_PREFIX	"S-"
673034Sdougm #define	SA_SHARE_PG_PREFIXLEN	2
683034Sdougm #define	SA_SHARE_PG_LEN		38
693034Sdougm #define	SA_SHARE_UUID_BUFLEN	64
703034Sdougm 
713034Sdougm /*
723034Sdougm  * service instance related defines
733034Sdougm  */
743034Sdougm #define	SA_GROUP_SVC_NAME	"network/shares/group"
753034Sdougm #define	SA_GROUP_INST_LEN	256
763034Sdougm 
773034Sdougm #ifdef	__cplusplus
783034Sdougm }
793034Sdougm #endif
803034Sdougm 
813034Sdougm #endif /* _SCFUTIL_H */
82