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
508f6c065Sgavinm  * Common Development and Distribution License (the "License").
608f6c065Sgavinm  * 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 /*
22705e9f42SStephen Hanson  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
237c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
247c478bd9Sstevel@tonic-gate  *
257c478bd9Sstevel@tonic-gate  * fme.h -- public definitions for fme module
267c478bd9Sstevel@tonic-gate  *
277c478bd9Sstevel@tonic-gate  * this module supports the management of a "fault management exercise".
287c478bd9Sstevel@tonic-gate  */
297c478bd9Sstevel@tonic-gate 
307c478bd9Sstevel@tonic-gate #ifndef	_EFT_FME_H
317c478bd9Sstevel@tonic-gate #define	_EFT_FME_H
327c478bd9Sstevel@tonic-gate 
337c478bd9Sstevel@tonic-gate #include <fm/fmd_api.h>
347c478bd9Sstevel@tonic-gate 
357c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
367c478bd9Sstevel@tonic-gate extern "C" {
377c478bd9Sstevel@tonic-gate #endif
387c478bd9Sstevel@tonic-gate 
3932d4e834STarik Soydan #define	UNDIAG_DEFECT_CHKPT	"defect.sunos.eft.undiag.checkpoint"
40705e9f42SStephen Hanson #define	UNDIAG_DEFECT_FME	"defect.sunos.eft.unexpected_telemetry"
4132d4e834STarik Soydan #define	UNDIAG_DEFECT_LIMIT	"defect.sunos.eft.undiag.limit"
4232d4e834STarik Soydan #define	UNDIAG_DEFECT_UNKNOWN	"defect.sunos.eft.undiag.unknown"
43705e9f42SStephen Hanson #define	UNDIAG_FAULT_FME	"fault.sunos.eft.unexpected_telemetry"
4432d4e834STarik Soydan 
457c478bd9Sstevel@tonic-gate #define	UNDIAG_REASON		"reason"
467c478bd9Sstevel@tonic-gate 
4732d4e834STarik Soydan /* Undiagnosable reason values */
4832d4e834STarik Soydan #define	UD_VAL_UNKNOWN		0
4932d4e834STarik Soydan #define	UD_VAL_BADEVENTI	1
5032d4e834STarik Soydan #define	UD_VAL_BADOBS		2
5132d4e834STarik Soydan #define	UD_VAL_CFGMISMATCH	3
5232d4e834STarik Soydan #define	UD_VAL_INSTFAIL		4
5332d4e834STarik Soydan #define	UD_VAL_MAXFME		5
5432d4e834STarik Soydan #define	UD_VAL_MISSINGINFO	6
5532d4e834STarik Soydan #define	UD_VAL_MISSINGOBS	7
5632d4e834STarik Soydan #define	UD_VAL_MISSINGPATH	8
5732d4e834STarik Soydan #define	UD_VAL_MISSINGZERO	9
5832d4e834STarik Soydan #define	UD_VAL_NOPATH		10
5932d4e834STarik Soydan #define	UD_VAL_UNSOLVD		11
60705e9f42SStephen Hanson #define	UD_VAL_BADEVENTPATH	12
61705e9f42SStephen Hanson #define	UD_VAL_BADEVENTCLASS	13
6232d4e834STarik Soydan 
637c478bd9Sstevel@tonic-gate /* Undiagnosable reason strings */
6432d4e834STarik Soydan #define	UD_STR_UNKNOWN		"undiagnosable reason unknown"
6532d4e834STarik Soydan #define	UD_STR_MISSINGPATH	"bad or missing path in persisted observation"
6632d4e834STarik Soydan #define	UD_STR_MISSINGINFO	"buffer persisting case info is AWOL"
6732d4e834STarik Soydan #define	UD_STR_MISSINGZERO	"buffer persisting principal ereport is AWOL"
6832d4e834STarik Soydan #define	UD_STR_CFGMISMATCH	"persisted config buffer size != actual size"
6932d4e834STarik Soydan #define	UD_STR_MISSINGOBS	"buffer persisting an observation is AWOL"
70705e9f42SStephen Hanson #define	UD_STR_BADEVENTI	"%s not found in pruned instance tree"
71705e9f42SStephen Hanson #define	UD_STR_INSTFAIL		"%s pruned instance tree is empty"
72705e9f42SStephen Hanson #define	UD_STR_UNSOLVD		"all hypotheses were disproved"
7332d4e834STarik Soydan #define	UD_STR_BADOBS	"persisted observation not found in instance tree"
74705e9f42SStephen Hanson #define	UD_STR_NOPATH	"no valid path to component was found in %s"
7532d4e834STarik Soydan #define	UD_STR_MAXFME	"reached the maximum number of open FMEs (maxfme)"
76705e9f42SStephen Hanson #define	UD_STR_BADEVENTPATH	"%s path was not in topology"
77705e9f42SStephen Hanson #define	UD_STR_BADEVENTCLASS	"%s class and path are incompatible"
787c478bd9Sstevel@tonic-gate 
797c478bd9Sstevel@tonic-gate #define	WOBUF_CFGLEN	"rawcfglen"
807c478bd9Sstevel@tonic-gate #define	WOBUF_POSTD	"posted"
817c478bd9Sstevel@tonic-gate #define	WOBUF_NOBS	"observations"
827c478bd9Sstevel@tonic-gate #define	WOBUF_PULL	"timewaited"
837c478bd9Sstevel@tonic-gate #define	WOBUF_CFG	"rawcfgdata"
847c478bd9Sstevel@tonic-gate #define	WOBUF_ID	"fmeid"
857aec1d6eScindi #define	WOBUF_ISTATS	"istats"
86b5016cbbSstephh #define	WOBUF_SERDS	"serds"
877aec1d6eScindi 
88*cfc9ef1dSToomas Soome extern struct lut *Istats;	/* instanced stats a la "count=" */
89*cfc9ef1dSToomas Soome extern struct lut *SerdEngines;
907c478bd9Sstevel@tonic-gate 
917c478bd9Sstevel@tonic-gate struct fme;
927c478bd9Sstevel@tonic-gate 
937c478bd9Sstevel@tonic-gate void fme_receive_external_report(fmd_hdl_t *hdl, fmd_event_t *ffep,
947c478bd9Sstevel@tonic-gate     nvlist_t *nvl, const char *eventstring);
95e5ba14ffSstephh void fme_receive_topology_change(void);
9608f6c065Sgavinm void fme_receive_repair_list(fmd_hdl_t *hdl, fmd_event_t *ffep,
9708f6c065Sgavinm     nvlist_t *nvl, const char *eventstring);
987c478bd9Sstevel@tonic-gate void fme_restart(fmd_hdl_t *hdl, fmd_case_t *inprogress);
997aec1d6eScindi void fme_istat_load(fmd_hdl_t *hdl);
100b5016cbbSstephh void fme_serd_load(fmd_hdl_t *hdl);
1017c478bd9Sstevel@tonic-gate void fme_close_case(fmd_hdl_t *hdl, fmd_case_t *fmcase);
1027c478bd9Sstevel@tonic-gate void fme_timer_fired(struct fme *, id_t);
1037c478bd9Sstevel@tonic-gate void fme_status(int flags);
1047c478bd9Sstevel@tonic-gate void fme_fini(void);
1057aec1d6eScindi void istat_fini(void);
1067aec1d6eScindi 
1077aec1d6eScindi struct istat_entry {
1087aec1d6eScindi 	const char *ename;
1097aec1d6eScindi 	const struct ipath *ipath;
1107aec1d6eScindi };
1117aec1d6eScindi int istat_cmp(struct istat_entry *ent1, struct istat_entry *ent2);
1127c478bd9Sstevel@tonic-gate 
113b5016cbbSstephh void serd_fini(void);
114b5016cbbSstephh 
115b5016cbbSstephh struct serd_entry {
116b5016cbbSstephh 	const char *ename;
117b5016cbbSstephh 	const struct ipath *ipath;
118b5016cbbSstephh 	fmd_hdl_t *hdl;
119b5016cbbSstephh };
120b5016cbbSstephh int serd_cmp(struct serd_entry *ent1, struct serd_entry *ent2);
121b5016cbbSstephh 
1227c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
1237c478bd9Sstevel@tonic-gate }
1247c478bd9Sstevel@tonic-gate #endif
1257c478bd9Sstevel@tonic-gate 
1267c478bd9Sstevel@tonic-gate #endif	/* _EFT_FME_H */
127