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