xref: /titanic_51/usr/src/cmd/nscd/nscd_cfgdef.h (revision 4b22b9337f359bfd063322244f5336cc7c6ffcfa)
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_CFGDEF_H
27 #define	_NSCD_CFGDEF_H
28 
29 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 #ifdef	__cplusplus
32 extern "C" {
33 #endif
34 
35 #include <stddef.h>
36 #include <limits.h>
37 #include <nss_dbdefs.h>
38 #include "nscd_config.h"
39 #include "nscd_log.h"
40 #include "cache.h"
41 
42 /*
43  * structure used for preliminary checking of an integer
44  * configuration value
45  */
46 typedef	struct {
47 	int	min;
48 	int	max;
49 } nscd_cfg_int_check_t;
50 
51 /*
52  * structure used for preliminary checking of a bitmap
53  * configuration value
54  */
55 typedef	struct {
56 	nscd_cfg_bitmap_t	valid_bits;
57 } nscd_cfg_bitmap_check_t;
58 
59 /*
60  * structure used for preliminary checking of a string
61  * configuration value
62  */
63 typedef	struct {
64 	nscd_bool_t	must_not_null;
65 	int		maxlen;
66 } nscd_cfg_str_check_t;
67 
68 /*
69  * Per nsswitch database config data
70  */
71 typedef struct {
72 	nscd_cfg_frontend_t	fe;
73 	nscd_cfg_switch_t	sw;
74 	nscd_cfg_cache_t	cache;
75 } nscd_cfg_nsw_db_data_t;
76 
77 /*
78  * Per nsswitch database statistics data
79  */
80 typedef struct {
81 	nscd_cfg_stat_switch_t		sw;
82 	nscd_cfg_stat_cache_t		cache;
83 } nscd_cfg_stat_nsw_db_data_t;
84 
85 /*
86  * global statistics data
87  */
88 typedef struct {
89 	nscd_cfg_stat_global_log_t	log;
90 	nscd_cfg_stat_global_switch_t	sw;
91 	nscd_cfg_stat_cache_t		cache;
92 } nscd_cfg_stat_global_data_t;
93 
94 /*
95  * global config data
96  */
97 typedef struct {
98 	nscd_cfg_global_log_t		log;
99 	nscd_cfg_global_frontend_t	fe;
100 	nscd_cfg_global_selfcred_t	sc;
101 	nscd_cfg_global_switch_t	sw;
102 	nscd_cfg_global_cache_t		cache;
103 } nscd_cfg_global_data_t;
104 
105 /*
106  * structure for handling the switch database specific group
107  * or parameter default
108  */
109 typedef struct nscd_cfg_nsw_spc_default {
110 	char	*db;
111 	int	group_off;
112 	int	param_off;
113 	void	*data;		/* pointer or link to data */
114 	int	data_len;
115 } nscd_cfg_nsw_spc_default_t;
116 
117 /*
118  * name service switch source (repository) table
119  */
120 nscd_cfg_id_t _nscd_cfg_nsw_src[] = {
121 	{	0,	"files"			},
122 	{	1,	"ldap"			},
123 	{	2,	"nis"			},
124 	{	3,	"nisplus"		},
125 	{	4,	"mdns"			},
126 	{	5,	"dns"			},
127 	{	6,	"compat"		},
128 	{	7,	"user"			},
129 	{	-1,	NULL			}
130 };
131 
132 /*
133  * name service related smf service table
134  * (the order of the services should match the order of the source
135  *  listed above, 0: files, 1: ldap, 2: nis, 3: nisplus, 4: mdns.
136  *  dns is not needed)
137  */
138 nscd_cfg_id_t _nscd_cfg_smf_services[] = {
139 	{	0,	"svc:/system/name-service-cache:default"},
140 	{	1,	"svc:/network/ldap/client:default"	},
141 	{	2,	"svc:/network/nis/client:default"	},
142 	{	3,	"svc:/network/rpc/bind:default"		},
143 	{	4,	"svc:/network/dns/multicast:default"	},
144 	{	-1,	NULL					}
145 };
146 
147 /*
148  * name service database table
149  */
150 nscd_cfg_id_t _nscd_cfg_nsw_db[] = {
151 	{	0,	NSS_DBNAM_PASSWD	},
152 	{	1,	NSS_DBNAM_GROUP		},
153 	{	2,	NSS_DBNAM_HOSTS		},
154 	{	3,	NSS_DBNAM_IPNODES	},
155 	{	4,	NSS_DBNAM_EXECATTR	},
156 	{	5,	NSS_DBNAM_PROFATTR	},
157 	{	6,	NSS_DBNAM_USERATTR	},
158 	{	7,	NSS_DBNAM_NETWORKS	},
159 	{	8,	NSS_DBNAM_PROTOCOLS	},
160 	{	9,	NSS_DBNAM_RPC		},
161 	{	10,	NSS_DBNAM_ETHERS	},
162 	{	11,	NSS_DBNAM_NETMASKS	},
163 	{	12,	NSS_DBNAM_BOOTPARAMS	},
164 	{	13,	NSS_DBNAM_PUBLICKEY	},
165 	{	14,	NSS_DBNAM_NETGROUP	},
166 	{	15,	NSS_DBNAM_SERVICES	},
167 	{	16,	NSS_DBNAM_PRINTERS	},
168 	{	17,	NSS_DBNAM_AUTHATTR	},
169 	{	18,	NSS_DBNAM_PROJECT	},
170 	{	19,	NSS_DBNAM_SHADOW	},
171 	{	20,	NSS_DBNAM_AUDITUSER	},
172 	{	21,	NSS_DBNAM_TSOL_TP	},
173 	{	22,	NSS_DBNAM_TSOL_RH	},
174 	/* pseudo-databases for the compat backend */
175 	{	23,	NSS_DBNAM_PASSWD_COMPAT },
176 	{	24,	NSS_DBNAM_GROUP_COMPAT  },
177 #define	NSS_DBNAM_COMPAT_NUM_DB	5
178 	/*
179 	 * pseudo-databases that use the switch policy that is
180 	 * configured for NSS_DBNAM_PASSWD_COMPAT
181 	 */
182 	{	25,	NSS_DBNAM_PASSWD	},
183 	{	26,	NSS_DBNAM_SHADOW	},
184 	{	27,	NSS_DBNAM_AUDITUSER	},
185 	{	28,	NSS_DBNAM_USERATTR	},
186 	/*
187 	 * pseudo-database that uses the switch policy that is
188 	 * configured for NSS_DBNAM_GROUP_COMPAT
189 	 */
190 	{	29,	NSS_DBNAM_GROUP		},
191 	{	-1,	NULL			}
192 };
193 
194 /*
195  * A special way to indicate all switch databases
196  */
197 static	nscd_cfg_id_t _nscd_cfg_nsw_alldb = {
198 		NSCD_CFG_NSW_ALLDB_INDEX,
199 		NSCD_CFG_NSW_ALLDB
200 };
201 
202 /*
203  * data for preliminary checking of the log configuration
204  */
205 static nscd_cfg_str_check_t	NSCD_CFG_LOGFILE_PCHECK =
206 				{nscd_false, PATH_MAX};
207 static nscd_cfg_bitmap_check_t	NSCD_CFG_LOGCOMP_PCHECK =
208 				{NSCD_LOG_ALL};
209 static nscd_cfg_bitmap_check_t	NSCD_CFG_LOGLEVEL_PCHECK =
210 				{NSCD_LOG_LEVEL_ALL};
211 
212 /* data for preliminary checking of the switch configuration */
213 static nscd_cfg_str_check_t	NSCD_CFG_NSWCFGSTR_PCHECK =
214 				{nscd_true, 128};
215 
216 /*
217  * macros for defining the static param table
218  */
219 #define	NSCD_CFG_PGROUP_DESC(pn, type, pflag, gf, g_in_t, pcheck_p,\
220 		nfunc_name, vfunc_name) \
221 	{ \
222 		{-1, pn}, type, (NSCD_CFG_PFLAG_GROUP | pflag), \
223 		0, 0, 0,\
224 		NSCD_SIZEOF(g_in_t, gf), offsetof(g_in_t, gf), -1, \
225 		pcheck_p, nfunc_name, vfunc_name \
226 	}
227 
228 #define	NSCD_CFG_PARAM_DESC(pn, type, pflag, pf, p_in_t, \
229 		gf, g_in_t, pcheck_p, nfunc_name, vfunc_name) \
230 	{ \
231 		{-1, pn}, type, pflag, \
232 		NSCD_SIZEOF(p_in_t, pf), offsetof(p_in_t, pf), -1, \
233 		NSCD_SIZEOF(g_in_t, gf), offsetof(g_in_t, gf), -1, \
234 		pcheck_p, nfunc_name, vfunc_name \
235 	}
236 
237 #define	NSCD_CFG_PGROUP_DESC_NULL \
238 	{ \
239 		{-1, NULL}, -1, NSCD_CFG_PFLAG_GROUP, \
240 		0, 0, 0, \
241 		0, 0, 0, \
242 		NULL, NULL, NULL \
243 	}
244 
245 /* nscd internal cfg_*_notify() cfg_*_verify() and cfg_*_get_stat()  */
246 extern	nscd_rc_t	_nscd_cfg_log_notify();
247 extern	nscd_rc_t	_nscd_cfg_log_verify();
248 extern	nscd_rc_t	_nscd_cfg_frontend_notify();
249 extern	nscd_rc_t	_nscd_cfg_frontend_verify();
250 extern	nscd_rc_t	_nscd_cfg_selfcred_notify();
251 extern	nscd_rc_t	_nscd_cfg_selfcred_verify();
252 extern	nscd_rc_t	_nscd_cfg_switch_notify();
253 extern	nscd_rc_t	_nscd_cfg_switch_verify();
254 extern	nscd_rc_t	_nscd_cfg_cache_notify();
255 extern	nscd_rc_t	_nscd_cfg_cache_verify();
256 extern	nscd_rc_t	_nscd_cfg_log_get_stat();
257 extern	nscd_rc_t	_nscd_cfg_switch_get_stat();
258 extern	nscd_rc_t	_nscd_cfg_cache_get_stat();
259 
260 /*
261  * the following macros are used to indicate a parameter's
262  * notify/verify/get_stat functions are the same as those
263  * of the group
264  */
265 #define	NSCD_CFG_FUNC_NOTIFY_AS_GROUP	((nscd_cfg_func_notify_t)-1)
266 #define	NSCD_CFG_FUNC_VERIFY_AS_GROUP	((nscd_cfg_func_verify_t)-1)
267 #define	NSCD_CFG_FUNC_GET_STAT_AS_GROUP	((nscd_cfg_func_get_stat_t)-1)
268 
269 /*
270  * the static config parameter description table
271  */
272 static	nscd_cfg_param_desc_t	_nscd_cfg_param_desc[] = {
273 
274 	NSCD_CFG_PGROUP_DESC(
275 		"param-group-global-log",
276 		NSCD_CFG_DATA_NONE,
277 		NSCD_CFG_PFLAG_INIT_SEND_WHOLE_GROUP |
278 		NSCD_CFG_PFLAG_GLOBAL,
279 		log,
280 		nscd_cfg_global_data_t,
281 		NULL,
282 		_nscd_cfg_log_notify,
283 		_nscd_cfg_log_verify),
284 
285 	NSCD_CFG_PARAM_DESC(
286 		"logfile",
287 		NSCD_CFG_DATA_STRING,
288 		NSCD_CFG_PFLAG_GLOBAL |
289 		NSCD_CFG_PFLAG_VLEN_DATA,
290 		logfile,
291 		nscd_cfg_global_log_t,
292 		log,
293 		nscd_cfg_global_data_t,
294 		&NSCD_CFG_LOGFILE_PCHECK,
295 		NSCD_CFG_FUNC_NOTIFY_AS_GROUP,
296 		NSCD_CFG_FUNC_VERIFY_AS_GROUP),
297 
298 	NSCD_CFG_PARAM_DESC(
299 		"debug-level",
300 		NSCD_CFG_DATA_BITMAP,
301 		NSCD_CFG_PFLAG_GLOBAL,
302 		debug_level,
303 		nscd_cfg_global_log_t,
304 		log,
305 		nscd_cfg_global_data_t,
306 		&NSCD_CFG_LOGLEVEL_PCHECK,
307 		NSCD_CFG_FUNC_NOTIFY_AS_GROUP,
308 		NSCD_CFG_FUNC_VERIFY_AS_GROUP),
309 
310 	NSCD_CFG_PARAM_DESC(
311 		"debug-components",
312 		NSCD_CFG_DATA_BITMAP,
313 		NSCD_CFG_PFLAG_GLOBAL,
314 		debug_comp,
315 		nscd_cfg_global_log_t,
316 		log,
317 		nscd_cfg_global_data_t,
318 		&NSCD_CFG_LOGCOMP_PCHECK,
319 		NSCD_CFG_FUNC_NOTIFY_AS_GROUP,
320 		NSCD_CFG_FUNC_VERIFY_AS_GROUP),
321 
322 	NSCD_CFG_PGROUP_DESC(
323 		"param-group-global-frontend",
324 		NSCD_CFG_DATA_NONE,
325 		NSCD_CFG_PFLAG_INIT_SEND_WHOLE_GROUP |
326 		NSCD_CFG_PFLAG_GLOBAL,
327 		fe,
328 		nscd_cfg_global_data_t,
329 		NULL,
330 		_nscd_cfg_frontend_notify,
331 		_nscd_cfg_frontend_verify),
332 
333 	NSCD_CFG_PARAM_DESC(
334 		"common-worker-threads",
335 		NSCD_CFG_DATA_INTEGER,
336 		NSCD_CFG_PFLAG_SEND_BIT_SELECTED |
337 		NSCD_CFG_PFLAG_GLOBAL,
338 		common_worker_threads,
339 		nscd_cfg_global_frontend_t,
340 		fe,
341 		nscd_cfg_global_data_t,
342 		NULL,
343 		NSCD_CFG_FUNC_NOTIFY_AS_GROUP,
344 		NSCD_CFG_FUNC_VERIFY_AS_GROUP),
345 
346 	NSCD_CFG_PARAM_DESC(
347 		"cache-hit-threads",
348 		NSCD_CFG_DATA_INTEGER,
349 		NSCD_CFG_PFLAG_SEND_BIT_SELECTED |
350 		NSCD_CFG_PFLAG_GLOBAL,
351 		cache_hit_threads,
352 		nscd_cfg_global_frontend_t,
353 		fe,
354 		nscd_cfg_global_data_t,
355 		NULL,
356 		NSCD_CFG_FUNC_NOTIFY_AS_GROUP,
357 		NSCD_CFG_FUNC_VERIFY_AS_GROUP),
358 
359 	NSCD_CFG_PGROUP_DESC(
360 		"param-group-global-selfcred",
361 		NSCD_CFG_DATA_NONE,
362 		NSCD_CFG_PFLAG_INIT_SEND_WHOLE_GROUP |
363 		NSCD_CFG_PFLAG_GLOBAL,
364 		sc,
365 		nscd_cfg_global_data_t,
366 		NULL,
367 		_nscd_cfg_selfcred_notify,
368 		_nscd_cfg_selfcred_verify),
369 
370 	NSCD_CFG_PARAM_DESC(
371 		"enable-selfcred",
372 		NSCD_CFG_DATA_BOOLEAN,
373 		NSCD_CFG_PFLAG_GLOBAL,
374 		enable_selfcred,
375 		nscd_cfg_global_selfcred_t,
376 		sc,
377 		nscd_cfg_global_data_t,
378 		NULL,
379 		NSCD_CFG_FUNC_NOTIFY_AS_GROUP,
380 		NSCD_CFG_FUNC_VERIFY_AS_GROUP),
381 
382 	NSCD_CFG_PARAM_DESC(
383 		"max-per-user-nscd",
384 		NSCD_CFG_DATA_INTEGER,
385 		NSCD_CFG_PFLAG_GLOBAL,
386 		max_per_user_nscd,
387 		nscd_cfg_global_selfcred_t,
388 		sc,
389 		nscd_cfg_global_data_t,
390 		NULL,
391 		NSCD_CFG_FUNC_NOTIFY_AS_GROUP,
392 		NSCD_CFG_FUNC_VERIFY_AS_GROUP),
393 
394 	NSCD_CFG_PARAM_DESC(
395 		"per-user-nscd-ttl",
396 		NSCD_CFG_DATA_INTEGER,
397 		NSCD_CFG_PFLAG_GLOBAL,
398 		per_user_nscd_ttl,
399 		nscd_cfg_global_selfcred_t,
400 		sc,
401 		nscd_cfg_global_data_t,
402 		NULL,
403 		NSCD_CFG_FUNC_NOTIFY_AS_GROUP,
404 		NSCD_CFG_FUNC_VERIFY_AS_GROUP),
405 
406 	NSCD_CFG_PGROUP_DESC(
407 		"param-group-global-switch",
408 		NSCD_CFG_DATA_NONE,
409 		NSCD_CFG_PFLAG_INIT_SEND_WHOLE_GROUP |
410 		NSCD_CFG_PFLAG_GLOBAL,
411 		sw,
412 		nscd_cfg_global_data_t,
413 		NULL,
414 		_nscd_cfg_switch_notify,
415 		_nscd_cfg_switch_verify),
416 
417 	NSCD_CFG_PARAM_DESC(
418 		"global-enable-lookup",
419 		NSCD_CFG_DATA_BOOLEAN,
420 		NSCD_CFG_PFLAG_GLOBAL,
421 		enable_lookup_g,
422 		nscd_cfg_global_switch_t,
423 		sw,
424 		nscd_cfg_global_data_t,
425 		NULL,
426 		NSCD_CFG_FUNC_NOTIFY_AS_GROUP,
427 		NSCD_CFG_FUNC_VERIFY_AS_GROUP),
428 
429 	NSCD_CFG_PARAM_DESC(
430 		"global-enable-loopback-checking",
431 		NSCD_CFG_DATA_BOOLEAN,
432 		NSCD_CFG_PFLAG_GLOBAL,
433 		enable_loopback_checking_g,
434 		nscd_cfg_global_switch_t,
435 		sw,
436 		nscd_cfg_global_data_t,
437 		NULL,
438 		NSCD_CFG_FUNC_NOTIFY_AS_GROUP,
439 		NSCD_CFG_FUNC_VERIFY_AS_GROUP),
440 
441 	NSCD_CFG_PARAM_DESC(
442 		"global-check-smf-state-interval",
443 		NSCD_CFG_DATA_INTEGER,
444 		NSCD_CFG_PFLAG_GLOBAL,
445 		check_smf_state_interval_g,
446 		nscd_cfg_global_switch_t,
447 		sw,
448 		nscd_cfg_global_data_t,
449 		NULL,
450 		NSCD_CFG_FUNC_NOTIFY_AS_GROUP,
451 		NSCD_CFG_FUNC_VERIFY_AS_GROUP),
452 
453 	NSCD_CFG_PGROUP_DESC(
454 		"param-group-global-cache",
455 		NSCD_CFG_DATA_NONE,
456 		NSCD_CFG_PFLAG_INIT_SEND_WHOLE_GROUP |
457 		NSCD_CFG_PFLAG_INIT_SET_ALL_DB |
458 		NSCD_CFG_PFLAG_GLOBAL,
459 		cache,
460 		nscd_cfg_global_data_t,
461 		NULL,
462 		_nscd_cfg_cache_notify,
463 		_nscd_cfg_cache_verify),
464 
465 	NSCD_CFG_PARAM_DESC(
466 		"global-enable-cache",
467 		NSCD_CFG_DATA_BOOLEAN,
468 		NSCD_CFG_PFLAG_GLOBAL,
469 		enable,
470 		nscd_cfg_global_cache_t,
471 		cache,
472 		nscd_cfg_global_data_t,
473 		NULL,
474 		NSCD_CFG_FUNC_NOTIFY_AS_GROUP,
475 		NSCD_CFG_FUNC_VERIFY_AS_GROUP),
476 
477 	/* non-global config param from this point on */
478 
479 	NSCD_CFG_PGROUP_DESC(
480 		"param-group-frontend",
481 		NSCD_CFG_DATA_NONE,
482 		NSCD_CFG_PFLAG_INIT_SEND_WHOLE_GROUP,
483 		fe,
484 		nscd_cfg_nsw_db_data_t,
485 		NULL,
486 		_nscd_cfg_frontend_notify,
487 		_nscd_cfg_frontend_verify),
488 
489 	NSCD_CFG_PARAM_DESC(
490 		"worker-thread-per-nsw-db",
491 		NSCD_CFG_DATA_INTEGER,
492 		NSCD_CFG_PFLAG_NONE,
493 		worker_thread_per_nsw_db,
494 		nscd_cfg_frontend_t,
495 		fe,
496 		nscd_cfg_nsw_db_data_t,
497 		NULL,
498 		NSCD_CFG_FUNC_NOTIFY_AS_GROUP,
499 		NSCD_CFG_FUNC_VERIFY_AS_GROUP),
500 
501 	NSCD_CFG_PGROUP_DESC(
502 		"param-group-switch",
503 		NSCD_CFG_DATA_NONE,
504 		NSCD_CFG_PFLAG_INIT_SEND_WHOLE_GROUP |
505 		NSCD_CFG_PFLAG_NONE,
506 		sw,
507 		nscd_cfg_nsw_db_data_t,
508 		NULL,
509 		_nscd_cfg_switch_notify,
510 		_nscd_cfg_switch_verify),
511 
512 	NSCD_CFG_PARAM_DESC(
513 		"nsw-config-string",
514 		NSCD_CFG_DATA_STRING,
515 		NSCD_CFG_PFLAG_VLEN_DATA |
516 		NSCD_CFG_PFLAG_LINKED,
517 		nsw_config_string,
518 		nscd_cfg_switch_t,
519 		sw,
520 		nscd_cfg_nsw_db_data_t,
521 		&NSCD_CFG_NSWCFGSTR_PCHECK,
522 		NSCD_CFG_FUNC_NOTIFY_AS_GROUP,
523 		NSCD_CFG_FUNC_VERIFY_AS_GROUP),
524 
525 	NSCD_CFG_PARAM_DESC(
526 		"nsw-config-database",
527 		NSCD_CFG_DATA_STRING,
528 		NSCD_CFG_PFLAG_VLEN_DATA |
529 		NSCD_CFG_PFLAG_HIDDEN,
530 		nsw_config_db,
531 		nscd_cfg_switch_t,
532 		sw,
533 		nscd_cfg_nsw_db_data_t,
534 		&NSCD_CFG_NSWCFGSTR_PCHECK,
535 		NSCD_CFG_FUNC_NOTIFY_AS_GROUP,
536 		NSCD_CFG_FUNC_VERIFY_AS_GROUP),
537 
538 	NSCD_CFG_PARAM_DESC(
539 		"enable-lookup",
540 		NSCD_CFG_DATA_BOOLEAN,
541 		NSCD_CFG_PFLAG_NONE,
542 		enable_lookup,
543 		nscd_cfg_switch_t,
544 		sw,
545 		nscd_cfg_nsw_db_data_t,
546 		NULL,
547 		NSCD_CFG_FUNC_NOTIFY_AS_GROUP,
548 		NSCD_CFG_FUNC_VERIFY_AS_GROUP),
549 
550 	NSCD_CFG_PARAM_DESC(
551 		"enable-loopback-checking",
552 		NSCD_CFG_DATA_BOOLEAN,
553 		NSCD_CFG_PFLAG_NONE,
554 		enable_loopback_checking,
555 		nscd_cfg_switch_t,
556 		sw,
557 		nscd_cfg_nsw_db_data_t,
558 		NULL,
559 		NSCD_CFG_FUNC_NOTIFY_AS_GROUP,
560 		NSCD_CFG_FUNC_VERIFY_AS_GROUP),
561 
562 	NSCD_CFG_PARAM_DESC(
563 		"max-nsw-state-per-db",
564 		NSCD_CFG_DATA_INTEGER,
565 		NSCD_CFG_PFLAG_NONE,
566 		max_nsw_state_per_db,
567 		nscd_cfg_switch_t,
568 		sw,
569 		nscd_cfg_nsw_db_data_t,
570 		NULL,
571 		NSCD_CFG_FUNC_NOTIFY_AS_GROUP,
572 		NSCD_CFG_FUNC_VERIFY_AS_GROUP),
573 
574 	NSCD_CFG_PARAM_DESC(
575 		"max-nsw-state-per-thread",
576 		NSCD_CFG_DATA_INTEGER,
577 		NSCD_CFG_PFLAG_NONE,
578 		max_nsw_state_per_thread,
579 		nscd_cfg_switch_t,
580 		sw,
581 		nscd_cfg_nsw_db_data_t,
582 		NULL,
583 		NSCD_CFG_FUNC_NOTIFY_AS_GROUP,
584 		NSCD_CFG_FUNC_VERIFY_AS_GROUP),
585 
586 	NSCD_CFG_PARAM_DESC(
587 		"max-getent-ctx-per-db",
588 		NSCD_CFG_DATA_INTEGER,
589 		NSCD_CFG_PFLAG_NONE,
590 		max_getent_ctx_per_db,
591 		nscd_cfg_switch_t,
592 		sw,
593 		nscd_cfg_nsw_db_data_t,
594 		NULL,
595 		NSCD_CFG_FUNC_NOTIFY_AS_GROUP,
596 		NSCD_CFG_FUNC_VERIFY_AS_GROUP),
597 
598 	NSCD_CFG_PGROUP_DESC(
599 		"param-group-cache",
600 		NSCD_CFG_DATA_NONE,
601 		NSCD_CFG_PFLAG_INIT_SEND_WHOLE_GROUP,
602 		cache,
603 		nscd_cfg_nsw_db_data_t,
604 		NULL,
605 		_nscd_cfg_cache_notify,
606 		_nscd_cfg_cache_verify),
607 
608 	NSCD_CFG_PARAM_DESC(
609 		"enable-cache",
610 		NSCD_CFG_DATA_BOOLEAN,
611 		NSCD_CFG_PFLAG_NONE,
612 		enable,
613 		nscd_cfg_cache_t,
614 		cache,
615 		nscd_cfg_nsw_db_data_t,
616 		NULL,
617 		NSCD_CFG_FUNC_NOTIFY_AS_GROUP,
618 		NSCD_CFG_FUNC_VERIFY_AS_GROUP),
619 
620 	NSCD_CFG_PARAM_DESC(
621 		"enable-per-user-cache",
622 		NSCD_CFG_DATA_BOOLEAN,
623 		NSCD_CFG_PFLAG_NONE,
624 		per_user,
625 		nscd_cfg_cache_t,
626 		cache,
627 		nscd_cfg_nsw_db_data_t,
628 		NULL,
629 		NSCD_CFG_FUNC_NOTIFY_AS_GROUP,
630 		NSCD_CFG_FUNC_VERIFY_AS_GROUP),
631 
632 	NSCD_CFG_PARAM_DESC(
633 		"avoid-nameservice",
634 		NSCD_CFG_DATA_BOOLEAN,
635 		NSCD_CFG_PFLAG_NONE,
636 		avoid_ns,
637 		nscd_cfg_cache_t,
638 		cache,
639 		nscd_cfg_nsw_db_data_t,
640 		NULL,
641 		NSCD_CFG_FUNC_NOTIFY_AS_GROUP,
642 		NSCD_CFG_FUNC_VERIFY_AS_GROUP),
643 
644 	NSCD_CFG_PARAM_DESC(
645 		"check-files",
646 		NSCD_CFG_DATA_BOOLEAN,
647 		NSCD_CFG_PFLAG_NONE,
648 		check_files,
649 		nscd_cfg_cache_t,
650 		cache,
651 		nscd_cfg_nsw_db_data_t,
652 		NULL,
653 		NSCD_CFG_FUNC_NOTIFY_AS_GROUP,
654 		NSCD_CFG_FUNC_VERIFY_AS_GROUP),
655 
656 	NSCD_CFG_PARAM_DESC(
657 		"check-file-interval",
658 		NSCD_CFG_DATA_INTEGER,
659 		NSCD_CFG_PFLAG_NONE,
660 		check_interval,
661 		nscd_cfg_cache_t,
662 		cache,
663 		nscd_cfg_nsw_db_data_t,
664 		NULL,
665 		NSCD_CFG_FUNC_NOTIFY_AS_GROUP,
666 		NSCD_CFG_FUNC_VERIFY_AS_GROUP),
667 
668 	NSCD_CFG_PARAM_DESC(
669 		"positive-time-to-live",
670 		NSCD_CFG_DATA_INTEGER,
671 		NSCD_CFG_PFLAG_NONE,
672 		pos_ttl,
673 		nscd_cfg_cache_t,
674 		cache,
675 		nscd_cfg_nsw_db_data_t,
676 		NULL,
677 		NSCD_CFG_FUNC_NOTIFY_AS_GROUP,
678 		NSCD_CFG_FUNC_VERIFY_AS_GROUP),
679 
680 	NSCD_CFG_PARAM_DESC(
681 		"negative-time-to-live",
682 		NSCD_CFG_DATA_INTEGER,
683 		NSCD_CFG_PFLAG_NONE,
684 		neg_ttl,
685 		nscd_cfg_cache_t,
686 		cache,
687 		nscd_cfg_nsw_db_data_t,
688 		NULL,
689 		NSCD_CFG_FUNC_NOTIFY_AS_GROUP,
690 		NSCD_CFG_FUNC_VERIFY_AS_GROUP),
691 
692 	NSCD_CFG_PARAM_DESC(
693 		"keep-hot-count",
694 		NSCD_CFG_DATA_INTEGER,
695 		NSCD_CFG_PFLAG_NONE,
696 		keephot,
697 		nscd_cfg_cache_t,
698 		cache,
699 		nscd_cfg_nsw_db_data_t,
700 		NULL,
701 		NSCD_CFG_FUNC_NOTIFY_AS_GROUP,
702 		NSCD_CFG_FUNC_VERIFY_AS_GROUP),
703 
704 	NSCD_CFG_PARAM_DESC(
705 		"hint-size",
706 		NSCD_CFG_DATA_INTEGER,
707 		NSCD_CFG_PFLAG_NONE,
708 		hint_size,
709 		nscd_cfg_cache_t,
710 		cache,
711 		nscd_cfg_nsw_db_data_t,
712 		NULL,
713 		NSCD_CFG_FUNC_NOTIFY_AS_GROUP,
714 		NSCD_CFG_FUNC_VERIFY_AS_GROUP),
715 
716 	NSCD_CFG_PARAM_DESC(
717 		"maximum-entries-allowed",
718 		NSCD_CFG_DATA_INTEGER,
719 		NSCD_CFG_PFLAG_NONE,
720 		maxentries,
721 		nscd_cfg_cache_t,
722 		cache,
723 		nscd_cfg_nsw_db_data_t,
724 		NULL,
725 		NSCD_CFG_FUNC_NOTIFY_AS_GROUP,
726 		NSCD_CFG_FUNC_VERIFY_AS_GROUP),
727 
728 	NSCD_CFG_PARAM_DESC(
729 		"suggested-size",
730 		NSCD_CFG_DATA_INTEGER,
731 		NSCD_CFG_PFLAG_OBSOLETE,
732 		suggestedsize,
733 		nscd_cfg_cache_t,
734 		cache,
735 		nscd_cfg_nsw_db_data_t,
736 		NULL,
737 		NSCD_CFG_FUNC_NOTIFY_AS_GROUP,
738 		NSCD_CFG_FUNC_VERIFY_AS_GROUP),
739 
740 	NSCD_CFG_PARAM_DESC(
741 		"old-data-ok",
742 		NSCD_CFG_DATA_BOOLEAN,
743 		NSCD_CFG_PFLAG_OBSOLETE,
744 		old_data_ok,
745 		nscd_cfg_cache_t,
746 		cache,
747 		nscd_cfg_nsw_db_data_t,
748 		NULL,
749 		NSCD_CFG_FUNC_NOTIFY_AS_GROUP,
750 		NSCD_CFG_FUNC_VERIFY_AS_GROUP),
751 
752 	NSCD_CFG_PGROUP_DESC_NULL
753 };
754 
755 /*
756  * defaults for the global configuration
757  */
758 static nscd_cfg_global_data_t nscd_cfg_global_default = {
759 
760 	/*
761 	 * nscd_cfg_global_log_t
762 	 */
763 	{
764 
765 	NSCD_CFG_GROUP_INFO_GLOBAL_LOG,
766 	NULL,
767 	NSCD_LOG_LEVEL_NONE,	/* debug_level */
768 	NSCD_LOG_CACHE,		/* debug_comp */
769 
770 	},
771 
772 	/*
773 	 * nscd_cfg_global_frontend_t
774 	 */
775 	{
776 
777 	NSCD_CFG_GROUP_INFO_GLOBAL_FRONTEND,
778 	100,			/* common_worker_threads */
779 	100,			/* cache_hit_threads */
780 
781 	},
782 
783 	/*
784 	 * nscd_cfg_global_selfcred_t
785 	 */
786 	{
787 
788 	NSCD_CFG_GROUP_INFO_GLOBAL_SELFCRED,
789 	nscd_true,		/* enable_selfcred */
790 	1000,			/* max_per_user_nscd */
791 	120,			/* per_user_nscd_ttl: 120 seconds */
792 
793 	},
794 
795 	/*
796 	 * nscd_cfg_global_switch_t
797 	 */
798 	{
799 
800 	NSCD_CFG_GROUP_INFO_GLOBAL_SWITCH,
801 	nscd_true,		/* enable_lookup_g */
802 	nscd_false,		/* enable_loopback_checking_g */
803 	120,			/* check_smf_state_interval_g */
804 
805 	},
806 
807 	/*
808 	 * nscd_cfg_global_cache_t
809 	 */
810 	NSCD_CFG_GLOBAL_CACHE_DEFAULTS
811 };
812 
813 /*
814  * defaults for the per switch database configuration
815  */
816 static nscd_cfg_nsw_db_data_t nscd_cfg_nsw_db_data_default = {
817 
818 	/*
819 	 * nscd_cfg_frontend_t
820 	 */
821 	{
822 
823 	NSCD_CFG_GROUP_INFO_FRONTEND,
824 	50, 			/* worker_thread_per_nsw_db */
825 
826 	},
827 
828 	/*
829 	 * nscd_cfg_switch_t
830 	 */
831 	{
832 
833 	NSCD_CFG_GROUP_INFO_SWITCH,
834 	"nis files",		/* nsw_config_string */
835 	NULL,			/* nsw_config_db */
836 	nscd_true,		/* enable_lookup */
837 	nscd_false,		/* enable_loopback_checking */
838 	288,			/* max_nsw_state_per_db */
839 	32,			/* max_nsw_state_per_thread */
840 	256,			/* max_getent_ctx_per_db */
841 
842 	},
843 
844 	/*
845 	 * nscd_cfg_cache_t
846 	 */
847 	NSCD_CFG_CACHE_DEFAULTS
848 };
849 
850 /*
851  * macros for defining the database specific defaults
852  */
853 #define	NSCD_CFG_DB_DEFAULT_PARAM(db, gf, pf, gt, defaddr, deflen) \
854 	{ \
855 		db, offsetof(nscd_cfg_nsw_db_data_t, gf), \
856 		offsetof(gt, pf), defaddr, deflen \
857 	}
858 
859 #define	NSCD_CFG_DB_DEFAULT_GROUP(db, gf, defaddr, deflen) \
860 	{ \
861 		db, offsetof(nscd_cfg_nsw_db_data_t, gf), \
862 		0, defaddr, deflen \
863 	}
864 
865 #define	NSCD_CFG_DB_DEFAULT_NULL \
866 	{ \
867 		NULL, 0, 0, NULL, 0 \
868 	}
869 
870 /*
871  * shadow, user_attr, and audit_user use the same switch policy
872  * as that of passwd. exec_attr use that of prof_attr.
873  */
874 static char *nscd_cfg_shadow_cfg_db	= NSS_DBNAM_PASSWD;
875 static char *nscd_cfg_userattr_cfg_db	= NSS_DBNAM_PASSWD;
876 static char *nscd_cfg_auuser_cfg_db	= NSS_DBNAM_PASSWD;
877 static char *nscd_cfg_execattr_cfg_db	= NSS_DBNAM_PROFATTR;
878 
879 /*
880  * default switch policy for pseudo-databases passwd_compat and
881  * and group_compa is "nis"
882  */
883 static char *nscd_cfg_def_passwd_compat	= NSS_DEFCONF_PASSWD_COMPAT;
884 static char *nscd_cfg_def_group_compat	= NSS_DEFCONF_GROUP_COMPAT;
885 
886 static nscd_cfg_nsw_spc_default_t nscd_cfg_passwd_cfg_link =
887 	NSCD_CFG_DB_DEFAULT_PARAM(
888 		NSS_DBNAM_PASSWD,
889 		sw,
890 		nsw_config_string,
891 		nscd_cfg_switch_t,
892 		NULL,
893 		NSCD_SIZEOF(nscd_cfg_switch_t, nsw_config_string));
894 
895 static nscd_cfg_nsw_spc_default_t nscd_cfg_profattr_cfg_link =
896 	NSCD_CFG_DB_DEFAULT_PARAM(
897 		NSS_DBNAM_PROFATTR,
898 		sw,
899 		nsw_config_string,
900 		nscd_cfg_switch_t,
901 		NULL,
902 		NSCD_SIZEOF(nscd_cfg_switch_t, nsw_config_string));
903 
904 
905 /*
906  * switch database specific defaults
907  */
908 nscd_cfg_nsw_spc_default_t	_nscd_cfg_nsw_spc_default[] = {
909 
910 	NSCD_CFG_DB_DEFAULT_PARAM(
911 	NSS_DBNAM_SHADOW,
912 		sw,
913 		nsw_config_db,
914 		nscd_cfg_switch_t,
915 		&nscd_cfg_shadow_cfg_db,
916 		sizeof (nscd_cfg_shadow_cfg_db)),
917 
918 	NSCD_CFG_DB_DEFAULT_PARAM(
919 		NSS_DBNAM_USERATTR,
920 		sw,
921 		nsw_config_db,
922 		nscd_cfg_switch_t,
923 		&nscd_cfg_userattr_cfg_db,
924 		sizeof (nscd_cfg_userattr_cfg_db)),
925 
926 	NSCD_CFG_DB_DEFAULT_PARAM(
927 		NSS_DBNAM_AUDITUSER,
928 		sw,
929 		nsw_config_db,
930 		nscd_cfg_switch_t,
931 		&nscd_cfg_auuser_cfg_db,
932 		sizeof (nscd_cfg_auuser_cfg_db)),
933 
934 	NSCD_CFG_DB_DEFAULT_PARAM(
935 		NSS_DBNAM_EXECATTR,
936 		sw,
937 		nsw_config_db,
938 		nscd_cfg_switch_t,
939 		&nscd_cfg_execattr_cfg_db,
940 		sizeof (nscd_cfg_execattr_cfg_db)),
941 
942 	NSCD_CFG_DB_DEFAULT_PARAM(
943 		NSS_DBNAM_PASSWD_COMPAT,
944 		sw,
945 		nsw_config_string,
946 		nscd_cfg_switch_t,
947 		&nscd_cfg_def_passwd_compat,
948 		sizeof (nscd_cfg_def_passwd_compat)),
949 
950 	NSCD_CFG_DB_DEFAULT_PARAM(
951 		NSS_DBNAM_GROUP_COMPAT,
952 		sw,
953 		nsw_config_string,
954 		nscd_cfg_switch_t,
955 		&nscd_cfg_def_group_compat,
956 		sizeof (nscd_cfg_def_group_compat)),
957 
958 	NSCD_CFG_DB_DEFAULT_NULL
959 };
960 
961 /*
962  * switch database specific defaults that are linked to
963  * those of other databases
964  */
965 nscd_cfg_nsw_spc_default_t	_nscd_cfg_nsw_link_default[] = {
966 
967 	NSCD_CFG_DB_DEFAULT_PARAM(
968 		NSS_DBNAM_SHADOW,
969 		sw,
970 		nsw_config_string,
971 		nscd_cfg_switch_t,
972 		&nscd_cfg_passwd_cfg_link,
973 		0),
974 
975 	NSCD_CFG_DB_DEFAULT_PARAM(
976 		NSS_DBNAM_USERATTR,
977 		sw,
978 		nsw_config_string,
979 		nscd_cfg_switch_t,
980 		&nscd_cfg_passwd_cfg_link,
981 		0),
982 
983 	NSCD_CFG_DB_DEFAULT_PARAM(
984 		NSS_DBNAM_AUDITUSER,
985 		sw,
986 		nsw_config_string,
987 		nscd_cfg_switch_t,
988 		&nscd_cfg_passwd_cfg_link,
989 		0),
990 
991 	NSCD_CFG_DB_DEFAULT_PARAM(
992 		NSS_DBNAM_EXECATTR,
993 		sw,
994 		nsw_config_string,
995 		nscd_cfg_switch_t,
996 		&nscd_cfg_profattr_cfg_link,
997 		0),
998 
999 	NSCD_CFG_DB_DEFAULT_NULL
1000 };
1001 
1002 /*
1003  * macros for defining the static stats table
1004  */
1005 #define	NSCD_CFG_SGROUP_DESC(sn, type, sflag, gi, \
1006 		gf, g_in_t, gsfunc_name) \
1007 	{ \
1008 		{-1, sn}, type, NSCD_CFG_SFLAG_GROUP | sflag, gi, \
1009 		0, 0, 0,\
1010 		NSCD_SIZEOF(g_in_t, gf), offsetof(g_in_t, gf), -1, \
1011 		gsfunc_name \
1012 	}
1013 
1014 #define	NSCD_CFG_STAT_DESC(sn, type, sflag, sf, s_in_t, \
1015 		gf, g_in_t, gsfunc_name) \
1016 	{ \
1017 		{-1, sn}, type, sflag, NSCD_CFG_GROUP_INFO_NULL, \
1018 		NSCD_SIZEOF(s_in_t, sf), offsetof(s_in_t, sf), -1, \
1019 		NSCD_SIZEOF(g_in_t, gf), offsetof(g_in_t, gf), -1, \
1020 		gsfunc_name \
1021 	}
1022 
1023 #define	NSCD_CFG_SGROUP_DESC_NULL \
1024 	{ \
1025 		{-1, NULL}, -1, NSCD_CFG_SFLAG_GROUP, NULL, \
1026 		0, 0, 0, \
1027 		0, 0, 0, \
1028 		NULL \
1029 	}
1030 
1031 /*
1032  * the static statistics description table
1033  */
1034 static	nscd_cfg_stat_desc_t	_nscd_cfg_stat_desc[] = {
1035 
1036 	NSCD_CFG_SGROUP_DESC(
1037 		"stat-group-global-log",
1038 		NSCD_CFG_DATA_NONE,
1039 		NSCD_CFG_SFLAG_GLOBAL,
1040 		NSCD_CFG_STAT_GROUP_INFO_GLOBAL_LOG,
1041 		log,
1042 		nscd_cfg_stat_global_data_t,
1043 		_nscd_cfg_log_get_stat),
1044 
1045 	NSCD_CFG_STAT_DESC(
1046 		"entries-logged",
1047 		NSCD_CFG_DATA_INTEGER,
1048 		NSCD_CFG_SFLAG_GLOBAL,
1049 		entries_logged,
1050 		nscd_cfg_stat_global_log_t,
1051 		log,
1052 		nscd_cfg_stat_global_data_t,
1053 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1054 
1055 	NSCD_CFG_SGROUP_DESC(
1056 		"stat-group-global-switch",
1057 		NSCD_CFG_DATA_NONE,
1058 		NSCD_CFG_SFLAG_GLOBAL,
1059 		NSCD_CFG_STAT_GROUP_INFO_GLOBAL_SWITCH,
1060 		sw,
1061 		nscd_cfg_stat_global_data_t,
1062 		_nscd_cfg_switch_get_stat),
1063 
1064 	NSCD_CFG_STAT_DESC(
1065 		"global-lookup-request-received",
1066 		NSCD_CFG_DATA_INTEGER,
1067 		NSCD_CFG_SFLAG_GLOBAL,
1068 		lookup_request_received_g,
1069 		nscd_cfg_stat_global_switch_t,
1070 		sw,
1071 		nscd_cfg_stat_global_data_t,
1072 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1073 
1074 	NSCD_CFG_STAT_DESC(
1075 		"global-lookup-request-queued",
1076 		NSCD_CFG_DATA_INTEGER,
1077 		NSCD_CFG_SFLAG_GLOBAL,
1078 		lookup_request_queued_g,
1079 		nscd_cfg_stat_global_switch_t,
1080 		sw,
1081 		nscd_cfg_stat_global_data_t,
1082 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1083 
1084 	NSCD_CFG_STAT_DESC(
1085 		"global-lookup-request-in-progress",
1086 		NSCD_CFG_DATA_INTEGER,
1087 		NSCD_CFG_SFLAG_GLOBAL,
1088 		lookup_request_in_progress_g,
1089 		nscd_cfg_stat_global_switch_t,
1090 		sw,
1091 		nscd_cfg_stat_global_data_t,
1092 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1093 
1094 	NSCD_CFG_STAT_DESC(
1095 		"global-lookup-request-succeeded",
1096 		NSCD_CFG_DATA_INTEGER,
1097 		NSCD_CFG_SFLAG_GLOBAL,
1098 		lookup_request_succeeded_g,
1099 		nscd_cfg_stat_global_switch_t,
1100 		sw,
1101 		nscd_cfg_stat_global_data_t,
1102 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1103 
1104 	NSCD_CFG_STAT_DESC(
1105 		"global-lookup-request-failed",
1106 		NSCD_CFG_DATA_INTEGER,
1107 		NSCD_CFG_SFLAG_GLOBAL,
1108 		lookup_request_failed_g,
1109 		nscd_cfg_stat_global_switch_t,
1110 		sw,
1111 		nscd_cfg_stat_global_data_t,
1112 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1113 
1114 	NSCD_CFG_STAT_DESC(
1115 		"global-loopback-nsw-db-skipped",
1116 		NSCD_CFG_DATA_INTEGER,
1117 		NSCD_CFG_SFLAG_GLOBAL,
1118 		loopback_nsw_db_skipped_g,
1119 		nscd_cfg_stat_global_switch_t,
1120 		sw,
1121 		nscd_cfg_stat_global_data_t,
1122 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1123 
1124 	NSCD_CFG_SGROUP_DESC(
1125 		"stat-group-global-cache",
1126 		NSCD_CFG_DATA_NONE,
1127 		NSCD_CFG_SFLAG_GLOBAL,
1128 		NSCD_CFG_STAT_GROUP_INFO_CACHE,
1129 		cache,
1130 		nscd_cfg_stat_global_data_t,
1131 		_nscd_cfg_cache_get_stat),
1132 
1133 	NSCD_CFG_STAT_DESC(
1134 		"global-cache-hits-on-positive",
1135 		NSCD_CFG_DATA_INTEGER,
1136 		NSCD_CFG_SFLAG_GLOBAL,
1137 		pos_hits,
1138 		nscd_cfg_stat_cache_t,
1139 		cache,
1140 		nscd_cfg_stat_global_data_t,
1141 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1142 
1143 	NSCD_CFG_STAT_DESC(
1144 		"global-cache-hits-on-negative",
1145 		NSCD_CFG_DATA_INTEGER,
1146 		NSCD_CFG_SFLAG_GLOBAL,
1147 		neg_hits,
1148 		nscd_cfg_stat_cache_t,
1149 		cache,
1150 		nscd_cfg_stat_global_data_t,
1151 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1152 
1153 	NSCD_CFG_STAT_DESC(
1154 		"global-cache-misses-on-positive",
1155 		NSCD_CFG_DATA_INTEGER,
1156 		NSCD_CFG_SFLAG_GLOBAL,
1157 		pos_misses,
1158 		nscd_cfg_stat_cache_t,
1159 		cache,
1160 		nscd_cfg_stat_global_data_t,
1161 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1162 
1163 	NSCD_CFG_STAT_DESC(
1164 		"global-cache-misses-on-negative",
1165 		NSCD_CFG_DATA_INTEGER,
1166 		NSCD_CFG_SFLAG_GLOBAL,
1167 		neg_misses,
1168 		nscd_cfg_stat_cache_t,
1169 		cache,
1170 		nscd_cfg_stat_global_data_t,
1171 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1172 
1173 	NSCD_CFG_STAT_DESC(
1174 		"global-cache-queries-queued",
1175 		NSCD_CFG_DATA_INTEGER,
1176 		NSCD_CFG_SFLAG_GLOBAL,
1177 		wait_count,
1178 		nscd_cfg_stat_cache_t,
1179 		cache,
1180 		nscd_cfg_stat_global_data_t,
1181 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1182 
1183 	NSCD_CFG_STAT_DESC(
1184 		"global-total-cache-entries",
1185 		NSCD_CFG_DATA_INTEGER,
1186 		NSCD_CFG_SFLAG_GLOBAL,
1187 		entries,
1188 		nscd_cfg_stat_cache_t,
1189 		cache,
1190 		nscd_cfg_stat_global_data_t,
1191 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1192 
1193 	NSCD_CFG_STAT_DESC(
1194 		"global-complete-cache-invalidations",
1195 		NSCD_CFG_DATA_INTEGER,
1196 		NSCD_CFG_SFLAG_GLOBAL,
1197 		invalidate_count,
1198 		nscd_cfg_stat_cache_t,
1199 		cache,
1200 		nscd_cfg_stat_global_data_t,
1201 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1202 
1203 	NSCD_CFG_STAT_DESC(
1204 		"global-cache-queries-dropped",
1205 		NSCD_CFG_DATA_INTEGER,
1206 		NSCD_CFG_SFLAG_GLOBAL,
1207 		drop_count,
1208 		nscd_cfg_stat_cache_t,
1209 		cache,
1210 		nscd_cfg_stat_global_data_t,
1211 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1212 
1213 	NSCD_CFG_STAT_DESC(
1214 		"global-cache-hit-rate",
1215 		NSCD_CFG_DATA_PERCENT,
1216 		NSCD_CFG_SFLAG_GLOBAL,
1217 		hitrate,
1218 		nscd_cfg_stat_cache_t,
1219 		cache,
1220 		nscd_cfg_stat_global_data_t,
1221 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1222 
1223 	/* non-global stat from this point on */
1224 
1225 	NSCD_CFG_SGROUP_DESC(
1226 		"stat-group-switch",
1227 		NSCD_CFG_DATA_NONE,
1228 		NSCD_CFG_SFLAG_GROUP,
1229 		NSCD_CFG_STAT_GROUP_INFO_SWITCH,
1230 		cache,
1231 		nscd_cfg_stat_nsw_db_data_t,
1232 		_nscd_cfg_switch_get_stat),
1233 
1234 	NSCD_CFG_STAT_DESC(
1235 		"lookup-request-received",
1236 		NSCD_CFG_DATA_INTEGER,
1237 		NSCD_CFG_SFLAG_NONE,
1238 		lookup_request_received,
1239 		nscd_cfg_stat_switch_t,
1240 		sw,
1241 		nscd_cfg_stat_nsw_db_data_t,
1242 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1243 
1244 	NSCD_CFG_STAT_DESC(
1245 		"lookup-request-queued",
1246 		NSCD_CFG_DATA_INTEGER,
1247 		NSCD_CFG_SFLAG_NONE,
1248 		lookup_request_queued,
1249 		nscd_cfg_stat_switch_t,
1250 		sw,
1251 		nscd_cfg_stat_nsw_db_data_t,
1252 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1253 
1254 	NSCD_CFG_STAT_DESC(
1255 		"lookup-request-in-progress",
1256 		NSCD_CFG_DATA_INTEGER,
1257 		NSCD_CFG_SFLAG_NONE,
1258 		lookup_request_in_progress,
1259 		nscd_cfg_stat_switch_t,
1260 		sw,
1261 		nscd_cfg_stat_nsw_db_data_t,
1262 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1263 
1264 	NSCD_CFG_STAT_DESC(
1265 		"lookup-request-succeeded",
1266 		NSCD_CFG_DATA_INTEGER,
1267 		NSCD_CFG_SFLAG_NONE,
1268 		lookup_request_succeeded,
1269 		nscd_cfg_stat_switch_t,
1270 		sw,
1271 		nscd_cfg_stat_nsw_db_data_t,
1272 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1273 
1274 	NSCD_CFG_STAT_DESC(
1275 		"lookup-request-failed",
1276 		NSCD_CFG_DATA_INTEGER,
1277 		NSCD_CFG_SFLAG_NONE,
1278 		lookup_request_failed,
1279 		nscd_cfg_stat_switch_t,
1280 		sw,
1281 		nscd_cfg_stat_nsw_db_data_t,
1282 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1283 
1284 	NSCD_CFG_STAT_DESC(
1285 		"loopback-nsw-db-skipped",
1286 		NSCD_CFG_DATA_INTEGER,
1287 		NSCD_CFG_SFLAG_NONE,
1288 		loopback_nsw_db_skipped,
1289 		nscd_cfg_stat_switch_t,
1290 		sw,
1291 		nscd_cfg_stat_nsw_db_data_t,
1292 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1293 
1294 	NSCD_CFG_SGROUP_DESC(
1295 		"stat-group-cache",
1296 		NSCD_CFG_DATA_NONE,
1297 		NSCD_CFG_SFLAG_GROUP,
1298 		NSCD_CFG_STAT_GROUP_INFO_CACHE,
1299 		cache,
1300 		nscd_cfg_stat_nsw_db_data_t,
1301 		_nscd_cfg_cache_get_stat),
1302 
1303 	NSCD_CFG_STAT_DESC(
1304 		"cache-hits-on-positive",
1305 		NSCD_CFG_DATA_INTEGER,
1306 		NSCD_CFG_SFLAG_NONE,
1307 		pos_hits,
1308 		nscd_cfg_stat_cache_t,
1309 		cache,
1310 		nscd_cfg_stat_nsw_db_data_t,
1311 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1312 
1313 	NSCD_CFG_STAT_DESC(
1314 		"cache-hits-on-negative",
1315 		NSCD_CFG_DATA_INTEGER,
1316 		NSCD_CFG_SFLAG_NONE,
1317 		neg_hits,
1318 		nscd_cfg_stat_cache_t,
1319 		cache,
1320 		nscd_cfg_stat_nsw_db_data_t,
1321 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1322 
1323 	NSCD_CFG_STAT_DESC(
1324 		"cache-misses-on-positive",
1325 		NSCD_CFG_DATA_INTEGER,
1326 		NSCD_CFG_SFLAG_NONE,
1327 		pos_misses,
1328 		nscd_cfg_stat_cache_t,
1329 		cache,
1330 		nscd_cfg_stat_nsw_db_data_t,
1331 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1332 
1333 	NSCD_CFG_STAT_DESC(
1334 		"cache-misses-on-negative",
1335 		NSCD_CFG_DATA_INTEGER,
1336 		NSCD_CFG_SFLAG_NONE,
1337 		neg_misses,
1338 		nscd_cfg_stat_cache_t,
1339 		cache,
1340 		nscd_cfg_stat_nsw_db_data_t,
1341 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1342 
1343 	NSCD_CFG_STAT_DESC(
1344 		"cache-queries-queued",
1345 		NSCD_CFG_DATA_INTEGER,
1346 		NSCD_CFG_SFLAG_NONE,
1347 		wait_count,
1348 		nscd_cfg_stat_cache_t,
1349 		cache,
1350 		nscd_cfg_stat_nsw_db_data_t,
1351 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1352 
1353 	NSCD_CFG_STAT_DESC(
1354 		"total-cache-entries",
1355 		NSCD_CFG_DATA_INTEGER,
1356 		NSCD_CFG_SFLAG_NONE,
1357 		entries,
1358 		nscd_cfg_stat_cache_t,
1359 		cache,
1360 		nscd_cfg_stat_nsw_db_data_t,
1361 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1362 
1363 	NSCD_CFG_STAT_DESC(
1364 		"complete-cache-invalidations",
1365 		NSCD_CFG_DATA_INTEGER,
1366 		NSCD_CFG_SFLAG_NONE,
1367 		invalidate_count,
1368 		nscd_cfg_stat_cache_t,
1369 		cache,
1370 		nscd_cfg_stat_nsw_db_data_t,
1371 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1372 
1373 	NSCD_CFG_STAT_DESC(
1374 		"cache-hit-rate",
1375 		NSCD_CFG_DATA_PERCENT,
1376 		NSCD_CFG_SFLAG_NONE,
1377 		hitrate,
1378 		nscd_cfg_stat_cache_t,
1379 		cache,
1380 		nscd_cfg_stat_nsw_db_data_t,
1381 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1382 
1383 	NSCD_CFG_STAT_DESC(
1384 		"cache-queries-dropped",
1385 		NSCD_CFG_DATA_PERCENT,
1386 		NSCD_CFG_SFLAG_NONE,
1387 		drop_count,
1388 		nscd_cfg_stat_cache_t,
1389 		cache,
1390 		nscd_cfg_stat_nsw_db_data_t,
1391 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1392 
1393 
1394 	NSCD_CFG_SGROUP_DESC_NULL
1395 };
1396 
1397 /* number of entries in the static tables */
1398 
1399 int _nscd_cfg_num_nsw_src =
1400 	(sizeof (_nscd_cfg_nsw_src) /
1401 		sizeof (_nscd_cfg_nsw_src[0]) - 1);
1402 
1403 int _nscd_cfg_num_smf_services =
1404 	(sizeof (_nscd_cfg_smf_services) /
1405 		sizeof (_nscd_cfg_smf_services[0]) - 1);
1406 
1407 /* number of supported nsw databases (including pseudo ones) */
1408 int _nscd_cfg_num_nsw_db_all =
1409 	(sizeof (_nscd_cfg_nsw_db) /
1410 		sizeof (_nscd_cfg_nsw_db[0]) - 1);
1411 
1412 /* number of supported nsw databases (not including pseudo ones) */
1413 int _nscd_cfg_num_nsw_db =
1414 	(sizeof (_nscd_cfg_nsw_db) /
1415 		sizeof (_nscd_cfg_nsw_db[0]) - 1) -
1416 		NSS_DBNAM_COMPAT_NUM_DB;
1417 
1418 static int _nscd_cfg_num_param =
1419 	(sizeof (_nscd_cfg_param_desc) /
1420 		sizeof (_nscd_cfg_param_desc[0]) - 1);
1421 
1422 static int _nscd_cfg_num_stat =
1423 	(sizeof (_nscd_cfg_stat_desc) /
1424 		sizeof (_nscd_cfg_stat_desc[0]) - 1);
1425 
1426 int _nscd_cfg_num_nsw_default =
1427 	(sizeof (_nscd_cfg_nsw_spc_default) /
1428 		sizeof (_nscd_cfg_nsw_spc_default[0]) - 1);
1429 
1430 int _nscd_cfg_num_link_default =
1431 	(sizeof (_nscd_cfg_nsw_link_default) /
1432 		sizeof (_nscd_cfg_nsw_link_default[0]) - 1);
1433 
1434 #ifdef	__cplusplus
1435 }
1436 #endif
1437 
1438 #endif	/* _NSCD_CFGDEF_H */
1439