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