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