8322 nl: misleading-indentation
[unleashed/tickless.git] / usr / src / lib / libc / inc / nsswitch_priv.h
blob65e2dd176e3efefd96104b89df40873de9b813a8
1 /*
2 * CDDL HEADER START
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.
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.
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]
19 * CDDL HEADER END
22 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
27 * nsswitch_priv.h
29 * The original switch low level interface to switch was defined in
30 * /usr/include/nsswitch.h. Although it was marked "Project Private",
31 * it was none-the-less "exposed" and used by several apps. This
32 * file, nsswitch_priv.h will *not* go in /usr/include to limit "exposure"
33 * and contains new versions of the switch low level interface.
35 * This is a Project Private interface. It may change in future releases.
38 #ifndef _NSSWITCH_PRIV_H
39 #define _NSSWITCH_PRIV_H
41 #pragma ident "%Z%%M% %I% %E% SMI"
43 #include <nsswitch.h>
45 #ifdef __cplusplus
46 extern "C" {
47 #endif
50 #define __NSW_STD_ERRS_V1 5 /* V1 number of reserved errors */
53 * Results: the first of which are from /usr/include/nsswitch.h
55 * #define __NSW_SUCCESS 0 found the required data
56 * #define __NSW_NOTFOUND 1 the naming service returned lookup failure
57 * #define __NSW_UNAVAIL 2 could not call the naming service
58 * #define __NSW_TRYAGAIN 3 bind error to suggest a retry
61 /* nis server in dns forwarding mode and dns server non-response */
62 #define __NSW_NISSERVDNS_TRYAGAIN 4
65 * Actions: the first of which are from /usr/include/nsswitch.h
67 * #define __NSW_CONTINUE 0 the action is to continue to next service
68 * #define __NSW_RETURN 1 the action is to return to the user
71 /* the action is to retry the request until we get an answer */
72 #define __NSW_TRYAGAIN_FOREVER 2
73 /* the action is to retry the request N times maximum */
74 #define __NSW_TRYAGAIN_NTIMES 3
75 /* retried N times so disable try-again until service is restored */
76 #define __NSW_TRYAGAIN_PAUSED 4
78 /* is this action available to all switch errs? */
79 #define __NSW_COMMON_ACTION(act)\
80 (((act) == __NSW_CONTINUE) || ((act) == __NSW_RETURN))
82 #define __NSW_SUCCESS_ACTION(act) __NSW_COMMON_ACTION(act)
83 #define __NSW_NOTFOUND_ACTION(act) __NSW_COMMON_ACTION(act)
84 #define __NSW_UNAVAIL_ACTION(act) __NSW_COMMON_ACTION(act)
85 #define __NSW_TRYAGAIN_ACTION(act) \
86 (__NSW_COMMON_ACTION(act) || \
87 ((act) == __NSW_TRYAGAIN_FOREVER) || \
88 ((act) == __NSW_TRYAGAIN_NTIMES))
89 #define __NSW_UNPAUSE_ACTION(act)\
90 (((act) == __NSW_TRYAGAIN_PAUSED) && ((act) = __NSW_TRYAGAIN_NTIMES))
92 #define __NSW_STR_FOREVER "forever"
94 #ifdef __NSS_PRIVATE_INTERFACE
96 struct __nsw_lookup_v1 {
97 char *service_name;
98 action_t actions[__NSW_STD_ERRS_V1];
99 int max_retries; /* for TRYAGAIN=N */
100 struct __nsw_long_err *long_errs;
101 struct __nsw_lookup_v1 *next;
104 struct __nsw_switchconfig_v1 {
105 int vers;
106 char *dbase;
107 int num_lookups;
108 struct __nsw_lookup_v1 *lookups;
111 #define __NSW_ACTION_V1(lkp, err) \
112 ((lkp)->next == NULL ? \
113 __NSW_RETURN \
115 ((err) >= 0 && (err) < __NSW_STD_ERRS_V1 ? \
116 (lkp)->actions[err] \
118 __nsw_extended_action_v1(lkp, err)))
121 struct __nsw_switchconfig_v1 *__nsw_getconfig_v1
122 (const char *, enum __nsw_parse_err *);
123 int __nsw_freeconfig_v1(struct __nsw_switchconfig_v1 *);
124 action_t __nsw_extended_action_v1(struct __nsw_lookup_v1 *, int);
126 #endif /* __NSS_PRIVATE_INTERFACE */
128 #ifdef __cplusplus
130 #endif
132 #endif /* _NSSWITCH_PRIV_H */