xref: /illumos-gate/usr/src/lib/libscf/common/libscf_impl.h (revision 88f8b78a88cbdc6d8c1af5c3e54bc49d25095c98)
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	_LIBSCF_IMPL_H
28 #define	_LIBSCF_IMPL_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifndef NATIVE_BUILD
33 #include "mtlib.h"
34 #endif
35 
36 #include <libscf.h>
37 #include <libscf_priv.h>
38 
39 #ifdef	__cplusplus
40 extern "C" {
41 #endif
42 
43 #define	SCF_FMRI_SVC_PREFIX		"svc:"
44 #define	SCF_FMRI_FILE_PREFIX		"file:"
45 #define	SCF_FMRI_SCOPE_PREFIX		"//"
46 #define	SCF_FMRI_LOCAL_SCOPE		"localhost"
47 #define	SCF_FMRI_SCOPE_SUFFIX		"@localhost"
48 #define	SCF_FMRI_SERVICE_PREFIX		"/"
49 #define	SCF_FMRI_INSTANCE_PREFIX	":"
50 #define	SCF_FMRI_PROPERTYGRP_PREFIX	"/:properties/"
51 #define	SCF_FMRI_PROPERTY_PREFIX	"/"
52 /*
53  * This macro must be extended if additional FMRI prefixes are defined
54  */
55 #define	SCF_FMRI_PREFIX_MAX_LEN		(sizeof (SCF_FMRI_SVC_PREFIX) > \
56 					    sizeof (SCF_FMRI_FILE_PREFIX) ? \
57 					    sizeof (SCF_FMRI_SVC_PREFIX) - 1 : \
58 					    sizeof (SCF_FMRI_FILE_PREFIX) - 1)
59 
60 int scf_setup_error(void);
61 int scf_set_error(scf_error_t);			/* returns -1 */
62 
63 typedef enum {
64 	SCF_MSG_ARGTOOLONG,
65 	SCF_MSG_PATTERN_NOINSTANCE,
66 	SCF_MSG_PATTERN_NOINSTSVC,
67 	SCF_MSG_PATTERN_NOSERVICE,
68 	SCF_MSG_PATTERN_NOENTITY,
69 	SCF_MSG_PATTERN_MULTIMATCH,
70 	SCF_MSG_PATTERN_POSSIBLE,
71 	SCF_MSG_PATTERN_LEGACY
72 } scf_msg_t;
73 
74 const char *scf_get_msg(scf_msg_t);
75 
76 #ifdef	__cplusplus
77 }
78 #endif
79 
80 #endif	/* _LIBSCF_IMPL_H */
81