xref: /titanic_52/usr/src/lib/libscf/inc/libscf.h (revision 70cbfe41f2338b77c15f79c6625eca6e70c412f3)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*70cbfe41SPhilippe Jung  * Common Development and Distribution License (the "License").
6*70cbfe41SPhilippe Jung  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*
22*70cbfe41SPhilippe Jung  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
237c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
247c478bd9Sstevel@tonic-gate  */
257c478bd9Sstevel@tonic-gate 
267c478bd9Sstevel@tonic-gate #ifndef	_LIBSCF_H
277c478bd9Sstevel@tonic-gate #define	_LIBSCF_H
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate 
307c478bd9Sstevel@tonic-gate #include <stddef.h>
317c478bd9Sstevel@tonic-gate #include <sys/types.h>
327c478bd9Sstevel@tonic-gate 
337c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
347c478bd9Sstevel@tonic-gate extern "C" {
357c478bd9Sstevel@tonic-gate #endif
367c478bd9Sstevel@tonic-gate 
377c478bd9Sstevel@tonic-gate typedef struct scf_version *scf_version_t;
387c478bd9Sstevel@tonic-gate #define	SCF_VERSION	((scf_version_t)1UL)
397c478bd9Sstevel@tonic-gate 
407c478bd9Sstevel@tonic-gate /*
417c478bd9Sstevel@tonic-gate  * Opaque structures
427c478bd9Sstevel@tonic-gate  */
437c478bd9Sstevel@tonic-gate typedef struct scf_handle scf_handle_t;
447c478bd9Sstevel@tonic-gate typedef struct scf_scope scf_scope_t;
457c478bd9Sstevel@tonic-gate typedef struct scf_service scf_service_t;
467c478bd9Sstevel@tonic-gate typedef struct scf_instance scf_instance_t;
477c478bd9Sstevel@tonic-gate typedef struct scf_propertygroup scf_propertygroup_t;
487c478bd9Sstevel@tonic-gate typedef struct scf_property scf_property_t;
497c478bd9Sstevel@tonic-gate 
507c478bd9Sstevel@tonic-gate typedef struct scf_snapshot scf_snapshot_t;
517c478bd9Sstevel@tonic-gate typedef struct scf_snaplevel scf_snaplevel_t;
527c478bd9Sstevel@tonic-gate 
537c478bd9Sstevel@tonic-gate typedef struct scf_transaction scf_transaction_t;
547c478bd9Sstevel@tonic-gate typedef struct scf_transaction_entry scf_transaction_entry_t;
557c478bd9Sstevel@tonic-gate typedef struct scf_value scf_value_t;
567c478bd9Sstevel@tonic-gate 
577c478bd9Sstevel@tonic-gate typedef struct scf_iter scf_iter_t;
587c478bd9Sstevel@tonic-gate 
597c478bd9Sstevel@tonic-gate typedef struct scf_simple_app_props scf_simple_app_props_t;
607c478bd9Sstevel@tonic-gate typedef struct scf_simple_prop scf_simple_prop_t;
617c478bd9Sstevel@tonic-gate 
627c478bd9Sstevel@tonic-gate /*
637c478bd9Sstevel@tonic-gate  * Types
647c478bd9Sstevel@tonic-gate  */
657c478bd9Sstevel@tonic-gate typedef enum {
667c478bd9Sstevel@tonic-gate 	SCF_TYPE_INVALID = 0,
677c478bd9Sstevel@tonic-gate 
687c478bd9Sstevel@tonic-gate 	SCF_TYPE_BOOLEAN,
697c478bd9Sstevel@tonic-gate 	SCF_TYPE_COUNT,
707c478bd9Sstevel@tonic-gate 	SCF_TYPE_INTEGER,
717c478bd9Sstevel@tonic-gate 	SCF_TYPE_TIME,
727c478bd9Sstevel@tonic-gate 	SCF_TYPE_ASTRING,
737c478bd9Sstevel@tonic-gate 	SCF_TYPE_OPAQUE,
747c478bd9Sstevel@tonic-gate 
757c478bd9Sstevel@tonic-gate 	SCF_TYPE_USTRING = 100,
767c478bd9Sstevel@tonic-gate 
777c478bd9Sstevel@tonic-gate 	SCF_TYPE_URI = 200,
787c478bd9Sstevel@tonic-gate 	SCF_TYPE_FMRI,
797c478bd9Sstevel@tonic-gate 
807c478bd9Sstevel@tonic-gate 	SCF_TYPE_HOST = 300,
817c478bd9Sstevel@tonic-gate 	SCF_TYPE_HOSTNAME,
827c478bd9Sstevel@tonic-gate 	SCF_TYPE_NET_ADDR_V4,
837c478bd9Sstevel@tonic-gate 	SCF_TYPE_NET_ADDR_V6
847c478bd9Sstevel@tonic-gate } scf_type_t;
857c478bd9Sstevel@tonic-gate 
867c478bd9Sstevel@tonic-gate /*
877c478bd9Sstevel@tonic-gate  * Return codes
887c478bd9Sstevel@tonic-gate  */
897c478bd9Sstevel@tonic-gate #define	SCF_SUCCESS			0
907c478bd9Sstevel@tonic-gate #define	SCF_COMPLETE			1
917c478bd9Sstevel@tonic-gate #define	SCF_FAILED			-1
927c478bd9Sstevel@tonic-gate 
937c478bd9Sstevel@tonic-gate typedef enum scf_error {
947c478bd9Sstevel@tonic-gate 	SCF_ERROR_NONE = 1000,		/* no error */
957c478bd9Sstevel@tonic-gate 	SCF_ERROR_NOT_BOUND,		/* handle not bound */
967c478bd9Sstevel@tonic-gate 	SCF_ERROR_NOT_SET,		/* cannot use unset argument */
977c478bd9Sstevel@tonic-gate 	SCF_ERROR_NOT_FOUND,		/* nothing of that name found */
987c478bd9Sstevel@tonic-gate 	SCF_ERROR_TYPE_MISMATCH,	/* type does not match value */
997c478bd9Sstevel@tonic-gate 	SCF_ERROR_IN_USE,		/* cannot modify while in-use */
1007c478bd9Sstevel@tonic-gate 	SCF_ERROR_CONNECTION_BROKEN,	/* repository connection gone */
1017c478bd9Sstevel@tonic-gate 	SCF_ERROR_INVALID_ARGUMENT,	/* bad argument */
1027c478bd9Sstevel@tonic-gate 	SCF_ERROR_NO_MEMORY,		/* no memory available */
1037c478bd9Sstevel@tonic-gate 	SCF_ERROR_CONSTRAINT_VIOLATED,	/* required constraint not met */
1047c478bd9Sstevel@tonic-gate 	SCF_ERROR_EXISTS,		/* object already exists */
1057c478bd9Sstevel@tonic-gate 	SCF_ERROR_NO_SERVER,		/* repository server unavailable */
1067c478bd9Sstevel@tonic-gate 	SCF_ERROR_NO_RESOURCES,		/* server has insufficient resources */
1077c478bd9Sstevel@tonic-gate 	SCF_ERROR_PERMISSION_DENIED,	/* insufficient privileges for action */
1087c478bd9Sstevel@tonic-gate 	SCF_ERROR_BACKEND_ACCESS,	/* backend refused access */
1097c478bd9Sstevel@tonic-gate 	SCF_ERROR_HANDLE_MISMATCH,	/* mismatched SCF handles */
1107c478bd9Sstevel@tonic-gate 	SCF_ERROR_HANDLE_DESTROYED,	/* object bound to destroyed handle */
1117c478bd9Sstevel@tonic-gate 	SCF_ERROR_VERSION_MISMATCH,	/* incompatible SCF version */
1127c478bd9Sstevel@tonic-gate 	SCF_ERROR_BACKEND_READONLY,	/* backend is read-only */
1137c478bd9Sstevel@tonic-gate 	SCF_ERROR_DELETED,		/* object has been deleted */
1147c478bd9Sstevel@tonic-gate 
1157c478bd9Sstevel@tonic-gate 	SCF_ERROR_CALLBACK_FAILED = 1080, /* user callback function failed */
1167c478bd9Sstevel@tonic-gate 
1177c478bd9Sstevel@tonic-gate 	SCF_ERROR_INTERNAL = 1101	/* internal error */
1187c478bd9Sstevel@tonic-gate } scf_error_t;
1197c478bd9Sstevel@tonic-gate 
1207c478bd9Sstevel@tonic-gate /*
1217c478bd9Sstevel@tonic-gate  * Standard services
1227c478bd9Sstevel@tonic-gate  */
1237c478bd9Sstevel@tonic-gate #define	SCF_SERVICE_STARTD	((const char *) \
1247c478bd9Sstevel@tonic-gate 				    "svc:/system/svc/restarter:default")
1257c478bd9Sstevel@tonic-gate #define	SCF_SERVICE_CONFIGD	((const char *) \
1267c478bd9Sstevel@tonic-gate 				    "svc:/system/svc/repository:default")
1277c478bd9Sstevel@tonic-gate 
1287c478bd9Sstevel@tonic-gate /*
1297c478bd9Sstevel@tonic-gate  * Major milestones
1307c478bd9Sstevel@tonic-gate  */
1317c478bd9Sstevel@tonic-gate #define	SCF_MILESTONE_SINGLE_USER \
1327c478bd9Sstevel@tonic-gate 	((const char *) "svc:/milestone/single-user:default")
1337c478bd9Sstevel@tonic-gate #define	SCF_MILESTONE_MULTI_USER \
1347c478bd9Sstevel@tonic-gate 	((const char *) "svc:/milestone/multi-user:default")
1357c478bd9Sstevel@tonic-gate #define	SCF_MILESTONE_MULTI_USER_SERVER \
1367c478bd9Sstevel@tonic-gate 	((const char *) "svc:/milestone/multi-user-server:default")
1377c478bd9Sstevel@tonic-gate 
1387c478bd9Sstevel@tonic-gate /*
1397c478bd9Sstevel@tonic-gate  * standard scope names
1407c478bd9Sstevel@tonic-gate  */
1417c478bd9Sstevel@tonic-gate #define	SCF_SCOPE_LOCAL			((const char *)"localhost")
1427c478bd9Sstevel@tonic-gate 
1437c478bd9Sstevel@tonic-gate /*
1447c478bd9Sstevel@tonic-gate  * Property group types
1457c478bd9Sstevel@tonic-gate  */
1467c478bd9Sstevel@tonic-gate #define	SCF_GROUP_APPLICATION		((const char *)"application")
1477c478bd9Sstevel@tonic-gate #define	SCF_GROUP_FRAMEWORK		((const char *)"framework")
1487c478bd9Sstevel@tonic-gate #define	SCF_GROUP_DEPENDENCY		((const char *)"dependency")
1497c478bd9Sstevel@tonic-gate #define	SCF_GROUP_METHOD		((const char *)"method")
1507c478bd9Sstevel@tonic-gate #define	SCF_GROUP_TEMPLATE		((const char *)"template")
1517c478bd9Sstevel@tonic-gate 
1527c478bd9Sstevel@tonic-gate /*
1537c478bd9Sstevel@tonic-gate  * Dependency types
1547c478bd9Sstevel@tonic-gate  */
1557c478bd9Sstevel@tonic-gate #define	SCF_DEP_REQUIRE_ALL		((const char *)"require_all")
1567c478bd9Sstevel@tonic-gate #define	SCF_DEP_REQUIRE_ANY		((const char *)"require_any")
1577c478bd9Sstevel@tonic-gate #define	SCF_DEP_EXCLUDE_ALL		((const char *)"exclude_all")
1587c478bd9Sstevel@tonic-gate #define	SCF_DEP_OPTIONAL_ALL		((const char *)"optional_all")
1597c478bd9Sstevel@tonic-gate 
1607c478bd9Sstevel@tonic-gate #define	SCF_DEP_RESET_ON_ERROR		((const char *)"error")
1617c478bd9Sstevel@tonic-gate #define	SCF_DEP_RESET_ON_RESTART	((const char *)"restart")
1627c478bd9Sstevel@tonic-gate #define	SCF_DEP_RESET_ON_REFRESH	((const char *)"refresh")
1637c478bd9Sstevel@tonic-gate #define	SCF_DEP_RESET_ON_NONE		((const char *)"none")
1647c478bd9Sstevel@tonic-gate 
1657c478bd9Sstevel@tonic-gate /*
1667c478bd9Sstevel@tonic-gate  * Standard property group names
1677c478bd9Sstevel@tonic-gate  */
1687c478bd9Sstevel@tonic-gate #define	SCF_PG_GENERAL			((const char *)"general")
1697c478bd9Sstevel@tonic-gate #define	SCF_PG_GENERAL_OVR		((const char *)"general_ovr")
1707c478bd9Sstevel@tonic-gate #define	SCF_PG_RESTARTER		((const char *)"restarter")
1717c478bd9Sstevel@tonic-gate #define	SCF_PG_RESTARTER_ACTIONS	((const char *)"restarter_actions")
1727c478bd9Sstevel@tonic-gate #define	SCF_PG_METHOD_CONTEXT		((const char *)"method_context")
1737c478bd9Sstevel@tonic-gate #define	SCF_PG_APP_DEFAULT		((const char *)"application")
1747c478bd9Sstevel@tonic-gate #define	SCF_PG_DEPENDENTS		((const char *)"dependents")
1757c478bd9Sstevel@tonic-gate #define	SCF_PG_OPTIONS			((const char *)"options")
1767c478bd9Sstevel@tonic-gate #define	SCF_PG_OPTIONS_OVR		((const char *)"options_ovr")
1777c478bd9Sstevel@tonic-gate #define	SCF_PG_STARTD			((const char *)"startd")
1787c478bd9Sstevel@tonic-gate #define	SCF_PG_STARTD_PRIVATE		((const char *)"svc-startd-private")
179*70cbfe41SPhilippe Jung #define	SCF_PG_DEATHROW			((const char *)"deathrow")
1807c478bd9Sstevel@tonic-gate 
1817c478bd9Sstevel@tonic-gate /*
1827c478bd9Sstevel@tonic-gate  * Template property group names and prefix
1837c478bd9Sstevel@tonic-gate  */
1847c478bd9Sstevel@tonic-gate #define	SCF_PG_TM_COMMON_NAME		((const char *)"tm_common_name")
1857c478bd9Sstevel@tonic-gate #define	SCF_PG_TM_DESCRIPTION		((const char *)"tm_description")
1867c478bd9Sstevel@tonic-gate 
1877c478bd9Sstevel@tonic-gate #define	SCF_PG_TM_MAN_PREFIX		((const char *)"tm_man_")
1887c478bd9Sstevel@tonic-gate #define	SCF_PG_TM_DOC_PREFIX		((const char *)"tm_doc_")
1897c478bd9Sstevel@tonic-gate 
1907c478bd9Sstevel@tonic-gate /*
1917c478bd9Sstevel@tonic-gate  * Standard property names
1927c478bd9Sstevel@tonic-gate  */
1937c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_AUX_STATE		((const char *)"auxiliary_state")
1947c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_CONTRACT		((const char *)"contract")
1957c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_COREFILE_PATTERN	((const char *)"corefile_pattern")
1967c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_DEGRADED		((const char *)"degraded")
1977c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_DEGRADE_IMMEDIATE	((const char *)"degrade_immediate")
1987c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_DURATION		((const char *)"duration")
1997c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_ENABLED		((const char *)"enabled")
200*70cbfe41SPhilippe Jung #define	SCF_PROPERTY_DEATHROW		((const char *)"deathrow")
2017c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_ENTITY_STABILITY	((const char *)"entity_stability")
2027c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_ENTITIES		((const char *)"entities")
2037c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_EXEC		((const char *)"exec")
2047c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_GROUP		((const char *)"group")
2057c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_GROUPING		((const char *)"grouping")
2067c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_IGNORE		((const char *)"ignore_error")
2077c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_LIMIT_PRIVILEGES	((const char *)"limit_privileges")
2087c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_MAINT_OFF		((const char *)"maint_off")
2097c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_MAINT_ON		((const char *)"maint_on")
2107c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_MAINT_ON_IMMEDIATE	((const char *)"maint_on_immediate")
2117c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_MAINT_ON_IMMTEMP	((const char *)"maint_on_immtemp")
2127c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_MAINT_ON_TEMPORARY	((const char *)"maint_on_temporary")
2137c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_METHOD_PID		((const char *)"method_pid")
2147c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_MILESTONE		((const char *)"milestone")
2157c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_NEED_SESSION	((const char *)"need_session")
2167c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_NEXT_STATE		((const char *)"next_state")
2177c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_PACKAGE		((const char *)"package")
2187c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_PRIVILEGES		((const char *)"privileges")
2197c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_PROFILE		((const char *)"profile")
2207c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_PROJECT		((const char *)"project")
2217c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_REFRESH		((const char *)"refresh")
2227c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_RESOURCE_POOL	((const char *)"resource_pool")
2237c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_ENVIRONMENT	((const char *)"environment")
2247c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_RESTART		((const char *)"restart")
2257c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_RESTARTER		((const char *)"restarter")
2267c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_RESTART_INTERVAL	((const char *)"restart_interval")
2277c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_RESTART_ON		((const char *)"restart_on")
2287c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_RESTORE		((const char *)"restore")
2297c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_SINGLE_INSTANCE	((const char *)"single_instance")
2307c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_START_METHOD_TIMESTAMP	\
2317c478bd9Sstevel@tonic-gate 	((const char *)"start_method_timestamp")
2327c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_START_METHOD_WAITSTATUS	\
2337c478bd9Sstevel@tonic-gate 	((const char *)"start_method_waitstatus")
2347c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_START_PID		((const char *)"start_pid")
2357c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_STATE		((const char *)"state")
2367c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_STABILITY		((const char *)"stability")
2377c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_STATE_TIMESTAMP	((const char *)"state_timestamp")
2387c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_SUPP_GROUPS	((const char *)"supp_groups")
2397c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_TIMEOUT		((const char *)"timeout_seconds")
2407c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_TIMEOUT_RETRY	((const char *)"timeout_retry")
2417c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_TRANSIENT_CONTRACT	((const char *)"transient_contract")
2427c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_TYPE		((const char *)"type")
2437c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_USE_PROFILE	((const char *)"use_profile")
2447c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_USER		((const char *)"user")
2457c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_UTMPX_PREFIX	((const char *)"utmpx_prefix")
2467c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_WORKING_DIRECTORY	((const char *)"working_directory")
2477c478bd9Sstevel@tonic-gate 
2487c478bd9Sstevel@tonic-gate /*
2497c478bd9Sstevel@tonic-gate  * Template property names
2507c478bd9Sstevel@tonic-gate  */
2517c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_TM_MANPATH		((const char *)"manpath")
2527c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_TM_SECTION		((const char *)"section")
2537c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_TM_TITLE		((const char *)"title")
2547c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_TM_NAME		((const char *)"name")
2557c478bd9Sstevel@tonic-gate #define	SCF_PROPERTY_TM_URI		((const char *)"uri")
2567c478bd9Sstevel@tonic-gate 
2577c478bd9Sstevel@tonic-gate /*
2587c478bd9Sstevel@tonic-gate  * Strings used by restarters for state and next_state properties.
2597c478bd9Sstevel@tonic-gate  * MAX_SCF_STATE_STRING holds the max length of a state string, including the
2607c478bd9Sstevel@tonic-gate  * terminating null.
2617c478bd9Sstevel@tonic-gate  */
2627c478bd9Sstevel@tonic-gate 
2637c478bd9Sstevel@tonic-gate #define	MAX_SCF_STATE_STRING_SZ		14
2647c478bd9Sstevel@tonic-gate 
2657c478bd9Sstevel@tonic-gate #define	SCF_STATE_STRING_NONE		((const char *)"none")
2667c478bd9Sstevel@tonic-gate #define	SCF_STATE_STRING_UNINIT		((const char *)"uninitialized")
2677c478bd9Sstevel@tonic-gate #define	SCF_STATE_STRING_MAINT		((const char *)"maintenance")
2687c478bd9Sstevel@tonic-gate #define	SCF_STATE_STRING_OFFLINE	((const char *)"offline")
2697c478bd9Sstevel@tonic-gate #define	SCF_STATE_STRING_DISABLED	((const char *)"disabled")
2707c478bd9Sstevel@tonic-gate #define	SCF_STATE_STRING_ONLINE		((const char *)"online")
2717c478bd9Sstevel@tonic-gate #define	SCF_STATE_STRING_DEGRADED	((const char *)"degraded")
2727c478bd9Sstevel@tonic-gate #define	SCF_STATE_STRING_LEGACY		((const char *)"legacy_run")
2737c478bd9Sstevel@tonic-gate 
2747c478bd9Sstevel@tonic-gate #define	SCF_STATE_UNINIT		0x00000001
2757c478bd9Sstevel@tonic-gate #define	SCF_STATE_MAINT			0x00000002
2767c478bd9Sstevel@tonic-gate #define	SCF_STATE_OFFLINE		0x00000004
2777c478bd9Sstevel@tonic-gate #define	SCF_STATE_DISABLED		0x00000008
2787c478bd9Sstevel@tonic-gate #define	SCF_STATE_ONLINE		0x00000010
2797c478bd9Sstevel@tonic-gate #define	SCF_STATE_DEGRADED		0x00000020
2807c478bd9Sstevel@tonic-gate #define	SCF_STATE_ALL			0x0000003F
2817c478bd9Sstevel@tonic-gate 
2827c478bd9Sstevel@tonic-gate #define	SCF_PG_FLAG_NONPERSISTENT	0x1
2837c478bd9Sstevel@tonic-gate 
2847c478bd9Sstevel@tonic-gate #define	SCF_TRACE_LIBRARY		0x1
2857c478bd9Sstevel@tonic-gate #define	SCF_TRACE_DAEMON		0x2
2867c478bd9Sstevel@tonic-gate 
2877c478bd9Sstevel@tonic-gate #define	SMF_IMMEDIATE			0x1
2887c478bd9Sstevel@tonic-gate #define	SMF_TEMPORARY			0x2
2897c478bd9Sstevel@tonic-gate #define	SMF_AT_NEXT_BOOT		0x4
2907c478bd9Sstevel@tonic-gate 
2917c478bd9Sstevel@tonic-gate scf_error_t scf_error(void);
2927c478bd9Sstevel@tonic-gate const char *scf_strerror(scf_error_t);
2937c478bd9Sstevel@tonic-gate 
2947c478bd9Sstevel@tonic-gate ssize_t scf_limit(uint32_t code);
2957c478bd9Sstevel@tonic-gate #define	SCF_LIMIT_MAX_NAME_LENGTH	-2000U
2967c478bd9Sstevel@tonic-gate #define	SCF_LIMIT_MAX_VALUE_LENGTH	-2001U
2977c478bd9Sstevel@tonic-gate #define	SCF_LIMIT_MAX_PG_TYPE_LENGTH	-2002U
2987c478bd9Sstevel@tonic-gate #define	SCF_LIMIT_MAX_FMRI_LENGTH	-2003U
2997c478bd9Sstevel@tonic-gate 
3007c478bd9Sstevel@tonic-gate scf_handle_t *scf_handle_create(scf_version_t);
3017c478bd9Sstevel@tonic-gate 
3027c478bd9Sstevel@tonic-gate int scf_handle_decorate(scf_handle_t *, const char *, scf_value_t *);
3037c478bd9Sstevel@tonic-gate #define	SCF_DECORATE_CLEAR	((scf_value_t *)0)
3047c478bd9Sstevel@tonic-gate 
3057c478bd9Sstevel@tonic-gate int scf_handle_bind(scf_handle_t *);
3067c478bd9Sstevel@tonic-gate int scf_handle_unbind(scf_handle_t *);
3077c478bd9Sstevel@tonic-gate void scf_handle_destroy(scf_handle_t *);
3087c478bd9Sstevel@tonic-gate 
3097c478bd9Sstevel@tonic-gate int scf_type_base_type(scf_type_t type, scf_type_t *out);
3107c478bd9Sstevel@tonic-gate 
3117c478bd9Sstevel@tonic-gate /* values */
3127c478bd9Sstevel@tonic-gate scf_value_t *scf_value_create(scf_handle_t *);
3137c478bd9Sstevel@tonic-gate scf_handle_t *scf_value_handle(const scf_value_t *);
3147c478bd9Sstevel@tonic-gate void scf_value_destroy(scf_value_t *);
3157c478bd9Sstevel@tonic-gate 
3167c478bd9Sstevel@tonic-gate scf_type_t scf_value_base_type(const scf_value_t *);
3177c478bd9Sstevel@tonic-gate scf_type_t scf_value_type(const scf_value_t *);
3187c478bd9Sstevel@tonic-gate int scf_value_is_type(const scf_value_t *, scf_type_t);
3197c478bd9Sstevel@tonic-gate 
3207c478bd9Sstevel@tonic-gate void scf_value_reset(scf_value_t *);
3217c478bd9Sstevel@tonic-gate 
3227c478bd9Sstevel@tonic-gate int scf_value_get_boolean(const scf_value_t *, uint8_t *);
3237c478bd9Sstevel@tonic-gate int scf_value_get_count(const scf_value_t *, uint64_t *);
3247c478bd9Sstevel@tonic-gate int scf_value_get_integer(const scf_value_t *, int64_t *);
3257c478bd9Sstevel@tonic-gate int scf_value_get_time(const scf_value_t *, int64_t *, int32_t *);
3267c478bd9Sstevel@tonic-gate ssize_t scf_value_get_astring(const scf_value_t *, char *, size_t);
3277c478bd9Sstevel@tonic-gate ssize_t scf_value_get_ustring(const scf_value_t *, char *, size_t);
3287c478bd9Sstevel@tonic-gate ssize_t scf_value_get_opaque(const scf_value_t *, void *, size_t);
3297c478bd9Sstevel@tonic-gate 
3307c478bd9Sstevel@tonic-gate void scf_value_set_boolean(scf_value_t *, uint8_t);
3317c478bd9Sstevel@tonic-gate void scf_value_set_count(scf_value_t *, uint64_t);
3327c478bd9Sstevel@tonic-gate void scf_value_set_integer(scf_value_t *, int64_t);
3337c478bd9Sstevel@tonic-gate int scf_value_set_time(scf_value_t *, int64_t, int32_t);
3347c478bd9Sstevel@tonic-gate int scf_value_set_astring(scf_value_t *, const char *);
3357c478bd9Sstevel@tonic-gate int scf_value_set_ustring(scf_value_t *, const char *);
3367c478bd9Sstevel@tonic-gate int scf_value_set_opaque(scf_value_t *, const void *, size_t);
3377c478bd9Sstevel@tonic-gate 
3387c478bd9Sstevel@tonic-gate ssize_t scf_value_get_as_string(const scf_value_t *, char *, size_t);
3397c478bd9Sstevel@tonic-gate ssize_t scf_value_get_as_string_typed(const scf_value_t *, scf_type_t,
3407c478bd9Sstevel@tonic-gate     char *, size_t);
3417c478bd9Sstevel@tonic-gate int scf_value_set_from_string(scf_value_t *, scf_type_t, const char *);
3427c478bd9Sstevel@tonic-gate 
3437c478bd9Sstevel@tonic-gate scf_iter_t *scf_iter_create(scf_handle_t *);
3447c478bd9Sstevel@tonic-gate scf_handle_t *scf_iter_handle(const scf_iter_t *);
3457c478bd9Sstevel@tonic-gate void scf_iter_reset(scf_iter_t *);
3467c478bd9Sstevel@tonic-gate void scf_iter_destroy(scf_iter_t *);
3477c478bd9Sstevel@tonic-gate 
3487c478bd9Sstevel@tonic-gate int scf_iter_handle_scopes(scf_iter_t *, const scf_handle_t *);
3497c478bd9Sstevel@tonic-gate int scf_iter_scope_services(scf_iter_t *, const scf_scope_t *);
3507c478bd9Sstevel@tonic-gate int scf_iter_service_instances(scf_iter_t *, const scf_service_t *);
3517c478bd9Sstevel@tonic-gate int scf_iter_service_pgs(scf_iter_t *, const scf_service_t *);
3527c478bd9Sstevel@tonic-gate int scf_iter_instance_pgs(scf_iter_t *, const scf_instance_t *);
3537c478bd9Sstevel@tonic-gate int scf_iter_instance_pgs_composed(scf_iter_t *, const scf_instance_t *,
3547c478bd9Sstevel@tonic-gate     const scf_snapshot_t *);
3557c478bd9Sstevel@tonic-gate int scf_iter_service_pgs_typed(scf_iter_t *, const scf_service_t *,
3567c478bd9Sstevel@tonic-gate     const char *);
3577c478bd9Sstevel@tonic-gate int scf_iter_instance_pgs_typed(scf_iter_t *, const scf_instance_t *,
3587c478bd9Sstevel@tonic-gate     const char *);
3597c478bd9Sstevel@tonic-gate int scf_iter_instance_pgs_typed_composed(scf_iter_t *, const scf_instance_t *,
3607c478bd9Sstevel@tonic-gate     const scf_snapshot_t *, const char *);
3617c478bd9Sstevel@tonic-gate int scf_iter_snaplevel_pgs(scf_iter_t *, const scf_snaplevel_t *);
3627c478bd9Sstevel@tonic-gate int scf_iter_snaplevel_pgs_typed(scf_iter_t *, const scf_snaplevel_t *,
3637c478bd9Sstevel@tonic-gate     const char *);
3647c478bd9Sstevel@tonic-gate int scf_iter_instance_snapshots(scf_iter_t *, const scf_instance_t *);
3657c478bd9Sstevel@tonic-gate int scf_iter_pg_properties(scf_iter_t *, const scf_propertygroup_t *);
3667c478bd9Sstevel@tonic-gate int scf_iter_property_values(scf_iter_t *, const scf_property_t *);
3677c478bd9Sstevel@tonic-gate 
3687c478bd9Sstevel@tonic-gate int scf_iter_next_scope(scf_iter_t *, scf_scope_t *);
3697c478bd9Sstevel@tonic-gate int scf_iter_next_service(scf_iter_t *, scf_service_t *);
3707c478bd9Sstevel@tonic-gate int scf_iter_next_instance(scf_iter_t *, scf_instance_t *);
3717c478bd9Sstevel@tonic-gate int scf_iter_next_pg(scf_iter_t *, scf_propertygroup_t *);
3727c478bd9Sstevel@tonic-gate int scf_iter_next_property(scf_iter_t *, scf_property_t *);
3737c478bd9Sstevel@tonic-gate int scf_iter_next_snapshot(scf_iter_t *, scf_snapshot_t *);
3747c478bd9Sstevel@tonic-gate int scf_iter_next_value(scf_iter_t *, scf_value_t *);
3757c478bd9Sstevel@tonic-gate 
3767c478bd9Sstevel@tonic-gate scf_scope_t *scf_scope_create(scf_handle_t *);
3777c478bd9Sstevel@tonic-gate scf_handle_t *scf_scope_handle(const scf_scope_t *);
3787c478bd9Sstevel@tonic-gate 
3797c478bd9Sstevel@tonic-gate /* XXX eventually remove this */
3807c478bd9Sstevel@tonic-gate #define	scf_handle_get_local_scope(h, s) \
3817c478bd9Sstevel@tonic-gate 	scf_handle_get_scope((h), SCF_SCOPE_LOCAL, (s))
3827c478bd9Sstevel@tonic-gate 
3837c478bd9Sstevel@tonic-gate int scf_handle_get_scope(scf_handle_t *, const char *, scf_scope_t *);
3847c478bd9Sstevel@tonic-gate void scf_scope_destroy(scf_scope_t *);
3857c478bd9Sstevel@tonic-gate ssize_t scf_scope_get_name(const scf_scope_t *, char *, size_t);
3867c478bd9Sstevel@tonic-gate 
3877c478bd9Sstevel@tonic-gate ssize_t scf_scope_to_fmri(const scf_scope_t *, char *, size_t);
3887c478bd9Sstevel@tonic-gate 
3897c478bd9Sstevel@tonic-gate scf_service_t *scf_service_create(scf_handle_t *);
3907c478bd9Sstevel@tonic-gate scf_handle_t *scf_service_handle(const scf_service_t *);
3917c478bd9Sstevel@tonic-gate void scf_service_destroy(scf_service_t *);
3927c478bd9Sstevel@tonic-gate int scf_scope_get_parent(const scf_scope_t *, scf_scope_t *);
3937c478bd9Sstevel@tonic-gate ssize_t scf_service_get_name(const scf_service_t *, char *, size_t);
3947c478bd9Sstevel@tonic-gate ssize_t scf_service_to_fmri(const scf_service_t *, char *, size_t);
3957c478bd9Sstevel@tonic-gate int scf_service_get_parent(const scf_service_t *, scf_scope_t *);
3967c478bd9Sstevel@tonic-gate int scf_scope_get_service(const scf_scope_t *, const char *, scf_service_t *);
3977c478bd9Sstevel@tonic-gate int scf_scope_add_service(const scf_scope_t *, const char *, scf_service_t *);
3987c478bd9Sstevel@tonic-gate int scf_service_delete(scf_service_t *);
3997c478bd9Sstevel@tonic-gate 
4007c478bd9Sstevel@tonic-gate scf_instance_t *scf_instance_create(scf_handle_t *);
4017c478bd9Sstevel@tonic-gate scf_handle_t *scf_instance_handle(const scf_instance_t *);
4027c478bd9Sstevel@tonic-gate void scf_instance_destroy(scf_instance_t *);
4037c478bd9Sstevel@tonic-gate ssize_t scf_instance_get_name(const scf_instance_t *, char *, size_t);
4047c478bd9Sstevel@tonic-gate ssize_t scf_instance_to_fmri(const scf_instance_t *, char *, size_t);
4057c478bd9Sstevel@tonic-gate int scf_service_get_instance(const scf_service_t *, const char *,
4067c478bd9Sstevel@tonic-gate     scf_instance_t *);
4077c478bd9Sstevel@tonic-gate int scf_service_add_instance(const scf_service_t *, const char *,
4087c478bd9Sstevel@tonic-gate     scf_instance_t *);
4097c478bd9Sstevel@tonic-gate int scf_instance_delete(scf_instance_t *);
4107c478bd9Sstevel@tonic-gate 
4117c478bd9Sstevel@tonic-gate scf_snapshot_t *scf_snapshot_create(scf_handle_t *);
4127c478bd9Sstevel@tonic-gate scf_handle_t *scf_snapshot_handle(const scf_snapshot_t *);
4137c478bd9Sstevel@tonic-gate void scf_snapshot_destroy(scf_snapshot_t *);
4147c478bd9Sstevel@tonic-gate ssize_t scf_snapshot_get_name(const scf_snapshot_t *, char *, size_t);
4157c478bd9Sstevel@tonic-gate int scf_snapshot_get_parent(const scf_snapshot_t *, scf_instance_t *);
4167c478bd9Sstevel@tonic-gate int scf_instance_get_snapshot(const scf_instance_t *, const char *,
4177c478bd9Sstevel@tonic-gate     scf_snapshot_t *);
4187c478bd9Sstevel@tonic-gate int scf_snapshot_update(scf_snapshot_t *);
4197c478bd9Sstevel@tonic-gate 
4207c478bd9Sstevel@tonic-gate scf_snaplevel_t *scf_snaplevel_create(scf_handle_t *);
4217c478bd9Sstevel@tonic-gate scf_handle_t *scf_snaplevel_handle(const scf_snaplevel_t *);
4227c478bd9Sstevel@tonic-gate void scf_snaplevel_destroy(scf_snaplevel_t *);
4237c478bd9Sstevel@tonic-gate int scf_snaplevel_get_parent(const scf_snaplevel_t *, scf_snapshot_t *);
4247c478bd9Sstevel@tonic-gate ssize_t scf_snaplevel_get_scope_name(const scf_snaplevel_t *, char *, size_t);
4257c478bd9Sstevel@tonic-gate ssize_t scf_snaplevel_get_service_name(const scf_snaplevel_t *, char *, size_t);
4267c478bd9Sstevel@tonic-gate ssize_t scf_snaplevel_get_instance_name(const scf_snaplevel_t *, char *,
4277c478bd9Sstevel@tonic-gate     size_t);
4287c478bd9Sstevel@tonic-gate int scf_snaplevel_get_pg(const scf_snaplevel_t *, const char *,
4297c478bd9Sstevel@tonic-gate     scf_propertygroup_t *pg);
4307c478bd9Sstevel@tonic-gate int scf_snapshot_get_base_snaplevel(const scf_snapshot_t *, scf_snaplevel_t *);
4317c478bd9Sstevel@tonic-gate int scf_snaplevel_get_next_snaplevel(const scf_snaplevel_t *,
4327c478bd9Sstevel@tonic-gate     scf_snaplevel_t *);
4337c478bd9Sstevel@tonic-gate 
4347c478bd9Sstevel@tonic-gate scf_propertygroup_t *scf_pg_create(scf_handle_t *);
4357c478bd9Sstevel@tonic-gate scf_handle_t *scf_pg_handle(const scf_propertygroup_t *);
4367c478bd9Sstevel@tonic-gate void scf_pg_destroy(scf_propertygroup_t *);
4377c478bd9Sstevel@tonic-gate ssize_t scf_pg_to_fmri(const scf_propertygroup_t *,  char *, size_t);
4387c478bd9Sstevel@tonic-gate ssize_t scf_pg_get_name(const scf_propertygroup_t *, char *, size_t);
4397c478bd9Sstevel@tonic-gate ssize_t scf_pg_get_type(const scf_propertygroup_t *, char *, size_t);
4407c478bd9Sstevel@tonic-gate int scf_pg_get_flags(const scf_propertygroup_t *, uint32_t *);
4417c478bd9Sstevel@tonic-gate int scf_pg_get_parent_service(const scf_propertygroup_t *, scf_service_t *);
4427c478bd9Sstevel@tonic-gate int scf_pg_get_parent_instance(const scf_propertygroup_t *, scf_instance_t *);
4437c478bd9Sstevel@tonic-gate int scf_pg_get_parent_snaplevel(const scf_propertygroup_t *, scf_snaplevel_t *);
4447c478bd9Sstevel@tonic-gate int scf_service_get_pg(const scf_service_t *, const char *,
4457c478bd9Sstevel@tonic-gate     scf_propertygroup_t *);
4467c478bd9Sstevel@tonic-gate int scf_instance_get_pg(const scf_instance_t *, const char *,
4477c478bd9Sstevel@tonic-gate     scf_propertygroup_t *);
4487c478bd9Sstevel@tonic-gate int scf_instance_get_pg_composed(const scf_instance_t *, const scf_snapshot_t *,
4497c478bd9Sstevel@tonic-gate     const char *, scf_propertygroup_t *);
4507c478bd9Sstevel@tonic-gate int scf_service_add_pg(const scf_service_t *,  const char *, const char *,
4517c478bd9Sstevel@tonic-gate     uint32_t, scf_propertygroup_t *);
4527c478bd9Sstevel@tonic-gate int scf_instance_add_pg(const scf_instance_t *,  const char *, const char *,
4537c478bd9Sstevel@tonic-gate     uint32_t, scf_propertygroup_t *);
4547c478bd9Sstevel@tonic-gate int scf_pg_delete(scf_propertygroup_t *);
4557c478bd9Sstevel@tonic-gate 
4567c478bd9Sstevel@tonic-gate int scf_pg_get_underlying_pg(const scf_propertygroup_t *,
4577c478bd9Sstevel@tonic-gate     scf_propertygroup_t *);
4587c478bd9Sstevel@tonic-gate int scf_instance_get_parent(const scf_instance_t *, scf_service_t *);
4597c478bd9Sstevel@tonic-gate 
4607c478bd9Sstevel@tonic-gate int scf_pg_update(scf_propertygroup_t *);
4617c478bd9Sstevel@tonic-gate 
4627c478bd9Sstevel@tonic-gate scf_property_t *scf_property_create(scf_handle_t *);
4637c478bd9Sstevel@tonic-gate scf_handle_t *scf_property_handle(const scf_property_t *);
4647c478bd9Sstevel@tonic-gate void scf_property_destroy(scf_property_t *);
4657c478bd9Sstevel@tonic-gate int scf_property_is_type(const scf_property_t *, scf_type_t);
4667c478bd9Sstevel@tonic-gate int scf_property_type(const scf_property_t *, scf_type_t *);
4677c478bd9Sstevel@tonic-gate ssize_t scf_property_get_name(const scf_property_t *, char *, size_t);
4687c478bd9Sstevel@tonic-gate int scf_property_get_value(const scf_property_t *, scf_value_t *);
4697c478bd9Sstevel@tonic-gate ssize_t scf_property_to_fmri(const scf_property_t *, char *, size_t);
4707c478bd9Sstevel@tonic-gate int scf_pg_get_property(const scf_propertygroup_t *,  const char *,
4717c478bd9Sstevel@tonic-gate     scf_property_t *);
4727c478bd9Sstevel@tonic-gate 
4737c478bd9Sstevel@tonic-gate scf_transaction_t *scf_transaction_create(scf_handle_t *);
4747c478bd9Sstevel@tonic-gate scf_handle_t *scf_transaction_handle(const scf_transaction_t *);
4757c478bd9Sstevel@tonic-gate int scf_transaction_start(scf_transaction_t *, scf_propertygroup_t *);
4767c478bd9Sstevel@tonic-gate void scf_transaction_destroy(scf_transaction_t *);
4777c478bd9Sstevel@tonic-gate void scf_transaction_destroy_children(scf_transaction_t *);
4787c478bd9Sstevel@tonic-gate 
4797c478bd9Sstevel@tonic-gate void scf_transaction_reset(scf_transaction_t *);
4807c478bd9Sstevel@tonic-gate void scf_transaction_reset_all(scf_transaction_t *);
4817c478bd9Sstevel@tonic-gate 
4827c478bd9Sstevel@tonic-gate int scf_transaction_commit(scf_transaction_t *);
4837c478bd9Sstevel@tonic-gate 
4847c478bd9Sstevel@tonic-gate scf_transaction_entry_t *scf_entry_create(scf_handle_t *);
4857c478bd9Sstevel@tonic-gate scf_handle_t *scf_entry_handle(const scf_transaction_entry_t *);
4867c478bd9Sstevel@tonic-gate void scf_entry_reset(scf_transaction_entry_t *);
4877c478bd9Sstevel@tonic-gate void scf_entry_destroy(scf_transaction_entry_t *);
4887c478bd9Sstevel@tonic-gate void scf_entry_destroy_children(scf_transaction_entry_t *);
4897c478bd9Sstevel@tonic-gate 
4907c478bd9Sstevel@tonic-gate int scf_transaction_property_change(scf_transaction_t *,
4917c478bd9Sstevel@tonic-gate     scf_transaction_entry_t *, const char *, scf_type_t);
4927c478bd9Sstevel@tonic-gate int scf_transaction_property_delete(scf_transaction_t *,
4937c478bd9Sstevel@tonic-gate     scf_transaction_entry_t *, const char *);
4947c478bd9Sstevel@tonic-gate int scf_transaction_property_new(scf_transaction_t *,
4957c478bd9Sstevel@tonic-gate     scf_transaction_entry_t *, const char *, scf_type_t);
4967c478bd9Sstevel@tonic-gate int scf_transaction_property_change_type(scf_transaction_t *,
4977c478bd9Sstevel@tonic-gate     scf_transaction_entry_t *, const char *, scf_type_t);
4987c478bd9Sstevel@tonic-gate 
4997c478bd9Sstevel@tonic-gate int scf_entry_add_value(scf_transaction_entry_t *, scf_value_t *);
5007c478bd9Sstevel@tonic-gate 
5017c478bd9Sstevel@tonic-gate int scf_handle_decode_fmri(scf_handle_t *, const char *, scf_scope_t *,
5027c478bd9Sstevel@tonic-gate     scf_service_t *, scf_instance_t *, scf_propertygroup_t *, scf_property_t *,
5037c478bd9Sstevel@tonic-gate     int);
5047c478bd9Sstevel@tonic-gate #define	SCF_DECODE_FMRI_EXACT			0x00000001
5057c478bd9Sstevel@tonic-gate #define	SCF_DECODE_FMRI_TRUNCATE		0x00000002
5067c478bd9Sstevel@tonic-gate #define	SCF_DECODE_FMRI_REQUIRE_INSTANCE	0x00000004
5077c478bd9Sstevel@tonic-gate #define	SCF_DECODE_FMRI_REQUIRE_NO_INSTANCE	0x00000008
5087c478bd9Sstevel@tonic-gate 
5097c478bd9Sstevel@tonic-gate ssize_t scf_myname(scf_handle_t *, char *, size_t);
5107c478bd9Sstevel@tonic-gate 
5117c478bd9Sstevel@tonic-gate /*
5127c478bd9Sstevel@tonic-gate  * Simplified calls
5137c478bd9Sstevel@tonic-gate  */
5147c478bd9Sstevel@tonic-gate 
5157c478bd9Sstevel@tonic-gate int smf_enable_instance(const char *, int);
5167c478bd9Sstevel@tonic-gate int smf_disable_instance(const char *, int);
5177c478bd9Sstevel@tonic-gate int smf_refresh_instance(const char *);
5187c478bd9Sstevel@tonic-gate int smf_restart_instance(const char *);
5197c478bd9Sstevel@tonic-gate int smf_maintain_instance(const char *, int);
5207c478bd9Sstevel@tonic-gate int smf_degrade_instance(const char *, int);
5217c478bd9Sstevel@tonic-gate int smf_restore_instance(const char *);
5227c478bd9Sstevel@tonic-gate char *smf_get_state(const char *);
5237c478bd9Sstevel@tonic-gate 
5247c478bd9Sstevel@tonic-gate int scf_simple_walk_instances(uint_t, void *,
5257c478bd9Sstevel@tonic-gate     int (*inst_callback)(scf_handle_t *, scf_instance_t *, void *));
5267c478bd9Sstevel@tonic-gate 
5277c478bd9Sstevel@tonic-gate scf_simple_prop_t *scf_simple_prop_get(scf_handle_t *, const char *,
5287c478bd9Sstevel@tonic-gate     const char *, const char *);
5297c478bd9Sstevel@tonic-gate void scf_simple_prop_free(scf_simple_prop_t *);
5307c478bd9Sstevel@tonic-gate scf_simple_app_props_t *scf_simple_app_props_get(scf_handle_t *, const char *);
5317c478bd9Sstevel@tonic-gate void scf_simple_app_props_free(scf_simple_app_props_t *);
5327c478bd9Sstevel@tonic-gate const scf_simple_prop_t *scf_simple_app_props_next(
5337c478bd9Sstevel@tonic-gate     const scf_simple_app_props_t *, scf_simple_prop_t *);
5347c478bd9Sstevel@tonic-gate const scf_simple_prop_t *scf_simple_app_props_search(
5357c478bd9Sstevel@tonic-gate     const scf_simple_app_props_t *, const char *, const char *);
5367c478bd9Sstevel@tonic-gate ssize_t scf_simple_prop_numvalues(const scf_simple_prop_t *);
5377c478bd9Sstevel@tonic-gate scf_type_t scf_simple_prop_type(const scf_simple_prop_t *);
5387c478bd9Sstevel@tonic-gate char *scf_simple_prop_name(const scf_simple_prop_t *);
5397c478bd9Sstevel@tonic-gate char *scf_simple_prop_pgname(const scf_simple_prop_t *);
5407c478bd9Sstevel@tonic-gate uint8_t *scf_simple_prop_next_boolean(scf_simple_prop_t *);
5417c478bd9Sstevel@tonic-gate uint64_t *scf_simple_prop_next_count(scf_simple_prop_t *);
5427c478bd9Sstevel@tonic-gate int64_t *scf_simple_prop_next_integer(scf_simple_prop_t *);
5437c478bd9Sstevel@tonic-gate int64_t *scf_simple_prop_next_time(scf_simple_prop_t *, int32_t *);
5447c478bd9Sstevel@tonic-gate char *scf_simple_prop_next_astring(scf_simple_prop_t *);
5457c478bd9Sstevel@tonic-gate char *scf_simple_prop_next_ustring(scf_simple_prop_t *);
5467c478bd9Sstevel@tonic-gate void *scf_simple_prop_next_opaque(scf_simple_prop_t *, size_t *);
5477c478bd9Sstevel@tonic-gate void scf_simple_prop_next_reset(scf_simple_prop_t *);
5487c478bd9Sstevel@tonic-gate 
5497c478bd9Sstevel@tonic-gate /*
5507c478bd9Sstevel@tonic-gate  * SMF exit status definitions
5517c478bd9Sstevel@tonic-gate  */
5527c478bd9Sstevel@tonic-gate #define	SMF_EXIT_OK		  0
5537c478bd9Sstevel@tonic-gate #define	SMF_EXIT_ERR_FATAL	 95
5547c478bd9Sstevel@tonic-gate #define	SMF_EXIT_ERR_CONFIG	 96
5557c478bd9Sstevel@tonic-gate #define	SMF_EXIT_MON_DEGRADE	 97
5567c478bd9Sstevel@tonic-gate #define	SMF_EXIT_MON_OFFLINE	 98
5577c478bd9Sstevel@tonic-gate #define	SMF_EXIT_ERR_NOSMF	 99
5587c478bd9Sstevel@tonic-gate #define	SMF_EXIT_ERR_PERM	100
5597c478bd9Sstevel@tonic-gate 
5607c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
5617c478bd9Sstevel@tonic-gate }
5627c478bd9Sstevel@tonic-gate #endif
5637c478bd9Sstevel@tonic-gate 
5647c478bd9Sstevel@tonic-gate #endif	/* _LIBSCF_H */
565