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