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 2005 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 _CMD_SVCCFG_H 28*7c478bd9Sstevel@tonic-gate #define _CMD_SVCCFG_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 <sys/types.h> 33*7c478bd9Sstevel@tonic-gate 34*7c478bd9Sstevel@tonic-gate #include <libxml/tree.h> 35*7c478bd9Sstevel@tonic-gate 36*7c478bd9Sstevel@tonic-gate #include <libscf.h> 37*7c478bd9Sstevel@tonic-gate #include <libtecla.h> 38*7c478bd9Sstevel@tonic-gate #include <libuutil.h> 39*7c478bd9Sstevel@tonic-gate 40*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 41*7c478bd9Sstevel@tonic-gate extern "C" { 42*7c478bd9Sstevel@tonic-gate #endif 43*7c478bd9Sstevel@tonic-gate 44*7c478bd9Sstevel@tonic-gate /* Command scope bits for command tab completion */ 45*7c478bd9Sstevel@tonic-gate #define CS_SCOPE 0x01 46*7c478bd9Sstevel@tonic-gate #define CS_SVC 0x02 47*7c478bd9Sstevel@tonic-gate #define CS_INST 0x04 48*7c478bd9Sstevel@tonic-gate #define CS_SNAP 0x08 49*7c478bd9Sstevel@tonic-gate #define CS_GLOBAL 0x0f 50*7c478bd9Sstevel@tonic-gate 51*7c478bd9Sstevel@tonic-gate /* Flags for lscf_bundle_import() & co. */ 52*7c478bd9Sstevel@tonic-gate #define SCI_NOREFRESH 0x01 /* Don't refresh instances */ 53*7c478bd9Sstevel@tonic-gate #define SCI_GENERALLAST 0x04 /* Add general property group last */ 54*7c478bd9Sstevel@tonic-gate #define SCI_NOENABLED 0x08 /* Don't import general/enabled. */ 55*7c478bd9Sstevel@tonic-gate #define SCI_FRESH 0x10 /* Freshly imported service */ 56*7c478bd9Sstevel@tonic-gate #define SCI_FORCE 0x20 /* Override-import. */ 57*7c478bd9Sstevel@tonic-gate #define SCI_KEEP 0x40 /* Don't delete when SCI_FORCEing */ 58*7c478bd9Sstevel@tonic-gate 59*7c478bd9Sstevel@tonic-gate #ifdef lint 60*7c478bd9Sstevel@tonic-gate extern int yyerror(const char *); 61*7c478bd9Sstevel@tonic-gate extern int yyparse(void); 62*7c478bd9Sstevel@tonic-gate #endif /* lint */ 63*7c478bd9Sstevel@tonic-gate 64*7c478bd9Sstevel@tonic-gate extern int lex_lineno; 65*7c478bd9Sstevel@tonic-gate 66*7c478bd9Sstevel@tonic-gate #define MANIFEST_DTD_PATH "/usr/share/lib/xml/dtd/service_bundle.dtd.1" 67*7c478bd9Sstevel@tonic-gate /* 68*7c478bd9Sstevel@tonic-gate * The following list must be kept in the same order as that of 69*7c478bd9Sstevel@tonic-gate * lxml_prop_types[] 70*7c478bd9Sstevel@tonic-gate */ 71*7c478bd9Sstevel@tonic-gate typedef enum element { 72*7c478bd9Sstevel@tonic-gate SC_ASTRING = 0x0, SC_BOOLEAN, SC_COMMON_NAME, SC_COUNT, 73*7c478bd9Sstevel@tonic-gate SC_INSTANCE_CREATE_DEFAULT, SC_DEPENDENCY, SC_DEPENDENT, SC_DESCRIPTION, 74*7c478bd9Sstevel@tonic-gate SC_DOC_LINK, SC_DOCUMENTATION, SC_ENABLED, SC_EXEC_METHOD, SC_FMRI, 75*7c478bd9Sstevel@tonic-gate SC_HOST, SC_HOSTNAME, SC_INSTANCE, SC_INTEGER, SC_LOCTEXT, SC_MANPAGE, 76*7c478bd9Sstevel@tonic-gate SC_METHOD_CONTEXT, SC_METHOD_CREDENTIAL, SC_METHOD_PROFILE, 77*7c478bd9Sstevel@tonic-gate SC_METHOD_ENVIRONMENT, SC_METHOD_ENVVAR, SC_NET_ADDR_V4, SC_NET_ADDR_V6, 78*7c478bd9Sstevel@tonic-gate SC_OPAQUE, SC_PROPERTY, SC_PROPERTY_GROUP, SC_PROPVAL, SC_RESTARTER, 79*7c478bd9Sstevel@tonic-gate SC_SERVICE, SC_SERVICE_BUNDLE, SC_SERVICE_FMRI, SC_INSTANCE_SINGLE, 80*7c478bd9Sstevel@tonic-gate SC_STABILITY, SC_TEMPLATE, SC_TIME, SC_URI, SC_USTRING, SC_VALUE_NODE, 81*7c478bd9Sstevel@tonic-gate SC_XI_FALLBACK, SC_XI_INCLUDE 82*7c478bd9Sstevel@tonic-gate } element_t; 83*7c478bd9Sstevel@tonic-gate 84*7c478bd9Sstevel@tonic-gate typedef enum bundle_type { 85*7c478bd9Sstevel@tonic-gate SVCCFG_UNKNOWN_BUNDLE, SVCCFG_MANIFEST, SVCCFG_PROFILE, SVCCFG_ARCHIVE 86*7c478bd9Sstevel@tonic-gate } bundle_type_t; 87*7c478bd9Sstevel@tonic-gate 88*7c478bd9Sstevel@tonic-gate typedef struct bundle { 89*7c478bd9Sstevel@tonic-gate uu_list_t *sc_bundle_services; 90*7c478bd9Sstevel@tonic-gate 91*7c478bd9Sstevel@tonic-gate xmlChar *sc_bundle_name; 92*7c478bd9Sstevel@tonic-gate bundle_type_t sc_bundle_type; 93*7c478bd9Sstevel@tonic-gate } bundle_t; 94*7c478bd9Sstevel@tonic-gate 95*7c478bd9Sstevel@tonic-gate typedef enum service_type { 96*7c478bd9Sstevel@tonic-gate SVCCFG_UNKNOWN_SERVICE = 0x0, SVCCFG_SERVICE, SVCCFG_RESTARTER, 97*7c478bd9Sstevel@tonic-gate SVCCFG_MILESTONE 98*7c478bd9Sstevel@tonic-gate } service_type_t; 99*7c478bd9Sstevel@tonic-gate 100*7c478bd9Sstevel@tonic-gate typedef enum entity_type { 101*7c478bd9Sstevel@tonic-gate SVCCFG_SERVICE_OBJECT = 0x0, SVCCFG_INSTANCE_OBJECT, 102*7c478bd9Sstevel@tonic-gate SVCCFG_TEMPLATE_OBJECT 103*7c478bd9Sstevel@tonic-gate } entity_type_t; 104*7c478bd9Sstevel@tonic-gate 105*7c478bd9Sstevel@tonic-gate enum import_state { 106*7c478bd9Sstevel@tonic-gate IMPORT_NONE = 0, 107*7c478bd9Sstevel@tonic-gate IMPORT_PREVIOUS, 108*7c478bd9Sstevel@tonic-gate IMPORT_PROP_BEGUN, 109*7c478bd9Sstevel@tonic-gate IMPORT_PROP_DONE, 110*7c478bd9Sstevel@tonic-gate IMPORT_COMPLETE, 111*7c478bd9Sstevel@tonic-gate IMPORT_REFRESHED 112*7c478bd9Sstevel@tonic-gate }; 113*7c478bd9Sstevel@tonic-gate 114*7c478bd9Sstevel@tonic-gate typedef struct entity { 115*7c478bd9Sstevel@tonic-gate uu_list_node_t sc_node; 116*7c478bd9Sstevel@tonic-gate entity_type_t sc_etype; 117*7c478bd9Sstevel@tonic-gate 118*7c478bd9Sstevel@tonic-gate /* Common fields to all entities. */ 119*7c478bd9Sstevel@tonic-gate const char *sc_name; 120*7c478bd9Sstevel@tonic-gate const char *sc_fmri; 121*7c478bd9Sstevel@tonic-gate uu_list_t *sc_pgroups; 122*7c478bd9Sstevel@tonic-gate uu_list_t *sc_dependents; 123*7c478bd9Sstevel@tonic-gate struct entity *sc_parent; 124*7c478bd9Sstevel@tonic-gate enum import_state sc_import_state; 125*7c478bd9Sstevel@tonic-gate int sc_seen; 126*7c478bd9Sstevel@tonic-gate 127*7c478bd9Sstevel@tonic-gate union { 128*7c478bd9Sstevel@tonic-gate struct { 129*7c478bd9Sstevel@tonic-gate uu_list_t *sc_service_instances; 130*7c478bd9Sstevel@tonic-gate service_type_t sc_service_type; 131*7c478bd9Sstevel@tonic-gate uint_t sc_service_version; 132*7c478bd9Sstevel@tonic-gate 133*7c478bd9Sstevel@tonic-gate struct entity *sc_service_template; 134*7c478bd9Sstevel@tonic-gate } sc_service; 135*7c478bd9Sstevel@tonic-gate struct { 136*7c478bd9Sstevel@tonic-gate uint_t sc_instance_dummy; 137*7c478bd9Sstevel@tonic-gate } sc_instance; 138*7c478bd9Sstevel@tonic-gate struct { 139*7c478bd9Sstevel@tonic-gate uint_t sc_template_dummy; 140*7c478bd9Sstevel@tonic-gate } sc_template; 141*7c478bd9Sstevel@tonic-gate } sc_u; 142*7c478bd9Sstevel@tonic-gate } entity_t; 143*7c478bd9Sstevel@tonic-gate 144*7c478bd9Sstevel@tonic-gate typedef struct pgroup { 145*7c478bd9Sstevel@tonic-gate uu_list_node_t sc_node; 146*7c478bd9Sstevel@tonic-gate uu_list_t *sc_pgroup_props; 147*7c478bd9Sstevel@tonic-gate 148*7c478bd9Sstevel@tonic-gate const char *sc_pgroup_name; 149*7c478bd9Sstevel@tonic-gate const char *sc_pgroup_type; 150*7c478bd9Sstevel@tonic-gate uint_t sc_pgroup_flags; 151*7c478bd9Sstevel@tonic-gate struct entity *sc_parent; 152*7c478bd9Sstevel@tonic-gate 153*7c478bd9Sstevel@tonic-gate int sc_pgroup_delete; 154*7c478bd9Sstevel@tonic-gate int sc_pgroup_override; 155*7c478bd9Sstevel@tonic-gate const char *sc_pgroup_fmri; /* Used for dependents */ 156*7c478bd9Sstevel@tonic-gate 157*7c478bd9Sstevel@tonic-gate int sc_pgroup_seen; 158*7c478bd9Sstevel@tonic-gate } pgroup_t; 159*7c478bd9Sstevel@tonic-gate 160*7c478bd9Sstevel@tonic-gate typedef struct property { 161*7c478bd9Sstevel@tonic-gate uu_list_node_t sc_node; 162*7c478bd9Sstevel@tonic-gate uu_list_t *sc_property_values; 163*7c478bd9Sstevel@tonic-gate 164*7c478bd9Sstevel@tonic-gate char *sc_property_name; 165*7c478bd9Sstevel@tonic-gate scf_type_t sc_value_type; 166*7c478bd9Sstevel@tonic-gate 167*7c478bd9Sstevel@tonic-gate int sc_property_override; 168*7c478bd9Sstevel@tonic-gate int sc_seen; 169*7c478bd9Sstevel@tonic-gate } property_t; 170*7c478bd9Sstevel@tonic-gate 171*7c478bd9Sstevel@tonic-gate typedef struct value { 172*7c478bd9Sstevel@tonic-gate uu_list_node_t sc_node; 173*7c478bd9Sstevel@tonic-gate 174*7c478bd9Sstevel@tonic-gate scf_type_t sc_type; 175*7c478bd9Sstevel@tonic-gate 176*7c478bd9Sstevel@tonic-gate void (*sc_free)(struct value *); 177*7c478bd9Sstevel@tonic-gate 178*7c478bd9Sstevel@tonic-gate union { 179*7c478bd9Sstevel@tonic-gate uint64_t sc_count; 180*7c478bd9Sstevel@tonic-gate int64_t sc_integer; 181*7c478bd9Sstevel@tonic-gate char *sc_string; 182*7c478bd9Sstevel@tonic-gate } sc_u; 183*7c478bd9Sstevel@tonic-gate } value_t; 184*7c478bd9Sstevel@tonic-gate 185*7c478bd9Sstevel@tonic-gate typedef struct scf_callback { 186*7c478bd9Sstevel@tonic-gate scf_handle_t *sc_handle; 187*7c478bd9Sstevel@tonic-gate void *sc_parent; /* immediate parent: scope, service, */ 188*7c478bd9Sstevel@tonic-gate /* instance, property group, property */ 189*7c478bd9Sstevel@tonic-gate scf_transaction_t *sc_trans; 190*7c478bd9Sstevel@tonic-gate int sc_service; /* True if sc_parent is a service. */ 191*7c478bd9Sstevel@tonic-gate uint_t sc_flags; 192*7c478bd9Sstevel@tonic-gate pgroup_t *sc_general; /* pointer to general property group */ 193*7c478bd9Sstevel@tonic-gate 194*7c478bd9Sstevel@tonic-gate const char *sc_source_fmri; 195*7c478bd9Sstevel@tonic-gate const char *sc_target_fmri; 196*7c478bd9Sstevel@tonic-gate int sc_err; 197*7c478bd9Sstevel@tonic-gate } scf_callback_t; 198*7c478bd9Sstevel@tonic-gate 199*7c478bd9Sstevel@tonic-gate #ifndef NDEBUG 200*7c478bd9Sstevel@tonic-gate #define bad_error(func, err) { \ 201*7c478bd9Sstevel@tonic-gate (void) fprintf(stderr, "%s:%d: %s() failed with unexpected " \ 202*7c478bd9Sstevel@tonic-gate "error %d. Aborting.\n", __FILE__, __LINE__, (func), (err)); \ 203*7c478bd9Sstevel@tonic-gate abort(); \ 204*7c478bd9Sstevel@tonic-gate } 205*7c478bd9Sstevel@tonic-gate #else 206*7c478bd9Sstevel@tonic-gate #define bad_error(func, err) abort() 207*7c478bd9Sstevel@tonic-gate #endif 208*7c478bd9Sstevel@tonic-gate 209*7c478bd9Sstevel@tonic-gate #define SC_CMD_LINE 0x0 210*7c478bd9Sstevel@tonic-gate #define SC_CMD_FILE 0x1 211*7c478bd9Sstevel@tonic-gate #define SC_CMD_EOF 0x2 212*7c478bd9Sstevel@tonic-gate #define SC_CMD_IACTIVE 0x4 213*7c478bd9Sstevel@tonic-gate #define SC_CMD_DONT_EXIT 0x8 214*7c478bd9Sstevel@tonic-gate 215*7c478bd9Sstevel@tonic-gate typedef struct engine_state { 216*7c478bd9Sstevel@tonic-gate uint_t sc_cmd_flags; 217*7c478bd9Sstevel@tonic-gate FILE *sc_cmd_file; 218*7c478bd9Sstevel@tonic-gate uint_t sc_cmd_lineno; 219*7c478bd9Sstevel@tonic-gate const char *sc_cmd_filename; 220*7c478bd9Sstevel@tonic-gate char *sc_cmd_buf; 221*7c478bd9Sstevel@tonic-gate size_t sc_cmd_bufsz; 222*7c478bd9Sstevel@tonic-gate off_t sc_cmd_bufoff; 223*7c478bd9Sstevel@tonic-gate GetLine *sc_gl; 224*7c478bd9Sstevel@tonic-gate 225*7c478bd9Sstevel@tonic-gate pid_t sc_repo_pid; 226*7c478bd9Sstevel@tonic-gate const char *sc_repo_filename; 227*7c478bd9Sstevel@tonic-gate const char *sc_repo_doordir; 228*7c478bd9Sstevel@tonic-gate const char *sc_repo_doorname; 229*7c478bd9Sstevel@tonic-gate const char *sc_repo_server; 230*7c478bd9Sstevel@tonic-gate } engine_state_t; 231*7c478bd9Sstevel@tonic-gate 232*7c478bd9Sstevel@tonic-gate extern engine_state_t *est; 233*7c478bd9Sstevel@tonic-gate 234*7c478bd9Sstevel@tonic-gate typedef struct string_list { 235*7c478bd9Sstevel@tonic-gate uu_list_node_t node; 236*7c478bd9Sstevel@tonic-gate char *str; 237*7c478bd9Sstevel@tonic-gate } string_list_t; 238*7c478bd9Sstevel@tonic-gate 239*7c478bd9Sstevel@tonic-gate extern uu_list_pool_t *string_pool; 240*7c478bd9Sstevel@tonic-gate 241*7c478bd9Sstevel@tonic-gate struct help_message { 242*7c478bd9Sstevel@tonic-gate int token; 243*7c478bd9Sstevel@tonic-gate const char *message; 244*7c478bd9Sstevel@tonic-gate }; 245*7c478bd9Sstevel@tonic-gate 246*7c478bd9Sstevel@tonic-gate extern struct help_message help_messages[]; 247*7c478bd9Sstevel@tonic-gate 248*7c478bd9Sstevel@tonic-gate extern scf_handle_t *g_hndl; /* global repcached connection handle */ 249*7c478bd9Sstevel@tonic-gate extern int g_exitcode; 250*7c478bd9Sstevel@tonic-gate extern int g_verbose; 251*7c478bd9Sstevel@tonic-gate 252*7c478bd9Sstevel@tonic-gate extern ssize_t max_scf_fmri_len; 253*7c478bd9Sstevel@tonic-gate extern ssize_t max_scf_name_len; 254*7c478bd9Sstevel@tonic-gate extern ssize_t max_scf_value_len; 255*7c478bd9Sstevel@tonic-gate extern ssize_t max_scf_pg_type_len; 256*7c478bd9Sstevel@tonic-gate 257*7c478bd9Sstevel@tonic-gate /* Common strings */ 258*7c478bd9Sstevel@tonic-gate extern const char * const name_attr; 259*7c478bd9Sstevel@tonic-gate extern const char * const type_attr; 260*7c478bd9Sstevel@tonic-gate extern const char * const value_attr; 261*7c478bd9Sstevel@tonic-gate extern const char * const enabled_attr; 262*7c478bd9Sstevel@tonic-gate extern const char * const scf_pg_general; 263*7c478bd9Sstevel@tonic-gate extern const char * const scf_group_framework; 264*7c478bd9Sstevel@tonic-gate extern const char * const true; 265*7c478bd9Sstevel@tonic-gate extern const char * const false; 266*7c478bd9Sstevel@tonic-gate 267*7c478bd9Sstevel@tonic-gate #define uu_list_append(list, elem) uu_list_insert_before(list, NULL, elem) 268*7c478bd9Sstevel@tonic-gate #define uu_list_prepend(list, elem) uu_list_insert_after(list, NULL, elem) 269*7c478bd9Sstevel@tonic-gate 270*7c478bd9Sstevel@tonic-gate void *safe_malloc(size_t); 271*7c478bd9Sstevel@tonic-gate char *safe_strdup(const char *); 272*7c478bd9Sstevel@tonic-gate void warn(const char *, ...); 273*7c478bd9Sstevel@tonic-gate void synerr(int); 274*7c478bd9Sstevel@tonic-gate void semerr(const char *, ...); 275*7c478bd9Sstevel@tonic-gate 276*7c478bd9Sstevel@tonic-gate void internal_init(void); 277*7c478bd9Sstevel@tonic-gate void internal_dump(bundle_t *); 278*7c478bd9Sstevel@tonic-gate 279*7c478bd9Sstevel@tonic-gate int value_cmp(const void *, const void *, void *); 280*7c478bd9Sstevel@tonic-gate 281*7c478bd9Sstevel@tonic-gate bundle_t *internal_bundle_new(void); 282*7c478bd9Sstevel@tonic-gate void internal_bundle_free(bundle_t *); 283*7c478bd9Sstevel@tonic-gate entity_t *internal_service_new(const char *); 284*7c478bd9Sstevel@tonic-gate void internal_service_free(entity_t *); 285*7c478bd9Sstevel@tonic-gate entity_t *internal_instance_new(const char *); 286*7c478bd9Sstevel@tonic-gate void internal_instance_free(entity_t *); 287*7c478bd9Sstevel@tonic-gate entity_t *internal_template_new(void); 288*7c478bd9Sstevel@tonic-gate pgroup_t *internal_pgroup_new(void); 289*7c478bd9Sstevel@tonic-gate void internal_pgroup_free(pgroup_t *); 290*7c478bd9Sstevel@tonic-gate pgroup_t *internal_pgroup_find(entity_t *, const char *, const char *); 291*7c478bd9Sstevel@tonic-gate pgroup_t *internal_dependent_find(entity_t *, const char *); 292*7c478bd9Sstevel@tonic-gate pgroup_t *internal_pgroup_find_or_create(entity_t *, const char *, 293*7c478bd9Sstevel@tonic-gate const char *); 294*7c478bd9Sstevel@tonic-gate property_t *internal_property_new(void); 295*7c478bd9Sstevel@tonic-gate void internal_property_free(property_t *); 296*7c478bd9Sstevel@tonic-gate property_t *internal_property_find(pgroup_t *, const char *); 297*7c478bd9Sstevel@tonic-gate property_t *internal_property_create(const char *, scf_type_t, uint_t, ...); 298*7c478bd9Sstevel@tonic-gate value_t *internal_value_new(void); 299*7c478bd9Sstevel@tonic-gate 300*7c478bd9Sstevel@tonic-gate int internal_attach_service(bundle_t *, entity_t *); 301*7c478bd9Sstevel@tonic-gate int internal_attach_entity(entity_t *, entity_t *); 302*7c478bd9Sstevel@tonic-gate int internal_attach_pgroup(entity_t *, pgroup_t *); 303*7c478bd9Sstevel@tonic-gate int internal_attach_dependent(entity_t *, pgroup_t *); 304*7c478bd9Sstevel@tonic-gate int internal_attach_property(pgroup_t *, property_t *); 305*7c478bd9Sstevel@tonic-gate void internal_attach_value(property_t *, value_t *); 306*7c478bd9Sstevel@tonic-gate 307*7c478bd9Sstevel@tonic-gate int load_init(void); 308*7c478bd9Sstevel@tonic-gate void load_fini(void); 309*7c478bd9Sstevel@tonic-gate int load_pg_attrs(const scf_propertygroup_t *, pgroup_t **); 310*7c478bd9Sstevel@tonic-gate int load_pg(const scf_propertygroup_t *, pgroup_t **, const char *, 311*7c478bd9Sstevel@tonic-gate const char *); 312*7c478bd9Sstevel@tonic-gate int prop_equal(property_t *, property_t *, const char *, const char *, int); 313*7c478bd9Sstevel@tonic-gate int pg_attrs_equal(pgroup_t *, pgroup_t *, const char *, int); 314*7c478bd9Sstevel@tonic-gate int pg_equal(pgroup_t *, pgroup_t *); 315*7c478bd9Sstevel@tonic-gate 316*7c478bd9Sstevel@tonic-gate void lscf_cleanup(void); 317*7c478bd9Sstevel@tonic-gate void lscf_prep_hndl(void); 318*7c478bd9Sstevel@tonic-gate void lscf_init(void); 319*7c478bd9Sstevel@tonic-gate int lscf_bundle_import(bundle_t *, const char *, uint_t); 320*7c478bd9Sstevel@tonic-gate int lscf_bundle_apply(bundle_t *); 321*7c478bd9Sstevel@tonic-gate void lscf_delete(const char *, int); 322*7c478bd9Sstevel@tonic-gate void lscf_list(const char *); 323*7c478bd9Sstevel@tonic-gate void lscf_select(const char *); 324*7c478bd9Sstevel@tonic-gate void lscf_unselect(); 325*7c478bd9Sstevel@tonic-gate void lscf_get_selection_str(char *, size_t); 326*7c478bd9Sstevel@tonic-gate void lscf_add(const char *); 327*7c478bd9Sstevel@tonic-gate void lscf_listpg(const char *); 328*7c478bd9Sstevel@tonic-gate void lscf_addpg(const char *, const char *, const char *); 329*7c478bd9Sstevel@tonic-gate void lscf_delpg(char *); 330*7c478bd9Sstevel@tonic-gate void lscf_listprop(const char *); 331*7c478bd9Sstevel@tonic-gate void lscf_addprop(char *, const char *, const uu_list_t *); 332*7c478bd9Sstevel@tonic-gate void lscf_delprop(char *); 333*7c478bd9Sstevel@tonic-gate void lscf_listsnap(); 334*7c478bd9Sstevel@tonic-gate void lscf_selectsnap(const char *); 335*7c478bd9Sstevel@tonic-gate void lscf_revert(const char *); 336*7c478bd9Sstevel@tonic-gate char *filename_to_propname(const char *); 337*7c478bd9Sstevel@tonic-gate int lscf_retrieve_hash(const char *, unsigned char *); 338*7c478bd9Sstevel@tonic-gate int lscf_store_hash(const char *, unsigned char *); 339*7c478bd9Sstevel@tonic-gate CPL_MATCH_FN(complete_select); 340*7c478bd9Sstevel@tonic-gate CPL_MATCH_FN(complete_command); 341*7c478bd9Sstevel@tonic-gate 342*7c478bd9Sstevel@tonic-gate int lxml_init(void); 343*7c478bd9Sstevel@tonic-gate int lxml_get_bundle_file(bundle_t *, const char *, int); 344*7c478bd9Sstevel@tonic-gate 345*7c478bd9Sstevel@tonic-gate void engine_init(void); 346*7c478bd9Sstevel@tonic-gate int engine_exec_cmd(void); 347*7c478bd9Sstevel@tonic-gate int engine_exec(char *); 348*7c478bd9Sstevel@tonic-gate int add_cmd_matches(WordCompletion *, const char *, int, uint32_t); 349*7c478bd9Sstevel@tonic-gate int engine_interp(void); 350*7c478bd9Sstevel@tonic-gate int engine_source(const char *, boolean_t); 351*7c478bd9Sstevel@tonic-gate int engine_import(uu_list_t *); 352*7c478bd9Sstevel@tonic-gate void help(int); 353*7c478bd9Sstevel@tonic-gate 354*7c478bd9Sstevel@tonic-gate int engine_cmd_getc(engine_state_t *); 355*7c478bd9Sstevel@tonic-gate int engine_cmd_ungetc(engine_state_t *, char); 356*7c478bd9Sstevel@tonic-gate void engine_cmd_nputs(engine_state_t *, char *, size_t); 357*7c478bd9Sstevel@tonic-gate 358*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 359*7c478bd9Sstevel@tonic-gate } 360*7c478bd9Sstevel@tonic-gate #endif 361*7c478bd9Sstevel@tonic-gate 362*7c478bd9Sstevel@tonic-gate #endif /* _CMD_SVCCFG_H */ 363