xref: /titanic_54/usr/src/lib/libscf/inc/libscf.h (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate  * CDDL HEADER START
3*7c478bd9Sstevel@tonic-gate  *
4*7c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*7c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*7c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*7c478bd9Sstevel@tonic-gate  * with the License.
8*7c478bd9Sstevel@tonic-gate  *
9*7c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*7c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*7c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*7c478bd9Sstevel@tonic-gate  * and limitations under the License.
13*7c478bd9Sstevel@tonic-gate  *
14*7c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*7c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*7c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*7c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*7c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*7c478bd9Sstevel@tonic-gate  *
20*7c478bd9Sstevel@tonic-gate  * CDDL HEADER END
21*7c478bd9Sstevel@tonic-gate  */
22*7c478bd9Sstevel@tonic-gate /*
23*7c478bd9Sstevel@tonic-gate  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24*7c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
25*7c478bd9Sstevel@tonic-gate  */
26*7c478bd9Sstevel@tonic-gate 
27*7c478bd9Sstevel@tonic-gate #ifndef	_LIBSCF_H
28*7c478bd9Sstevel@tonic-gate #define	_LIBSCF_H
29*7c478bd9Sstevel@tonic-gate 
30*7c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
31*7c478bd9Sstevel@tonic-gate 
32*7c478bd9Sstevel@tonic-gate #include <stddef.h>
33*7c478bd9Sstevel@tonic-gate #include <sys/types.h>
34*7c478bd9Sstevel@tonic-gate 
35*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
36*7c478bd9Sstevel@tonic-gate extern "C" {
37*7c478bd9Sstevel@tonic-gate #endif
38*7c478bd9Sstevel@tonic-gate 
39*7c478bd9Sstevel@tonic-gate typedef struct scf_version *scf_version_t;
40*7c478bd9Sstevel@tonic-gate #define	SCF_VERSION	((scf_version_t)1UL)
41*7c478bd9Sstevel@tonic-gate 
42*7c478bd9Sstevel@tonic-gate /*
43*7c478bd9Sstevel@tonic-gate  * Opaque structures
44*7c478bd9Sstevel@tonic-gate  */
45*7c478bd9Sstevel@tonic-gate typedef struct scf_handle scf_handle_t;
46*7c478bd9Sstevel@tonic-gate typedef struct scf_scope scf_scope_t;
47*7c478bd9Sstevel@tonic-gate typedef struct scf_service scf_service_t;
48*7c478bd9Sstevel@tonic-gate typedef struct scf_instance scf_instance_t;
49*7c478bd9Sstevel@tonic-gate typedef struct scf_propertygroup scf_propertygroup_t;
50*7c478bd9Sstevel@tonic-gate typedef struct scf_property scf_property_t;
51*7c478bd9Sstevel@tonic-gate 
52*7c478bd9Sstevel@tonic-gate typedef struct scf_snapshot scf_snapshot_t;
53*7c478bd9Sstevel@tonic-gate typedef struct scf_snaplevel scf_snaplevel_t;
54*7c478bd9Sstevel@tonic-gate 
55*7c478bd9Sstevel@tonic-gate typedef struct scf_transaction scf_transaction_t;
56*7c478bd9Sstevel@tonic-gate typedef struct scf_transaction_entry scf_transaction_entry_t;
57*7c478bd9Sstevel@tonic-gate typedef struct scf_value scf_value_t;
58*7c478bd9Sstevel@tonic-gate 
59*7c478bd9Sstevel@tonic-gate typedef struct scf_iter scf_iter_t;
60*7c478bd9Sstevel@tonic-gate 
61*7c478bd9Sstevel@tonic-gate typedef struct scf_simple_app_props scf_simple_app_props_t;
62*7c478bd9Sstevel@tonic-gate typedef struct scf_simple_prop scf_simple_prop_t;
63*7c478bd9Sstevel@tonic-gate 
64*7c478bd9Sstevel@tonic-gate /*
65*7c478bd9Sstevel@tonic-gate  * Types
66*7c478bd9Sstevel@tonic-gate  */
67*7c478bd9Sstevel@tonic-gate typedef enum {
68*7c478bd9Sstevel@tonic-gate 	SCF_TYPE_INVALID = 0,
69*7c478bd9Sstevel@tonic-gate 
70*7c478bd9Sstevel@tonic-gate 	SCF_TYPE_BOOLEAN,
71*7c478bd9Sstevel@tonic-gate 	SCF_TYPE_COUNT,
72*7c478bd9Sstevel@tonic-gate 	SCF_TYPE_INTEGER,
73*7c478bd9Sstevel@tonic-gate 	SCF_TYPE_TIME,
74*7c478bd9Sstevel@tonic-gate 	SCF_TYPE_ASTRING,
75*7c478bd9Sstevel@tonic-gate 	SCF_TYPE_OPAQUE,
76*7c478bd9Sstevel@tonic-gate 
77*7c478bd9Sstevel@tonic-gate 	SCF_TYPE_USTRING = 100,
78*7c478bd9Sstevel@tonic-gate 
79*7c478bd9Sstevel@tonic-gate 	SCF_TYPE_URI = 200,
80*7c478bd9Sstevel@tonic-gate 	SCF_TYPE_FMRI,
81*7c478bd9Sstevel@tonic-gate 
82*7c478bd9Sstevel@tonic-gate 	SCF_TYPE_HOST = 300,
83*7c478bd9Sstevel@tonic-gate 	SCF_TYPE_HOSTNAME,
84*7c478bd9Sstevel@tonic-gate 	SCF_TYPE_NET_ADDR_V4,
85*7c478bd9Sstevel@tonic-gate 	SCF_TYPE_NET_ADDR_V6
86*7c478bd9Sstevel@tonic-gate } scf_type_t;
87*7c478bd9Sstevel@tonic-gate 
88*7c478bd9Sstevel@tonic-gate /*
89*7c478bd9Sstevel@tonic-gate  * Return codes
90*7c478bd9Sstevel@tonic-gate  */
91*7c478bd9Sstevel@tonic-gate #define	SCF_SUCCESS			0
92*7c478bd9Sstevel@tonic-gate #define	SCF_COMPLETE			1
93*7c478bd9Sstevel@tonic-gate #define	SCF_FAILED			-1
94*7c478bd9Sstevel@tonic-gate 
95*7c478bd9Sstevel@tonic-gate typedef enum scf_error {
96*7c478bd9Sstevel@tonic-gate 	SCF_ERROR_NONE = 1000,		/* no error */
97*7c478bd9Sstevel@tonic-gate 	SCF_ERROR_NOT_BOUND,		/* handle not bound */
98*7c478bd9Sstevel@tonic-gate 	SCF_ERROR_NOT_SET,		/* cannot use unset argument */
99*7c478bd9Sstevel@tonic-gate 	SCF_ERROR_NOT_FOUND,		/* nothing of that name found */
100*7c478bd9Sstevel@tonic-gate 	SCF_ERROR_TYPE_MISMATCH,	/* type does not match value */
101*7c478bd9Sstevel@tonic-gate 	SCF_ERROR_IN_USE,		/* cannot modify while in-use */
102*7c478bd9Sstevel@tonic-gate 	SCF_ERROR_CONNECTION_BROKEN,	/* repository connection gone */
103*7c478bd9Sstevel@tonic-gate 	SCF_ERROR_INVALID_ARGUMENT,	/* bad argument */
104*7c478bd9Sstevel@tonic-gate 	SCF_ERROR_NO_MEMORY,		/* no memory available */
105*7c478bd9Sstevel@tonic-gate 	SCF_ERROR_CONSTRAINT_VIOLATED,	/* required constraint not met */
106*7c478bd9Sstevel@tonic-gate 	SCF_ERROR_EXISTS,		/* object already exists */
107*7c478bd9Sstevel@tonic-gate 	SCF_ERROR_NO_SERVER,		/* repository server unavailable */
108*7c478bd9Sstevel@tonic-gate 	SCF_ERROR_NO_RESOURCES,		/* server has insufficient resources */
109*7c478bd9Sstevel@tonic-gate 	SCF_ERROR_PERMISSION_DENIED,	/* insufficient privileges for action */
110*7c478bd9Sstevel@tonic-gate 	SCF_ERROR_BACKEND_ACCESS,	/* backend refused access */
111*7c478bd9Sstevel@tonic-gate 	SCF_ERROR_HANDLE_MISMATCH,	/* mismatched SCF handles */
112*7c478bd9Sstevel@tonic-gate 	SCF_ERROR_HANDLE_DESTROYED,	/* object bound to destroyed handle */
113*7c478bd9Sstevel@tonic-gate 	SCF_ERROR_VERSION_MISMATCH,	/* incompatible SCF version */
114*7c478bd9Sstevel@tonic-gate 	SCF_ERROR_BACKEND_READONLY,	/* backend is read-only */
115*7c478bd9Sstevel@tonic-gate 	SCF_ERROR_DELETED,		/* object has been deleted */
116*7c478bd9Sstevel@tonic-gate 
117*7c478bd9Sstevel@tonic-gate 	SCF_ERROR_CALLBACK_FAILED = 1080, /* user callback function failed */
118*7c478bd9Sstevel@tonic-gate 
119*7c478bd9Sstevel@tonic-gate 	SCF_ERROR_INTERNAL = 1101	/* internal error */
120*7c478bd9Sstevel@tonic-gate } scf_error_t;
121*7c478bd9Sstevel@tonic-gate 
122*7c478bd9Sstevel@tonic-gate /*
123*7c478bd9Sstevel@tonic-gate  * Standard services
124*7c478bd9Sstevel@tonic-gate  */
125*7c478bd9Sstevel@tonic-gate #define	SCF_SERVICE_STARTD	((const char *) \
126*7c478bd9Sstevel@tonic-gate 				    "svc:/system/svc/restarter:default")
127*7c478bd9Sstevel@tonic-gate #define	SCF_SERVICE_CONFIGD	((const char *) \
128*7c478bd9Sstevel@tonic-gate 				    "svc:/system/svc/repository:default")
129*7c478bd9Sstevel@tonic-gate 
130*7c478bd9Sstevel@tonic-gate /*
131*7c478bd9Sstevel@tonic-gate  * Major milestones
132*7c478bd9Sstevel@tonic-gate  */
133*7c478bd9Sstevel@tonic-gate #define	SCF_MILESTONE_SINGLE_USER \
134*7c478bd9Sstevel@tonic-gate 	((const char *) "svc:/milestone/single-user:default")
135*7c478bd9Sstevel@tonic-gate #define	SCF_MILESTONE_MULTI_USER \
136*7c478bd9Sstevel@tonic-gate 	((const char *) "svc:/milestone/multi-user:default")
137*7c478bd9Sstevel@tonic-gate #define	SCF_MILESTONE_MULTI_USER_SERVER \
138*7c478bd9Sstevel@tonic-gate 	((const char *) "svc:/milestone/multi-user-server:default")
139*7c478bd9Sstevel@tonic-gate 
140*7c478bd9Sstevel@tonic-gate /*
141*7c478bd9Sstevel@tonic-gate  * standard scope names
142*7c478bd9Sstevel@tonic-gate  */
143*7c478bd9Sstevel@tonic-gate #define	SCF_SCOPE_LOCAL			((const char *)"localhost")
144*7c478bd9Sstevel@tonic-gate 
145*7c478bd9Sstevel@tonic-gate /*
146*7c478bd9Sstevel@tonic-gate  * Property group types
147*7c478bd9Sstevel@tonic-gate  */
148*7c478bd9Sstevel@tonic-gate #define	SCF_GROUP_APPLICATION		((const char *)"application")
149*7c478bd9Sstevel@tonic-gate #define	SCF_GROUP_FRAMEWORK		((const char *)"framework")
150*7c478bd9Sstevel@tonic-gate #define	SCF_GROUP_DEPENDENCY		((const char *)"dependency")
151*7c478bd9Sstevel@tonic-gate #define	SCF_GROUP_METHOD		((const char *)"method")
152*7c478bd9Sstevel@tonic-gate #define	SCF_GROUP_TEMPLATE		((const char *)"template")
153*7c478bd9Sstevel@tonic-gate 
154*7c478bd9Sstevel@tonic-gate /*
155*7c478bd9Sstevel@tonic-gate  * Dependency types
156*7c478bd9Sstevel@tonic-gate  */
157*7c478bd9Sstevel@tonic-gate #define	SCF_DEP_REQUIRE_ALL		((const char *)"require_all")
158*7c478bd9Sstevel@tonic-gate #define	SCF_DEP_REQUIRE_ANY		((const char *)"require_any")
159*7c478bd9Sstevel@tonic-gate #define	SCF_DEP_EXCLUDE_ALL		((const char *)"exclude_all")
160*7c478bd9Sstevel@tonic-gate #define	SCF_DEP_OPTIONAL_ALL		((const char *)"optional_all")
161*7c478bd9Sstevel@tonic-gate 
162*7c478bd9Sstevel@tonic-gate #define	SCF_DEP_RESET_ON_ERROR		((const char *)"error")
163*7c478bd9Sstevel@tonic-gate #define	SCF_DEP_RESET_ON_RESTART	((const char *)"restart")
164*7c478bd9Sstevel@tonic-gate #define	SCF_DEP_RESET_ON_REFRESH	((const char *)"refresh")
165*7c478bd9Sstevel@tonic-gate #define	SCF_DEP_RESET_ON_NONE		((const char *)"none")
166*7c478bd9Sstevel@tonic-gate 
167*7c478bd9Sstevel@tonic-gate /*
168*7c478bd9Sstevel@tonic-gate  * Standard property group names
169*7c478bd9Sstevel@tonic-gate  */
170*7c478bd9Sstevel@tonic-gate #define	SCF_PG_GENERAL			((const char *)"general")
171*7c478bd9Sstevel@tonic-gate #define	SCF_PG_GENERAL_OVR		((const char *)"general_ovr")
172*7c478bd9Sstevel@tonic-gate #define	SCF_PG_RESTARTER		((const char *)"restarter")
173*7c478bd9Sstevel@tonic-gate #define	SCF_PG_RESTARTER_ACTIONS	((const char *)"restarter_actions")
174*7c478bd9Sstevel@tonic-gate #define	SCF_PG_METHOD_CONTEXT		((const char *)"method_context")
175*7c478bd9Sstevel@tonic-gate #define	SCF_PG_APP_DEFAULT		((const char *)"application")
176*7c478bd9Sstevel@tonic-gate #define	SCF_PG_DEPENDENTS		((const char *)"dependents")
177*7c478bd9Sstevel@tonic-gate #define	SCF_PG_OPTIONS			((const char *)"options")
178*7c478bd9Sstevel@tonic-gate #define	SCF_PG_OPTIONS_OVR		((const char *)"options_ovr")
179*7c478bd9Sstevel@tonic-gate #define	SCF_PG_STARTD			((const char *)"startd")
180*7c478bd9Sstevel@tonic-gate #define	SCF_PG_STARTD_PRIVATE		((const char *)"svc-startd-private")
181*7c478bd9Sstevel@tonic-gate 
182*7c478bd9Sstevel@tonic-gate /*
183*7c478bd9Sstevel@tonic-gate  * Template property group names and prefix
184*7c478bd9Sstevel@tonic-gate  */
185*7c478bd9Sstevel@tonic-gate #define	SCF_PG_TM_COMMON_NAME		((const char *)"tm_common_name")
186*7c478bd9Sstevel@tonic-gate #define	SCF_PG_TM_DESCRIPTION		((const char *)"tm_description")
187*7c478bd9Sstevel@tonic-gate 
188*7c478bd9Sstevel@tonic-gate #define	SCF_PG_TM_MAN_PREFIX		((const char *)"tm_man_")
189*7c478bd9Sstevel@tonic-gate #define	SCF_PG_TM_DOC_PREFIX		((const char *)"tm_doc_")
190*7c478bd9Sstevel@tonic-gate 
191*7c478bd9Sstevel@tonic-gate /*
192*7c478bd9Sstevel@tonic-gate  * Standard property names
193*7c478bd9Sstevel@tonic-gate  */
194*7c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_AUX_STATE		((const char *)"auxiliary_state")
195*7c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_CONTRACT		((const char *)"contract")
196*7c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_COREFILE_PATTERN	((const char *)"corefile_pattern")
197*7c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_DEGRADED		((const char *)"degraded")
198*7c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_DEGRADE_IMMEDIATE	((const char *)"degrade_immediate")
199*7c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_DURATION		((const char *)"duration")
200*7c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_ENABLED		((const char *)"enabled")
201*7c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_ENTITY_STABILITY	((const char *)"entity_stability")
202*7c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_ENTITIES		((const char *)"entities")
203*7c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_EXEC		((const char *)"exec")
204*7c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_GROUP		((const char *)"group")
205*7c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_GROUPING		((const char *)"grouping")
206*7c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_IGNORE		((const char *)"ignore_error")
207*7c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_LIMIT_PRIVILEGES	((const char *)"limit_privileges")
208*7c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_MAINT_OFF		((const char *)"maint_off")
209*7c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_MAINT_ON		((const char *)"maint_on")
210*7c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_MAINT_ON_IMMEDIATE	((const char *)"maint_on_immediate")
211*7c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_MAINT_ON_IMMTEMP	((const char *)"maint_on_immtemp")
212*7c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_MAINT_ON_TEMPORARY	((const char *)"maint_on_temporary")
213*7c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_METHOD_PID		((const char *)"method_pid")
214*7c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_MILESTONE		((const char *)"milestone")
215*7c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_NEED_SESSION	((const char *)"need_session")
216*7c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_NEXT_STATE		((const char *)"next_state")
217*7c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_PACKAGE		((const char *)"package")
218*7c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_PRIVILEGES		((const char *)"privileges")
219*7c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_PROFILE		((const char *)"profile")
220*7c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_PROJECT		((const char *)"project")
221*7c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_REFRESH		((const char *)"refresh")
222*7c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_RESOURCE_POOL	((const char *)"resource_pool")
223*7c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_ENVIRONMENT	((const char *)"environment")
224*7c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_RESTART		((const char *)"restart")
225*7c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_RESTARTER		((const char *)"restarter")
226*7c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_RESTART_INTERVAL	((const char *)"restart_interval")
227*7c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_RESTART_ON		((const char *)"restart_on")
228*7c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_RESTORE		((const char *)"restore")
229*7c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_SINGLE_INSTANCE	((const char *)"single_instance")
230*7c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_START_METHOD_TIMESTAMP	\
231*7c478bd9Sstevel@tonic-gate 	((const char *)"start_method_timestamp")
232*7c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_START_METHOD_WAITSTATUS	\
233*7c478bd9Sstevel@tonic-gate 	((const char *)"start_method_waitstatus")
234*7c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_START_PID		((const char *)"start_pid")
235*7c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_STATE		((const char *)"state")
236*7c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_STABILITY		((const char *)"stability")
237*7c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_STATE_TIMESTAMP	((const char *)"state_timestamp")
238*7c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_SUPP_GROUPS	((const char *)"supp_groups")
239*7c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_TIMEOUT		((const char *)"timeout_seconds")
240*7c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_TIMEOUT_RETRY	((const char *)"timeout_retry")
241*7c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_TRANSIENT_CONTRACT	((const char *)"transient_contract")
242*7c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_TYPE		((const char *)"type")
243*7c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_USE_PROFILE	((const char *)"use_profile")
244*7c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_USER		((const char *)"user")
245*7c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_UTMPX_PREFIX	((const char *)"utmpx_prefix")
246*7c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_WORKING_DIRECTORY	((const char *)"working_directory")
247*7c478bd9Sstevel@tonic-gate 
248*7c478bd9Sstevel@tonic-gate /*
249*7c478bd9Sstevel@tonic-gate  * Template property names
250*7c478bd9Sstevel@tonic-gate  */
251*7c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_TM_MANPATH		((const char *)"manpath")
252*7c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_TM_SECTION		((const char *)"section")
253*7c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_TM_TITLE		((const char *)"title")
254*7c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_TM_NAME		((const char *)"name")
255*7c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_TM_URI		((const char *)"uri")
256*7c478bd9Sstevel@tonic-gate 
257*7c478bd9Sstevel@tonic-gate /*
258*7c478bd9Sstevel@tonic-gate  * Strings used by restarters for state and next_state properties.
259*7c478bd9Sstevel@tonic-gate  * MAX_SCF_STATE_STRING holds the max length of a state string, including the
260*7c478bd9Sstevel@tonic-gate  * terminating null.
261*7c478bd9Sstevel@tonic-gate  */
262*7c478bd9Sstevel@tonic-gate 
263*7c478bd9Sstevel@tonic-gate #define	MAX_SCF_STATE_STRING_SZ		14
264*7c478bd9Sstevel@tonic-gate 
265*7c478bd9Sstevel@tonic-gate #define	SCF_STATE_STRING_NONE		((const char *)"none")
266*7c478bd9Sstevel@tonic-gate #define	SCF_STATE_STRING_UNINIT		((const char *)"uninitialized")
267*7c478bd9Sstevel@tonic-gate #define	SCF_STATE_STRING_MAINT		((const char *)"maintenance")
268*7c478bd9Sstevel@tonic-gate #define	SCF_STATE_STRING_OFFLINE	((const char *)"offline")
269*7c478bd9Sstevel@tonic-gate #define	SCF_STATE_STRING_DISABLED	((const char *)"disabled")
270*7c478bd9Sstevel@tonic-gate #define	SCF_STATE_STRING_ONLINE		((const char *)"online")
271*7c478bd9Sstevel@tonic-gate #define	SCF_STATE_STRING_DEGRADED	((const char *)"degraded")
272*7c478bd9Sstevel@tonic-gate #define	SCF_STATE_STRING_LEGACY		((const char *)"legacy_run")
273*7c478bd9Sstevel@tonic-gate 
274*7c478bd9Sstevel@tonic-gate #define	SCF_STATE_UNINIT		0x00000001
275*7c478bd9Sstevel@tonic-gate #define	SCF_STATE_MAINT			0x00000002
276*7c478bd9Sstevel@tonic-gate #define	SCF_STATE_OFFLINE		0x00000004
277*7c478bd9Sstevel@tonic-gate #define	SCF_STATE_DISABLED		0x00000008
278*7c478bd9Sstevel@tonic-gate #define	SCF_STATE_ONLINE		0x00000010
279*7c478bd9Sstevel@tonic-gate #define	SCF_STATE_DEGRADED		0x00000020
280*7c478bd9Sstevel@tonic-gate #define	SCF_STATE_ALL			0x0000003F
281*7c478bd9Sstevel@tonic-gate 
282*7c478bd9Sstevel@tonic-gate #define	SCF_PG_FLAG_NONPERSISTENT	0x1
283*7c478bd9Sstevel@tonic-gate 
284*7c478bd9Sstevel@tonic-gate #define	SCF_TRACE_LIBRARY		0x1
285*7c478bd9Sstevel@tonic-gate #define	SCF_TRACE_DAEMON		0x2
286*7c478bd9Sstevel@tonic-gate 
287*7c478bd9Sstevel@tonic-gate #define	SMF_IMMEDIATE			0x1
288*7c478bd9Sstevel@tonic-gate #define	SMF_TEMPORARY			0x2
289*7c478bd9Sstevel@tonic-gate #define	SMF_AT_NEXT_BOOT		0x4
290*7c478bd9Sstevel@tonic-gate 
291*7c478bd9Sstevel@tonic-gate scf_error_t scf_error(void);
292*7c478bd9Sstevel@tonic-gate const char *scf_strerror(scf_error_t);
293*7c478bd9Sstevel@tonic-gate 
294*7c478bd9Sstevel@tonic-gate ssize_t scf_limit(uint32_t code);
295*7c478bd9Sstevel@tonic-gate #define	SCF_LIMIT_MAX_NAME_LENGTH	-2000U
296*7c478bd9Sstevel@tonic-gate #define	SCF_LIMIT_MAX_VALUE_LENGTH	-2001U
297*7c478bd9Sstevel@tonic-gate #define	SCF_LIMIT_MAX_PG_TYPE_LENGTH	-2002U
298*7c478bd9Sstevel@tonic-gate #define	SCF_LIMIT_MAX_FMRI_LENGTH	-2003U
299*7c478bd9Sstevel@tonic-gate 
300*7c478bd9Sstevel@tonic-gate scf_handle_t *scf_handle_create(scf_version_t);
301*7c478bd9Sstevel@tonic-gate 
302*7c478bd9Sstevel@tonic-gate int scf_handle_decorate(scf_handle_t *, const char *, scf_value_t *);
303*7c478bd9Sstevel@tonic-gate #define	SCF_DECORATE_CLEAR	((scf_value_t *)0)
304*7c478bd9Sstevel@tonic-gate 
305*7c478bd9Sstevel@tonic-gate int scf_handle_bind(scf_handle_t *);
306*7c478bd9Sstevel@tonic-gate int scf_handle_unbind(scf_handle_t *);
307*7c478bd9Sstevel@tonic-gate void scf_handle_destroy(scf_handle_t *);
308*7c478bd9Sstevel@tonic-gate 
309*7c478bd9Sstevel@tonic-gate int scf_type_base_type(scf_type_t type, scf_type_t *out);
310*7c478bd9Sstevel@tonic-gate 
311*7c478bd9Sstevel@tonic-gate /* values */
312*7c478bd9Sstevel@tonic-gate scf_value_t *scf_value_create(scf_handle_t *);
313*7c478bd9Sstevel@tonic-gate scf_handle_t *scf_value_handle(const scf_value_t *);
314*7c478bd9Sstevel@tonic-gate void scf_value_destroy(scf_value_t *);
315*7c478bd9Sstevel@tonic-gate 
316*7c478bd9Sstevel@tonic-gate scf_type_t scf_value_base_type(const scf_value_t *);
317*7c478bd9Sstevel@tonic-gate scf_type_t scf_value_type(const scf_value_t *);
318*7c478bd9Sstevel@tonic-gate int scf_value_is_type(const scf_value_t *, scf_type_t);
319*7c478bd9Sstevel@tonic-gate 
320*7c478bd9Sstevel@tonic-gate void scf_value_reset(scf_value_t *);
321*7c478bd9Sstevel@tonic-gate 
322*7c478bd9Sstevel@tonic-gate int scf_value_get_boolean(const scf_value_t *, uint8_t *);
323*7c478bd9Sstevel@tonic-gate int scf_value_get_count(const scf_value_t *, uint64_t *);
324*7c478bd9Sstevel@tonic-gate int scf_value_get_integer(const scf_value_t *, int64_t *);
325*7c478bd9Sstevel@tonic-gate int scf_value_get_time(const scf_value_t *, int64_t *, int32_t *);
326*7c478bd9Sstevel@tonic-gate ssize_t scf_value_get_astring(const scf_value_t *, char *, size_t);
327*7c478bd9Sstevel@tonic-gate ssize_t scf_value_get_ustring(const scf_value_t *, char *, size_t);
328*7c478bd9Sstevel@tonic-gate ssize_t scf_value_get_opaque(const scf_value_t *, void *, size_t);
329*7c478bd9Sstevel@tonic-gate 
330*7c478bd9Sstevel@tonic-gate void scf_value_set_boolean(scf_value_t *, uint8_t);
331*7c478bd9Sstevel@tonic-gate void scf_value_set_count(scf_value_t *, uint64_t);
332*7c478bd9Sstevel@tonic-gate void scf_value_set_integer(scf_value_t *, int64_t);
333*7c478bd9Sstevel@tonic-gate int scf_value_set_time(scf_value_t *, int64_t, int32_t);
334*7c478bd9Sstevel@tonic-gate int scf_value_set_astring(scf_value_t *, const char *);
335*7c478bd9Sstevel@tonic-gate int scf_value_set_ustring(scf_value_t *, const char *);
336*7c478bd9Sstevel@tonic-gate int scf_value_set_opaque(scf_value_t *, const void *, size_t);
337*7c478bd9Sstevel@tonic-gate 
338*7c478bd9Sstevel@tonic-gate ssize_t scf_value_get_as_string(const scf_value_t *, char *, size_t);
339*7c478bd9Sstevel@tonic-gate ssize_t scf_value_get_as_string_typed(const scf_value_t *, scf_type_t,
340*7c478bd9Sstevel@tonic-gate     char *, size_t);
341*7c478bd9Sstevel@tonic-gate int scf_value_set_from_string(scf_value_t *, scf_type_t, const char *);
342*7c478bd9Sstevel@tonic-gate 
343*7c478bd9Sstevel@tonic-gate scf_iter_t *scf_iter_create(scf_handle_t *);
344*7c478bd9Sstevel@tonic-gate scf_handle_t *scf_iter_handle(const scf_iter_t *);
345*7c478bd9Sstevel@tonic-gate void scf_iter_reset(scf_iter_t *);
346*7c478bd9Sstevel@tonic-gate void scf_iter_destroy(scf_iter_t *);
347*7c478bd9Sstevel@tonic-gate 
348*7c478bd9Sstevel@tonic-gate int scf_iter_handle_scopes(scf_iter_t *, const scf_handle_t *);
349*7c478bd9Sstevel@tonic-gate int scf_iter_scope_services(scf_iter_t *, const scf_scope_t *);
350*7c478bd9Sstevel@tonic-gate int scf_iter_service_instances(scf_iter_t *, const scf_service_t *);
351*7c478bd9Sstevel@tonic-gate int scf_iter_service_pgs(scf_iter_t *, const scf_service_t *);
352*7c478bd9Sstevel@tonic-gate int scf_iter_instance_pgs(scf_iter_t *, const scf_instance_t *);
353*7c478bd9Sstevel@tonic-gate int scf_iter_instance_pgs_composed(scf_iter_t *, const scf_instance_t *,
354*7c478bd9Sstevel@tonic-gate     const scf_snapshot_t *);
355*7c478bd9Sstevel@tonic-gate int scf_iter_service_pgs_typed(scf_iter_t *, const scf_service_t *,
356*7c478bd9Sstevel@tonic-gate     const char *);
357*7c478bd9Sstevel@tonic-gate int scf_iter_instance_pgs_typed(scf_iter_t *, const scf_instance_t *,
358*7c478bd9Sstevel@tonic-gate     const char *);
359*7c478bd9Sstevel@tonic-gate int scf_iter_instance_pgs_typed_composed(scf_iter_t *, const scf_instance_t *,
360*7c478bd9Sstevel@tonic-gate     const scf_snapshot_t *, const char *);
361*7c478bd9Sstevel@tonic-gate int scf_iter_snaplevel_pgs(scf_iter_t *, const scf_snaplevel_t *);
362*7c478bd9Sstevel@tonic-gate int scf_iter_snaplevel_pgs_typed(scf_iter_t *, const scf_snaplevel_t *,
363*7c478bd9Sstevel@tonic-gate     const char *);
364*7c478bd9Sstevel@tonic-gate int scf_iter_instance_snapshots(scf_iter_t *, const scf_instance_t *);
365*7c478bd9Sstevel@tonic-gate int scf_iter_pg_properties(scf_iter_t *, const scf_propertygroup_t *);
366*7c478bd9Sstevel@tonic-gate int scf_iter_property_values(scf_iter_t *, const scf_property_t *);
367*7c478bd9Sstevel@tonic-gate 
368*7c478bd9Sstevel@tonic-gate int scf_iter_next_scope(scf_iter_t *, scf_scope_t *);
369*7c478bd9Sstevel@tonic-gate int scf_iter_next_service(scf_iter_t *, scf_service_t *);
370*7c478bd9Sstevel@tonic-gate int scf_iter_next_instance(scf_iter_t *, scf_instance_t *);
371*7c478bd9Sstevel@tonic-gate int scf_iter_next_pg(scf_iter_t *, scf_propertygroup_t *);
372*7c478bd9Sstevel@tonic-gate int scf_iter_next_property(scf_iter_t *, scf_property_t *);
373*7c478bd9Sstevel@tonic-gate int scf_iter_next_snapshot(scf_iter_t *, scf_snapshot_t *);
374*7c478bd9Sstevel@tonic-gate int scf_iter_next_value(scf_iter_t *, scf_value_t *);
375*7c478bd9Sstevel@tonic-gate 
376*7c478bd9Sstevel@tonic-gate scf_scope_t *scf_scope_create(scf_handle_t *);
377*7c478bd9Sstevel@tonic-gate scf_handle_t *scf_scope_handle(const scf_scope_t *);
378*7c478bd9Sstevel@tonic-gate 
379*7c478bd9Sstevel@tonic-gate /* XXX eventually remove this */
380*7c478bd9Sstevel@tonic-gate #define	scf_handle_get_local_scope(h, s) \
381*7c478bd9Sstevel@tonic-gate 	scf_handle_get_scope((h), SCF_SCOPE_LOCAL, (s))
382*7c478bd9Sstevel@tonic-gate 
383*7c478bd9Sstevel@tonic-gate int scf_handle_get_scope(scf_handle_t *, const char *, scf_scope_t *);
384*7c478bd9Sstevel@tonic-gate void scf_scope_destroy(scf_scope_t *);
385*7c478bd9Sstevel@tonic-gate ssize_t scf_scope_get_name(const scf_scope_t *, char *, size_t);
386*7c478bd9Sstevel@tonic-gate 
387*7c478bd9Sstevel@tonic-gate ssize_t scf_scope_to_fmri(const scf_scope_t *, char *, size_t);
388*7c478bd9Sstevel@tonic-gate 
389*7c478bd9Sstevel@tonic-gate scf_service_t *scf_service_create(scf_handle_t *);
390*7c478bd9Sstevel@tonic-gate scf_handle_t *scf_service_handle(const scf_service_t *);
391*7c478bd9Sstevel@tonic-gate void scf_service_destroy(scf_service_t *);
392*7c478bd9Sstevel@tonic-gate int scf_scope_get_parent(const scf_scope_t *, scf_scope_t *);
393*7c478bd9Sstevel@tonic-gate ssize_t scf_service_get_name(const scf_service_t *, char *, size_t);
394*7c478bd9Sstevel@tonic-gate ssize_t scf_service_to_fmri(const scf_service_t *, char *, size_t);
395*7c478bd9Sstevel@tonic-gate int scf_service_get_parent(const scf_service_t *, scf_scope_t *);
396*7c478bd9Sstevel@tonic-gate int scf_scope_get_service(const scf_scope_t *, const char *, scf_service_t *);
397*7c478bd9Sstevel@tonic-gate int scf_scope_add_service(const scf_scope_t *, const char *, scf_service_t *);
398*7c478bd9Sstevel@tonic-gate int scf_service_delete(scf_service_t *);
399*7c478bd9Sstevel@tonic-gate 
400*7c478bd9Sstevel@tonic-gate scf_instance_t *scf_instance_create(scf_handle_t *);
401*7c478bd9Sstevel@tonic-gate scf_handle_t *scf_instance_handle(const scf_instance_t *);
402*7c478bd9Sstevel@tonic-gate void scf_instance_destroy(scf_instance_t *);
403*7c478bd9Sstevel@tonic-gate ssize_t scf_instance_get_name(const scf_instance_t *, char *, size_t);
404*7c478bd9Sstevel@tonic-gate ssize_t scf_instance_to_fmri(const scf_instance_t *, char *, size_t);
405*7c478bd9Sstevel@tonic-gate int scf_service_get_instance(const scf_service_t *, const char *,
406*7c478bd9Sstevel@tonic-gate     scf_instance_t *);
407*7c478bd9Sstevel@tonic-gate int scf_service_add_instance(const scf_service_t *, const char *,
408*7c478bd9Sstevel@tonic-gate     scf_instance_t *);
409*7c478bd9Sstevel@tonic-gate int scf_instance_delete(scf_instance_t *);
410*7c478bd9Sstevel@tonic-gate 
411*7c478bd9Sstevel@tonic-gate scf_snapshot_t *scf_snapshot_create(scf_handle_t *);
412*7c478bd9Sstevel@tonic-gate scf_handle_t *scf_snapshot_handle(const scf_snapshot_t *);
413*7c478bd9Sstevel@tonic-gate void scf_snapshot_destroy(scf_snapshot_t *);
414*7c478bd9Sstevel@tonic-gate ssize_t scf_snapshot_get_name(const scf_snapshot_t *, char *, size_t);
415*7c478bd9Sstevel@tonic-gate int scf_snapshot_get_parent(const scf_snapshot_t *, scf_instance_t *);
416*7c478bd9Sstevel@tonic-gate int scf_instance_get_snapshot(const scf_instance_t *, const char *,
417*7c478bd9Sstevel@tonic-gate     scf_snapshot_t *);
418*7c478bd9Sstevel@tonic-gate int scf_snapshot_update(scf_snapshot_t *);
419*7c478bd9Sstevel@tonic-gate 
420*7c478bd9Sstevel@tonic-gate scf_snaplevel_t *scf_snaplevel_create(scf_handle_t *);
421*7c478bd9Sstevel@tonic-gate scf_handle_t *scf_snaplevel_handle(const scf_snaplevel_t *);
422*7c478bd9Sstevel@tonic-gate void scf_snaplevel_destroy(scf_snaplevel_t *);
423*7c478bd9Sstevel@tonic-gate int scf_snaplevel_get_parent(const scf_snaplevel_t *, scf_snapshot_t *);
424*7c478bd9Sstevel@tonic-gate ssize_t scf_snaplevel_get_scope_name(const scf_snaplevel_t *, char *, size_t);
425*7c478bd9Sstevel@tonic-gate ssize_t scf_snaplevel_get_service_name(const scf_snaplevel_t *, char *, size_t);
426*7c478bd9Sstevel@tonic-gate ssize_t scf_snaplevel_get_instance_name(const scf_snaplevel_t *, char *,
427*7c478bd9Sstevel@tonic-gate     size_t);
428*7c478bd9Sstevel@tonic-gate int scf_snaplevel_get_pg(const scf_snaplevel_t *, const char *,
429*7c478bd9Sstevel@tonic-gate     scf_propertygroup_t *pg);
430*7c478bd9Sstevel@tonic-gate int scf_snapshot_get_base_snaplevel(const scf_snapshot_t *, scf_snaplevel_t *);
431*7c478bd9Sstevel@tonic-gate int scf_snaplevel_get_next_snaplevel(const scf_snaplevel_t *,
432*7c478bd9Sstevel@tonic-gate     scf_snaplevel_t *);
433*7c478bd9Sstevel@tonic-gate 
434*7c478bd9Sstevel@tonic-gate scf_propertygroup_t *scf_pg_create(scf_handle_t *);
435*7c478bd9Sstevel@tonic-gate scf_handle_t *scf_pg_handle(const scf_propertygroup_t *);
436*7c478bd9Sstevel@tonic-gate void scf_pg_destroy(scf_propertygroup_t *);
437*7c478bd9Sstevel@tonic-gate ssize_t scf_pg_to_fmri(const scf_propertygroup_t *,  char *, size_t);
438*7c478bd9Sstevel@tonic-gate ssize_t scf_pg_get_name(const scf_propertygroup_t *, char *, size_t);
439*7c478bd9Sstevel@tonic-gate ssize_t scf_pg_get_type(const scf_propertygroup_t *, char *, size_t);
440*7c478bd9Sstevel@tonic-gate int scf_pg_get_flags(const scf_propertygroup_t *, uint32_t *);
441*7c478bd9Sstevel@tonic-gate int scf_pg_get_parent_service(const scf_propertygroup_t *, scf_service_t *);
442*7c478bd9Sstevel@tonic-gate int scf_pg_get_parent_instance(const scf_propertygroup_t *, scf_instance_t *);
443*7c478bd9Sstevel@tonic-gate int scf_pg_get_parent_snaplevel(const scf_propertygroup_t *, scf_snaplevel_t *);
444*7c478bd9Sstevel@tonic-gate int scf_service_get_pg(const scf_service_t *, const char *,
445*7c478bd9Sstevel@tonic-gate     scf_propertygroup_t *);
446*7c478bd9Sstevel@tonic-gate int scf_instance_get_pg(const scf_instance_t *, const char *,
447*7c478bd9Sstevel@tonic-gate     scf_propertygroup_t *);
448*7c478bd9Sstevel@tonic-gate int scf_instance_get_pg_composed(const scf_instance_t *, const scf_snapshot_t *,
449*7c478bd9Sstevel@tonic-gate     const char *, scf_propertygroup_t *);
450*7c478bd9Sstevel@tonic-gate int scf_service_add_pg(const scf_service_t *,  const char *, const char *,
451*7c478bd9Sstevel@tonic-gate     uint32_t, scf_propertygroup_t *);
452*7c478bd9Sstevel@tonic-gate int scf_instance_add_pg(const scf_instance_t *,  const char *, const char *,
453*7c478bd9Sstevel@tonic-gate     uint32_t, scf_propertygroup_t *);
454*7c478bd9Sstevel@tonic-gate int scf_pg_delete(scf_propertygroup_t *);
455*7c478bd9Sstevel@tonic-gate 
456*7c478bd9Sstevel@tonic-gate int scf_pg_get_underlying_pg(const scf_propertygroup_t *,
457*7c478bd9Sstevel@tonic-gate     scf_propertygroup_t *);
458*7c478bd9Sstevel@tonic-gate int scf_instance_get_parent(const scf_instance_t *, scf_service_t *);
459*7c478bd9Sstevel@tonic-gate 
460*7c478bd9Sstevel@tonic-gate int scf_pg_update(scf_propertygroup_t *);
461*7c478bd9Sstevel@tonic-gate 
462*7c478bd9Sstevel@tonic-gate scf_property_t *scf_property_create(scf_handle_t *);
463*7c478bd9Sstevel@tonic-gate scf_handle_t *scf_property_handle(const scf_property_t *);
464*7c478bd9Sstevel@tonic-gate void scf_property_destroy(scf_property_t *);
465*7c478bd9Sstevel@tonic-gate int scf_property_is_type(const scf_property_t *, scf_type_t);
466*7c478bd9Sstevel@tonic-gate int scf_property_type(const scf_property_t *, scf_type_t *);
467*7c478bd9Sstevel@tonic-gate ssize_t scf_property_get_name(const scf_property_t *, char *, size_t);
468*7c478bd9Sstevel@tonic-gate int scf_property_get_value(const scf_property_t *, scf_value_t *);
469*7c478bd9Sstevel@tonic-gate ssize_t scf_property_to_fmri(const scf_property_t *, char *, size_t);
470*7c478bd9Sstevel@tonic-gate int scf_pg_get_property(const scf_propertygroup_t *,  const char *,
471*7c478bd9Sstevel@tonic-gate     scf_property_t *);
472*7c478bd9Sstevel@tonic-gate 
473*7c478bd9Sstevel@tonic-gate scf_transaction_t *scf_transaction_create(scf_handle_t *);
474*7c478bd9Sstevel@tonic-gate scf_handle_t *scf_transaction_handle(const scf_transaction_t *);
475*7c478bd9Sstevel@tonic-gate int scf_transaction_start(scf_transaction_t *, scf_propertygroup_t *);
476*7c478bd9Sstevel@tonic-gate void scf_transaction_destroy(scf_transaction_t *);
477*7c478bd9Sstevel@tonic-gate void scf_transaction_destroy_children(scf_transaction_t *);
478*7c478bd9Sstevel@tonic-gate 
479*7c478bd9Sstevel@tonic-gate void scf_transaction_reset(scf_transaction_t *);
480*7c478bd9Sstevel@tonic-gate void scf_transaction_reset_all(scf_transaction_t *);
481*7c478bd9Sstevel@tonic-gate 
482*7c478bd9Sstevel@tonic-gate int scf_transaction_commit(scf_transaction_t *);
483*7c478bd9Sstevel@tonic-gate 
484*7c478bd9Sstevel@tonic-gate scf_transaction_entry_t *scf_entry_create(scf_handle_t *);
485*7c478bd9Sstevel@tonic-gate scf_handle_t *scf_entry_handle(const scf_transaction_entry_t *);
486*7c478bd9Sstevel@tonic-gate void scf_entry_reset(scf_transaction_entry_t *);
487*7c478bd9Sstevel@tonic-gate void scf_entry_destroy(scf_transaction_entry_t *);
488*7c478bd9Sstevel@tonic-gate void scf_entry_destroy_children(scf_transaction_entry_t *);
489*7c478bd9Sstevel@tonic-gate 
490*7c478bd9Sstevel@tonic-gate int scf_transaction_property_change(scf_transaction_t *,
491*7c478bd9Sstevel@tonic-gate     scf_transaction_entry_t *, const char *, scf_type_t);
492*7c478bd9Sstevel@tonic-gate int scf_transaction_property_delete(scf_transaction_t *,
493*7c478bd9Sstevel@tonic-gate     scf_transaction_entry_t *, const char *);
494*7c478bd9Sstevel@tonic-gate int scf_transaction_property_new(scf_transaction_t *,
495*7c478bd9Sstevel@tonic-gate     scf_transaction_entry_t *, const char *, scf_type_t);
496*7c478bd9Sstevel@tonic-gate int scf_transaction_property_change_type(scf_transaction_t *,
497*7c478bd9Sstevel@tonic-gate     scf_transaction_entry_t *, const char *, scf_type_t);
498*7c478bd9Sstevel@tonic-gate 
499*7c478bd9Sstevel@tonic-gate int scf_entry_add_value(scf_transaction_entry_t *, scf_value_t *);
500*7c478bd9Sstevel@tonic-gate 
501*7c478bd9Sstevel@tonic-gate int scf_handle_decode_fmri(scf_handle_t *, const char *, scf_scope_t *,
502*7c478bd9Sstevel@tonic-gate     scf_service_t *, scf_instance_t *, scf_propertygroup_t *, scf_property_t *,
503*7c478bd9Sstevel@tonic-gate     int);
504*7c478bd9Sstevel@tonic-gate #define	SCF_DECODE_FMRI_EXACT			0x00000001
505*7c478bd9Sstevel@tonic-gate #define	SCF_DECODE_FMRI_TRUNCATE		0x00000002
506*7c478bd9Sstevel@tonic-gate #define	SCF_DECODE_FMRI_REQUIRE_INSTANCE	0x00000004
507*7c478bd9Sstevel@tonic-gate #define	SCF_DECODE_FMRI_REQUIRE_NO_INSTANCE	0x00000008
508*7c478bd9Sstevel@tonic-gate 
509*7c478bd9Sstevel@tonic-gate ssize_t scf_myname(scf_handle_t *, char *, size_t);
510*7c478bd9Sstevel@tonic-gate 
511*7c478bd9Sstevel@tonic-gate /*
512*7c478bd9Sstevel@tonic-gate  * Simplified calls
513*7c478bd9Sstevel@tonic-gate  */
514*7c478bd9Sstevel@tonic-gate 
515*7c478bd9Sstevel@tonic-gate int smf_enable_instance(const char *, int);
516*7c478bd9Sstevel@tonic-gate int smf_disable_instance(const char *, int);
517*7c478bd9Sstevel@tonic-gate int smf_refresh_instance(const char *);
518*7c478bd9Sstevel@tonic-gate int smf_restart_instance(const char *);
519*7c478bd9Sstevel@tonic-gate int smf_maintain_instance(const char *, int);
520*7c478bd9Sstevel@tonic-gate int smf_degrade_instance(const char *, int);
521*7c478bd9Sstevel@tonic-gate int smf_restore_instance(const char *);
522*7c478bd9Sstevel@tonic-gate char *smf_get_state(const char *);
523*7c478bd9Sstevel@tonic-gate 
524*7c478bd9Sstevel@tonic-gate int scf_simple_walk_instances(uint_t, void *,
525*7c478bd9Sstevel@tonic-gate     int (*inst_callback)(scf_handle_t *, scf_instance_t *, void *));
526*7c478bd9Sstevel@tonic-gate 
527*7c478bd9Sstevel@tonic-gate scf_simple_prop_t *scf_simple_prop_get(scf_handle_t *, const char *,
528*7c478bd9Sstevel@tonic-gate     const char *, const char *);
529*7c478bd9Sstevel@tonic-gate void scf_simple_prop_free(scf_simple_prop_t *);
530*7c478bd9Sstevel@tonic-gate scf_simple_app_props_t *scf_simple_app_props_get(scf_handle_t *, const char *);
531*7c478bd9Sstevel@tonic-gate void scf_simple_app_props_free(scf_simple_app_props_t *);
532*7c478bd9Sstevel@tonic-gate const scf_simple_prop_t *scf_simple_app_props_next(
533*7c478bd9Sstevel@tonic-gate     const scf_simple_app_props_t *, scf_simple_prop_t *);
534*7c478bd9Sstevel@tonic-gate const scf_simple_prop_t *scf_simple_app_props_search(
535*7c478bd9Sstevel@tonic-gate     const scf_simple_app_props_t *, const char *, const char *);
536*7c478bd9Sstevel@tonic-gate ssize_t scf_simple_prop_numvalues(const scf_simple_prop_t *);
537*7c478bd9Sstevel@tonic-gate scf_type_t scf_simple_prop_type(const scf_simple_prop_t *);
538*7c478bd9Sstevel@tonic-gate char *scf_simple_prop_name(const scf_simple_prop_t *);
539*7c478bd9Sstevel@tonic-gate char *scf_simple_prop_pgname(const scf_simple_prop_t *);
540*7c478bd9Sstevel@tonic-gate uint8_t *scf_simple_prop_next_boolean(scf_simple_prop_t *);
541*7c478bd9Sstevel@tonic-gate uint64_t *scf_simple_prop_next_count(scf_simple_prop_t *);
542*7c478bd9Sstevel@tonic-gate int64_t *scf_simple_prop_next_integer(scf_simple_prop_t *);
543*7c478bd9Sstevel@tonic-gate int64_t *scf_simple_prop_next_time(scf_simple_prop_t *, int32_t *);
544*7c478bd9Sstevel@tonic-gate char *scf_simple_prop_next_astring(scf_simple_prop_t *);
545*7c478bd9Sstevel@tonic-gate char *scf_simple_prop_next_ustring(scf_simple_prop_t *);
546*7c478bd9Sstevel@tonic-gate void *scf_simple_prop_next_opaque(scf_simple_prop_t *, size_t *);
547*7c478bd9Sstevel@tonic-gate void scf_simple_prop_next_reset(scf_simple_prop_t *);
548*7c478bd9Sstevel@tonic-gate 
549*7c478bd9Sstevel@tonic-gate /*
550*7c478bd9Sstevel@tonic-gate  * SMF exit status definitions
551*7c478bd9Sstevel@tonic-gate  */
552*7c478bd9Sstevel@tonic-gate #define	SMF_EXIT_OK		  0
553*7c478bd9Sstevel@tonic-gate #define	SMF_EXIT_ERR_FATAL	 95
554*7c478bd9Sstevel@tonic-gate #define	SMF_EXIT_ERR_CONFIG	 96
555*7c478bd9Sstevel@tonic-gate #define	SMF_EXIT_MON_DEGRADE	 97
556*7c478bd9Sstevel@tonic-gate #define	SMF_EXIT_MON_OFFLINE	 98
557*7c478bd9Sstevel@tonic-gate #define	SMF_EXIT_ERR_NOSMF	 99
558*7c478bd9Sstevel@tonic-gate #define	SMF_EXIT_ERR_PERM	100
559*7c478bd9Sstevel@tonic-gate 
560*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
561*7c478bd9Sstevel@tonic-gate }
562*7c478bd9Sstevel@tonic-gate #endif
563*7c478bd9Sstevel@tonic-gate 
564*7c478bd9Sstevel@tonic-gate #endif	/* _LIBSCF_H */
565