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