svccfg.h revision 9e9ae1fc5a2cf0c35d578ad826dff4763cd0a605
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _CMD_SVCCFG_H
#define _CMD_SVCCFG_H
#pragma ident "%Z%%M% %I% %E% SMI"
#include <libscf.h>
#include <libtecla.h>
#include <libuutil.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Command scope bits for command tab completion */
#define CS_SCOPE 0x01
#define CS_SVC 0x02
#define CS_INST 0x04
#define CS_SNAP 0x08
#define CS_GLOBAL 0x0f
/* Flags for lscf_bundle_import() & co. */
#ifdef lint
extern int yyerror(const char *);
extern int yyparse(void);
#endif /* lint */
extern int lex_lineno;
#define MANIFEST_DTD_PATH "/usr/share/lib/xml/dtd/service_bundle.dtd.1"
/*
* The following list must be kept in the same order as that of
* lxml_prop_types[]
*/
typedef enum element {
} element_t;
typedef enum bundle_type {
typedef struct bundle {
} bundle_t;
typedef enum service_type {
typedef enum entity_type {
enum import_state {
IMPORT_NONE = 0,
};
typedef struct entity {
/* Common fields to all entities. */
const char *sc_name;
const char *sc_fmri;
enum import_state sc_import_state;
int sc_seen;
union {
struct {
struct entity *sc_service_template;
} sc_service;
struct {
} sc_instance;
struct {
} sc_template;
} sc_u;
} entity_t;
typedef struct pgroup {
const char *sc_pgroup_name;
const char *sc_pgroup_type;
int sc_pgroup_delete;
int sc_pgroup_override;
const char *sc_pgroup_fmri; /* Used for dependents */
int sc_pgroup_seen;
} pgroup_t;
typedef struct property {
char *sc_property_name;
int sc_property_override;
int sc_seen;
} property_t;
typedef struct value {
union {
char *sc_string;
} sc_u;
} value_t;
typedef struct scf_callback {
void *sc_parent; /* immediate parent: scope, service, */
/* instance, property group, property */
int sc_service; /* True if sc_parent is a service. */
const char *sc_source_fmri;
const char *sc_target_fmri;
int sc_err;
#ifndef NDEBUG
abort(); \
}
#else
#endif
#define SC_CMD_LINE 0x0
#define SC_CMD_FILE 0x1
#define SC_CMD_EOF 0x2
#define SC_CMD_IACTIVE 0x4
#define SC_CMD_DONT_EXIT 0x8
typedef struct engine_state {
const char *sc_cmd_filename;
char *sc_cmd_buf;
const char *sc_repo_filename;
const char *sc_repo_doordir;
const char *sc_repo_doorname;
const char *sc_repo_server;
extern engine_state_t *est;
typedef struct string_list {
char *str;
extern uu_list_pool_t *string_pool;
struct help_message {
int token;
const char *message;
};
extern struct help_message help_messages[];
extern int g_exitcode;
extern int g_verbose;
extern ssize_t max_scf_fmri_len;
extern ssize_t max_scf_name_len;
extern ssize_t max_scf_value_len;
extern ssize_t max_scf_pg_type_len;
/* Common strings */
extern const char * const name_attr;
extern const char * const type_attr;
extern const char * const value_attr;
extern const char * const enabled_attr;
extern const char * const scf_pg_general;
extern const char * const scf_group_framework;
extern const char * const true;
extern const char * const false;
void *safe_malloc(size_t);
char *safe_strdup(const char *);
void warn(const char *, ...);
void synerr(int);
void semerr(const char *, ...);
void internal_init(void);
void internal_dump(bundle_t *);
int value_cmp(const void *, const void *, void *);
bundle_t *internal_bundle_new(void);
void internal_bundle_free(bundle_t *);
entity_t *internal_service_new(const char *);
void internal_service_free(entity_t *);
entity_t *internal_instance_new(const char *);
void internal_instance_free(entity_t *);
entity_t *internal_template_new(void);
pgroup_t *internal_pgroup_new(void);
void internal_pgroup_free(pgroup_t *);
const char *);
property_t *internal_property_new(void);
void internal_property_free(property_t *);
value_t *internal_value_new(void);
int load_init(void);
void load_fini(void);
const char *);
void lscf_cleanup(void);
void lscf_prep_hndl(void);
void lscf_init(void);
int lscf_bundle_apply(bundle_t *);
void lscf_delete(const char *, int);
void lscf_list(const char *);
void lscf_select(const char *);
void lscf_unselect();
void lscf_get_selection_str(char *, size_t);
void lscf_add(const char *);
void lscf_listpg(const char *);
void lscf_addpg(const char *, const char *, const char *);
void lscf_delpg(char *);
void lscf_listprop(const char *);
void lscf_addprop(char *, const char *, const uu_list_t *);
void lscf_delprop(char *);
void lscf_listsnap();
void lscf_selectsnap(const char *);
void lscf_revert(const char *);
char *filename_to_propname(const char *);
int lscf_retrieve_hash(const char *, unsigned char *);
int lscf_store_hash(const char *, unsigned char *);
int lxml_init(void);
int lxml_get_bundle_file(bundle_t *, const char *, int);
void engine_init(void);
int engine_exec_cmd(void);
int engine_exec(char *);
int engine_interp(void);
int engine_source(const char *, boolean_t);
int engine_import(uu_list_t *);
void help(int);
int engine_cmd_getc(engine_state_t *);
int engine_cmd_ungetc(engine_state_t *, char);
#ifdef __cplusplus
}
#endif
#endif /* _CMD_SVCCFG_H */