xref: /illumos-gate/usr/src/cmd/nscd/nscd_common.h (revision 2a8bcb4efb45d99ac41c94a75c396b362c414f7f)
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  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef	_NSCD_COMMON_H
27 #define	_NSCD_COMMON_H
28 
29 #ifdef	__cplusplus
30 extern "C" {
31 #endif
32 
33 #include <sys/types.h>
34 #include <synch.h>
35 
36 /*
37  * nscd internal return/error codes
38  */
39 typedef enum {
40 	NSCD_SUCCESS			= 0,
41 	NSCD_INITIALIZATION_FAILED,
42 	NSCD_CTX_NOT_FOUND,
43 	NSCD_DB_ENTRY_FOUND,
44 	NSCD_DB_ENTRY_NOT_FOUND,
45 	NSCD_INVALID_ARGUMENT,
46 	NSCD_NO_MEMORY,
47 	NSCD_THREAD_CREATE_ERROR,
48 	NSCD_SMF_ERROR,
49 	NSCD_CFG_UNSUPPORTED_SWITCH_DB,
50 	NSCD_CFG_UNSUPPORTED_SWITCH_SRC,
51 	NSCD_CFG_DLOPEN_ERROR,
52 	NSCD_CFG_DLSYM_ERROR,
53 	NSCD_CFG_SET_PARAM_FAILED,
54 	NSCD_CFG_PARAM_DESC_ERROR,
55 	NSCD_CFG_STAT_DESC_ERROR,
56 	NSCD_CFG_INVALID_HANDLE,
57 	NSCD_CFG_PARSE_ERROR,
58 	NSCD_CFG_FILE_OPEN_ERROR,
59 	NSCD_CFG_FILE_ACCESS_ERROR,
60 	NSCD_CFG_SYNTAX_ERROR,
61 	NSCD_CFG_PRELIM_CHECK_FAILED,
62 	NSCD_CFG_DATA_CONVERSION_FAILED,
63 	NSCD_CFG_WRITE_ERROR,
64 	NSCD_CFG_READ_ONLY,
65 	NSCD_CFG_CHANGE_NOT_ALLOWED,
66 	NSCD_CREATE_NSW_STATE_FAILED,
67 	NSCD_CREATE_GETENT_CTX_FAILED,
68 	NSCD_NSS_BACKEND_NOT_FOUND,
69 	NSCD_DOOR_UCRED_ERROR,
70 	NSCD_DOOR_BUFFER_CHECK_FAILED,
71 	NSCD_SELF_CRED_NOT_CONFIGURED,
72 	NSCD_SELF_CRED_NO_FORKER,
73 	NSCD_SELF_CRED_WRONG_NSCD,
74 	NSCD_SELF_CRED_MAIN_IMPOSTER,
75 	NSCD_SELF_CRED_FORKER_IMPOSTER,
76 	NSCD_SELF_CRED_CHILD_IMPOSTER,
77 	NSCD_SELF_CRED_NO_DOOR,
78 	NSCD_SELF_CRED_NO_CHILD_SLOT,
79 	NSCD_SELF_CRED_INVALID_SLOT_NUMBER,
80 	NSCD_SELF_CRED_INVALID_SLOT_STATE,
81 	NSCD_ADMIN_FAIL_TO_SET,
82 	NSCD_CACHE_INVALID_CACHE_NAME,
83 	NSCD_CACHE_NO_CACHE_CTX,
84 	NSCD_CACHE_DISABLED,
85 	NSCD_CACHE_NO_CACHE_FOUND,
86 	NSCD_CACHE_AVOID_NS
87 
88 } nscd_rc_t;
89 
90 
91 /* nscd data type: boolean */
92 typedef	uint8_t		nscd_bool_t;
93 #define	nscd_true	1
94 #define	nscd_false	0
95 
96 /* common functions */
97 void _nscd_set_start_time(int reset);
98 time_t _nscd_get_start_time();
99 nscd_rc_t _nscd_init(char *cfgfile);
100 nscd_rc_t _nscd_refresh();
101 
102 #ifdef	__cplusplus
103 }
104 #endif
105 
106 #endif	/* _NSCD_COMMON_H */
107