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