xref: /titanic_41/usr/src/lib/fm/libdiagcode/common/diagcode.h (revision 82629e3015252bf18319ba3815c773df23e21436)
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, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_FM_DIAGCODE_H
28 #define	_FM_DIAGCODE_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #include <sys/types.h>
33 
34 #ifdef	__cplusplus
35 extern "C" {
36 #endif
37 
38 /*
39  * The following interfaces are private to Sun and should
40  * not be used by applications developed outside of Sun.
41  * They may change incompatibly or go away without notice.
42  */
43 
44 #define	FM_DC_VERSION   1	/* pass to fm_dc_opendict() */
45 
46 typedef struct fm_dc_handle fm_dc_handle_t;
47 
48 /* open a dictionary, return opaque handle */
49 fm_dc_handle_t *fm_dc_opendict(int version, const char *dirpath,
50     const char *dictname);
51 
52 /* close a dictionary */
53 void fm_dc_closedict(fm_dc_handle_t *dhp);
54 
55 /* return maximum length (in bytes) of diagcodes for a given dictionary */
56 size_t fm_dc_codelen(fm_dc_handle_t *dhp);
57 
58 /* return number of strings in key for a given dictionary, plus 1 for null */
59 int fm_dc_maxkey(fm_dc_handle_t *dhp);
60 
61 /* given a key, construct a diagcode */
62 int fm_dc_key2code(fm_dc_handle_t *dhp,
63     const char *key[], char *code, size_t maxcode);
64 
65 /* given a diagcode, return the key (array of strings) */
66 int fm_dc_code2key(fm_dc_handle_t *dhp, const char *code,
67     char *key[], int maxkey);
68 
69 /* return the right-hand side of a names property from the dict header */
70 const char *fm_dc_getprop(fm_dc_handle_t *dhp, const char *name);
71 
72 #ifdef	__cplusplus
73 }
74 #endif
75 
76 #endif	/* _FM_DIAGCODE_H */
77