xref: /titanic_51/usr/src/cmd/nscd/nscd_cfgdef.h (revision 32885d593baf8bac788fa78885893a51b3ad0f28)
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 		"max-per-user-nscd",
389 		NSCD_CFG_DATA_INTEGER,
390 		NSCD_CFG_PFLAG_GLOBAL,
391 		max_per_user_nscd,
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_PARAM_DESC(
400 		"per-user-nscd-ttl",
401 		NSCD_CFG_DATA_INTEGER,
402 		NSCD_CFG_PFLAG_GLOBAL,
403 		per_user_nscd_ttl,
404 		nscd_cfg_global_selfcred_t,
405 		sc,
406 		nscd_cfg_global_data_t,
407 		NULL,
408 		NSCD_CFG_FUNC_NOTIFY_AS_GROUP,
409 		NSCD_CFG_FUNC_VERIFY_AS_GROUP),
410 
411 	NSCD_CFG_PGROUP_DESC(
412 		"param-group-global-switch",
413 		NSCD_CFG_DATA_NONE,
414 		NSCD_CFG_PFLAG_INIT_SEND_WHOLE_GROUP |
415 		NSCD_CFG_PFLAG_GLOBAL,
416 		sw,
417 		nscd_cfg_global_data_t,
418 		NULL,
419 		_nscd_cfg_switch_notify,
420 		_nscd_cfg_switch_verify),
421 
422 	NSCD_CFG_PARAM_DESC(
423 		"global-enable-lookup",
424 		NSCD_CFG_DATA_BOOLEAN,
425 		NSCD_CFG_PFLAG_GLOBAL,
426 		enable_lookup_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-enable-loopback-checking",
436 		NSCD_CFG_DATA_BOOLEAN,
437 		NSCD_CFG_PFLAG_GLOBAL,
438 		enable_loopback_checking_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_PARAM_DESC(
447 		"global-check-smf-state-interval",
448 		NSCD_CFG_DATA_INTEGER,
449 		NSCD_CFG_PFLAG_GLOBAL,
450 		check_smf_state_interval_g,
451 		nscd_cfg_global_switch_t,
452 		sw,
453 		nscd_cfg_global_data_t,
454 		NULL,
455 		NSCD_CFG_FUNC_NOTIFY_AS_GROUP,
456 		NSCD_CFG_FUNC_VERIFY_AS_GROUP),
457 
458 	NSCD_CFG_PGROUP_DESC(
459 		"param-group-global-cache",
460 		NSCD_CFG_DATA_NONE,
461 		NSCD_CFG_PFLAG_INIT_SEND_WHOLE_GROUP |
462 		NSCD_CFG_PFLAG_INIT_SET_ALL_DB |
463 		NSCD_CFG_PFLAG_GLOBAL,
464 		cache,
465 		nscd_cfg_global_data_t,
466 		NULL,
467 		_nscd_cfg_cache_notify,
468 		_nscd_cfg_cache_verify),
469 
470 	NSCD_CFG_PARAM_DESC(
471 		"global-enable-cache",
472 		NSCD_CFG_DATA_BOOLEAN,
473 		NSCD_CFG_PFLAG_GLOBAL,
474 		enable,
475 		nscd_cfg_global_cache_t,
476 		cache,
477 		nscd_cfg_global_data_t,
478 		NULL,
479 		NSCD_CFG_FUNC_NOTIFY_AS_GROUP,
480 		NSCD_CFG_FUNC_VERIFY_AS_GROUP),
481 
482 	/* non-global config param from this point on */
483 
484 	NSCD_CFG_PGROUP_DESC(
485 		"param-group-frontend",
486 		NSCD_CFG_DATA_NONE,
487 		NSCD_CFG_PFLAG_INIT_SEND_WHOLE_GROUP,
488 		fe,
489 		nscd_cfg_nsw_db_data_t,
490 		NULL,
491 		_nscd_cfg_frontend_notify,
492 		_nscd_cfg_frontend_verify),
493 
494 	NSCD_CFG_PARAM_DESC(
495 		"worker-thread-per-nsw-db",
496 		NSCD_CFG_DATA_INTEGER,
497 		NSCD_CFG_PFLAG_NONE,
498 		worker_thread_per_nsw_db,
499 		nscd_cfg_frontend_t,
500 		fe,
501 		nscd_cfg_nsw_db_data_t,
502 		NULL,
503 		NSCD_CFG_FUNC_NOTIFY_AS_GROUP,
504 		NSCD_CFG_FUNC_VERIFY_AS_GROUP),
505 
506 	NSCD_CFG_PGROUP_DESC(
507 		"param-group-switch",
508 		NSCD_CFG_DATA_NONE,
509 		NSCD_CFG_PFLAG_INIT_SEND_WHOLE_GROUP |
510 		NSCD_CFG_PFLAG_NONE,
511 		sw,
512 		nscd_cfg_nsw_db_data_t,
513 		NULL,
514 		_nscd_cfg_switch_notify,
515 		_nscd_cfg_switch_verify),
516 
517 	NSCD_CFG_PARAM_DESC(
518 		"nsw-config-string",
519 		NSCD_CFG_DATA_STRING,
520 		NSCD_CFG_PFLAG_VLEN_DATA |
521 		NSCD_CFG_PFLAG_LINKED,
522 		nsw_config_string,
523 		nscd_cfg_switch_t,
524 		sw,
525 		nscd_cfg_nsw_db_data_t,
526 		&NSCD_CFG_NSWCFGSTR_PCHECK,
527 		NSCD_CFG_FUNC_NOTIFY_AS_GROUP,
528 		NSCD_CFG_FUNC_VERIFY_AS_GROUP),
529 
530 	NSCD_CFG_PARAM_DESC(
531 		"nsw-config-database",
532 		NSCD_CFG_DATA_STRING,
533 		NSCD_CFG_PFLAG_VLEN_DATA |
534 		NSCD_CFG_PFLAG_HIDDEN,
535 		nsw_config_db,
536 		nscd_cfg_switch_t,
537 		sw,
538 		nscd_cfg_nsw_db_data_t,
539 		&NSCD_CFG_NSWCFGSTR_PCHECK,
540 		NSCD_CFG_FUNC_NOTIFY_AS_GROUP,
541 		NSCD_CFG_FUNC_VERIFY_AS_GROUP),
542 
543 	NSCD_CFG_PARAM_DESC(
544 		"enable-lookup",
545 		NSCD_CFG_DATA_BOOLEAN,
546 		NSCD_CFG_PFLAG_NONE,
547 		enable_lookup,
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 		"enable-loopback-checking",
557 		NSCD_CFG_DATA_BOOLEAN,
558 		NSCD_CFG_PFLAG_NONE,
559 		enable_loopback_checking,
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-db",
569 		NSCD_CFG_DATA_INTEGER,
570 		NSCD_CFG_PFLAG_NONE,
571 		max_nsw_state_per_db,
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-nsw-state-per-thread",
581 		NSCD_CFG_DATA_INTEGER,
582 		NSCD_CFG_PFLAG_NONE,
583 		max_nsw_state_per_thread,
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_PARAM_DESC(
592 		"max-getent-ctx-per-db",
593 		NSCD_CFG_DATA_INTEGER,
594 		NSCD_CFG_PFLAG_NONE,
595 		max_getent_ctx_per_db,
596 		nscd_cfg_switch_t,
597 		sw,
598 		nscd_cfg_nsw_db_data_t,
599 		NULL,
600 		NSCD_CFG_FUNC_NOTIFY_AS_GROUP,
601 		NSCD_CFG_FUNC_VERIFY_AS_GROUP),
602 
603 	NSCD_CFG_PGROUP_DESC(
604 		"param-group-cache",
605 		NSCD_CFG_DATA_NONE,
606 		NSCD_CFG_PFLAG_INIT_SEND_WHOLE_GROUP,
607 		cache,
608 		nscd_cfg_nsw_db_data_t,
609 		NULL,
610 		_nscd_cfg_cache_notify,
611 		_nscd_cfg_cache_verify),
612 
613 	NSCD_CFG_PARAM_DESC(
614 		"enable-cache",
615 		NSCD_CFG_DATA_BOOLEAN,
616 		NSCD_CFG_PFLAG_NONE,
617 		enable,
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 		"enable-per-user-cache",
627 		NSCD_CFG_DATA_BOOLEAN,
628 		NSCD_CFG_PFLAG_NONE,
629 		per_user,
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 		"avoid-nameservice",
639 		NSCD_CFG_DATA_BOOLEAN,
640 		NSCD_CFG_PFLAG_NONE,
641 		avoid_ns,
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-files",
651 		NSCD_CFG_DATA_BOOLEAN,
652 		NSCD_CFG_PFLAG_NONE,
653 		check_files,
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 		"check-file-interval",
663 		NSCD_CFG_DATA_INTEGER,
664 		NSCD_CFG_PFLAG_NONE,
665 		check_interval,
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 		"positive-time-to-live",
675 		NSCD_CFG_DATA_INTEGER,
676 		NSCD_CFG_PFLAG_NONE,
677 		pos_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 		"negative-time-to-live",
687 		NSCD_CFG_DATA_INTEGER,
688 		NSCD_CFG_PFLAG_NONE,
689 		neg_ttl,
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 		"keep-hot-count",
699 		NSCD_CFG_DATA_INTEGER,
700 		NSCD_CFG_PFLAG_NONE,
701 		keephot,
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 		"hint-size",
711 		NSCD_CFG_DATA_INTEGER,
712 		NSCD_CFG_PFLAG_NONE,
713 		hint_size,
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 		"maximum-entries-allowed",
723 		NSCD_CFG_DATA_INTEGER,
724 		NSCD_CFG_PFLAG_NONE,
725 		maxentries,
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 		"suggested-size",
735 		NSCD_CFG_DATA_INTEGER,
736 		NSCD_CFG_PFLAG_OBSOLETE,
737 		suggestedsize,
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_PARAM_DESC(
746 		"old-data-ok",
747 		NSCD_CFG_DATA_BOOLEAN,
748 		NSCD_CFG_PFLAG_OBSOLETE,
749 		old_data_ok,
750 		nscd_cfg_cache_t,
751 		cache,
752 		nscd_cfg_nsw_db_data_t,
753 		NULL,
754 		NSCD_CFG_FUNC_NOTIFY_AS_GROUP,
755 		NSCD_CFG_FUNC_VERIFY_AS_GROUP),
756 
757 	NSCD_CFG_PGROUP_DESC_NULL
758 };
759 
760 /*
761  * defaults for the global configuration
762  */
763 static nscd_cfg_global_data_t nscd_cfg_global_default = {
764 
765 	/*
766 	 * nscd_cfg_global_log_t
767 	 */
768 	{
769 
770 	NSCD_CFG_GROUP_INFO_GLOBAL_LOG,
771 	NULL,
772 	NSCD_LOG_LEVEL_NONE,	/* debug_level */
773 	NSCD_LOG_CACHE,		/* debug_comp */
774 
775 	},
776 
777 	/*
778 	 * nscd_cfg_global_frontend_t
779 	 */
780 	{
781 
782 	NSCD_CFG_GROUP_INFO_GLOBAL_FRONTEND,
783 	100,			/* common_worker_threads */
784 	100,			/* cache_hit_threads */
785 
786 	},
787 
788 	/*
789 	 * nscd_cfg_global_selfcred_t
790 	 */
791 	{
792 
793 	NSCD_CFG_GROUP_INFO_GLOBAL_SELFCRED,
794 	nscd_true,		/* enable_selfcred */
795 	1000,			/* max_per_user_nscd */
796 	120,			/* per_user_nscd_ttl: 120 seconds */
797 
798 	},
799 
800 	/*
801 	 * nscd_cfg_global_switch_t
802 	 */
803 	{
804 
805 	NSCD_CFG_GROUP_INFO_GLOBAL_SWITCH,
806 	nscd_true,		/* enable_lookup_g */
807 	nscd_false,		/* enable_loopback_checking_g */
808 	120,			/* check_smf_state_interval_g */
809 
810 	},
811 
812 	/*
813 	 * nscd_cfg_global_cache_t
814 	 */
815 	NSCD_CFG_GLOBAL_CACHE_DEFAULTS
816 };
817 
818 /*
819  * defaults for the per switch database configuration
820  */
821 static nscd_cfg_nsw_db_data_t nscd_cfg_nsw_db_data_default = {
822 
823 	/*
824 	 * nscd_cfg_frontend_t
825 	 */
826 	{
827 
828 	NSCD_CFG_GROUP_INFO_FRONTEND,
829 	50, 			/* worker_thread_per_nsw_db */
830 
831 	},
832 
833 	/*
834 	 * nscd_cfg_switch_t
835 	 */
836 	{
837 
838 	NSCD_CFG_GROUP_INFO_SWITCH,
839 	"nis files",		/* nsw_config_string */
840 	NULL,			/* nsw_config_db */
841 	nscd_true,		/* enable_lookup */
842 	nscd_false,		/* enable_loopback_checking */
843 	288,			/* max_nsw_state_per_db */
844 	32,			/* max_nsw_state_per_thread */
845 	256,			/* max_getent_ctx_per_db */
846 
847 	},
848 
849 	/*
850 	 * nscd_cfg_cache_t
851 	 */
852 	NSCD_CFG_CACHE_DEFAULTS
853 };
854 
855 /*
856  * macros for defining the database specific defaults
857  */
858 #define	NSCD_CFG_DB_DEFAULT_PARAM(db, gf, pf, gt, defaddr, deflen) \
859 	{ \
860 		db, offsetof(nscd_cfg_nsw_db_data_t, gf), \
861 		offsetof(gt, pf), defaddr, deflen \
862 	}
863 
864 #define	NSCD_CFG_DB_DEFAULT_GROUP(db, gf, defaddr, deflen) \
865 	{ \
866 		db, offsetof(nscd_cfg_nsw_db_data_t, gf), \
867 		0, defaddr, deflen \
868 	}
869 
870 #define	NSCD_CFG_DB_DEFAULT_NULL \
871 	{ \
872 		NULL, 0, 0, NULL, 0 \
873 	}
874 
875 /*
876  * shadow, user_attr, and audit_user use the same switch policy
877  * as that of passwd. exec_attr use that of prof_attr.
878  */
879 static char *nscd_cfg_shadow_cfg_db	= NSS_DBNAM_PASSWD;
880 static char *nscd_cfg_userattr_cfg_db	= NSS_DBNAM_PASSWD;
881 static char *nscd_cfg_auuser_cfg_db	= NSS_DBNAM_PASSWD;
882 static char *nscd_cfg_execattr_cfg_db	= NSS_DBNAM_PROFATTR;
883 
884 /*
885  * default switch policy for pseudo-databases passwd_compat and
886  * and group_compa is "nis"
887  */
888 static char *nscd_cfg_def_passwd_compat	= NSS_DEFCONF_PASSWD_COMPAT;
889 static char *nscd_cfg_def_group_compat	= NSS_DEFCONF_GROUP_COMPAT;
890 
891 static nscd_cfg_nsw_spc_default_t nscd_cfg_passwd_cfg_link =
892 	NSCD_CFG_DB_DEFAULT_PARAM(
893 		NSS_DBNAM_PASSWD,
894 		sw,
895 		nsw_config_string,
896 		nscd_cfg_switch_t,
897 		NULL,
898 		NSCD_SIZEOF(nscd_cfg_switch_t, nsw_config_string));
899 
900 static nscd_cfg_nsw_spc_default_t nscd_cfg_profattr_cfg_link =
901 	NSCD_CFG_DB_DEFAULT_PARAM(
902 		NSS_DBNAM_PROFATTR,
903 		sw,
904 		nsw_config_string,
905 		nscd_cfg_switch_t,
906 		NULL,
907 		NSCD_SIZEOF(nscd_cfg_switch_t, nsw_config_string));
908 
909 
910 /*
911  * switch database specific defaults
912  */
913 nscd_cfg_nsw_spc_default_t	_nscd_cfg_nsw_spc_default[] = {
914 
915 	NSCD_CFG_DB_DEFAULT_PARAM(
916 	NSS_DBNAM_SHADOW,
917 		sw,
918 		nsw_config_db,
919 		nscd_cfg_switch_t,
920 		&nscd_cfg_shadow_cfg_db,
921 		sizeof (nscd_cfg_shadow_cfg_db)),
922 
923 	NSCD_CFG_DB_DEFAULT_PARAM(
924 		NSS_DBNAM_USERATTR,
925 		sw,
926 		nsw_config_db,
927 		nscd_cfg_switch_t,
928 		&nscd_cfg_userattr_cfg_db,
929 		sizeof (nscd_cfg_userattr_cfg_db)),
930 
931 	NSCD_CFG_DB_DEFAULT_PARAM(
932 		NSS_DBNAM_AUDITUSER,
933 		sw,
934 		nsw_config_db,
935 		nscd_cfg_switch_t,
936 		&nscd_cfg_auuser_cfg_db,
937 		sizeof (nscd_cfg_auuser_cfg_db)),
938 
939 	NSCD_CFG_DB_DEFAULT_PARAM(
940 		NSS_DBNAM_EXECATTR,
941 		sw,
942 		nsw_config_db,
943 		nscd_cfg_switch_t,
944 		&nscd_cfg_execattr_cfg_db,
945 		sizeof (nscd_cfg_execattr_cfg_db)),
946 
947 	NSCD_CFG_DB_DEFAULT_PARAM(
948 		NSS_DBNAM_PASSWD_COMPAT,
949 		sw,
950 		nsw_config_string,
951 		nscd_cfg_switch_t,
952 		&nscd_cfg_def_passwd_compat,
953 		sizeof (nscd_cfg_def_passwd_compat)),
954 
955 	NSCD_CFG_DB_DEFAULT_PARAM(
956 		NSS_DBNAM_GROUP_COMPAT,
957 		sw,
958 		nsw_config_string,
959 		nscd_cfg_switch_t,
960 		&nscd_cfg_def_group_compat,
961 		sizeof (nscd_cfg_def_group_compat)),
962 
963 	NSCD_CFG_DB_DEFAULT_NULL
964 };
965 
966 /*
967  * switch database specific defaults that are linked to
968  * those of other databases
969  */
970 nscd_cfg_nsw_spc_default_t	_nscd_cfg_nsw_link_default[] = {
971 
972 	NSCD_CFG_DB_DEFAULT_PARAM(
973 		NSS_DBNAM_SHADOW,
974 		sw,
975 		nsw_config_string,
976 		nscd_cfg_switch_t,
977 		&nscd_cfg_passwd_cfg_link,
978 		0),
979 
980 	NSCD_CFG_DB_DEFAULT_PARAM(
981 		NSS_DBNAM_USERATTR,
982 		sw,
983 		nsw_config_string,
984 		nscd_cfg_switch_t,
985 		&nscd_cfg_passwd_cfg_link,
986 		0),
987 
988 	NSCD_CFG_DB_DEFAULT_PARAM(
989 		NSS_DBNAM_AUDITUSER,
990 		sw,
991 		nsw_config_string,
992 		nscd_cfg_switch_t,
993 		&nscd_cfg_passwd_cfg_link,
994 		0),
995 
996 	NSCD_CFG_DB_DEFAULT_PARAM(
997 		NSS_DBNAM_EXECATTR,
998 		sw,
999 		nsw_config_string,
1000 		nscd_cfg_switch_t,
1001 		&nscd_cfg_profattr_cfg_link,
1002 		0),
1003 
1004 	NSCD_CFG_DB_DEFAULT_NULL
1005 };
1006 
1007 /*
1008  * macros for defining the static stats table
1009  */
1010 #define	NSCD_CFG_SGROUP_DESC(sn, type, sflag, gi, \
1011 		gf, g_in_t, gsfunc_name) \
1012 	{ \
1013 		{-1, sn}, type, NSCD_CFG_SFLAG_GROUP | sflag, gi, \
1014 		0, 0, 0,\
1015 		NSCD_SIZEOF(g_in_t, gf), offsetof(g_in_t, gf), -1, \
1016 		gsfunc_name \
1017 	}
1018 
1019 #define	NSCD_CFG_STAT_DESC(sn, type, sflag, sf, s_in_t, \
1020 		gf, g_in_t, gsfunc_name) \
1021 	{ \
1022 		{-1, sn}, type, sflag, NSCD_CFG_GROUP_INFO_NULL, \
1023 		NSCD_SIZEOF(s_in_t, sf), offsetof(s_in_t, sf), -1, \
1024 		NSCD_SIZEOF(g_in_t, gf), offsetof(g_in_t, gf), -1, \
1025 		gsfunc_name \
1026 	}
1027 
1028 #define	NSCD_CFG_SGROUP_DESC_NULL \
1029 	{ \
1030 		{-1, NULL}, -1, NSCD_CFG_SFLAG_GROUP, NULL, \
1031 		0, 0, 0, \
1032 		0, 0, 0, \
1033 		NULL \
1034 	}
1035 
1036 /*
1037  * the static statistics description table
1038  */
1039 static	nscd_cfg_stat_desc_t	_nscd_cfg_stat_desc[] = {
1040 
1041 	NSCD_CFG_SGROUP_DESC(
1042 		"stat-group-global-log",
1043 		NSCD_CFG_DATA_NONE,
1044 		NSCD_CFG_SFLAG_GLOBAL,
1045 		NSCD_CFG_STAT_GROUP_INFO_GLOBAL_LOG,
1046 		log,
1047 		nscd_cfg_stat_global_data_t,
1048 		_nscd_cfg_log_get_stat),
1049 
1050 	NSCD_CFG_STAT_DESC(
1051 		"entries-logged",
1052 		NSCD_CFG_DATA_INTEGER,
1053 		NSCD_CFG_SFLAG_GLOBAL,
1054 		entries_logged,
1055 		nscd_cfg_stat_global_log_t,
1056 		log,
1057 		nscd_cfg_stat_global_data_t,
1058 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1059 
1060 	NSCD_CFG_SGROUP_DESC(
1061 		"stat-group-global-switch",
1062 		NSCD_CFG_DATA_NONE,
1063 		NSCD_CFG_SFLAG_GLOBAL,
1064 		NSCD_CFG_STAT_GROUP_INFO_GLOBAL_SWITCH,
1065 		sw,
1066 		nscd_cfg_stat_global_data_t,
1067 		_nscd_cfg_switch_get_stat),
1068 
1069 	NSCD_CFG_STAT_DESC(
1070 		"global-lookup-request-received",
1071 		NSCD_CFG_DATA_INTEGER,
1072 		NSCD_CFG_SFLAG_GLOBAL,
1073 		lookup_request_received_g,
1074 		nscd_cfg_stat_global_switch_t,
1075 		sw,
1076 		nscd_cfg_stat_global_data_t,
1077 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1078 
1079 	NSCD_CFG_STAT_DESC(
1080 		"global-lookup-request-queued",
1081 		NSCD_CFG_DATA_INTEGER,
1082 		NSCD_CFG_SFLAG_GLOBAL,
1083 		lookup_request_queued_g,
1084 		nscd_cfg_stat_global_switch_t,
1085 		sw,
1086 		nscd_cfg_stat_global_data_t,
1087 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1088 
1089 	NSCD_CFG_STAT_DESC(
1090 		"global-lookup-request-in-progress",
1091 		NSCD_CFG_DATA_INTEGER,
1092 		NSCD_CFG_SFLAG_GLOBAL,
1093 		lookup_request_in_progress_g,
1094 		nscd_cfg_stat_global_switch_t,
1095 		sw,
1096 		nscd_cfg_stat_global_data_t,
1097 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1098 
1099 	NSCD_CFG_STAT_DESC(
1100 		"global-lookup-request-succeeded",
1101 		NSCD_CFG_DATA_INTEGER,
1102 		NSCD_CFG_SFLAG_GLOBAL,
1103 		lookup_request_succeeded_g,
1104 		nscd_cfg_stat_global_switch_t,
1105 		sw,
1106 		nscd_cfg_stat_global_data_t,
1107 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1108 
1109 	NSCD_CFG_STAT_DESC(
1110 		"global-lookup-request-failed",
1111 		NSCD_CFG_DATA_INTEGER,
1112 		NSCD_CFG_SFLAG_GLOBAL,
1113 		lookup_request_failed_g,
1114 		nscd_cfg_stat_global_switch_t,
1115 		sw,
1116 		nscd_cfg_stat_global_data_t,
1117 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1118 
1119 	NSCD_CFG_STAT_DESC(
1120 		"global-loopback-nsw-db-skipped",
1121 		NSCD_CFG_DATA_INTEGER,
1122 		NSCD_CFG_SFLAG_GLOBAL,
1123 		loopback_nsw_db_skipped_g,
1124 		nscd_cfg_stat_global_switch_t,
1125 		sw,
1126 		nscd_cfg_stat_global_data_t,
1127 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1128 
1129 	NSCD_CFG_SGROUP_DESC(
1130 		"stat-group-global-cache",
1131 		NSCD_CFG_DATA_NONE,
1132 		NSCD_CFG_SFLAG_GLOBAL,
1133 		NSCD_CFG_STAT_GROUP_INFO_CACHE,
1134 		cache,
1135 		nscd_cfg_stat_global_data_t,
1136 		_nscd_cfg_cache_get_stat),
1137 
1138 	NSCD_CFG_STAT_DESC(
1139 		"global-cache-hits-on-positive",
1140 		NSCD_CFG_DATA_INTEGER,
1141 		NSCD_CFG_SFLAG_GLOBAL,
1142 		pos_hits,
1143 		nscd_cfg_stat_cache_t,
1144 		cache,
1145 		nscd_cfg_stat_global_data_t,
1146 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1147 
1148 	NSCD_CFG_STAT_DESC(
1149 		"global-cache-hits-on-negative",
1150 		NSCD_CFG_DATA_INTEGER,
1151 		NSCD_CFG_SFLAG_GLOBAL,
1152 		neg_hits,
1153 		nscd_cfg_stat_cache_t,
1154 		cache,
1155 		nscd_cfg_stat_global_data_t,
1156 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1157 
1158 	NSCD_CFG_STAT_DESC(
1159 		"global-cache-misses-on-positive",
1160 		NSCD_CFG_DATA_INTEGER,
1161 		NSCD_CFG_SFLAG_GLOBAL,
1162 		pos_misses,
1163 		nscd_cfg_stat_cache_t,
1164 		cache,
1165 		nscd_cfg_stat_global_data_t,
1166 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1167 
1168 	NSCD_CFG_STAT_DESC(
1169 		"global-cache-misses-on-negative",
1170 		NSCD_CFG_DATA_INTEGER,
1171 		NSCD_CFG_SFLAG_GLOBAL,
1172 		neg_misses,
1173 		nscd_cfg_stat_cache_t,
1174 		cache,
1175 		nscd_cfg_stat_global_data_t,
1176 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1177 
1178 	NSCD_CFG_STAT_DESC(
1179 		"global-cache-queries-queued",
1180 		NSCD_CFG_DATA_INTEGER,
1181 		NSCD_CFG_SFLAG_GLOBAL,
1182 		wait_count,
1183 		nscd_cfg_stat_cache_t,
1184 		cache,
1185 		nscd_cfg_stat_global_data_t,
1186 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1187 
1188 	NSCD_CFG_STAT_DESC(
1189 		"global-total-cache-entries",
1190 		NSCD_CFG_DATA_INTEGER,
1191 		NSCD_CFG_SFLAG_GLOBAL,
1192 		entries,
1193 		nscd_cfg_stat_cache_t,
1194 		cache,
1195 		nscd_cfg_stat_global_data_t,
1196 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1197 
1198 	NSCD_CFG_STAT_DESC(
1199 		"global-complete-cache-invalidations",
1200 		NSCD_CFG_DATA_INTEGER,
1201 		NSCD_CFG_SFLAG_GLOBAL,
1202 		invalidate_count,
1203 		nscd_cfg_stat_cache_t,
1204 		cache,
1205 		nscd_cfg_stat_global_data_t,
1206 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1207 
1208 	NSCD_CFG_STAT_DESC(
1209 		"global-cache-queries-dropped",
1210 		NSCD_CFG_DATA_INTEGER,
1211 		NSCD_CFG_SFLAG_GLOBAL,
1212 		drop_count,
1213 		nscd_cfg_stat_cache_t,
1214 		cache,
1215 		nscd_cfg_stat_global_data_t,
1216 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1217 
1218 	NSCD_CFG_STAT_DESC(
1219 		"global-cache-hit-rate",
1220 		NSCD_CFG_DATA_PERCENT,
1221 		NSCD_CFG_SFLAG_GLOBAL,
1222 		hitrate,
1223 		nscd_cfg_stat_cache_t,
1224 		cache,
1225 		nscd_cfg_stat_global_data_t,
1226 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1227 
1228 	/* non-global stat from this point on */
1229 
1230 	NSCD_CFG_SGROUP_DESC(
1231 		"stat-group-switch",
1232 		NSCD_CFG_DATA_NONE,
1233 		NSCD_CFG_SFLAG_GROUP,
1234 		NSCD_CFG_STAT_GROUP_INFO_SWITCH,
1235 		cache,
1236 		nscd_cfg_stat_nsw_db_data_t,
1237 		_nscd_cfg_switch_get_stat),
1238 
1239 	NSCD_CFG_STAT_DESC(
1240 		"lookup-request-received",
1241 		NSCD_CFG_DATA_INTEGER,
1242 		NSCD_CFG_SFLAG_NONE,
1243 		lookup_request_received,
1244 		nscd_cfg_stat_switch_t,
1245 		sw,
1246 		nscd_cfg_stat_nsw_db_data_t,
1247 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1248 
1249 	NSCD_CFG_STAT_DESC(
1250 		"lookup-request-queued",
1251 		NSCD_CFG_DATA_INTEGER,
1252 		NSCD_CFG_SFLAG_NONE,
1253 		lookup_request_queued,
1254 		nscd_cfg_stat_switch_t,
1255 		sw,
1256 		nscd_cfg_stat_nsw_db_data_t,
1257 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1258 
1259 	NSCD_CFG_STAT_DESC(
1260 		"lookup-request-in-progress",
1261 		NSCD_CFG_DATA_INTEGER,
1262 		NSCD_CFG_SFLAG_NONE,
1263 		lookup_request_in_progress,
1264 		nscd_cfg_stat_switch_t,
1265 		sw,
1266 		nscd_cfg_stat_nsw_db_data_t,
1267 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1268 
1269 	NSCD_CFG_STAT_DESC(
1270 		"lookup-request-succeeded",
1271 		NSCD_CFG_DATA_INTEGER,
1272 		NSCD_CFG_SFLAG_NONE,
1273 		lookup_request_succeeded,
1274 		nscd_cfg_stat_switch_t,
1275 		sw,
1276 		nscd_cfg_stat_nsw_db_data_t,
1277 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1278 
1279 	NSCD_CFG_STAT_DESC(
1280 		"lookup-request-failed",
1281 		NSCD_CFG_DATA_INTEGER,
1282 		NSCD_CFG_SFLAG_NONE,
1283 		lookup_request_failed,
1284 		nscd_cfg_stat_switch_t,
1285 		sw,
1286 		nscd_cfg_stat_nsw_db_data_t,
1287 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1288 
1289 	NSCD_CFG_STAT_DESC(
1290 		"loopback-nsw-db-skipped",
1291 		NSCD_CFG_DATA_INTEGER,
1292 		NSCD_CFG_SFLAG_NONE,
1293 		loopback_nsw_db_skipped,
1294 		nscd_cfg_stat_switch_t,
1295 		sw,
1296 		nscd_cfg_stat_nsw_db_data_t,
1297 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1298 
1299 	NSCD_CFG_SGROUP_DESC(
1300 		"stat-group-cache",
1301 		NSCD_CFG_DATA_NONE,
1302 		NSCD_CFG_SFLAG_GROUP,
1303 		NSCD_CFG_STAT_GROUP_INFO_CACHE,
1304 		cache,
1305 		nscd_cfg_stat_nsw_db_data_t,
1306 		_nscd_cfg_cache_get_stat),
1307 
1308 	NSCD_CFG_STAT_DESC(
1309 		"cache-hits-on-positive",
1310 		NSCD_CFG_DATA_INTEGER,
1311 		NSCD_CFG_SFLAG_NONE,
1312 		pos_hits,
1313 		nscd_cfg_stat_cache_t,
1314 		cache,
1315 		nscd_cfg_stat_nsw_db_data_t,
1316 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1317 
1318 	NSCD_CFG_STAT_DESC(
1319 		"cache-hits-on-negative",
1320 		NSCD_CFG_DATA_INTEGER,
1321 		NSCD_CFG_SFLAG_NONE,
1322 		neg_hits,
1323 		nscd_cfg_stat_cache_t,
1324 		cache,
1325 		nscd_cfg_stat_nsw_db_data_t,
1326 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1327 
1328 	NSCD_CFG_STAT_DESC(
1329 		"cache-misses-on-positive",
1330 		NSCD_CFG_DATA_INTEGER,
1331 		NSCD_CFG_SFLAG_NONE,
1332 		pos_misses,
1333 		nscd_cfg_stat_cache_t,
1334 		cache,
1335 		nscd_cfg_stat_nsw_db_data_t,
1336 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1337 
1338 	NSCD_CFG_STAT_DESC(
1339 		"cache-misses-on-negative",
1340 		NSCD_CFG_DATA_INTEGER,
1341 		NSCD_CFG_SFLAG_NONE,
1342 		neg_misses,
1343 		nscd_cfg_stat_cache_t,
1344 		cache,
1345 		nscd_cfg_stat_nsw_db_data_t,
1346 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1347 
1348 	NSCD_CFG_STAT_DESC(
1349 		"cache-queries-queued",
1350 		NSCD_CFG_DATA_INTEGER,
1351 		NSCD_CFG_SFLAG_NONE,
1352 		wait_count,
1353 		nscd_cfg_stat_cache_t,
1354 		cache,
1355 		nscd_cfg_stat_nsw_db_data_t,
1356 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1357 
1358 	NSCD_CFG_STAT_DESC(
1359 		"total-cache-entries",
1360 		NSCD_CFG_DATA_INTEGER,
1361 		NSCD_CFG_SFLAG_NONE,
1362 		entries,
1363 		nscd_cfg_stat_cache_t,
1364 		cache,
1365 		nscd_cfg_stat_nsw_db_data_t,
1366 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1367 
1368 	NSCD_CFG_STAT_DESC(
1369 		"complete-cache-invalidations",
1370 		NSCD_CFG_DATA_INTEGER,
1371 		NSCD_CFG_SFLAG_NONE,
1372 		invalidate_count,
1373 		nscd_cfg_stat_cache_t,
1374 		cache,
1375 		nscd_cfg_stat_nsw_db_data_t,
1376 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1377 
1378 	NSCD_CFG_STAT_DESC(
1379 		"cache-hit-rate",
1380 		NSCD_CFG_DATA_PERCENT,
1381 		NSCD_CFG_SFLAG_NONE,
1382 		hitrate,
1383 		nscd_cfg_stat_cache_t,
1384 		cache,
1385 		nscd_cfg_stat_nsw_db_data_t,
1386 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1387 
1388 	NSCD_CFG_STAT_DESC(
1389 		"cache-queries-dropped",
1390 		NSCD_CFG_DATA_PERCENT,
1391 		NSCD_CFG_SFLAG_NONE,
1392 		drop_count,
1393 		nscd_cfg_stat_cache_t,
1394 		cache,
1395 		nscd_cfg_stat_nsw_db_data_t,
1396 		NSCD_CFG_FUNC_GET_STAT_AS_GROUP),
1397 
1398 
1399 	NSCD_CFG_SGROUP_DESC_NULL
1400 };
1401 
1402 /* number of entries in the static tables */
1403 
1404 int _nscd_cfg_num_nsw_src =
1405 	(sizeof (_nscd_cfg_nsw_src) /
1406 		sizeof (_nscd_cfg_nsw_src[0]) - 1);
1407 
1408 int _nscd_cfg_num_smf_services =
1409 	(sizeof (_nscd_cfg_smf_services) /
1410 		sizeof (_nscd_cfg_smf_services[0]) - 1);
1411 
1412 /* number of supported nsw databases (including pseudo ones) */
1413 int _nscd_cfg_num_nsw_db_all =
1414 	(sizeof (_nscd_cfg_nsw_db) /
1415 		sizeof (_nscd_cfg_nsw_db[0]) - 1);
1416 
1417 /* number of supported nsw databases (not including pseudo ones) */
1418 int _nscd_cfg_num_nsw_db =
1419 	(sizeof (_nscd_cfg_nsw_db) /
1420 		sizeof (_nscd_cfg_nsw_db[0]) - 1) -
1421 		NSS_DBNAM_COMPAT_NUM_DB;
1422 
1423 static int _nscd_cfg_num_param =
1424 	(sizeof (_nscd_cfg_param_desc) /
1425 		sizeof (_nscd_cfg_param_desc[0]) - 1);
1426 
1427 static int _nscd_cfg_num_stat =
1428 	(sizeof (_nscd_cfg_stat_desc) /
1429 		sizeof (_nscd_cfg_stat_desc[0]) - 1);
1430 
1431 int _nscd_cfg_num_nsw_default =
1432 	(sizeof (_nscd_cfg_nsw_spc_default) /
1433 		sizeof (_nscd_cfg_nsw_spc_default[0]) - 1);
1434 
1435 int _nscd_cfg_num_link_default =
1436 	(sizeof (_nscd_cfg_nsw_link_default) /
1437 		sizeof (_nscd_cfg_nsw_link_default[0]) - 1);
1438 
1439 #ifdef	__cplusplus
1440 }
1441 #endif
1442 
1443 #endif	/* _NSCD_CFGDEF_H */
1444