[BACK]Return to ci_config.h CVS log [TXT][DIR] Up to [Development] / failsafe / FailSafe / cluster_services / include

File: [Development] / failsafe / FailSafe / cluster_services / include / ci_config.h (download)

Revision 1.2, Wed Mar 28 01:52:33 2001 UTC (16 years, 7 months ago) by scotth
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +3 -3 lines

Fix *_LOG macro definitions to be correct ANSI C preprocessor usage:
remove incorrect ## usage and replace with correct: space-char.
bugzilla #61.

/*
 * Copyright (c) 2000,2001 Silicon Graphics, Inc.  All Rights Reserved.
 * 
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of version 2.1 of the GNU Lesser General Public
 * License as published by the Free Software Foundation.
 * 
 * This program is distributed in the hope that it would be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * 
 * Further, this software is distributed without any warranty that it is
 * free of the rightful claim of any third person regarding infringement
 * or the like.  Any license provided herein, whether implied or
 * otherwise, applies only to this software file.  Patent licenses, if
 * any, provided herein do not apply to combinations of this program with
 * other software, or any other product whatsoever.
 * 
 * You should have received a copy of the GNU Lesser General Public
 * License along with this program; if not, write the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307,
 * USA.
 * 
 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
 * Mountain View, CA 94043, or:
 * 
 * http://www.sgi.com 
 * 
 * For further information regarding this notice, see: 
 * 
 * http://oss.sgi.com/projects/GenInfo/NoticeExplan
 */

/* 
 * ci_config.h
 *
 * Prototypes for routines and data structures used by routines defined 
 * lib/libci/src/config directory. These routines read and write to
 * CDB.
 */
#ifndef	CI_CONFIG_H
#define	CI_CONFIG_H

#ident "$Id: ci_config.h,v 1.2 2001/03/28 01:52:33 scotth Exp $"

#include <sys/types.h>
#include <netinet/in.h>
#include <ci_nlist.h>
#include <ci_param.h>
#include <ci_types.h>
#include <ci_clock.h>
#include <cms_types.h>

#define	CI_CONFIG_REV		"1.666"

/* Number of lock retries done by cicdb_lock() routine. */
#define CI_LOCK_RETRY_COUNT	10

#define CI_CLI_LOG(args) (CI_LOG_START, ci_cli_log args, CI_LOG_END)

#define	CI_NODEMODE_ENABLED_STR		"enabled"
#define	CI_NODEMODE_DISABLED_STR	"disabled"
#define	CI_NODEMODE_SUSPENDED_STR	"suspended"
#define	CI_NODEMODE_CONSOLE_STR		"console"
#define CI_NODEMODE_TIEBREAKER_STR	"tiebreaker"	/* assumed to be 
							 * enabled too */

#define NULLCHAR	'\0'
#define ISEMPTY_STR(str) (str[0] == NULLCHAR)

/* Macro for setting variable var to B_TRUE or B_FALSE depending on the string
 * str. Uses key and err to print error message. 
 * 
 * This macro can be used by various CLIs in parse_args() routine, to validate 
 * keys whose values must be true/false.
 */

#define SET_VAR_TRUE_OR_FALSE(str, var, key, err) \
{\
    if ( str ) {\
        if ( ! strcasecmp(str, CICLI_TRUE_VALUE) )\
	    (var) =  B_TRUE;\
        else if ( !strcasecmp(str, CICLI_FALSE_VALUE) )\
	    (var) = B_FALSE;\
        else {\
	    sprintf((err), "Illegal value for key %s: %s", (key), (str));\
	    return CI_ERR_INVAL;\
        }\
   }\
}
 
/* 
 * Macro to convert cdb error in to ci_err_t.
 * The ci_err_t value is set in err variable.
 * cdb_error_lock_timeout -> CI_ERR_RETRY
 * cdb_error_handle_stale -> CI_ERR_HDL_STALE
 * Arguments: cdb handle and ci_err_t variable 
 */
#define CI_CDBERR_TO_CIERR(dbhdl, err)	\
	if (cdb_error(dbhdl) == cdb_error_lock_timeout) \
	    err = CI_ERR_RETRY;	\
	else if (cdb_error(dbhdl) == cdb_error_handle_stale) \
	    err = CI_ERR_HDL_STALE;


typedef cdb_generation_t	ci_generation_t;

typedef struct ci_config_intf_s {
  	int			rank;	/* Specifies the priority of
					 * this node. A interface with a
					 * lower rank is preferred over
					 * other interfaces. */
	char			*name;
} ci_config_intf_t;

typedef struct ci_config_node_s {
	ci_nodeid_t		id;
	ci_nodemode_t		mode;
	char			*name;
	char			*reset_name;
	uint32_t		intf_count;
	ci_config_intf_t	*intf;
} ci_config_node_t;

/* This structure is used to store log configuration data retrieved
 * from CDB or to be written to CDB. */
typedef struct ci_config_logentry_s {
    char	*logentrykey;	/* The key under the ...#logging tree */
    ci_nlist_t	*groupl;	/* List of groups this entry stands for. */
    int		level;		
    char	*mode;
    char	*hdrsize;
    char	*debug;
    ci_nlist_t	*subsysl;
    ci_nlist_t	*filel;
} ci_config_logentry_t;

#define	CI_LOG_LEVEL_DEFAULT	CI_INFO0
#define CI_LOG_MODE_DEFAULT	CDB_ASCII
#define CI_LOG_HDRSIZE_DEFAULT	CDB_MEDIUM
#define CI_LOG_DEBUG_DEFAULT	CDB_NORMAL
#define CI_LOG_SUBSYS_DEFAULT	CDB_ALL
#define CI_LOG_FILE_DEFAULT	CDB_GROUP_NAME

/*
 * This structure is used by CDB resource routines in CI library to return 
 * resource attributes and resource dependencies.
 */
typedef	struct ci_config_reskey_s {
    char	*key;		/* This field can be attribute key or
				 * resource type */
    char	*value;		/* This field can be attribute value or
				 * resource value */
} ci_config_reskey_t;

/*
 * Data structures used in resource type functions.
 */

/* Restart modes - restype_restartmode */

#define CICFGRT_RESTART_NONE	0x0000	/* Do not restart the resource */
#define CICFGRT_RESTART_COUNT	0x0001	/* Restart count number of times */

/* Maximum restart count */
#define CICFGRT_MAX_RESTART_COUNT  0xffffffff 	/* Default value if restart 
						 * count is not specified */
/* Maximum resoure type order */
#define CICFGRT_MAX_ORDER	10000	/* Default value if order is
					 * not specified */

/* Maximum default value length for a resource attribute */
#define CICFGRT_MAX_DEFVALUE	1024	/* Maximum length of the default value
					 * string */

/* Resource type specific keys datatypes - restypekey_datatype */
#define CIRTKEY_DATATYPE_INT	"integer"
#define CIRTKEY_DATATYPE_STRING	"string"

/* Resource type information */
typedef struct ci_config_restype_s {
    char	*restype_name;		/* Resource type name */
    boolean_t	restype_predefined;	/* Flag used to determine a predefined
					 * resource type */
    uint32_t	restype_order;		/* Resource type order */
    uint32_t	restype_restartmode;	/* None or count */
    uint32_t	restype_restartcount;	/* Number of restsrt counts */
} ci_config_restype_t;

/* Resource type specific resource keys */
typedef struct ci_config_restypekeys_s {
    char	*restypekey_name;	/* Resource type specific key name */
    char	*restypekey_datatype;	/* Type of resource type key - integer,
					 * or string */
    char	*restypekey_default;	/* Default values for the resource
					 * key */
} ci_config_restypekeys_t;

/* Resource type action structure */
typedef struct ci_config_restypeaction_s {
    char	*restypeaction_name;		/* Resource type action name -
						 * "start", "stop", ... */
    char	*restypeaction_executable;	/* Executable path name */
    uint32_t	restypeaction_maxexectime;	/* Timeout */
    uint32_t	restypeaction_moninterval;	/* Monitoring interval */
    uint32_t	restypeaction_startmontime;	/* Start monitoring time */
} ci_config_restypeaction_t;


/*
 * Data structures for library to pass info read from CDB to CLI for
 * machines.
 */
typedef struct ci_config_cdb_tree_s {
    cdb_node_handle_t	nodeh;
    char 		*name;
    char 		*value;
    int			nkids;
    int			kid_i[100]; /* max children for a node */
} ci_config_cdb_tree_t;

typedef struct ci_config_sys_controller_s {
    char	*type;		        /* chalS, chalL, msc, mmsc, null */  
    char	*passwd;	        /* System controller password        
				           (optional string) */              
    char	*admin_status;	        /* enabled/disabled */               
    char	*owner;		        /* Logical machine name of owner */  
    char	*device;	        /* Device name of port on owner      
				           machine that is attached to the   
				           system controller */              
    char	*owner_type;     	/* Type of owner device - tty only */
} ci_config_sys_controller_t;

#define   CDB_NETID_LEN 15

typedef struct ci_config_control_net_s {
    char 	netid[CDB_NETID_LEN];
    char 	*ipaddr;  		 /* ip addr for the interface */
    char 	*priority; /* priority of the use */
    boolean_t	hb;
    boolean_t   ctrl;	
} ci_config_control_net_t;

typedef struct ci_config_machine_s {
    char			*logical_name;
    char			*hostname;
    char 			*nodeid;
    ci_config_sys_controller_t	sys_ctrl;
    char			*reset_type;	/* Reset operation type -
						 * regular reset or nmi. */
    ci_nlist_t			*ctrl_net_list;
    cdb_consistency_t		db_consistency;
    boolean_t			is_localhost; /* B_TRUE if machine_query is called
						 specifying logical name of
						 the local machine.*/

    boolean_t			cell_is_failsafe;
} ci_config_machine_t;


/* Data structures for library to pass info read from CDB to CLI for clusters. */

typedef struct ci_config_cluster_s {
    char 		*clustername;
    boolean_t		cluster_is_failsafe;
    char 		*notify_cmd;
    char 		*notify_addr;
    char		*ha_mode;
    cdb_consistency_t  db_consistency;
} ci_config_cluster_t;

/* Standarad error format strings to be used to generate error messages
 * while reading/writing configuration. */

#define CI_EFMTSTR_NOARG	"Internal error: internal required argument"\
				" %s is not given"
#define CI_EFMTSTR_ARGINVAL	"Internal error: internal argument is"\
				" invalid"
#define CI_EFMTSTR_ARGILLVALUE	"Internal error: internal argument %s has"\
				" illegal value %s"
#define CI_EFMTSTR_DBOPEN	"Internal error: unable to open internal "\
				"database"
#define CI_EFMTSTR_DBFMT	"Internal error: database format problem for "\
				"%s"
#define CI_EFMTSTR_NOMEM	"Not enough memory to process internal "\
				"action"
#define CI_EFMTSTR_ARG		"Internal error: processing argument for "\
				"internal action"
#define CI_EFMTSTR_NODBENTRY	"Database entry %s not found"
#define CI_EFMTSTR_CREATE	"Create %s failed"
#define CI_EFMTSTR_EXISTS	"%s already exists"
#define CI_EFMTSTR_LOCK		"Unable to obtain configuration database "\
				"lock for %s"
#define CI_EFMTSTR_UNLOCK	"Unable to release configuration database "\
				"lock for %s"
#define CI_EFMTSTR_REMOTE	"Remote execution not supported yet"
#define CI_EFMTSTR_OTHER	"Internal error %s"
#define CI_EFMTSTR_SERVER	"Server error"
#define CI_EFMTSTR_RETRY	"Please try again"


/* Functions defined in libci/src/config/ci_config_reinit.c */
ci_err_t		ci_config_reinit(void);

/* Functions defined in libci/src/config/ci_config_machine.c */
void 			ci_config_control_net_destroy(void *p);
void 			ci_config_machine_destroy(void *p);
ci_err_t		ci_set_nodename(char *);
ci_err_t		ci_get_nodename(char *);
char*			ci_get_hostname(void);
char*			ci_machine_get_canonical_name(char *, char *);
ci_err_t		cicdb_machine_reinit(cdb_handle_t db);
boolean_t		cicdb_machine_local_isdefined(cdb_handle_t db, 
						      char *errorstr);
ci_err_t		cicdb_machine_get_name(cdb_handle_t db, 
					       char *machine_name,
					       char *errorstr);
boolean_t		cicdb_machine_isdefined(cdb_handle_t, char *,
						char *);
ci_err_t 		cicdb_machine_create(cdb_handle_t db,
					     ci_config_machine_t *machine_info,
					     char *errorstr);
ci_err_t 		cicdb_machine_delete(cdb_handle_t db, char *machine,
					     char *errorstr);
ci_err_t		cicdb_machine_enumerate(cdb_handle_t db,
						ci_nlist_t *list,
						char *errorstr);
ci_err_t		cicdb_machine_query(cdb_handle_t	db,
					    char		*machinename,
					    ci_config_machine_t *minfo,
					    char                *errorstr);
ci_err_t		cicdb_machine_which_cluster(cdb_handle_t db,
						    char 	 *machine,
						    ci_nlist_t   *clist);
ci_err_t		cicdb_machine_get_name_for_nodeid(cdb_handle_t 	db,
							  ci_nodeid_t 	nodeid,
							  char *logical_name,
							  char *errorstr);
ci_err_t		cicdb_machine_get_hostname(cdb_handle_t db,
						   char 	*logical_name,
						   char 	*hostanme,
						   char 	*errorstr);
ci_err_t		cicdb_machine_get_name_for_hostname(cdb_handle_t db,
							    char *hostname,
							    ci_nlist_t *mnames,
							    char *errorstr);


/* Functions defined in libci/src/config/ci_config_cluster.c */
void			ci_set_node_status_func(
				ci_err_t (*ha_func)(cdb_handle_t, char *,
					ci_machine_status_t *, char *));
void 			ci_config_cluster_print(void *, int);
void 			ci_config_cluster_destroy(void *);
ci_cmp_result_t		ci_config_cluster_compare(void *c1, void *c2);
boolean_t		cicdb_cluster_isdefined(cdb_handle_t, char *, char *);
ci_err_t		ci_identify_cluster(void);
ci_err_t		cicdb_identify_cluster(cdb_handle_t db); 
ci_err_t		ci_get_cluster_name(char *);
ci_err_t		cicdb_get_cluster_name(cdb_handle_t, char *);
ci_clusterid_t          cicdb_get_cluster_id(cdb_handle_t);
void			ci_set_cluster_name(char *);
ci_err_t		cicdb_cluster_add_machine(cdb_handle_t, char *, char *,
						 char *);
ci_err_t		cicdb_cluster_create(cdb_handle_t, 
					     ci_config_cluster_t *,
					     boolean_t, char *);
boolean_t		cicdb_cluster_isha(cdb_handle_t, char *);
ci_err_t		cicdb_cluster_enumerate(cdb_handle_t, ci_nlist_t *, 
						char *);
ci_err_t		cicdb_cluster_query(cdb_handle_t, char *, 
					    ci_config_cluster_t *,
					    char *);
ci_err_t		cicdb_cluster_delete(cdb_handle_t, char *,  char *);
ci_err_t		cicdb_cluster_remove_machine(cdb_handle_t, char *, 
						     char *, char *);
ci_err_t		cicdb_cluster_enumerate_machines(cdb_handle_t db,
							 char *clustername,
							 ci_nlist_t   *list,
							 char *errorstr);
ci_err_t		cicdb_cluster_rename(cdb_handle_t, char *,  char *);
boolean_t		cicdb_cluster_has_machine(cdb_handle_t, char *, char *,
						  char *);
ci_err_t		cicdb_cluster_is_experimental(cdb_handle_t, char *,
						      boolean_t	*);

/* Functions defined in libci/src/config/ci_config_crs.c */
ci_err_t		cicdb_crs_param_get(cdb_handle_t dbhdl,
					    boolean_t *localp,
		    		    	    ci_param_name_t *paramname,
				            ci_param_t **paramp,
					    char *errstr);
ci_err_t		cicdb_crs_param_set(cdb_handle_t dbhdl,
					    boolean_t local,
		    		    	    ci_param_name_t *paramname,
				            ci_param_t *param,
					    char *errstr);

/* Functions defined in libci/src/config/ci_cdbconfig_nodes.c */
void			ci_set_nodeconf_file(char *);
char			*ci_get_nodeconf_file(void);
ci_nodeid_t		ci_get_tiebreaker_nodeid(void);
ci_err_t		ci_nodeconf_read(void *, ci_generation_t *, ci_chksum_t *);
ci_err_t		cicdb_nodeconf_read(cdb_handle_t dbhdl,
					    ci_generation_t *, ci_chksum_t *);
void			ci_nodeconf_sort(void);
ci_config_node_t	*ci_nodeconf_next(ci_config_node_t *);
uint32_t		ci_nodeconf_count(void);


/* Functions defined in libci/src/config/ci_config_log.c */
ci_err_t		ci_config_log(__uint32_t, ci_err_t, 
				      const char *, ...);
void			ci_clilog_register(void);
ci_err_t		cicdb_logentrykey_list_get(cdb_handle_t, char	*,
						   ci_nlist_t **, char *);
ci_err_t		cicdb_logentry_get(cdb_handle_t, char *, char *,
					   ci_config_logentry_t	**, char *);
ci_err_t		cicdb_logentry_set(cdb_handle_t, char *, 
					   ci_config_logentry_t	*, char *);
ci_err_t		cicdb_logentry_group_list_get(cdb_handle_t, char *,
						      char *, ci_nlist_t **,
						      boolean_t, char *);
void			cicdb_logentry_destroy(ci_config_logentry_t *);
void			cicdb_logentry_destroy_void(void *);
ci_err_t		cicdb_logentry_effective_group_list_get(cdb_handle_t,
								char *,
								boolean_t *,
								char *,
								ci_nlist_t **,
								boolean_t,
								char *);
boolean_t		cicdb_loggroup_isdefined(cdb_handle_t, char *,
						 boolean_t *, char *, char *);

/* Functions defined in libci/src/config/ci_config_cdb.c */
ci_err_t		ci_cdb_open(cdb_handle_t *);
ci_err_t		cicdb_open(cdb_handle_t *);
void			ci_cdb_close(cdb_handle_t);
void			cicdb_close(cdb_handle_t);
char			*ci_get_cdb_file(void);
void			ci_set_cdb_file(char *);
ci_err_t		cicdb_lock(cdb_handle_t, cdb_key_t, cdb_lock_state_t,
				cdb_node_handle_t *, char *);
ci_err_t		cicdb_unlock(cdb_handle_t, cdb_node_handle_t, char *);
ci_err_t		cicdb_abort_and_unlock(cdb_handle_t, cdb_node_handle_t,
				char *);
ci_err_t    		ci_cli_log(__uint32_t level, ci_err_t err, 
					const char *format, ...);
ci_err_t 		ci_cdb_create_and_set_node(cdb_handle_t db, 
						   cdb_node_handle_t,
						   cdb_key_t, char *);
ci_err_t 		cicdb_create_and_set_node(cdb_handle_t db, 
						  cdb_node_handle_t,
						  cdb_key_t, char *);
ci_err_t		cicdb_create_and_set_node_at_key(cdb_handle_t,
							 cdb_key_t, cdb_key_t,
							 char *);
ci_err_t		cicdb_delete_tree_at_key(cdb_handle_t, cdb_key_t);
ci_err_t 		cicdb_read_string(cdb_handle_t, cdb_node_handle_t,
					  cdb_key_t, char **, char *);
ci_err_t 		cicdb_read_string_empty(cdb_handle_t, 
						cdb_node_handle_t, cdb_key_t, 
						char **, char *);
ci_err_t		cicdb_read_int(cdb_handle_t, cdb_node_handle_t,
				       cdb_key_t, int *, char *);
ci_err_t		cicdb_read_string_list(cdb_handle_t, 
					       cdb_node_handle_t, cdb_key_t,
					       ci_nlist_t **, char *);
ci_err_t		cicdb_read_int_list(cdb_handle_t, cdb_node_handle_t,
					    cdb_key_t, ci_nlist_t **, char *);
void			cicdb_print_args(int argc, char *argv[]);
void			cicdb_print_exit(ci_err_t err, char *errorstr);
void			cicdb_command_setup(int argc, char *argv[]);
void			cicdb_print_exit(ci_err_t, char *);

boolean_t		ci_executable_check(char *);
ci_err_t		cicdb_get_child(cdb_handle_t db,
					cdb_node_handle_t parenth,
					cdb_key_t         subkey,
					char 	    	  *value,
					cdb_node_handle_t *childh);
ci_err_t 		cicdb_create_tree(cdb_handle_t cdb,
					  ci_config_cdb_tree_t *tree,
					  cdb_node_handle_t pnodeh);
ci_err_t		cicdb_destroy_tree(cdb_handle_t 	db,
					   ci_config_cdb_tree_t *tree,
					   int 			tree_size,
					   cdb_node_handle_t    parent);
ci_err_t		cicdb_recreate_subtree(cdb_handle_t, cdb_node_handle_t,
					cdb_key_t, cdb_key_t, ci_nlist_t *);

/* Functions defined in libci/src/config/ci_config_resources.c */
void			ci_reskey_destroy(void	*);
void			ci_reskey_print(void *, int);
ci_cmp_result_t		ci_reskey_compare(void *c1, void *c2);
ci_cmp_result_t		ci_reskey_compare_type(void *c1, void *c2);
ci_err_t		ci_reskey_list_add(ci_nlist_t *, char *, char *);
boolean_t		cicdb_resource_isdefined(cdb_handle_t, char *, char *,
						 char *, char *);
ci_err_t		cicdb_resource_query(cdb_handle_t, char *, 
					     ci_nlist_t *, char *);
ci_err_t		cicdb_resource_delete(cdb_handle_t, char *, char *,
					      char *, char *, char *);
ci_err_t		cicdb_resource_attribute_delete(cdb_handle_t, char *,
							char *, char *,
							ci_nlist_t *, char *);
ci_err_t		cicdb_resource_modify(cdb_handle_t, char *, char *,
					      char *, char *, ci_nlist_t *, 
					      char *);
ci_err_t		cicdb_resource_dependency_add(cdb_handle_t, char *,
						      char *, char *,
						      ci_nlist_t *, char *);
ci_err_t		cicdb_resource_dependency_delete(cdb_handle_t, char *, 
							 char *, char *,
							 ci_nlist_t *, char *);
ci_err_t		cicdb_resource_dependency_query(cdb_handle_t, cdb_key_t,
							ci_nlist_t *, char *);
ci_err_t		cicdb_resource_list(cdb_handle_t, char *, ci_nlist_t *,
							char *);
ci_err_t		cicdb_resource_restype_list(cdb_handle_t, char *,
						char *, ci_nlist_t *, char *);
boolean_t		cicdb_resource_locally_defined(cdb_handle_t, char *,
					       char *, char *, char *);
ci_err_t		cicdb_resource_validate(char *, char *, char *);

/* Functions defined in libci/src/config/ci_config_restypes.c */
boolean_t		cicdb_restype_isdefined(cdb_handle_t, char *, char *,
						char *);
boolean_t		cicdb_restype_isdefined_atkey(cdb_handle_t, char *, 
						char *, char *, char *);
void			ci_restype_destroy(void	*);
void			ci_restype_print(void *, int);
void			ci_restypeaction_destroy(void	*);
void			ci_restypeaction_print(void *, int);
void			ci_restypekeys_destroy(void	*);
void			ci_restypekeys_print(void *, int);
ci_err_t		ci_restypekeys_list_add(ci_nlist_t *,
						ci_config_restypekeys_t *);
ci_err_t		ci_restypeaction_list_add(ci_nlist_t *,
						  ci_config_restypeaction_t *);
ci_config_restypeaction_t *
			ci_create_restypeaction(char *, char *, uint32_t, 
						uint32_t, uint32_t);
ci_config_restypekeys_t *
			ci_create_restypekeys(char *, char *, char *);
ci_err_t		cicdb_restype_query(cdb_handle_t, char *, 
					    ci_config_restype_t *, ci_nlist_t *,
					    ci_nlist_t *, char *);
ci_err_t		cicdb_restype_delete(cdb_handle_t, char *, char *,
					     char *, char *);
ci_err_t		cicdb_restype_action_delete(cdb_handle_t, char *,
						    char *, ci_nlist_t *,
						    char *);
ci_err_t		cicdb_restype_keys_delete(cdb_handle_t, char *,
						  char *, ci_nlist_t *, char *);
ci_err_t		cicdb_restype_modify(cdb_handle_t, char *, char *,
					     ci_config_restype_t *,
					     ci_nlist_t *,
					     ci_nlist_t *, char *);
ci_err_t		cicdb_restype_dependency_add(cdb_handle_t, char *,
						     char *, ci_nlist_t *,
						     char *);
ci_err_t		cicdb_restype_dependency_delete(cdb_handle_t, char *, 
							char *, ci_nlist_t *,
							char *);
ci_err_t		cicdb_restype_dependency_query(cdb_handle_t, cdb_key_t,
						       ci_nlist_t *, char *);
ci_err_t		cicdb_restype_list(cdb_handle_t, char *, ci_nlist_t *,
					   char *);
ci_err_t		cicdb_restype_clone(cdb_handle_t, char *, char *, 
					    char *, char *);
ci_err_t		cicdb_restype_install_enumerate(cdb_handle_t, 
							ci_nlist_t *, char *);
ci_err_t		cicdb_restype_install(cdb_handle_t, char *, 
							char *, char *);
boolean_t		cicdb_restype_locally_defined(cdb_handle_t, char *,
					       char *, char *);


/* Data structs and functions defined in libci/src/config/ci_config_hasvcs.c 
 */

#define CI_HASVC_CMS_PULSETIME  100000  /* 100 s */
#define CI_HASVC_CMS_MONTIME    20000   /* 20 s */

typedef enum {
    HASVCS_START,
    HASVCS_STOP,
    HASVCS_START_PERMANENT,
    HASVCS_STOP_PERMANENT,
    HASVCS_RESTART
} ci_hasvcs_op_t;

/* HA services source flags */
#define HASVCS_INFO_FROM_CMSD	0x1
#define HASVCS_INFO_FROM_CDB	0x2

typedef struct ci_config_hasvcs_s {
    char 	*node_timeout;
    char	*hb_interval;
    
} ci_config_hasvcs_t;

ci_err_t	cicdb_hasvcs_query_cluster_status(cdb_handle_t 	db,
						  char *clustername,
						  ci_cluster_status_t *status,
						  char *errorstr);
ci_err_t	cicdb_hasvcs_query_machine_status(cdb_handle_t 	db,
						  char *machine,
						  ci_machine_status_t *status,
						  char *errorstr);
ci_err_t	cicdb_hasvcs_param_set(cdb_handle_t	dbhdl,
				       char		*svcname,
				       char		*cluster,
				       ci_param_name_t	*paramname,
				       ci_param_t	*param,
				       char		*errstr);
ci_err_t	cicdb_hasvcs_param_get(cdb_handle_t	dbhdl,
				       char		*svcname,
				       char		*cluster,
				       boolean_t	*localp,
				       ci_param_name_t	*paramname,
				       ci_param_t	**paramp,
				       char		*errstr);

ci_err_t	cicdb_hasvcs_deactivate(cdb_handle_t 	db,
					char 	   	*clustername,
					char		*machine,
					char 	   	*errorstr);
ci_err_t
cicdb_hasvcs_machine_in_cluster_status_get(cdb_handle_t	dbhdl,
					   char		*cluster,
					   char		*machine,
					   boolean_t	*enabledp,
					   char		*errstr);
ci_err_t
cicdb_hasvcs_machine_in_cluster_status_set(cdb_handle_t	dbhdl,
					   char		*cluster,
					   char		*machine,
					   boolean_t	enabled,
					   char		*errstr);

ci_err_t
cicdb_hasvcs_cluster_info_get(cdb_handle_t              dbhdl,
			      char                      *cluster,
			      ci_cluster_status_t       *cstatusp,
			      cms_new_info_t            *cinfo,
			      boolean_t                 blocking,
			      int                       flags);



/* Functions defined in ci_validate_failsafe.c */

boolean_t	cicdb_machine_in_fop(cdb_handle_t 	db, 
				     char		*machine,
				     char 		*errorstr);

/* Functions defined in libci/src/config/ci_config_cdb.c */

boolean_t 	ci_string_has_illegal_char_allow_space(char *string, 
						       char *illegal_char);

boolean_t 	ci_string_has_unprintable_char(char *string, 
					       char *illegal_char);

boolean_t 	ci_string_has_illegal_char(char *string, 
					   char *illegal_char);

ci_err_t        ci_legal_character_check(int  argc, 
					 char *argv[],
					 char *errorstr);

ci_err_t        ci_legal_key_check(int  argc, 
				   char *argv[],
				   char *errorstr,
				   char *valid_keys[]);
#endif	/* CI_CONFIG_H */