xref: /illumos-gate/usr/src/lib/fm/libfmd_msg/common/fmd_msg.h (revision 6a634c9dca3093f3922e4b7ab826d7bdf17bf78e)
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 (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
24  */
25 
26 #ifndef	_FMD_MSG_H
27 #define	_FMD_MSG_H
28 
29 #include <sys/types.h>
30 #include <sys/nvpair.h>
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 /*
37  * Fault Management Daemon msg File Interfaces
38  *
39  * Note: The contents of this file are private to the implementation of the
40  * Solaris system and FMD subsystem and are subject to change at any time
41  * without notice.  Applications and drivers using these interfaces will fail
42  * to run on future releases.  These interfaces should not be used for any
43  * purpose until they are publicly documented for use outside of Sun.
44  */
45 
46 #define	FMD_MSG_VERSION	1	/* libary ABI interface version */
47 
48 typedef struct fmd_msg_hdl fmd_msg_hdl_t;
49 
50 typedef enum {
51 	FMD_MSG_ITEM_TYPE,
52 	FMD_MSG_ITEM_SEVERITY,
53 	FMD_MSG_ITEM_DESC,
54 	FMD_MSG_ITEM_RESPONSE,
55 	FMD_MSG_ITEM_IMPACT,
56 	FMD_MSG_ITEM_ACTION,
57 	FMD_MSG_ITEM_URL,
58 	FMD_MSG_ITEM_MAX
59 } fmd_msg_item_t;
60 
61 extern void fmd_msg_lock(void);
62 extern void fmd_msg_unlock(void);
63 
64 fmd_msg_hdl_t *fmd_msg_init(const char *, int);
65 void fmd_msg_fini(fmd_msg_hdl_t *);
66 
67 extern int fmd_msg_locale_set(fmd_msg_hdl_t *, const char *);
68 extern const char *fmd_msg_locale_get(fmd_msg_hdl_t *);
69 
70 extern int fmd_msg_url_set(fmd_msg_hdl_t *, const char *);
71 extern const char *fmd_msg_url_get(fmd_msg_hdl_t *);
72 
73 extern char *fmd_msg_gettext_nv(fmd_msg_hdl_t *, const char *, nvlist_t *);
74 extern char *fmd_msg_gettext_id(fmd_msg_hdl_t *, const char *, const char *);
75 extern char *fmd_msg_gettext_key(fmd_msg_hdl_t *, const char *, const char *,
76     const char *);
77 extern char *fmd_msg_decode_tokens(nvlist_t *, const char *, const char *);
78 extern char *fmd_msg_getitem_nv(fmd_msg_hdl_t *,
79     const char *, nvlist_t *, fmd_msg_item_t);
80 
81 extern char *fmd_msg_getitem_id(fmd_msg_hdl_t *,
82     const char *, const char *, fmd_msg_item_t);
83 
84 #ifdef	__cplusplus
85 }
86 #endif
87 
88 #endif	/* _FMD_MSG_H */
89