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 /*
23  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_FMD_PROTOCOL_H
28 #define	_FMD_PROTOCOL_H
29 
30 #include <sys/fm/protocol.h>
31 #include <libnvpair.h>
32 #include <stdarg.h>
33 
34 #ifdef	__cplusplus
35 extern "C" {
36 #endif
37 
38 #define	FMD_RSRC_CLASS		FM_RSRC_CLASS ".fm."
39 #define	FMD_CTL_CLASS		FMD_RSRC_CLASS "fmd."
40 #define	SYSEVENT_RSRC_CLASS	FM_RSRC_CLASS ".sysevent."
41 
42 #define	FMD_RSRC_CLASS_LEN	(sizeof (FMD_RSRC_CLASS) - 1)
43 #define	FMD_CTL_CLASS_LEN	(sizeof (FMD_CTL_CLASS) - 1)
44 #define	SYSEVENT_RSRC_CLASS_LEN	(sizeof (SYSEVENT_RSRC_CLASS) - 1)
45 
46 #define	FMD_CTL_ADDHRT		FMD_CTL_CLASS "clock.addhrtime"
47 #define	FMD_CTL_ADDHRT_VERS1	1
48 #define	FMD_CTL_ADDHRT_DELTA	"delta"
49 
50 /*
51  * The FMD_FLT_* events still use defect.sunos.* for now: a future registry
52  * putback should define all fmd events and convert these to defect.fm.fmd.*
53  */
54 #define	FMD_FLT_NOSUB		"defect.sunos.fmd.nosub"
55 #define	FMD_FLT_NODC		"defect.sunos.fmd.nodiagcode"
56 #define	FMD_FLT_MOD		"defect.sunos.fmd.module"
57 #define	FMD_FLT_CONF		"defect.sunos.fmd.config"
58 
59 #define	FMD_ERR_CLASS		"ereport.fm.fmd."
60 #define	FMD_ERR_CLASS_LEN	(sizeof (FMD_ERR_CLASS) - 1)
61 
62 #define	FMD_ERR_MOD_MSG		"msg"
63 #define	FMD_ERR_MOD_ERRNO	"errno"
64 #define	FMD_ERR_MOD_ERRCLASS	"errclass"
65 
66 struct fmd_module;			/* see <fmd_module.h> */
67 
68 extern nvlist_t *fmd_protocol_authority(void);
69 extern nvlist_t *fmd_protocol_fmri_module(struct fmd_module *);
70 extern nvlist_t *fmd_protocol_fault(const char *,
71     uint8_t, nvlist_t *, nvlist_t *, nvlist_t *, const char *);
72 extern nvlist_t *fmd_protocol_list(const char *, nvlist_t *,
73     const char *, const char *, uint_t, nvlist_t **, uint8_t *, int,
74     struct timeval *, int);
75 extern nvlist_t *fmd_protocol_rsrc_asru(const char *, nvlist_t *,
76     const char *, const char *, boolean_t, boolean_t, boolean_t, nvlist_t *,
77     struct timeval *m, boolean_t, boolean_t, boolean_t, boolean_t, nvlist_t *,
78     boolean_t);
79 extern nvlist_t *fmd_protocol_fmderror(int, const char *, va_list);
80 extern nvlist_t *fmd_protocol_moderror(struct fmd_module *, int, const char *);
81 extern nvlist_t *fmd_protocol_xprt_ctl(struct fmd_module *,
82     const char *, uint8_t);
83 extern nvlist_t *fmd_protocol_xprt_sub(struct fmd_module *,
84     const char *, uint8_t, const char *);
85 extern nvlist_t *fmd_protocol_xprt_uuclose(struct fmd_module *,
86     const char *, uint8_t, const char *);
87 extern nvlist_t *fmd_protocol_xprt_uuresolved(struct fmd_module *,
88     const char *, uint8_t, const char *);
89 extern nvlist_t *fmd_protocol_xprt_updated(struct fmd_module *,
90     const char *, uint8_t, const char *, uint8_t *, uint8_t *, uint_t);
91 
92 #ifdef	__cplusplus
93 }
94 #endif
95 
96 #endif	/* _FMD_PROTOCOL_H */
97