xref: /titanic_51/usr/src/cmd/fm/modules/common/eversholt/fme.h (revision 56f33205c9ed776c3c909e07d52e94610a675740)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  *
25  * fme.h -- public definitions for fme module
26  *
27  * this module supports the management of a "fault management exercise".
28  */
29 
30 #ifndef	_EFT_FME_H
31 #define	_EFT_FME_H
32 
33 #include <fm/fmd_api.h>
34 
35 #ifdef	__cplusplus
36 extern "C" {
37 #endif
38 
39 #define	UNDIAG_DEFECT_CHKPT	"defect.sunos.eft.undiag.checkpoint"
40 #define	UNDIAG_DEFECT_FME	"defect.sunos.eft.unexpected_telemetry"
41 #define	UNDIAG_DEFECT_LIMIT	"defect.sunos.eft.undiag.limit"
42 #define	UNDIAG_DEFECT_UNKNOWN	"defect.sunos.eft.undiag.unknown"
43 #define	UNDIAG_FAULT_FME	"fault.sunos.eft.unexpected_telemetry"
44 
45 #define	UNDIAG_REASON		"reason"
46 
47 /* Undiagnosable reason values */
48 #define	UD_VAL_UNKNOWN		0
49 #define	UD_VAL_BADEVENTI	1
50 #define	UD_VAL_BADOBS		2
51 #define	UD_VAL_CFGMISMATCH	3
52 #define	UD_VAL_INSTFAIL		4
53 #define	UD_VAL_MAXFME		5
54 #define	UD_VAL_MISSINGINFO	6
55 #define	UD_VAL_MISSINGOBS	7
56 #define	UD_VAL_MISSINGPATH	8
57 #define	UD_VAL_MISSINGZERO	9
58 #define	UD_VAL_NOPATH		10
59 #define	UD_VAL_UNSOLVD		11
60 #define	UD_VAL_BADEVENTPATH	12
61 #define	UD_VAL_BADEVENTCLASS	13
62 
63 /* Undiagnosable reason strings */
64 #define	UD_STR_UNKNOWN		"undiagnosable reason unknown"
65 #define	UD_STR_MISSINGPATH	"bad or missing path in persisted observation"
66 #define	UD_STR_MISSINGINFO	"buffer persisting case info is AWOL"
67 #define	UD_STR_MISSINGZERO	"buffer persisting principal ereport is AWOL"
68 #define	UD_STR_CFGMISMATCH	"persisted config buffer size != actual size"
69 #define	UD_STR_MISSINGOBS	"buffer persisting an observation is AWOL"
70 #define	UD_STR_BADEVENTI	"%s not found in pruned instance tree"
71 #define	UD_STR_INSTFAIL		"%s pruned instance tree is empty"
72 #define	UD_STR_UNSOLVD		"all hypotheses were disproved"
73 #define	UD_STR_BADOBS	"persisted observation not found in instance tree"
74 #define	UD_STR_NOPATH	"no valid path to component was found in %s"
75 #define	UD_STR_MAXFME	"reached the maximum number of open FMEs (maxfme)"
76 #define	UD_STR_BADEVENTPATH	"%s path was not in topology"
77 #define	UD_STR_BADEVENTCLASS	"%s class and path are incompatible"
78 
79 #define	WOBUF_CFGLEN	"rawcfglen"
80 #define	WOBUF_POSTD	"posted"
81 #define	WOBUF_NOBS	"observations"
82 #define	WOBUF_PULL	"timewaited"
83 #define	WOBUF_CFG	"rawcfgdata"
84 #define	WOBUF_ID	"fmeid"
85 #define	WOBUF_ISTATS	"istats"
86 #define	WOBUF_SERDS	"serds"
87 
88 struct lut *Istats;	/* instanced stats a la "count=" */
89 struct lut *SerdEngines;
90 
91 struct fme;
92 
93 void fme_receive_external_report(fmd_hdl_t *hdl, fmd_event_t *ffep,
94     nvlist_t *nvl, const char *eventstring);
95 void fme_receive_topology_change(void);
96 void fme_receive_repair_list(fmd_hdl_t *hdl, fmd_event_t *ffep,
97     nvlist_t *nvl, const char *eventstring);
98 void fme_restart(fmd_hdl_t *hdl, fmd_case_t *inprogress);
99 void fme_istat_load(fmd_hdl_t *hdl);
100 void fme_serd_load(fmd_hdl_t *hdl);
101 void fme_close_case(fmd_hdl_t *hdl, fmd_case_t *fmcase);
102 void fme_timer_fired(struct fme *, id_t);
103 void fme_status(int flags);
104 void fme_fini(void);
105 void istat_fini(void);
106 
107 struct istat_entry {
108 	const char *ename;
109 	const struct ipath *ipath;
110 };
111 int istat_cmp(struct istat_entry *ent1, struct istat_entry *ent2);
112 
113 void serd_fini(void);
114 
115 struct serd_entry {
116 	const char *ename;
117 	const struct ipath *ipath;
118 	fmd_hdl_t *hdl;
119 };
120 int serd_cmp(struct serd_entry *ent1, struct serd_entry *ent2);
121 
122 #ifdef	__cplusplus
123 }
124 #endif
125 
126 #endif	/* _EFT_FME_H */
127